diff --git a/src/com/dre/brewery/BIngredients.java b/src/com/dre/brewery/BIngredients.java index 5d56e49..f5e59ec 100644 --- a/src/com/dre/brewery/BIngredients.java +++ b/src/com/dre/brewery/BIngredients.java @@ -62,8 +62,8 @@ public class BIngredients { } /** - * Force add an ingredient to this - * Will not check if item is acceptable + * Force add an ingredient to this. + *
Will not check if item is acceptable
*
* @param ingredient the item to add
*/
@@ -98,7 +98,9 @@ public class BIngredients {
ingredients.add(ingredientItem);
}
- // returns an Potion item with cooked ingredients
+ /**
+ * returns an Potion item with cooked ingredients
+ */
public ItemStack cook(int state) {
ItemStack potion = new ItemStack(Material.POTION);
@@ -178,7 +180,9 @@ public class BIngredients {
return potion;
}
- // returns amount of ingredients
+ /**
+ * returns amount of ingredients
+ */
public int getIngredientsCount() {
int count = 0;
for (Ingredient ing : ingredients) {
@@ -195,8 +199,9 @@ public class BIngredients {
return cookedTime;
}
- // best recipe for current state of potion, STILL not always returns the
- // correct one...
+ /**
+ * best recipe for current state of potion, STILL not always returns the correct one...
+ */
public BRecipe getBestRecipe(float wood, float time, boolean distilled) {
float quality = 0;
int ingredientQuality;
@@ -237,8 +242,9 @@ public class BIngredients {
return bestRecipe;
}
- // returns recipe that is cooking only and matches the ingredients and
- // cooking time
+ /**
+ * returns recipe that is cooking only and matches the ingredients and cooking time
+ */
public BRecipe getCookRecipe() {
BRecipe bestRecipe = getBestRecipe(0, 0, false);
@@ -272,7 +278,9 @@ public class BIngredients {
return best;
}
- // returns the currently best matching recipe for distilling for the ingredients and cooking time
+ /**
+ * returns the currently best matching recipe for distilling for the ingredients and cooking time
+ */
public BRecipe getDistillRecipe(float wood, float time) {
BRecipe bestRecipe = getBestRecipe(wood, time, true);
@@ -285,7 +293,9 @@ public class BIngredients {
return null;
}
- // returns currently best matching recipe for ingredients, cooking- and ageingtime
+ /**
+ * returns currently best matching recipe for ingredients, cooking- and ageingtime
+ */
public BRecipe getAgeRecipe(float wood, float time, boolean distilled) {
BRecipe bestRecipe = getBestRecipe(wood, time, distilled);
@@ -297,7 +307,9 @@ public class BIngredients {
return null;
}
- // returns the quality of the ingredients conditioning given recipe, -1 if no recipe is near them
+ /**
+ * returns the quality of the ingredients conditioning given recipe, -1 if no recipe is near them
+ */
public int getIngredientQuality(BRecipe recipe) {
float quality = 10;
int count;
@@ -335,7 +347,9 @@ public class BIngredients {
return -1;
}
- // returns the quality regarding the cooking-time conditioning given Recipe
+ /**
+ * returns the quality regarding the cooking-time conditioning given Recipe
+ */
public int getCookingQuality(BRecipe recipe, boolean distilled) {
if (!recipe.needsDistilling() == distilled) {
return -1;
@@ -351,7 +365,9 @@ public class BIngredients {
return -1;
}
- // returns pseudo quality of distilling. 0 if doesnt match the need of the recipes distilling
+ /**
+ * returns pseudo quality of distilling. 0 if doesnt match the need of the recipes distilling
+ */
public int getDistillQuality(BRecipe recipe, byte distillRuns) {
if (recipe.needsDistilling() != distillRuns > 0) {
return 0;
@@ -359,7 +375,9 @@ public class BIngredients {
return 10 - Math.abs(recipe.getDistillRuns() - distillRuns);
}
- // returns the quality regarding the barrel wood conditioning given Recipe
+ /**
+ * returns the quality regarding the barrel wood conditioning given Recipe
+ */
public int getWoodQuality(BRecipe recipe, float wood) {
if (recipe.getWood() == 0) {
// type of wood doesnt matter
@@ -370,7 +388,9 @@ public class BIngredients {
return Math.max(quality, 0);
}
- // returns the quality regarding the ageing time conditioning given Recipe
+ /**
+ * returns the quality regarding the ageing time conditioning given Recipe
+ */
public int getAgeQuality(BRecipe recipe, float time) {
int quality = 10 - Math.round(Math.abs(time - recipe.getAge()) * ((float) recipe.getDifficulty() / 2));
diff --git a/src/com/dre/brewery/Barrel.java b/src/com/dre/brewery/Barrel.java
index a2e9f99..a547285 100644
--- a/src/com/dre/brewery/Barrel.java
+++ b/src/com/dre/brewery/Barrel.java
@@ -31,6 +31,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+/**
+ * A Multi Block Barrel with Inventory
+ */
public class Barrel implements InventoryHolder {
public static List The barrel needs to be formed correctly
+ *
+ * @param force to also check even if chunk is not loaded
+ */
public Block getBrokenBlock(boolean force) {
return body.getBrokenBlock(force);
}
- //unloads barrels that are in a unloading world
+ /**
+ * unloads barrels that are in a unloading world
+ */
public static void onUnload(String name) {
barrels.removeIf(barrel -> barrel.spigot.getWorld().getName().equals(name));
}
- // Saves all data
+ /**
+ * Saves all data
+ */
public static void save(ConfigurationSection config, ConfigurationSection oldData) {
BUtil.createWorldSections(config);
diff --git a/src/com/dre/brewery/BarrelBody.java b/src/com/dre/brewery/BarrelBody.java
index c3c9efa..da0c617 100644
--- a/src/com/dre/brewery/BarrelBody.java
+++ b/src/com/dre/brewery/BarrelBody.java
@@ -10,7 +10,9 @@ import org.jetbrains.annotations.NotNull;
import java.util.Objects;
-// The Blocks that make up a Barrel in the World
+/**
+ * The Blocks that make up a Barrel in the World
+ */
public class BarrelBody {
private final Barrel barrel;
@@ -25,7 +27,9 @@ public class BarrelBody {
this.bounds = new BoundingBox(0, 0, 0, 0, 0, 0);
}
- // Loading from file
+ /**
+ * Loading from file
+ */
public BarrelBody(Barrel barrel, byte signoffset, BoundingBox bounds) {
this(barrel, signoffset);
@@ -67,12 +71,16 @@ public class BarrelBody {
this.signoffset = signoffset;
}
- // If the Sign of a Large Barrel gets destroyed, set signOffset to 0
+ /**
+ * If the Sign of a Large Barrel gets destroyed, set signOffset to 0
+ */
public void destroySign() {
signoffset = 0;
}
- // direction of the barrel from the spigot
+ /**
+ * direction of the barrel from the spigot
+ */
public static int getDirection(Block spigot) {
int direction = 0;// 1=x+ 2=x- 3=z+ 4=z-
Material type = spigot.getRelative(0, 0, 1).getType();
@@ -106,17 +114,23 @@ public class BarrelBody {
return direction;
}
- // is this a Large barrel?
+ /**
+ * is this a Large barrel?
+ */
public boolean isLarge() {
return barrel.isLarge();
}
- // is this a Small barrel?
+ /**
+ * is this a Small barrel?
+ */
public boolean isSmall() {
return barrel.isSmall();
}
- // woodtype of the block the spigot is attached to
+ /**
+ * woodtype of the block the spigot is attached to
+ */
public byte getWood() {
Block wood;
switch (getDirection(spigot)) { // 1=x+ 2=x- 3=z+ 4=z-
@@ -160,13 +174,17 @@ public class BarrelBody {
return false;
}
- // Returns true if the Offset of the clicked Sign matches the Barrel.
- // This prevents adding another sign to the barrel and clicking that.
+ /**
+ * Returns true if the Offset of the clicked Sign matches the Barrel.
+ * This prevents adding another sign to the barrel and clicking that.
+ */
public boolean isSignOfBarrel(byte offset) {
return offset == 0 || signoffset == 0 || signoffset == offset;
}
- // returns the Sign of a large barrel, the spigot if there is none
+ /**
+ * returns the Sign of a large barrel, the spigot if there is none
+ */
public Block getSignOfSpigot() {
if (signoffset != 0) {
if (LegacyUtil.isSign(spigot.getType())) {
@@ -182,7 +200,9 @@ public class BarrelBody {
return spigot;
}
- // returns the fence above/below a block, itself if there is none
+ /**
+ * returns the fence above/below a block, itself if there is none
+ */
public static Block getSpigotOfSign(Block block) {
int y = -2;
@@ -197,9 +217,12 @@ public class BarrelBody {
return block;
}
- // returns null if Barrel is correctly placed; the block that is missing when not
- // the barrel needs to be formed correctly
- // flag force to also check if chunk is not loaded
+ /**
+ * returns null if Barrel is correctly placed; the block that is missing when not.
+ * the barrel needs to be formed correctly
+ *
+ * @param force to also check even if chunk is not loaded
+ */
public Block getBrokenBlock(boolean force) {
if (force || BUtil.isChunkLoaded(spigot)) {
//spigot = getSpigotOfSign(spigot);
diff --git a/src/com/dre/brewery/Brew.java b/src/com/dre/brewery/Brew.java
index 5b0d811..3620397 100644
--- a/src/com/dre/brewery/Brew.java
+++ b/src/com/dre/brewery/Brew.java
@@ -173,8 +173,11 @@ public class Brew implements Cloneable {
return null;
}
- // returns a Brew by its UID
- // Does not work anymore with new save system
+ /**
+ * returns a Brew by its UID
+ *
+ * @deprecated Does not work anymore with new save system
+ */
@Deprecated
public static Brew get(int uid) {
if (uid < -1) {
@@ -188,8 +191,11 @@ public class Brew implements Cloneable {
return legacyPotions.get(uid);
}
- // returns UID of custom Potion item
- // Does not work anymore with new save system
+ /**
+ * returns UID of custom Potion item
+ *
+ * @deprecated Does not work anymore with new save system
+ */
@Deprecated
public static int getUID(ItemStack item) {
return getUID((PotionMeta) item.getItemMeta());
@@ -197,6 +203,12 @@ public class Brew implements Cloneable {
// returns UID of custom Potion meta
// Does not work anymore with new save system
+
+ /**
+ * returns UID of custom Potion meta
+ *
+ * @deprecated Does not work anymore with new save system
+ */
@Deprecated
public static int getUID(PotionMeta potionMeta) {
if (potionMeta.hasCustomEffect(PotionEffectType.REGENERATION)) {
@@ -395,7 +407,9 @@ public class Brew implements Cloneable {
}
}
- // return special effect
+ /**
+ * Get Special Drink Effects
+ */
public List Not really used, apart from legacy potion timed purge
*/
public void touch() {
lastUpdate = (int) ((double) (System.currentTimeMillis() - installTime) / 3600000D);
@@ -734,8 +749,8 @@ public class Brew implements Cloneable {
}
/**
- * Performant way of checking if this item is a Brew
- * Does not give any guarantees that get() will return notnull for this item, i.e. if it is a brew but the data is corrupt
+ * Performant way of checking if this item is a Brew.
+ * Does not give any guarantees that get() will return notnull for this item, i.e. if it is a brew but the data is corrupt
*
* @param item The Item to check
* @return True if the item is a brew
@@ -854,8 +869,8 @@ public class Brew implements Cloneable {
}
/**
- * Save brew data into meta: lore/nbt
- * Should be called after any changes made to the brew
+ * Save brew data into meta: lore/nbt.
+ * Should be called after any changes made to the brew
*/
public void save(ItemMeta meta) {
OutputStream itemSaveStream;
@@ -881,8 +896,8 @@ public class Brew implements Cloneable {
}
/**
- * Save brew data into the meta/lore of the specified item
- * The meta on the item changes, so to make further changes to the meta, item.getItemMeta() has to be called again after this
+ * Save brew data into the meta/lore of the specified item.
+ * The meta on the item changes, so to make further changes to the meta, item.getItemMeta() has to be called again after this
*
* @param item The item to save this brew into
*/
@@ -1027,8 +1042,8 @@ public class Brew implements Cloneable {
}
/**
- * Saves all data
- * Legacy method to save to data file
+ * Saves all data,
+ * Legacy method to save to data file.
*/
public static void saveLegacy(ConfigurationSection config) {
for (Map.Entry Contains shortcuts and collects of some of the main functions of this Plugin
+ *
+ * Next to this there are lots of public Methods in many Objects
+ * like Brew, Barrel, BCauldron, BRecipe, etc
+ * In the api package, you can also find custom Events.
*/
public class BreweryApi {
/**
- * Remove any data that this Plugin may associate with the given Block
- * Currently Cauldrons and Barrels (Cauldron, Wood, Woodstairs, Fence, Sign)
- * Does not remove any actual Blocks
- * Returns true if anything was removed
+ * Remove any data that this Plugin may associate with the given Block.
+ * Currently Cauldrons and Barrels (Cauldron, Wood, Woodstairs, Fence, Sign)
+ * Does not remove any actual Blocks
+ * Returns true if anything was removed
+ *
+ * @return true if anything was removed
*/
public static boolean removeAny(Block block) {
if (removeCauldron(block)) return true;
@@ -34,8 +41,8 @@ public class BreweryApi {
}
/**
- * Like removeAny() but removes data as if the given player broke the Block
- * Currently only makes a difference for Logging
+ * Like removeAny() but removes data as if the given player broke the Block.
+ * Currently only makes a difference for Logging
*/
public static boolean removeAnyByPlayer(Block block, Player player) {
if (removeCauldron(block)) return true;
@@ -47,17 +54,20 @@ public class BreweryApi {
// # # # # # Player # # # # #
// # # # # # # # # # # # #
+ /**
+ * Get the BPlayer for the given Player, containing drunkeness and hangover data.
+ */
public static BPlayer getBPlayer(Player player) {
return BPlayer.get(player);
}
/**
- * Set the Players drunkeness state
+ * Set the Players drunkeness state.
*
* @param player The Player to set the drunkeness on
* @param drunkeness The amount of drunkeness 0-100 to apply to the player
- * @param quality The Quality 1-10 the drunkeness of the player should have
- * zero Quality keeps the players current quality
+ * @param quality The Quality 1-10 the drunkeness of the player should have.
+ * Reads the Brew data from the saved data on the item
+ * Checks if item is actually a Brew
+ * Returns null if item is not a Brew
*/
@Nullable
public static Brew getBrew(ItemStack item) {
@@ -111,10 +121,10 @@ public class BreweryApi {
}
/**
- * Get a Brew from an ItemMeta
- * Reads the Brew data from the saved data in the Meta
- * Checks if meta has a Brew saved
- * Returns null if meta is not a Brew
+ * Get a Brew from an ItemMeta.
+ * Reads the Brew data from the saved data in the Meta
+ * Checks if meta has a Brew saved
+ * Returns null if meta is not a Brew
*/
@Nullable
public static Brew getBrew(ItemMeta meta) {
@@ -123,14 +133,14 @@ public class BreweryApi {
/**
* Performant way to check if an item is a brew.
- * Does not give any guarantees that getBrew() will return notnull for this item, i.e. if it is a brew but couldn't be loaded
+ * Does not give any guarantees that getBrew() will return notnull for this item, i.e. if it is a brew but couldn't be loaded
*/
public static boolean isBrew(ItemStack item) {
return Brew.isBrew(item);
}
/**
- * Create a Brew from the given Recipe
+ * Create a Brew from the given Recipe.
*
* @param recipe The Recipe to create a brew from
* @return The Brew that was created. Can use brew.createItem() to get an ItemStack
@@ -145,9 +155,9 @@ public class BreweryApi {
// # # # # # # # # # # # #
/**
- * Get a Barrel from a Block
- * May be any Wood, Fence, Sign that is part of a Barrel
- * Returns null if block is not part of a Barrel
+ * Get a Barrel from a Block.
+ * May be any Wood, Fence, Sign that is part of a Barrel
+ * Returns null if block is not part of a Barrel
*/
@Nullable
public static Barrel getBarrel(Block block) {
@@ -155,9 +165,9 @@ public class BreweryApi {
}
/**
- * Get the Inventory of a Block part of a Barrel
- * May be any Wood, Fence or Sign that is part of a Barrel
- * Returns null if block is not part of a Barrel
+ * Get the Inventory of a Block part of a Barrel.
+ * May be any Wood, Fence or Sign that is part of a Barrel
+ * Returns null if block is not part of a Barrel
*/
@Nullable
public static Inventory getBarrelInventory(Block block) {
@@ -169,7 +179,7 @@ public class BreweryApi {
}
/**
- * Remove any Barrel that this Block may be Part of
+ * Remove any Barrel that this Block may be Part of.
* Does not remove any actual Block
*
* @param block The Block thats part of the barrel, potions will drop there
@@ -181,7 +191,7 @@ public class BreweryApi {
}
/**
- * Remove any Barrel that this Block may be Part of, as if broken by the Player
+ * Remove any Barrel that this Block may be Part of, as if broken by the Player.
* Does not remove any actual Block from the World
*
* @param block The Block thats part of the barrel, potions will drop there
@@ -203,8 +213,8 @@ public class BreweryApi {
// # # # # # # # # # # # #
/**
- * Get a BCauldron from a Block
- * Returns null if block is not a BCauldron
+ * Get a BCauldron from a Block.
+ * Returns null if block is not a BCauldron
*/
@Nullable
public static BCauldron getCauldron(Block block) {
@@ -212,9 +222,9 @@ public class BreweryApi {
}
/**
- * Remove any data associated with a Cauldron at that given Block
- * Returns true if a Cauldron was removed
- * Does not remove the Block from the World
+ * Remove any data associated with a Cauldron at that given Block.
+ * Returns true if a Cauldron was removed
+ * Does not remove the Block from the World
*/
public static boolean removeCauldron(Block block) {
return BCauldron.remove(block);
@@ -226,9 +236,9 @@ public class BreweryApi {
// # # # # # # # # # # # #
/**
- * Get a BRecipe by its name
- * The name is the middle one of the three if three are set in the config
- * Returns null if recipe with that name does not exist
+ * Get a BRecipe by its name.
+ * The name is the middle one of the three if three are set in the config
+ * Returns null if recipe with that name does not exist
*/
@Nullable
public static BRecipe getRecipe(String name) {
@@ -237,15 +247,15 @@ public class BreweryApi {
/**
* Add a New Recipe.
- * Brews can be made out of this Recipe.
- * The recipe can be changed or removed later.
+ * Brews can be made out of this Recipe.
+ * The recipe can be changed or removed later.
*
* @param recipe The Recipe to add
- * @param saveForever Not Implemented yet
- * If the recipe should be saved forever, even after the Server restarts
- * If True: Recipe will be saved until removed manually
- * If False: Recipe will be removed when the Server restarts, existing potions using
- * this Recipe will become bad after continued aging, if the recipe is not added again.
+ * @param saveForever Not Implemented yet.
+ * This can also remove Recipes that were loaded from config, though these will be readded when reloading the config
*
* @param name The name of the recipe to remove
* @return The Recipe that was removed, null if none was removed
@@ -296,8 +306,8 @@ public class BreweryApi {
// # # # # # # # # # # # #
/**
- * Get A BCauldronRecipe by its name
- * Returns null if recipe with that name does not exist
+ * Get A BCauldronRecipe by its name.
+ * Returns null if recipe with that name does not exist
*/
@Nullable
public static BCauldronRecipe getCauldronRecipe(String name) {
@@ -306,14 +316,14 @@ public class BreweryApi {
/**
* Add a New Cauldron Recipe.
- * Base Brews coming out of the Cauldron can be made from this recipe
- * The recipe can be changed or removed later.
+ * Base Brews coming out of the Cauldron can be made from this recipe
+ * The recipe can be changed or removed later.
*
* @param recipe The Cauldron Recipe to add
- * @param saveForever Not Implemented yet
- * If the recipe should be saved forever, even after the Server restarts
- * If True: Recipe will be saved until removed manually
- * If False: Recipe will be removed when the Server restarts
+ * @param saveForever Not Implemented yet.
+ * This can also remove Cauldron Recipes that were loaded from config,
+ * though these will be readded when reloading the config
*
* @param name The name of the cauldron recipe to remove
* @return The Cauldron Recipe that was removed, null if none was removed
diff --git a/src/com/dre/brewery/api/events/ConfigLoadEvent.java b/src/com/dre/brewery/api/events/ConfigLoadEvent.java
index 5af5893..3c4e615 100644
--- a/src/com/dre/brewery/api/events/ConfigLoadEvent.java
+++ b/src/com/dre/brewery/api/events/ConfigLoadEvent.java
@@ -7,17 +7,15 @@ import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
-import java.util.List;
-
/**
- * The Brewery Config was reloaded
+ * The Brewery Config was reloaded.
*/
public class ConfigLoadEvent extends Event {
private static final HandlerList handlers = new HandlerList();
/**
- * One of the things one might need to do after reloading
- * Removes a Recipe, can also remove config recipes
+ * Removes a Recipe, can also remove config recipes.
+ * One of the things one might need to do after reloading.
*
* @param name Name of the Recipe to remove
* @return The Recipe that was removed, null if none was removed
@@ -27,8 +25,8 @@ public class ConfigLoadEvent extends Event {
}
/**
- * One of the things one might need to do after reloading
- * Removes a Cauldron Recipe, can also remove config recipes
+ * Removes a Cauldron Recipe, can also remove config recipes.
+ * One of the things one might need to do after reloading.
*
* @param name Name of the Cauldron Recipe to remove
* @return The Cauldron Recipe that was removed, null if none was removed
diff --git a/src/com/dre/brewery/api/events/IngedientAddEvent.java b/src/com/dre/brewery/api/events/IngedientAddEvent.java
index d576f51..37461f3 100644
--- a/src/com/dre/brewery/api/events/IngedientAddEvent.java
+++ b/src/com/dre/brewery/api/events/IngedientAddEvent.java
@@ -15,9 +15,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
- * Player adding an ingredient to a cauldron
- * Always one item added at a time
- * If needed use the caudrons add method to manually add more Items
+ * Player adding an ingredient to a cauldron.
+ * Always one item added at a time.
+ * If needed use the caudrons add method to manually add more Items
*/
public class IngedientAddEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -46,17 +46,17 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
/**
* The Recipe item that matches the ingredient.
- * This might not be the only recipe item that will match the ingredient
- * Will be recalculated if the Ingredient is changed with the setIngredient Method
+ * This might not be the only recipe item that will match the ingredient
+ * Will be recalculated if the Ingredient is changed with the setIngredient Method
*/
public RecipeItem getRecipeItem() {
return rItem;
}
/**
- * Get the item currently being added to the cauldron by the player
- * Can be changed directly (mutable) or with the setter Method
- * The amount is ignored and always one added
+ * Get the item currently being added to the cauldron by the player.
+ * Can be changed directly (mutable) or with the setter Method
+ * The amount is ignored and always one added
*
* @return The item being added
*/
@@ -65,10 +65,10 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
}
/**
- * Set the ingredient added to the cauldron to something else
- * Will always be accepted, even when not in a recipe or the cooked lis
- * The amount is ignored and always one added
- * This also recalculates the recipeItem!
+ * Set the ingredient added to the cauldron to something else.
+ * Will always be accepted, even when not in a recipe or the cooked lis
+ * The amount is ignored and always one added
+ * This also recalculates the recipeItem!
*
* @param ingredient The item to add instead
*/
@@ -79,15 +79,15 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
}
/**
- * If the amount of the item in the players hand should be decreased
- * Default true
+ * If the amount of the item in the players hand should be decreased.
+ * (Default true)
*/
public boolean willTakeItem() {
return takeItem;
}
/**
- * Set if the amount of the item in the players hand should be decreased
+ * Set if the amount of the item in the players hand should be decreased.
*
* @param takeItem if the item amount in the hand should be decreased
*/
@@ -96,8 +96,8 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
}
/**
- * Get the BlockData of the Cauldron
- * May be null if the Cauldron does not exist anymore
+ * Get the BlockData of the Cauldron.
+ * May be null if the Cauldron does not exist anymore
*
* @return The BlockData of the cauldron
*/
@@ -111,9 +111,9 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
}
/**
- * Get the water fill level of the Cauldron
- * 0 = empty, 1 = something in, 2 = full
- * Can use BCauldron.EMPTY, BCauldron.SOME, BCauldron.FULL
+ * Get the water fill level of the Cauldron.
+ * 0 = empty, 1 = something in, 2 = full
+ * Can use BCauldron.EMPTY, BCauldron.SOME, BCauldron.FULL
*
* @return The fill level as a byte 0-2
*/
@@ -127,7 +127,7 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
}
/**
- * If the event is cancelled, no item will be added or taken from the player
+ * If the event is cancelled, no item will be added or taken from the player.
*/
@Override
public void setCancelled(boolean cancelled) {
diff --git a/src/com/dre/brewery/api/events/PlayerChatDistortEvent.java b/src/com/dre/brewery/api/events/PlayerChatDistortEvent.java
index 107ad10..15e7dfc 100644
--- a/src/com/dre/brewery/api/events/PlayerChatDistortEvent.java
+++ b/src/com/dre/brewery/api/events/PlayerChatDistortEvent.java
@@ -13,7 +13,7 @@ import java.util.Objects;
/**
* The Player writes something in Chat or on a Sign and his words are distorted.
*
- * This Event may be Async if the Chat Event is Async!
+ * This Event may be Async if the Chat Event is Async!
*/
public class PlayerChatDistortEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
diff --git a/src/com/dre/brewery/api/events/PlayerEffectEvent.java b/src/com/dre/brewery/api/events/PlayerEffectEvent.java
index b980b8b..3d1b432 100644
--- a/src/com/dre/brewery/api/events/PlayerEffectEvent.java
+++ b/src/com/dre/brewery/api/events/PlayerEffectEvent.java
@@ -11,8 +11,9 @@ import java.util.List;
/**
* A List of effects is applied to the player.
- * This happens for various reasons like Alcohol level, Brew quality, Brew effects, etc.
- * Can be changed or cancelled
+ * This happens for various reasons like Alcohol level, Brew quality, Brew effects, etc.
+ *
+ * Can be changed or cancelled
*/
public class PlayerEffectEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -38,7 +39,7 @@ public class PlayerEffectEvent extends PlayerEvent implements Cancellable {
}
/**
- * @return What type of effects are applied, sie EffectType
+ * @return What type of effects are applied, see EffectType
*/
public EffectType getEffectType() {
return effectType;
@@ -66,27 +67,30 @@ public class PlayerEffectEvent extends PlayerEvent implements Cancellable {
}
+ /**
+ * The Type of Effect, or why an effect is being added to the player.
+ */
public enum EffectType {
/**
* The Alcohol level demands its toll.
- * Regularly applied depending on the players alcohol level
- * By default it is just one Confusion effect
+ * Regularly applied depending on the players alcohol level
+ * By default it is just one Confusion effect
*/
ALCOHOL,
/**
- * Effects of a Brew are applied to the player (drinking the Brew)
- * These depend on alcohol and quality of the brew
+ * Effects of a Brew are applied to the player (drinking the Brew).
+ * These depend on alcohol and quality of the brew
*/
DRINK,
/**
- * When drinking a Brew with low Quality, these effects are applied
+ * When drinking a Brew with low Quality, these effects are applied.
*/
QUALITY,
/**
- * When logging in after drinking, Hangover Effects are applied
+ * When logging in after drinking, Hangover Effects are applied.
*/
HANGOVER
diff --git a/src/com/dre/brewery/api/events/PlayerPukeEvent.java b/src/com/dre/brewery/api/events/PlayerPukeEvent.java
index d4b8da6..05f3bbc 100644
--- a/src/com/dre/brewery/api/events/PlayerPukeEvent.java
+++ b/src/com/dre/brewery/api/events/PlayerPukeEvent.java
@@ -8,9 +8,9 @@ import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;
/**
- * The player pukes (throws puke items to the ground)
- * Those items can never be picked up and despawn after the time set in the config
- * Number of items to drop can be changed with count
+ * The player pukes (throws puke items to the ground).
+ * Those items can never be picked up and despawn after the time set in the config
+ * Number of items to drop can be changed with count
*/
public class PlayerPukeEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -25,14 +25,14 @@ public class PlayerPukeEvent extends PlayerEvent implements Cancellable {
}
/**
- * @return The Amount of items being dropped this time
+ * Get the Amount of items being dropped this time
*/
public int getCount() {
return count;
}
/**
- * @param count Set the amount of items being dropped this time
+ * Set the amount of items being dropped this time
*/
public void setCount(int count) {
this.count = count;
diff --git a/src/com/dre/brewery/api/events/PlayerPushEvent.java b/src/com/dre/brewery/api/events/PlayerPushEvent.java
index f7406bd..03290fe 100644
--- a/src/com/dre/brewery/api/events/PlayerPushEvent.java
+++ b/src/com/dre/brewery/api/events/PlayerPushEvent.java
@@ -9,9 +9,9 @@ import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
/**
- * The Players movement is hindered because of drunkeness
- * Called each time before pushing the Player with the Vector push 10 times
- * The Push Vector can be changed or multiplied
+ * The Players movement is hindered because of drunkeness.
+ * Called each time before pushing the Player with the Vector push 10 times
+ * The Push Vector can be changed or multiplied
*/
public class PlayerPushEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -29,12 +29,9 @@ public class PlayerPushEvent extends PlayerEvent implements Cancellable {
return bPlayer;
}
- // The Vector in which direction and magnitude the player is Pushed
- // Can be changed directly or through setPush
-
/**
- * Get the Vector in which direction and magnitude the player is pushed
- * Can be changed directly or through setPush
+ * Get the Vector in which direction and magnitude the player is pushed.
+ * Can be changed directly or through setPush
*
* @return The current push vector
*/
@@ -43,7 +40,7 @@ public class PlayerPushEvent extends PlayerEvent implements Cancellable {
}
/**
- * Set the Push vector
+ * Set the Push vector.
*
* @param push The new push vector, not null
*/
diff --git a/src/com/dre/brewery/api/events/barrel/BarrelAccessEvent.java b/src/com/dre/brewery/api/events/barrel/BarrelAccessEvent.java
index 256da96..b3c853d 100644
--- a/src/com/dre/brewery/api/events/barrel/BarrelAccessEvent.java
+++ b/src/com/dre/brewery/api/events/barrel/BarrelAccessEvent.java
@@ -8,9 +8,9 @@ import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
- * A Player opens a Barrel by rightclicking it
- * The PlayerInteractEvent on the Barrel may be cancelled. In that case this never gets called
- * Can be cancelled to silently deny opening the Barrel
+ * A Player opens a Barrel by rightclicking it.
+ * The PlayerInteractEvent on the Barrel may be cancelled. In that case this never gets called
+ * Can be cancelled to silently deny opening the Barrel
*/
public class BarrelAccessEvent extends BarrelEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -26,7 +26,7 @@ public class BarrelAccessEvent extends BarrelEvent implements Cancellable {
/**
* Gets the Block that was actually clicked.
- * For access Permissions getSpigot() should be used
+ * For access Permissions getSpigot() should be used
*/
public Block getClickedBlock() {
return clickedBlock;
diff --git a/src/com/dre/brewery/api/events/barrel/BarrelCreateEvent.java b/src/com/dre/brewery/api/events/barrel/BarrelCreateEvent.java
index 81be00d..ef9129e 100644
--- a/src/com/dre/brewery/api/events/barrel/BarrelCreateEvent.java
+++ b/src/com/dre/brewery/api/events/barrel/BarrelCreateEvent.java
@@ -7,8 +7,8 @@ import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
- * Called when a Barrel is created by a Player by placing a Sign
- * Cancelling this will silently fail the Barrel creation
+ * Called when a Barrel is created by a Player by placing a Sign.
+ * Cancelling this will silently fail the Barrel creation
*/
public class BarrelCreateEvent extends BarrelEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
diff --git a/src/com/dre/brewery/api/events/barrel/BarrelDestroyEvent.java b/src/com/dre/brewery/api/events/barrel/BarrelDestroyEvent.java
index 6ec802d..45ee763 100644
--- a/src/com/dre/brewery/api/events/barrel/BarrelDestroyEvent.java
+++ b/src/com/dre/brewery/api/events/barrel/BarrelDestroyEvent.java
@@ -9,10 +9,10 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
- * A Barrel is being destroyed by something, may not be by a Player
- * A BarrelRemoveEvent will be called after this, if this is not cancelled
- * Use the BarrelRemoveEvent to monitor any and all barrels being removed in a non cancellable way
- * Cancelling the Event will stop the barrel from being destroyed
+ * A Barrel is being destroyed by something, may not be by a Player.
+ * A BarrelRemoveEvent will be called after this, if this is not cancelled
+ * Use the BarrelRemoveEvent to monitor any and all barrels being removed in a non cancellable way
+ * Cancelling the Event will stop the barrel from being destroyed
*/
public class BarrelDestroyEvent extends BarrelEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -82,6 +82,9 @@ public class BarrelDestroyEvent extends BarrelEvent implements Cancellable {
return handlers;
}
+ /**
+ * The Reason why the Barrel is being destroyed.
+ */
public enum Reason {
/**
* A Player Broke the Barrel
diff --git a/src/com/dre/brewery/api/events/barrel/BarrelRemoveEvent.java b/src/com/dre/brewery/api/events/barrel/BarrelRemoveEvent.java
index d2b0f84..827d6de 100644
--- a/src/com/dre/brewery/api/events/barrel/BarrelRemoveEvent.java
+++ b/src/com/dre/brewery/api/events/barrel/BarrelRemoveEvent.java
@@ -5,7 +5,8 @@ import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
- * A Barrel is being removed. There may have been a BarrelDestroyEvent before this
+ * A Barrel is being removed.
+ * There may have been a BarrelDestroyEvent before this.
* If not, Worldedit, other Plugins etc may be the cause for unexpected removal
*/
public class BarrelRemoveEvent extends BarrelEvent {
diff --git a/src/com/dre/brewery/api/events/brew/BrewDrinkEvent.java b/src/com/dre/brewery/api/events/brew/BrewDrinkEvent.java
index 56a6f8b..49f3378 100644
--- a/src/com/dre/brewery/api/events/brew/BrewDrinkEvent.java
+++ b/src/com/dre/brewery/api/events/brew/BrewDrinkEvent.java
@@ -9,9 +9,9 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
/**
- * A Player Drinks a Brew
- * The amount of alcohol and quality that will be added to the player can be get/set here
- * If cancelled the drinking will fail silently
+ * A Player Drinks a Brew.
+ * The amount of alcohol and quality that will be added to the player can be get/set here
+ * If cancelled the drinking will fail silently
*/
public class BrewDrinkEvent extends BrewEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
diff --git a/src/com/dre/brewery/api/events/brew/BrewEvent.java b/src/com/dre/brewery/api/events/brew/BrewEvent.java
index c6fee36..aa76e7e 100644
--- a/src/com/dre/brewery/api/events/brew/BrewEvent.java
+++ b/src/com/dre/brewery/api/events/brew/BrewEvent.java
@@ -19,6 +19,9 @@ public abstract class BrewEvent extends Event {
return brew;
}
+ /**
+ * Gets the Meta of the Item this Brew is attached to
+ */
@NotNull
public ItemMeta getItemMeta() {
return meta;
diff --git a/src/com/dre/brewery/api/events/brew/BrewModifyEvent.java b/src/com/dre/brewery/api/events/brew/BrewModifyEvent.java
index 5a21187..74bed88 100644
--- a/src/com/dre/brewery/api/events/brew/BrewModifyEvent.java
+++ b/src/com/dre/brewery/api/events/brew/BrewModifyEvent.java
@@ -9,10 +9,10 @@ import org.bukkit.inventory.meta.PotionMeta;
import org.jetbrains.annotations.NotNull;
/**
- * A Brew has been created or modified
- * Usually happens on Filling from cauldron, distilling and aging.
- * Modifications to the Brew or the PotionMeta can be done now
- * Cancelling reverts the Brew to the state it was before the modification
+ * A Brew has been created or modified.
+ * Usually happens on filling from cauldron, distilling and aging.
+ * Modifications to the Brew or the PotionMeta can be done now
+ * Cancelling reverts the Brew to the state it was before the modification
*/
public class BrewModifyEvent extends BrewEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -25,11 +25,17 @@ public class BrewModifyEvent extends BrewEvent implements Cancellable {
this.type = type;
}
+ /**
+ * Get the Type of modification being applied to the Brew.
+ */
@NotNull
public Type getType() {
return type;
}
+ /**
+ * Get the BrewLore to modify lore on the Brew
+ */
@NotNull
public BrewLore getLore() {
return new BrewLore(getBrew(), (PotionMeta) getItemMeta());
@@ -42,7 +48,7 @@ public class BrewModifyEvent extends BrewEvent implements Cancellable {
/**
* Setting the Event cancelled cancels all modificatons to the brew.
- * Modifications to the Brew or ItemMeta will not be applied
+ * Modifications to the Brew or ItemMeta will not be applied
*/
@Override
public void setCancelled(boolean cancelled) {
@@ -60,13 +66,44 @@ public class BrewModifyEvent extends BrewEvent implements Cancellable {
return handlers;
}
+ /**
+ * The Type of Modification being applied to the Brew.
+ */
public enum Type {
- CREATE, // A new Brew is created with arbitrary ways, like the create command
- FILL, // Filled from a Cauldron into a new Brew
- DISTILL, // Distilled in the Brewing stand
- AGE, // Aged in a Barrel
- UNLABEL, // Unlabeling Brew with command
- STATIC, // Making Brew static with command
- UNKNOWN // Unknown modification, unused
+ /**
+ * A new Brew is created with arbitrary ways, like the create command.
+ * Cancelling this will disallow the creation
+ */
+ CREATE,
+
+ /**
+ * Filled from a Cauldron into a new Brew.
+ */
+ FILL,
+
+ /**
+ * Distilled in the Brewing stand.
+ */
+ DISTILL,
+
+ /**
+ * Aged in a Barrel.
+ */
+ AGE,
+
+ /**
+ * Unlabeling Brew with command.
+ */
+ UNLABEL,
+
+ /**
+ * Making Brew static with command.
+ */
+ STATIC,
+
+ /**
+ * Unknown modification, unused.
+ */
+ UNKNOWN
}
}
diff --git a/src/com/dre/brewery/listeners/InventoryListener.java b/src/com/dre/brewery/listeners/InventoryListener.java
index b30d6e7..a27283f 100644
--- a/src/com/dre/brewery/listeners/InventoryListener.java
+++ b/src/com/dre/brewery/listeners/InventoryListener.java
@@ -68,7 +68,7 @@ public class InventoryListener implements Listener {
/**
* Clicking can either start or stop the new brew distillation tracking.
- * Note that server restart will halt any ongoing brewing processes and
+ * Note that server restart will halt any ongoing brewing processes and
* they will _not_ restart until a new click event.
*/
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
diff --git a/src/com/dre/brewery/lore/BrewLore.java b/src/com/dre/brewery/lore/BrewLore.java
index 7da480f..163fce2 100644
--- a/src/com/dre/brewery/lore/BrewLore.java
+++ b/src/com/dre/brewery/lore/BrewLore.java
@@ -15,6 +15,10 @@ import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
+/**
+ * Represents the Lore on a Brew under Modification.
+ * Can efficiently replace certain lines of lore, to update brew information on an item.
+ */
public class BrewLore {
private Brew brew;
private PotionMeta meta;
@@ -32,8 +36,8 @@ public class BrewLore {
}
/**
- * Write the new lore into the Meta
- * Should be called at the end of operation on this Brew Lore
+ * Write the new lore into the Meta.
+ * Should be called at the end of operation on this Brew Lore
*/
public PotionMeta write() {
if (lineAddedOrRem) {
@@ -286,7 +290,7 @@ public class BrewLore {
/**
* Adds or replaces a line of Lore.
- * Searches for type and if not found for Substring lore and replaces it
+ * Searches for type and if not found for Substring lore and replaces it
*
* @param type The Type of BrewLore to replace
* @param prefix The Prefix to add to the line of lore
@@ -473,6 +477,9 @@ public class BrewLore {
return P.p.color(color);
}
+ /**
+ * Type of Lore Line
+ */
public enum Type {
STARS("§s"),
CUSTOM("§t"),
diff --git a/src/com/dre/brewery/lore/XORScrambleStream.java b/src/com/dre/brewery/lore/XORScrambleStream.java
index d860088..0072375 100644
--- a/src/com/dre/brewery/lore/XORScrambleStream.java
+++ b/src/com/dre/brewery/lore/XORScrambleStream.java
@@ -7,8 +7,8 @@ import java.util.Random;
/**
* A Scramble Stream that uses XOR operations to scramble an outputstream.
- * a byte generator feeded with the seed is used as xor source
- * The resulting data can be unscrambled by the XORUnscrambleStream
+ * a byte generator feeded with the seed is used as xor source
+ * The resulting data can be unscrambled by the XORUnscrambleStream
*/
public class XORScrambleStream extends FilterOutputStream {
@@ -29,8 +29,8 @@ public class XORScrambleStream extends FilterOutputStream {
/**
* To start the scrambling process this has to be called before writing any data to this stream.
- * Before starting the scrambler, any data will just be passed through unscrambled to the underlying stream.
- * The Scrambling can be started and stopped arbitrarily at any point, allowing for parts of unscrambled data in the stream.
+ * Useful if a stream may be scrambled or unscrambled, the unscrambler will automatically identify either way.
*
* @throws IOException IOException
* @throws IllegalStateException If the Scrambler was started in normal scrambling mode before
diff --git a/src/com/dre/brewery/lore/XORUnscrambleStream.java b/src/com/dre/brewery/lore/XORUnscrambleStream.java
index e418eb1..38a7123 100644
--- a/src/com/dre/brewery/lore/XORUnscrambleStream.java
+++ b/src/com/dre/brewery/lore/XORUnscrambleStream.java
@@ -11,8 +11,8 @@ import java.util.List;
/**
* A Scramble Stream that uses XOR operations to unscramble an inputstream.
- * a byte generator feeded with the seed is used as xor source
- * Used to unscramble data generated by the XORScrambleStream
+ * a byte generator feeded with the seed is used as xor source
+ * Used to unscramble data generated by the XORScrambleStream
*/
public class XORUnscrambleStream extends FilterInputStream {
@@ -26,7 +26,7 @@ public class XORUnscrambleStream extends FilterInputStream {
private SuccessType successType = SuccessType.NONE;
/**
- * Create a new instance of an XORUnscrambler, unscrambling the given inputstream
+ * Create a new instance of an XORUnscrambler, unscrambling the given inputstream.
*
* @param in The Inputstream to be unscrambled
* @param seed The seed used for unscrambling
@@ -38,11 +38,12 @@ public class XORUnscrambleStream extends FilterInputStream {
}
/**
- * Create a new instance of an XORUnscrambler, unscrambling the given inputstream
- * If given a List of previous Seeds, the unscrambler will try all of them for unscrambling the stream in case the seed fails.
+ * Create a new instance of an XORUnscrambler, unscrambling the given inputstream.
+ * If given a List of previous Seeds, the unscrambler will try all of them for unscrambling the stream in case the seed fails.
*
* @param in The Inputstream to be unscrambled
* @param seed The seed used for unscrambling
+ * @param prevSeeds List of previously used seeds
*/
public XORUnscrambleStream(InputStream in, long seed, List The unscrambling can be started again at any point after calling this
*/
public void stop() {
running = false;
@@ -126,7 +127,7 @@ public class XORUnscrambleStream extends FilterInputStream {
}
/**
- * What was used to unscramble the stream, it was already unscrambled, Main Seed, Prev Seed
+ * What was used to unscramble the stream: it was already unscrambled | Main Seed | Prev Seed
*
* @return The Type of Seed used to unscramble this, if any
*/
@@ -180,10 +181,28 @@ public class XORUnscrambleStream extends FilterInputStream {
markRunning = running;
}
+ /**
+ * What succeeded in unscrambling the Stream.
+ */
public static enum SuccessType {
+ /**
+ * The Stream was already unscrambled.
+ */
UNSCRAMBLED,
+
+ /**
+ * The Main Seed was used to unscramble the Stream.
+ */
MAIN_SEED,
+
+ /**
+ * One of the Previous Seeds was used to unscramble the Stream.
+ */
PREV_SEED,
+
+ /**
+ * It was not successful.
+ */
NONE;
}
}
diff --git a/src/com/dre/brewery/recipe/BCauldronRecipe.java b/src/com/dre/brewery/recipe/BCauldronRecipe.java
index a724a30..c3143e6 100644
--- a/src/com/dre/brewery/recipe/BCauldronRecipe.java
+++ b/src/com/dre/brewery/recipe/BCauldronRecipe.java
@@ -16,6 +16,9 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
+/**
+ * A Recipe for the Base Potion coming out of the Cauldron.
+ */
public class BCauldronRecipe {
public static List Use new BCauldronRecipe.Builder() for easier Cauldron Recipe Creation
*
* @param name Name of the Cauldron Recipe
*/
@@ -134,9 +137,9 @@ public class BCauldronRecipe {
/**
* Find how much these ingredients match the given ones from 0-10.
- * If any ingredient is missing, returns 0
- * If all Ingredients and their amounts are equal, returns 10
- * Returns something between 0 and 10 if all ingredients present, but differing amounts, depending on how much the amount differs.
+ * If any ingredient is missing, returns 0
+ * Changes are directly reflected by the main list of all recipes
+ * After adding or removing elements, CauldronRecipes.numConfigRecipes MUST be updated!
*/
public static List Changes are directly reflected by the main list of all recipes
+ * Use new BRecipe.Builder() for easier Recipe Creation
*
* @param name The name for all qualities
*/
@@ -66,8 +69,8 @@ public class BRecipe {
}
/**
- * New BRecipe with Names
- * Use new BRecipe.Builder() for easier Recipe Creation
+ * New BRecipe with Names.
+ * Use new BRecipe.Builder() for easier Recipe Creation
*
* @param names {name bad, name normal, name good}
*/
@@ -311,7 +314,9 @@ public class BRecipe {
return null;
}
- // check every part of the recipe for validity
+ /**
+ * check every part of the recipe for validity.
+ */
public boolean isValid() {
if (ingredients == null || ingredients.isEmpty()) {
P.p.errorLog("No ingredients could be loaded for Recipe: " + getRecipeName());
@@ -348,7 +353,9 @@ public class BRecipe {
return true;
}
- // allowed deviation to the recipes count of ingredients at the given difficulty
+ /**
+ * allowed deviation to the recipes count of ingredients at the given difficulty
+ */
public int allowedCountDiff(int count) {
if (count < 8) {
count = 8;
@@ -361,7 +368,9 @@ public class BRecipe {
return allowedCountDiff;
}
- // allowed deviation to the recipes cooking-time at the given difficulty
+ /**
+ * allowed deviation to the recipes cooking-time at the given difficulty
+ */
public int allowedTimeDiff(int time) {
if (time < 8) {
time = 8;
@@ -374,7 +383,9 @@ public class BRecipe {
return allowedTimeDiff;
}
- // difference between given and recipe-wanted woodtype
+ /**
+ * difference between given and recipe-wanted woodtype
+ */
public float getWoodDiff(float wood) {
return Math.abs(wood - this.wood);
}
@@ -391,7 +402,9 @@ public class BRecipe {
return age != 0;
}
- // true if given list misses an ingredient
+ /**
+ * true if given list misses an ingredient
+ */
public boolean isMissingIngredients(List Changes are directly reflected by the main list of all recipes
+ * After adding or removing elements, BRecipe.numConfigRecipes MUST be updated!
*/
public static List Changes are directly reflected by the main list of all recipes
+ * Mostly used for Custom Items of the Config, but also for general custom items
*/
public class CustomItem extends RecipeItem implements Ingredient {
@@ -167,7 +167,7 @@ public class CustomItem extends RecipeItem implements Ingredient {
/**
* If this item has lore that matches the given lore.
- * It matches if our lore is contained in the given lore consecutively, ignoring color of the given lore.
+ * It matches if our lore is contained in the given lore consecutively, ignoring color of the given lore.
*
* @param usedLore The given lore to match
* @return True if the given lore contains our lore consecutively
diff --git a/src/com/dre/brewery/recipe/CustomMatchAnyItem.java b/src/com/dre/brewery/recipe/CustomMatchAnyItem.java
index 840747d..99dc570 100644
--- a/src/com/dre/brewery/recipe/CustomMatchAnyItem.java
+++ b/src/com/dre/brewery/recipe/CustomMatchAnyItem.java
@@ -13,7 +13,7 @@ import java.util.Objects;
/**
* Custom Item that matches any one of the given info.
- * Does not implement Ingredient, as it can not directly be added to an ingredient
+ * Does not implement Ingredient, as it can not directly be added to an ingredient
*/
public class CustomMatchAnyItem extends RecipeItem {
diff --git a/src/com/dre/brewery/recipe/Ingredient.java b/src/com/dre/brewery/recipe/Ingredient.java
index 9d8ab64..3d27118 100644
--- a/src/com/dre/brewery/recipe/Ingredient.java
+++ b/src/com/dre/brewery/recipe/Ingredient.java
@@ -9,11 +9,11 @@ import java.util.Map;
import java.util.function.Function;
/**
- * Item used in a BIngredients, inside BCauldron or Brew.
- * Represents the Items used as ingredients in the Brewing process
- * Can be a copy of a recipe item
- * Will be saved and loaded with a DataStream
- * Each implementing class needs to register a static function as Item Loader
+ * Item used in a BIngredients, inside BCauldron or Brew,
+ * Represents the Items used as ingredients in the Brewing process.
+ * Can be a copy of a recipe item
+ * Will be saved and loaded with a DataStream
+ * Each implementing class needs to register a static function as Item Loader
*/
public interface Ingredient {
@@ -21,7 +21,7 @@ public interface Ingredient {
/**
* Register a Static function as function that takes an ItemLoader, containing a DataInputStream.
- * Using the Stream it constructs a corresponding Ingredient for the chosen SaveID
+ * Using the Stream it constructs a corresponding Ingredient for the chosen SaveID
*
* @param saveID The SaveID should be a small identifier like "AB"
* @param loadFct The Static Function that loads the Item, i.e.
@@ -43,10 +43,10 @@ public interface Ingredient {
/**
* Saves this Ingredient to the DataOutputStream.
- * The first data HAS to be storing the SaveID like:
+ * The first data HAS to be storing the SaveID like:
* out.writeUTF("AB");
- * Amount will be saved automatically and does not have to be saved here.
- * Saving is done to Brew or for BCauldron into data.yml
+ * Amount will be saved automatically and does not have to be saved here.
+ * Saving is done to Brew or for BCauldron into data.yml
*
* @param out The outputstream to write to
* @throws IOException Any IOException
@@ -67,9 +67,8 @@ public interface Ingredient {
/*
* Does this Item match the given RecipeItem.
- * An IngredientItem matches a RecipeItem if all required info of the RecipeItem are fulfilled on this IngredientItem
- * This does not imply that the same holds the other way round, as this item might have more info than needed
- *
+ * An IngredientItem matches a RecipeItem if all required info of the RecipeItem are fulfilled on this IngredientItem
+ * This does not imply that the same holds the other way round, as this item might have more info than needed
*
* @param recipeItem The recipeItem whose requirements need to be fulfilled
* @return True if this matches the required info of the recipeItem
@@ -77,7 +76,7 @@ public interface Ingredient {
//boolean matches(RecipeItem recipeItem);
/**
- * The other Ingredient is Similar if it is equal except amount
+ * The other Ingredient is Similar if it is equal except amount.
*
* @param item The item to check similarity with
* @return True if this is equal to item except for amount
diff --git a/src/com/dre/brewery/recipe/PluginItem.java b/src/com/dre/brewery/recipe/PluginItem.java
index 8234e87..3a02a1a 100644
--- a/src/com/dre/brewery/recipe/PluginItem.java
+++ b/src/com/dre/brewery/recipe/PluginItem.java
@@ -16,8 +16,8 @@ import java.util.function.Supplier;
/**
* An Item of a Recipe or as Ingredient in a Brew that corresponds to an item from another plugin.
- * See /integration/item for examples on how to extend this class.
- * This class stores items as name of the plugin and item id
+ * See /integration/item for examples on how to extend this class.
+ * This class stores items as name of the plugin and item id
*/
public abstract class PluginItem extends RecipeItem implements Ingredient {
@@ -72,14 +72,14 @@ public abstract class PluginItem extends RecipeItem implements Ingredient {
/**
* Called after Loading this Plugin Item from Config, or (by default) from Ingredients.
- * Allows Override to define custom actions after an Item was constructed
+ * Allows Override to define custom actions after an Item was constructed
*/
protected void onConstruct() {
}
/**
* Does this PluginItem Match the other Ingredient.
- * By default it matches exactly when they are similar, i.e. also a PluginItem with same parameters
+ * By default it matches exactly when they are similar, i.e. also a PluginItem with same parameters
*
* @param ingredient The ingredient that needs to fulfill the requirements
* @return True if the ingredient matches the required info of this
@@ -132,8 +132,8 @@ public abstract class PluginItem extends RecipeItem implements Ingredient {
}
/**
- * Called when loading this Plugin Item from Ingredients (of a Brew)
- * The default loading is the same as loading from Config
+ * Called when loading this Plugin Item from Ingredients (of a Brew).
+ * The default loading is the same as loading from Config
*
* @param loader The ItemLoader from which to load the data, use loader.getInputStream()
* @return The constructed PluginItem
@@ -161,8 +161,8 @@ public abstract class PluginItem extends RecipeItem implements Ingredient {
}
/**
- * Needs to be called at Server start
- * Registers the chosen SaveID and the loading Method for loading from Brew or BCauldron
+ * Registers the chosen SaveID and the loading Method for loading from Brew or BCauldron.
+ * Needs to be called at Server start.
*/
public static void registerItemLoader() {
Ingredient.registerForItemLoader("PI", PluginItem::loadFrom);
@@ -170,8 +170,8 @@ public abstract class PluginItem extends RecipeItem implements Ingredient {
/**
- * Called when loading trying to find a config defined Plugin Item, or by default also when loading from ingredients
- * Will call a registered constructor matching the given plugin identifier
+ * Called when loading trying to find a config defined Plugin Item. By default also when loading from ingredients
+ * Will call a registered constructor matching the given plugin identifier
*
* @param plugin The Identifier of the Plugin used in the config
* @param itemId The Identifier of the Item belonging to this Plugin used in the config
@@ -193,11 +193,11 @@ public abstract class PluginItem extends RecipeItem implements Ingredient {
/**
* This needs to be called at Server Start before Brewery loads its data.
- * When implementing this, put Brewery as softdepend in your plugin.yml!
- * Registers a Constructor that returns a new or cloned instance of a PluginItem
- * This Constructor will be called when loading a Plugin Item from Config or by default from ingredients
- * After the Constructor is called, the plugin and itemid will be set on the new instance
- * Finally the onConstruct is called.
+ * When implementing this, put Brewery as softdepend in your plugin.yml!
+ * Registers a Constructor that returns a new or cloned instance of a PluginItem
+ * Finally the onConstruct is called.
*
* @param pluginId The ID to use in the config
* @param constructor The constructor i.e. YourPluginItem::new
diff --git a/src/com/dre/brewery/recipe/RecipeItem.java b/src/com/dre/brewery/recipe/RecipeItem.java
index 9f1b216..48bf510 100644
--- a/src/com/dre/brewery/recipe/RecipeItem.java
+++ b/src/com/dre/brewery/recipe/RecipeItem.java
@@ -17,8 +17,8 @@ import java.util.stream.Collectors;
/**
* Item that can be used in a Recipe.
- * They are not necessarily only loaded from config
- * They are immutable if used in a recipe. If one implements Ingredient,
+ * They are not necessarily only loaded from config
+ * They are immutable if used in a recipe. If one implements Ingredient,
* it can be used as mutable copy directly in a
* BIngredients. Otherwise it needs to be converted to an Ingredient
*/
@@ -31,7 +31,7 @@ public abstract class RecipeItem implements Cloneable {
/**
* Does this RecipeItem match the given ItemStack?
- * Used to determine if the given item corresponds to this recipeitem
+ * Used to determine if the given item corresponds to this recipeitem
*
* @param item The ItemStack for comparison
* @return True if the given item matches this recipeItem
@@ -39,9 +39,9 @@ public abstract class RecipeItem implements Cloneable {
public abstract boolean matches(ItemStack item);
/**
- * Does this Item match the given Ingredient.
- * A RecipeItem matches an Ingredient if all required info of the RecipeItem are fulfilled on the Ingredient
- * This does not imply that the same holds the other way round, as the ingredient item might have more info than needed
+ * Does this Item match the given Ingredient?
+ * A RecipeItem matches an Ingredient if all required info of the RecipeItem are fulfilled on the Ingredient
+ * This is called when this recipe item is added to a BIngredients
*
* @param forItem The ItemStack that has previously matched this RecipeItem. Used if the resulting Ingredient needs more info from the ItemStack
* @return The IngredientItem corresponding to this RecipeItem
@@ -92,9 +92,9 @@ public abstract class RecipeItem implements Cloneable {
}
/**
- * Set the Amount of this Item in a Recipe
- * The amount can not be set on an existing item in a recipe or existing custom item.
- * To change amount you need to use getMutableCopy() and change the amount on the copy
+ * Set the Amount of this Item in a Recipe.
+ * The amount can not be set on an existing item in a recipe or existing custom item.
+ *
zero Quality keeps the players current quality
*/
public static void setPlayerDrunk(Player player, int drunkeness, int quality) {
if (drunkeness < 0) {
@@ -100,10 +110,10 @@ public class BreweryApi {
// # # # # # # # # # # # #
/**
- * Get a Brew from an ItemStack
- * Reads the Brew data from the saved data on the item
- * Checks if item is actually a Brew
- * Returns null if item is not a Brew
+ * Get a Brew from an ItemStack.
+ *
If the recipe should be saved forever, even after the Server restarts
+ *
If True: Recipe will be saved until removed manually
+ *
If False: Recipe will be removed when the Server restarts, existing potions using
+ *
this Recipe will become bad after continued aging, if the recipe is not added again.
*/
public static void addRecipe(BRecipe recipe, boolean saveForever) {
//recipe.setSaveInData(saveForever);
@@ -258,7 +268,7 @@ public class BreweryApi {
/**
* Removes a Recipe from the List of all Recipes.
- * This can also remove Recipes that were loaded from config, though these will be readded when reloading the config
+ *
If the recipe should be saved forever, even after the Server restarts
+ *
If True: Recipe will be saved until removed manually
+ *
If False: Recipe will be removed when the Server restarts
*/
public static void addCauldronRecipe(BCauldronRecipe recipe, boolean saveForever) {
//recipe.setSaveInData(saveForever);
@@ -326,7 +336,8 @@ public class BreweryApi {
/**
* Removes a Cauldron Recipe from the List of all Cauldron Recipes.
- * This can also remove Cauldron Recipes that were loaded from config, though these will be readded when reloading the config
+ *
Before starting the scrambler, any data will just be passed through unscrambled to the underlying stream.
+ *
The Scrambling can be started and stopped arbitrarily at any point, allowing for parts of unscrambled data in the stream.
*
* @throws IOException IOException
*/
@@ -50,15 +50,15 @@ public class XORScrambleStream extends FilterOutputStream {
/**
* Stop the scrambling, any following data will be passed through unscrambled.
- * The scrambling can be started again at any point after calling this
+ *
The scrambling can be started again at any point after calling this
*/
public void stop() {
running = false;
}
/**
- * Mark the stream as unscrambled, any effort of unscrambing the data later will automatically read the already unscrambled data
- * Useful if a stream may be scrambled or unscrambled, the unscrambler will automatically identify either way.
+ * Mark the stream as unscrambled, any effort of unscrambing the data later will automatically read the already unscrambled data.
+ *
Before starting the unscrambler, any data will just be passed through unmodified to the underlying stream.
+ *
The Unscrambling can be started and stopped arbitrarily at any point, allowing for parts of already unscrambled data in the stream.
*
* @throws IOException IOException
* @throws InvalidKeyException If the scrambled data could not be read, very likely caused by a wrong seed. Thrown after checking all previous seeds.
@@ -99,7 +100,7 @@ public class XORUnscrambleStream extends FilterInputStream {
/**
* Stop the unscrambling, any following data will be passed through unmodified.
- * The unscrambling can be started again at any point after calling this
+ *
If all Ingredients and their amounts are equal, returns 10
+ *
Returns something between 0 and 10 if all ingredients present, but differing amounts, depending on how much the amount differs.
*/
public float getIngredientMatch(List
Changes to the main List of all CauldronRecipes will make the reference to this sublist invalid
*
- * After adding or removing elements, CauldronRecipes.numConfigRecipes MUST be updated!
+ *
Changes to the main List of all CauldronRecipes will make the reference to this sublist invalid
*/
public static List
Changes to the main List of all recipes will make the reference to this sublist invalid
*
- * After adding or removing elements, BRecipe.numConfigRecipes MUST be updated!
+ *
Changes to the main List of all recipes will make the reference to this sublist invalid
*/
public static List
This Constructor will be called when loading a Plugin Item from Config or by default from ingredients
+ *
After the Constructor is called, the plugin and itemid will be set on the new instance
+ *
This does not imply that the same holds the other way round, as the ingredient item might have more info than needed
*
*
* @param ingredient The ingredient that needs to fulfill the requirements
@@ -51,7 +51,7 @@ public abstract class RecipeItem implements Cloneable {
/**
* Get the Corresponding Ingredient Item. For Items implementing Ingredient, just getMutableCopy()
- * This is called when this recipe item is added to a BIngredients
+ *
To change amount you need to use getMutableCopy() and change the amount on the copy
*
* @param amount The new amount
*/
@@ -128,12 +128,12 @@ public abstract class RecipeItem implements Cloneable {
/**
* Tries to find a matching RecipeItem for this item. It checks custom items and if it has found a unique custom item
- * it will return that. If there are multiple matching custom items, a new CustomItem with all item info is returned
- * If there is no matching CustomItem, it will return a SimpleItem with the items type
+ * it will return that. If there are multiple matching custom items, a new CustomItem with all item info is returned.
+ *
If there is no matching CustomItem, it will return a SimpleItem with the items type
*
* @param item The Item for which to find a matching RecipeItem
* @param acceptAll If true it will accept any item and return a SimpleItem even if not on the accepted list
- * If false it will return null if the item is not acceptable by the Cauldron
+ *
If false it will return null if the item is not acceptable by the Cauldron
* @return The Matched CustomItem, new CustomItem with all item info or SimpleItem
*/
@Nullable
diff --git a/src/com/dre/brewery/utility/BUtil.java b/src/com/dre/brewery/utility/BUtil.java
index 9ce5ad2..64c7563 100644
--- a/src/com/dre/brewery/utility/BUtil.java
+++ b/src/com/dre/brewery/utility/BUtil.java
@@ -59,7 +59,9 @@ public class BUtil {
}
}
- // returns the Player if online
+ /**
+ * returns the Player if online
+ */
public static Player getPlayerfromString(String name) {
if (P.useUUID) {
try {
@@ -97,7 +99,7 @@ public class BUtil {
}
/**
- * Load A List of Strings from config. If found a single String, will convert to List
+ * Load A List of Strings from config, if found a single String, will convert to List
*/
@Nullable
public static List