mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-09-29 04:07:30 +02:00
parent
98394b14b4
commit
b3a5013a7f
@ -642,6 +642,15 @@ public class P extends JavaPlugin {
|
|||||||
|
|
||||||
// Utility
|
// 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) {
|
public int parseInt(String string) {
|
||||||
return NumberUtils.toInt(string, 0);
|
return NumberUtils.toInt(string, 0);
|
||||||
}
|
}
|
||||||
|
@ -353,6 +353,7 @@ public class CommandListener implements CommandExecutor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void cmdCopy(CommandSender sender, int count) {
|
public void cmdCopy(CommandSender sender, int count) {
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
@ -389,6 +390,7 @@ public class CommandListener implements CommandExecutor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void cmdDelete(CommandSender sender) {
|
public void cmdDelete(CommandSender sender) {
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
@ -413,6 +415,7 @@ public class CommandListener implements CommandExecutor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void cmdPersist(CommandSender sender) {
|
public void cmdPersist(CommandSender sender) {
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
@ -441,6 +444,7 @@ public class CommandListener implements CommandExecutor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void cmdStatic(CommandSender sender) {
|
public void cmdStatic(CommandSender sender) {
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
@ -471,6 +475,7 @@ public class CommandListener implements CommandExecutor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void cmdUnlabel(CommandSender sender) {
|
public void cmdUnlabel(CommandSender sender) {
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
|
@ -38,10 +38,24 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
// Interacting with a Cauldron
|
// Interacting with a Cauldron
|
||||||
if (type == Material.CAULDRON) {
|
if (type == Material.CAULDRON) {
|
||||||
Material materialInHand = event.getMaterial();
|
Material materialInHand;
|
||||||
ItemStack item = event.getItem();
|
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);
|
BCauldron.printTime(player, clickedBlock);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -54,7 +68,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(Material.AIR));
|
P.p.setHand(player, new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,9 +115,9 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isBucket) {
|
if (isBucket) {
|
||||||
player.setItemInHand(new ItemStack(Material.BUCKET));
|
P.p.setHand(player, new ItemStack(Material.BUCKET));
|
||||||
} else {
|
} else {
|
||||||
player.setItemInHand(new ItemStack(Material.AIR));
|
P.p.setHand(player, new ItemStack(Material.AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user