mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 10:08:54 +00:00
@@ -642,6 +642,15 @@ public class P extends JavaPlugin {
|
||||
|
||||
// Utility
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setHand(Player player, ItemStack item) {
|
||||
if (P.use1_9) {
|
||||
player.getInventory().setItemInMainHand(item);
|
||||
} else {
|
||||
player.setItemInHand(item);
|
||||
}
|
||||
}
|
||||
|
||||
public int parseInt(String string) {
|
||||
return NumberUtils.toInt(string, 0);
|
||||
}
|
||||
|
||||
@@ -353,6 +353,7 @@ public class CommandListener implements CommandExecutor {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void cmdCopy(CommandSender sender, int count) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
@@ -389,6 +390,7 @@ public class CommandListener implements CommandExecutor {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void cmdDelete(CommandSender sender) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
@@ -413,6 +415,7 @@ public class CommandListener implements CommandExecutor {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void cmdPersist(CommandSender sender) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
@@ -441,6 +444,7 @@ public class CommandListener implements CommandExecutor {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void cmdStatic(CommandSender sender) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
@@ -471,6 +475,7 @@ public class CommandListener implements CommandExecutor {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void cmdUnlabel(CommandSender sender) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
|
||||
@@ -38,10 +38,24 @@ public class PlayerListener implements Listener {
|
||||
|
||||
// Interacting with a Cauldron
|
||||
if (type == Material.CAULDRON) {
|
||||
Material materialInHand = event.getMaterial();
|
||||
ItemStack item = event.getItem();
|
||||
Material materialInHand;
|
||||
ItemStack item;
|
||||
if (P.use1_9) {
|
||||
item = player.getInventory().getItemInMainHand();
|
||||
if (item != null) {
|
||||
materialInHand = item.getType();
|
||||
} else {
|
||||
materialInHand = null;
|
||||
}
|
||||
} else {
|
||||
materialInHand = event.getMaterial();
|
||||
item = event.getItem();
|
||||
}
|
||||
|
||||
if (materialInHand == Material.WATCH) {
|
||||
if (item == null || materialInHand == null) {
|
||||
return;
|
||||
|
||||
} else if (materialInHand == Material.WATCH) {
|
||||
BCauldron.printTime(player, clickedBlock);
|
||||
return;
|
||||
|
||||
@@ -54,7 +68,7 @@ public class PlayerListener implements Listener {
|
||||
if (item.getAmount() > 1) {
|
||||
item.setAmount(item.getAmount() - 1);
|
||||
} else {
|
||||
player.setItemInHand(new ItemStack(Material.AIR));
|
||||
P.p.setHand(player, new ItemStack(Material.AIR));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,9 +115,9 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
} else {
|
||||
if (isBucket) {
|
||||
player.setItemInHand(new ItemStack(Material.BUCKET));
|
||||
P.p.setHand(player, new ItemStack(Material.BUCKET));
|
||||
} else {
|
||||
player.setItemInHand(new ItemStack(Material.AIR));
|
||||
P.p.setHand(player, new ItemStack(Material.AIR));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user