mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 06:38:56 +00:00
Removed almost all uses from ItemIds
This commit is contained in:
@@ -85,7 +85,6 @@ public class BCauldron {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fills players bottle with cooked brew
|
// fills players bottle with cooked brew
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static boolean fill(Player player, Block block) {
|
public static boolean fill(Player player, Block block) {
|
||||||
BCauldron bcauldron = get(block);
|
BCauldron bcauldron = get(block);
|
||||||
if (bcauldron != null) {
|
if (bcauldron != null) {
|
||||||
@@ -172,7 +171,7 @@ public class BCauldron {
|
|||||||
if (cauldron.state != 1) {
|
if (cauldron.state != 1) {
|
||||||
config.set(prefix + ".state", cauldron.state);
|
config.set(prefix + ".state", cauldron.state);
|
||||||
}
|
}
|
||||||
config.set(prefix + ".ingredients", cauldron.ingredients.serializeIngredients());
|
config.set(prefix + ".ingredients", cauldron.ingredients);
|
||||||
id++;
|
id++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,17 +297,17 @@ public class BIngredients {
|
|||||||
if (cookedTime != 0) {
|
if (cookedTime != 0) {
|
||||||
config.set(path + ".cookedTime", cookedTime);
|
config.set(path + ".cookedTime", cookedTime);
|
||||||
}
|
}
|
||||||
config.set(path + ".mats", serializeIngredients());
|
config.set(path + ".mats", ingredients);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert the ingredient Material to id
|
// convert the ingredient Material to id
|
||||||
public Map<Integer, Integer> serializeIngredients() {
|
/*public Map<Integer, Integer> serializeIngredients() {
|
||||||
Map<Integer, Integer> mats = new HashMap<Integer, Integer>();
|
Map<Integer, Integer> mats = new HashMap<Integer, Integer>();
|
||||||
for (Material mat : ingredients.keySet()) {
|
for (Material mat : ingredients.keySet()) {
|
||||||
mats.put(mat.getId(), ingredients.get(mat));
|
mats.put(mat.getId(), ingredients.get(mat));
|
||||||
}
|
}
|
||||||
return mats;
|
return mats;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,6 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ public class Barrel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// player opens the barrel
|
// player opens the barrel
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public void open(Player player) {
|
public void open(Player player) {
|
||||||
if (inventory == null) {
|
if (inventory == null) {
|
||||||
if (isLarge()) {
|
if (isLarge()) {
|
||||||
@@ -225,7 +224,7 @@ public class Barrel {
|
|||||||
// if nobody has the inventory opened
|
// if nobody has the inventory opened
|
||||||
if (inventory.getViewers().isEmpty()) {
|
if (inventory.getViewers().isEmpty()) {
|
||||||
// if inventory contains potions
|
// if inventory contains potions
|
||||||
if (inventory.contains(373)) {
|
if (inventory.contains(Material.POTION)) {
|
||||||
byte wood = getWood();
|
byte wood = getWood();
|
||||||
long loadTime = System.nanoTime();
|
long loadTime = System.nanoTime();
|
||||||
for (ItemStack item : inventory.getContents()) {
|
for (ItemStack item : inventory.getContents()) {
|
||||||
@@ -348,6 +347,8 @@ public class Barrel {
|
|||||||
if (barrel2 != null) {
|
if (barrel2 != null) {
|
||||||
return barrel2;
|
return barrel2;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -560,31 +561,30 @@ public class Barrel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// direction of the barrel from the spigot
|
// direction of the barrel from the spigot
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static int getDirection(Block spigot) {
|
public static int getDirection(Block spigot) {
|
||||||
int direction = 0;// 1=x+ 2=x- 3=z+ 4=z-
|
int direction = 0;// 1=x+ 2=x- 3=z+ 4=z-
|
||||||
int typeId = spigot.getRelative(0, 0, 1).getTypeId();
|
Material type = spigot.getRelative(0, 0, 1).getType();
|
||||||
if (typeId == 5 || isStairs(typeId)) {
|
if (type == Material.WOOD || isStairs(type)) {
|
||||||
direction = 3;
|
direction = 3;
|
||||||
}
|
}
|
||||||
typeId = spigot.getRelative(0, 0, -1).getTypeId();
|
type = spigot.getRelative(0, 0, -1).getType();
|
||||||
if (typeId == 5 || isStairs(typeId)) {
|
if (type == Material.WOOD || isStairs(type)) {
|
||||||
if (direction == 0) {
|
if (direction == 0) {
|
||||||
direction = 4;
|
direction = 4;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
typeId = spigot.getRelative(1, 0, 0).getTypeId();
|
type = spigot.getRelative(1, 0, 0).getType();
|
||||||
if (typeId == 5 || isStairs(typeId)) {
|
if (type == Material.WOOD || isStairs(type)) {
|
||||||
if (direction == 0) {
|
if (direction == 0) {
|
||||||
direction = 1;
|
direction = 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
typeId = spigot.getRelative(-1, 0, 0).getTypeId();
|
type = spigot.getRelative(-1, 0, 0).getType();
|
||||||
if (typeId == 5 || isStairs(typeId)) {
|
if (type == Material.WOOD || isStairs(type)) {
|
||||||
if (direction == 0) {
|
if (direction == 0) {
|
||||||
direction = 2;
|
direction = 2;
|
||||||
} else {
|
} else {
|
||||||
@@ -600,13 +600,11 @@ public class Barrel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// true for small barrels
|
// true for small barrels
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static boolean isSign(Block spigot) {
|
public static boolean isSign(Block spigot) {
|
||||||
return spigot.getTypeId() == 63 || spigot.getTypeId() == 68;
|
return spigot.getType() == Material.SIGN || spigot.getType() == Material.SIGN_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
// woodtype of the block the spigot is attached to
|
// woodtype of the block the spigot is attached to
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public byte getWood() {
|
public byte getWood() {
|
||||||
int direction = getDirection(this.spigot);// 1=x+ 2=x- 3=z+ 4=z-
|
int direction = getDirection(this.spigot);// 1=x+ 2=x- 3=z+ 4=z-
|
||||||
Block wood;
|
Block wood;
|
||||||
@@ -621,7 +619,7 @@ public class Barrel {
|
|||||||
} else {
|
} else {
|
||||||
wood = this.spigot.getRelative(0, 0, -1);
|
wood = this.spigot.getRelative(0, 0, -1);
|
||||||
}
|
}
|
||||||
if (wood.getTypeId() == 5) {
|
if (wood.getType() == Material.WOOD) {
|
||||||
byte data = wood.getData();
|
byte data = wood.getData();
|
||||||
if (data == 0x0) {
|
if (data == 0x0) {
|
||||||
return 2;
|
return 2;
|
||||||
@@ -633,16 +631,16 @@ public class Barrel {
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wood.getTypeId() == 53) {
|
if (wood.getType() == Material.WOOD_STAIRS) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (wood.getTypeId() == 134) {
|
if (wood.getType() == Material.SPRUCE_WOOD_STAIRS) {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
if (wood.getTypeId() == 135) {
|
if (wood.getType() == Material.BIRCH_WOOD_STAIRS) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (wood.getTypeId() == 136) {
|
if (wood.getType() == Material.JUNGLE_WOOD_STAIRS) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -665,14 +663,13 @@ public class Barrel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns the fence above/below a block, itself if there is none
|
// returns the fence above/below a block, itself if there is none
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static Block getSpigotOfSign(Block block) {
|
public static Block getSpigotOfSign(Block block) {
|
||||||
|
|
||||||
int y = -2;
|
int y = -2;
|
||||||
while (y <= 1) {
|
while (y <= 1) {
|
||||||
// Fence and Netherfence
|
// Fence and Netherfence
|
||||||
Block relative = block.getRelative(0, y, 0);
|
Block relative = block.getRelative(0, y, 0);
|
||||||
if (relative.getTypeId() == 85 || relative.getTypeId() == 113) {
|
if (relative.getType() == Material.FENCE || relative.getType() == Material.NETHER_FENCE) {
|
||||||
return (relative);
|
return (relative);
|
||||||
}
|
}
|
||||||
y++;
|
y++;
|
||||||
@@ -680,13 +677,8 @@ public class Barrel {
|
|||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
public static boolean isStairs(Material material) {
|
||||||
public static boolean isStairs(Material mat) {
|
return material == Material.WOOD_STAIRS || material == Material.SPRUCE_WOOD_STAIRS || material == Material.BIRCH_WOOD_STAIRS || material == Material.JUNGLE_WOOD_STAIRS || material == Material.ACACIA_STAIRS || material == Material.DARK_OAK_STAIRS;
|
||||||
return isStairs(mat.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isStairs(int id) {
|
|
||||||
return id == 53 || id == 134 || id == 135 || id == 136 || id == 163 || id == 164;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns null if Barrel is correctly placed; the block that is missing when not
|
// returns null if Barrel is correctly placed; the block that is missing when not
|
||||||
@@ -704,7 +696,6 @@ public class Barrel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public Block checkSBarrel() {
|
public Block checkSBarrel() {
|
||||||
int direction = getDirection(spigot);// 1=x+ 2=x- 3=z+ 4=z-
|
int direction = getDirection(spigot);// 1=x+ 2=x- 3=z+ 4=z-
|
||||||
if (direction == 0) {
|
if (direction == 0) {
|
||||||
@@ -739,7 +730,7 @@ public class Barrel {
|
|||||||
endZ = startZ + 1;
|
endZ = startZ + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int typeId;
|
Material type;
|
||||||
int x = startX;
|
int x = startX;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int z = startZ;
|
int z = startZ;
|
||||||
@@ -747,9 +738,9 @@ public class Barrel {
|
|||||||
while (x <= endX) {
|
while (x <= endX) {
|
||||||
while (z <= endZ) {
|
while (z <= endZ) {
|
||||||
Block block = spigot.getRelative(x, y, z);
|
Block block = spigot.getRelative(x, y, z);
|
||||||
typeId = block.getTypeId();
|
type = block.getType();
|
||||||
|
|
||||||
if (isStairs(typeId)) {
|
if (isStairs(type)) {
|
||||||
if (y == 0) {
|
if (y == 0) {
|
||||||
// stairs have to be upside down
|
// stairs have to be upside down
|
||||||
if (block.getData() < 4) {
|
if (block.getData() < 4) {
|
||||||
@@ -775,7 +766,6 @@ public class Barrel {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public Block checkLBarrel() {
|
public Block checkLBarrel() {
|
||||||
int direction = getDirection(spigot);// 1=x+ 2=x- 3=z+ 4=z-
|
int direction = getDirection(spigot);// 1=x+ 2=x- 3=z+ 4=z-
|
||||||
if (direction == 0) {
|
if (direction == 0) {
|
||||||
@@ -811,7 +801,7 @@ public class Barrel {
|
|||||||
endZ = startZ + 3;
|
endZ = startZ + 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
int typeId;
|
Material type;
|
||||||
int x = startX;
|
int x = startX;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int z = startZ;
|
int z = startZ;
|
||||||
@@ -819,7 +809,7 @@ public class Barrel {
|
|||||||
while (x <= endX) {
|
while (x <= endX) {
|
||||||
while (z <= endZ) {
|
while (z <= endZ) {
|
||||||
Block block = spigot.getRelative(x, y, z);
|
Block block = spigot.getRelative(x, y, z);
|
||||||
typeId = block.getTypeId();
|
type = block.getType();
|
||||||
if (direction == 1 || direction == 2) {
|
if (direction == 1 || direction == 2) {
|
||||||
if (y == 1 && z == 0) {
|
if (y == 1 && z == 0) {
|
||||||
if (x == -1 || x == -4 || x == 1 || x == 4) {
|
if (x == -1 || x == -4 || x == 1 || x == 4) {
|
||||||
@@ -841,8 +831,8 @@ public class Barrel {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeId == 5 || isStairs(typeId)) {
|
if (type == Material.WOOD || isStairs(type)) {
|
||||||
if (typeId == 5) {
|
if (type == Material.WOOD) {
|
||||||
woods.add(block.getX());
|
woods.add(block.getX());
|
||||||
woods.add(block.getY());
|
woods.add(block.getY());
|
||||||
woods.add(block.getZ());
|
woods.add(block.getZ());
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
@@ -73,7 +74,7 @@ public class Brew {
|
|||||||
|
|
||||||
// returns a Brew by ItemStack
|
// returns a Brew by ItemStack
|
||||||
public static Brew get(ItemStack item) {
|
public static Brew get(ItemStack item) {
|
||||||
if (item.getTypeId() == 373) {
|
if (item.getType() == Material.POTION) {
|
||||||
if (item.hasItemMeta()) {
|
if (item.hasItemMeta()) {
|
||||||
PotionMeta potionMeta = (PotionMeta) item.getItemMeta();
|
PotionMeta potionMeta = (PotionMeta) item.getItemMeta();
|
||||||
return get(potionMeta);
|
return get(potionMeta);
|
||||||
|
|||||||
@@ -639,6 +639,8 @@ public class P extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package com.dre.brewery.integration;
|
package com.dre.brewery.integration;
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.dre.brewery.P;
|
import com.dre.brewery.P;
|
||||||
import me.ryanhamshire.GriefPrevention.Claim;
|
|
||||||
import me.ryanhamshire.GriefPrevention.Configuration.WorldConfig;
|
import me.ryanhamshire.GriefPrevention.Configuration.WorldConfig;
|
||||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||||
import me.ryanhamshire.GriefPrevention.Messages;
|
import me.ryanhamshire.GriefPrevention.Messages;
|
||||||
@@ -13,7 +11,6 @@ import me.ryanhamshire.GriefPrevention.PlayerData;
|
|||||||
import me.ryanhamshire.GriefPrevention.TextMode;
|
import me.ryanhamshire.GriefPrevention.TextMode;
|
||||||
|
|
||||||
public class GriefPreventionBarrel {
|
public class GriefPreventionBarrel {
|
||||||
|
|
||||||
public static boolean checkAccess(Player player, Block sign) {
|
public static boolean checkAccess(Player player, Block sign) {
|
||||||
|
|
||||||
WorldConfig wc = GriefPrevention.instance.getWorldCfg(player.getWorld());
|
WorldConfig wc = GriefPrevention.instance.getWorldCfg(player.getWorld());
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ public class LogBlockBarrel {
|
|||||||
opened.add(this);
|
opened.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private void compareInv(final ItemStack[] after) {
|
private void compareInv(final ItemStack[] after) {
|
||||||
final ItemStack[] diff = compareInventories(items, after);
|
final ItemStack[] diff = compareInventories(items, after);
|
||||||
for (final ItemStack item : diff) {
|
for (final ItemStack item : diff) {
|
||||||
@@ -62,7 +61,6 @@ public class LogBlockBarrel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static void breakBarrel(String playerName, ItemStack[] contents, Location spigotLoc) {
|
public static void breakBarrel(String playerName, ItemStack[] contents, Location spigotLoc) {
|
||||||
if (!isLogging(spigotLoc.getWorld(), Logging.CHESTACCESS)) return;
|
if (!isLogging(spigotLoc.getWorld(), Logging.CHESTACCESS)) return;
|
||||||
final ItemStack[] items = compressInventory(contents);
|
final ItemStack[] items = compressInventory(contents);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.dre.brewery.listeners;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -346,7 +347,7 @@ public class CommandListener implements CommandExecutor {
|
|||||||
if (hand != null) {
|
if (hand != null) {
|
||||||
if (Brew.get(hand) != null) {
|
if (Brew.get(hand) != null) {
|
||||||
Brew.remove(hand);
|
Brew.remove(hand);
|
||||||
player.setItemInHand(new ItemStack(0));
|
player.setItemInHand(new ItemStack(Material.AIR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.dre.brewery.listeners;
|
|||||||
|
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -11,6 +12,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
|||||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||||
import org.bukkit.event.entity.EntityCombustEvent;
|
import org.bukkit.event.entity.EntityCombustEvent;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@@ -25,7 +27,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onItemDespawn(ItemDespawnEvent event) {
|
public void onItemDespawn(ItemDespawnEvent event) {
|
||||||
ItemStack item = event.getEntity().getItemStack();
|
ItemStack item = event.getEntity().getItemStack();
|
||||||
if (item.getTypeId() == 373) {
|
if (item.getType() == Material.POTION) {
|
||||||
Brew.remove(item);
|
Brew.remove(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,10 +35,10 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityCombust(EntityCombustEvent event) {
|
public void onEntityCombust(EntityCombustEvent event) {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (entity.getType().getTypeId() == 1) {
|
if (entity.getType() == EntityType.DROPPED_ITEM) {
|
||||||
if (entity instanceof Item) {
|
if (entity instanceof Item) {
|
||||||
ItemStack item = ((Item) entity).getItemStack();
|
ItemStack item = ((Item) entity).getItemStack();
|
||||||
if (item.getTypeId() == 373) {
|
if (item.getType() == Material.POTION) {
|
||||||
Brew.remove(item);
|
Brew.remove(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
ItemStack item = event.getCurrentItem();
|
ItemStack item = event.getCurrentItem();
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (item.getTypeId() == 373) {
|
if (item.getType() == Material.POTION) {
|
||||||
if (item.hasItemMeta()) {
|
if (item.hasItemMeta()) {
|
||||||
PotionMeta meta = (PotionMeta) item.getItemMeta();
|
PotionMeta meta = (PotionMeta) item.getItemMeta();
|
||||||
Brew brew = Brew.get(meta);
|
Brew brew = Brew.get(meta);
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import com.dre.brewery.P;
|
|||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
public static boolean openEverywhere;
|
public static boolean openEverywhere;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
Block clickedBlock = event.getClickedBlock();
|
Block clickedBlock = event.getClickedBlock();
|
||||||
@@ -53,7 +52,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (item.getAmount() > 1) {
|
if (item.getAmount() > 1) {
|
||||||
item.setAmount(item.getAmount() - 1);
|
item.setAmount(item.getAmount() - 1);
|
||||||
} else {
|
} else {
|
||||||
player.setItemInHand(new ItemStack(0));
|
player.setItemInHand(new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +88,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (isBucket) {
|
if (isBucket) {
|
||||||
player.setItemInHand(new ItemStack(Material.BUCKET));
|
player.setItemInHand(new ItemStack(Material.BUCKET));
|
||||||
} else {
|
} else {
|
||||||
player.setItemInHand(new ItemStack(0));
|
player.setItemInHand(new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user