Finalized Merge of 2.0-StoreDataInLore

Rebased onto Master Branch commit e5438e7ae3
And moved to new branch v2.0
This commit is contained in:
Sn0wStorm
2019-10-12 13:52:55 +02:00
parent 519c4821d9
commit 4a1f606e99
24 changed files with 380 additions and 477 deletions
@@ -1,8 +1,11 @@
package com.dre.brewery.api.events;
import com.dre.brewery.BCauldron;
import com.dre.brewery.LegacyUtil;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Levelled;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@@ -40,7 +43,7 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
}
// Get the item currently being added to the cauldron by the player
// Can be changed directly or with the setter
// Can be changed directly (mutable) or with the setter Method
// The amount is ignored and always one added
public ItemStack getIngredient() {
return ingredient;
@@ -55,7 +58,7 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
// If the amount of the item in the players hand should be decreased
// Default true
public boolean shouldTakeItem() {
public boolean willTakeItem() {
return takeItem;
}
@@ -64,22 +67,21 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
this.takeItem = takeItem;
}
// Get the MaterialData of the Cauldron
// Get the BlockData of the Cauldron
// May be null if the Cauldron does not exist anymore
public Cauldron getCauldronData() {
BlockState state = block.getState();
if (state != null) {
MaterialData data = state.getData();
if (data instanceof Cauldron) {
return ((Cauldron) state);
}
public Levelled getCauldronData() {
BlockData data = block.getBlockData();
if (data instanceof Levelled) {
return (Levelled) data;
}
return null;
}
// Get the Water Fill level of the Cauldron
// 0 = empty, 1 = something in, 2 = full
public int getFillLevel() {
return BCauldron.getFillLevel(block);
// Can use BCauldron.EMPTY, BCauldron.SOME, BCauldron.FULL
public byte getFillLevel() {
return LegacyUtil.getFillLevel(block);
}
@Override
@@ -24,7 +24,7 @@ public class PlayerPushEvent extends PlayerEvent implements Cancellable {
this.bPlayer = bPlayer;
}
public BPlayer getbPlayer() {
public BPlayer getBPlayer() {
return bPlayer;
}
@@ -15,7 +15,7 @@ public class BarrelRemoveEvent extends BarrelEvent {
super(barrel);
}
public boolean shouldItemsDrop() {
public boolean willItemsDrop() {
return itemsDrop;
}
@@ -12,6 +12,7 @@ public class BrewModifyEvent extends BrewEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Type type;
private boolean cancelled;
//private List<Consumer<Brew>> fcts;
public BrewModifyEvent(Brew brew, Type type) {
super(brew);
@@ -22,6 +23,10 @@ public class BrewModifyEvent extends BrewEvent implements Cancellable {
return type;
}
/*public void addModification(Consumer<Brew> predicate) {
fcts.add(predicate);
}*/
@Override
public boolean isCancelled() {
return cancelled;