Added bypass for repair command
This commit is contained in:
parent
cb78772f85
commit
be11d3852a
1 changed files with 17 additions and 15 deletions
|
@ -448,23 +448,25 @@ public class V10LiftCommand implements CommandExecutor {
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
int masterAmount = V10LiftPlugin.getSConfig().getFile().getInt("MasterRepairAmount");
|
if (!p.hasPermission("v10lift.admin")) {
|
||||||
Optional<XMaterial> mat = XMaterial.matchXMaterial(Objects.requireNonNull(V10LiftPlugin.getSConfig().getFile().getString("MasterRepairItem"), "MasterRepairItem is null"));
|
int masterAmount = V10LiftPlugin.getSConfig().getFile().getInt("MasterRepairAmount");
|
||||||
if (!mat.isPresent()) {
|
Optional<XMaterial> mat = XMaterial.matchXMaterial(Objects.requireNonNull(V10LiftPlugin.getSConfig().getFile().getString("MasterRepairItem"), "MasterRepairItem is null"));
|
||||||
Bukkit.getLogger().severe("[V10Lift] The material for MasterRepairItem is undefined!");
|
if (!mat.isPresent()) {
|
||||||
return true;
|
Bukkit.getLogger().severe("[V10Lift] The material for MasterRepairItem is undefined!");
|
||||||
}
|
|
||||||
Material masterItem = mat.get().parseMaterial();
|
|
||||||
if (masterItem == null) {
|
|
||||||
Bukkit.getLogger().severe("[V10Lift] The material for MasterRepairItem is undefined!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (p.getGameMode() != GameMode.CREATIVE && masterAmount > 0) {
|
|
||||||
if (!p.getInventory().contains(masterItem)) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "You need " + masterAmount + "x " + masterItem.toString().toLowerCase() + "!");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
p.getInventory().remove(new ItemStack(masterItem, masterAmount));
|
Material masterItem = mat.get().parseMaterial();
|
||||||
|
if (masterItem == null) {
|
||||||
|
Bukkit.getLogger().severe("[V10Lift] The material for MasterRepairItem is undefined!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (p.getGameMode() != GameMode.CREATIVE && masterAmount > 0) {
|
||||||
|
if (!p.getInventory().contains(masterItem)) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "You need " + masterAmount + "x " + masterItem.toString().toLowerCase() + "!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
p.getInventory().remove(new ItemStack(masterItem, masterAmount));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
V10LiftPlugin.getAPI().setDefective(liftName, false);
|
V10LiftPlugin.getAPI().setDefective(liftName, false);
|
||||||
|
|
Loading…
Reference in a new issue