-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Drawethree/feature/1.2.0
Feature/1.2.0
- Loading branch information
Showing
8 changed files
with
86 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/dev/drawethree/ultrabackpacks/api/exception/BackpackNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package dev.drawethree.ultrabackpacks.api.exception; | ||
|
||
import org.bukkit.entity.Player; | ||
|
||
public final class BackpackNotFoundException extends Throwable { | ||
|
||
public BackpackNotFoundException(Player player) { | ||
super("Player " + player.getName() + " does not have backpack."); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/dev/drawethree/ultrabackpacks/api/model/backpack/BackpackEnchantment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package dev.drawethree.ultrabackpacks.api.model.backpack; | ||
|
||
public enum BackpackEnchantment { | ||
SELL_MULTI, | ||
CAPACITY, | ||
AUTO_SELL | ||
} |
44 changes: 34 additions & 10 deletions
44
src/main/java/dev/drawethree/ultrabackpacks/api/model/backpack/IBackpackData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,45 @@ | ||
package dev.drawethree.ultrabackpacks.api.model.backpack; | ||
|
||
import java.util.Map; | ||
import org.bukkit.Material; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
import java.util.List; | ||
|
||
public interface IBackpackData { | ||
|
||
/** | ||
* Returns Map of enchants that player has in his backpack. | ||
* Key - Id of enchant | ||
* Value - Level of enchant | ||
* @return Map of enchants belonging to player | ||
* Returns List of backpack items {@link IBackpackItem} | ||
* | ||
* @return list of item in backpack | ||
*/ | ||
List<? extends IBackpackItem> getItems(); | ||
|
||
/** | ||
* Adds an item to backpack. If item with type already exists, it adds the quantity to already existing item. | ||
* | ||
* @return Added / Updated {@link IBackpackItem} | ||
*/ | ||
IBackpackItem addItem(ItemStack item); | ||
|
||
/** | ||
* Removes an item from backpack. | ||
* | ||
* @return removed {@link IBackpackItem}, or null if not found. | ||
*/ | ||
IBackpackItem removeItem(Material type); | ||
|
||
/** | ||
* Sets the enchant level of given enchant | ||
* | ||
* @return removed {@link IBackpackItem} | ||
*/ | ||
Map<Integer, Long> getEnchants(); | ||
boolean setEnchantLevel(BackpackEnchantment enchantment, long level); | ||
|
||
/** | ||
* Returns Map | ||
* Key - {@link CompMaterial} | ||
* @return Map of backpack contents | ||
* Return the current enchant level | ||
* | ||
* @param enchantment {@link BackpackEnchantment} | ||
* @return current level of enchant | ||
*/ | ||
Map<?, Long> getItems(); | ||
long getEnchantLevel(BackpackEnchantment enchantment); | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/dev/drawethree/ultrabackpacks/api/model/backpack/IBackpackItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package dev.drawethree.ultrabackpacks.api.model.backpack; | ||
|
||
import org.bukkit.Material; | ||
|
||
public interface IBackpackItem { | ||
|
||
/** | ||
* Gets the type of item. | ||
* @return {@link Material} | ||
*/ | ||
Material getType(); | ||
|
||
/** | ||
* Gets the amount of item. | ||
* @return amount | ||
*/ | ||
long getAmount(); | ||
|
||
/** | ||
* Sets the amount of item | ||
* @param amount amount | ||
*/ | ||
void setAmount(long amount); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters