ChaosBauGUI #183
@ -44,36 +44,20 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
Bukkit.getScheduler().runTaskTimerAsynchronously(BauSystem.getPlugin(), LAST_F_PLAYER::clear, 0, 20);
|
Bukkit.getScheduler().runTaskTimerAsynchronously(BauSystem.getPlugin(), LAST_F_PLAYER::clear, 0, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
|
||||||
if(!(commandSender instanceof Player))
|
|
||||||
return false;
|
|
||||||
Player player = ((Player) commandSender);
|
|
||||||
if(strings.length == 0) {
|
|
||||||
openBauGui(player);
|
|
||||||
OPEN_INVS.add(player);
|
|
||||||
}else {
|
|
||||||
if ("item".equalsIgnoreCase(strings[0])) {
|
|
||||||
if (player.getInventory().getItemInMainHand().getType() == Material.AIR)
|
|
||||||
player.getInventory().setItemInMainHand(new ItemStack(Material.NETHER_STAR));
|
|
||||||
else
|
|
||||||
player.getInventory().addItem(new ItemStack(Material.NETHER_STAR));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void openBauGui(Player player) {
|
public static void openBauGui(Player player) {
|
||||||
Region region = Region.getRegion(player.getLocation());
|
Region region = Region.getRegion(player.getLocation());
|
||||||
SWInventory inv = new SWInventory(player, 5*9, SteamwarUser.get(BauSystem.getOwner()).getUserName() + "s Bau");
|
SWInventory inv = new SWInventory(player, 5 * 9, SteamwarUser.get(BauSystem.getOwner()).getUserName() + "s Bau");
|
||||||
inv.setCallback(-1, clickType -> {
|
inv.setCallback(-1, clickType -> {
|
||||||
if(!isRefreshing)
|
if (!isRefreshing)
|
||||||
OPEN_INVS.remove(player);
|
OPEN_INVS.remove(player);
|
||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(37, getMaterial("GLASS_PANE", "THIN_GLASS"), "§7Platzhalter", clickType -> {});
|
inv.setItem(37, getMaterial("GLASS_PANE", "THIN_GLASS"), "§7Platzhalter", clickType -> {
|
||||||
inv.setItem(38, getMaterial("GLASS_PANE", "THIN_GLASS"), "§7Platzhalter", clickType -> {});
|
});
|
||||||
inv.setItem(43, getMaterial("GLASS_PANE", "THIN_GLASS"), "§7Platzhalter", clickType -> {});
|
inv.setItem(38, getMaterial("GLASS_PANE", "THIN_GLASS"), "§7Platzhalter", clickType -> {
|
||||||
|
});
|
||||||
|
inv.setItem(43, getMaterial("GLASS_PANE", "THIN_GLASS"), "§7Platzhalter", clickType -> {
|
||||||
|
});
|
||||||
inv.setItem(42, Material.NETHER_STAR, "§7Bau GUI Item", Arrays.asList("§7Du kannst dieses Item zum Öffnen der BauGUI nutzen", "§7oder Doppel F (Swap hands) drücken."), false, clickType -> {
|
inv.setItem(42, Material.NETHER_STAR, "§7Bau GUI Item", Arrays.asList("§7Du kannst dieses Item zum Öffnen der BauGUI nutzen", "§7oder Doppel F (Swap hands) drücken."), false, clickType -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.performCommand("gui item");
|
player.performCommand("gui item");
|
||||||
@ -83,32 +67,32 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
ItemMeta meta = dtWand.getItemMeta();
|
ItemMeta meta = dtWand.getItemMeta();
|
||||||
List<String> lore = meta.getLore();
|
List<String> lore = meta.getLore();
|
||||||
lore.add("§8/§7dt wand");
|
lore.add("§8/§7dt wand");
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
lore.add("§cDu hast keine Worldrechte");
|
lore.add("§cDu hast keine Worldrechte");
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
dtWand.setItemMeta(meta);
|
dtWand.setItemMeta(meta);
|
||||||
inv.setItem(39, dtWand, clickType -> {
|
inv.setItem(39, dtWand, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.performCommand("dt wand");
|
player.performCommand("dt wand");
|
||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.worldedit), false, clickType -> {
|
inv.setItem(40, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", getNoPermsLore(Arrays.asList("§8//§7wand"), player, "§cDu hast keine Worldeditrechte", Permission.worldedit), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.performCommand("/wand");
|
player.performCommand("/wand");
|
||||||
});
|
});
|
||||||
inv.setItem(41, getMaterial("DEBUG_STICK", "STICK"), "§eDebugstick", getNoPermsLore(Arrays.asList("§8/§7debugstick"), player, "§cDu hast keine Worldrechte", Permission.world), Core.getVersion() < 13,clickType -> {
|
inv.setItem(41, getMaterial("DEBUG_STICK", "STICK"), "§eDebugstick", getNoPermsLore(Arrays.asList("§8/§7debugstick"), player, "§cDu hast keine Worldrechte", Permission.world), Core.getVersion() < 13, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.performCommand("debugstick");
|
player.performCommand("debugstick");
|
||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e0,5 - " + (TPSUtils.isWarpAllowed()?40:20) + "§8]"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e0,5 - " + (TPSUtils.isWarpAllowed() ? 40 : 20) + "§8]"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "TPS Limitieren");
|
SWAnvilInv anvilInv = new SWAnvilInv(player, "TPS Limitieren");
|
||||||
anvilInv.setItem(Material.COMPASS);
|
anvilInv.setItem(Material.COMPASS);
|
||||||
@ -122,13 +106,13 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
anvilInv.open();
|
anvilInv.open();
|
||||||
});
|
});
|
||||||
|
|
||||||
if(player.getUniqueId().equals(BauSystem.getOwner())) {
|
if (player.getUniqueId().equals(BauSystem.getOwner())) {
|
||||||
SWItem skull = SWItem.getPlayerSkull(player.getName());
|
SWItem skull = SWItem.getPlayerSkull(player.getName());
|
||||||
skull.setName("§7Bau verwalten");
|
skull.setName("§7Bau verwalten");
|
||||||
List<String> skullLore = new ArrayList<>();
|
List<String> skullLore = new ArrayList<>();
|
||||||
skullLore.add("§7TNT: §e" + region.getTntMode().getName());
|
skullLore.add("§7TNT: §e" + region.getTntMode().getName());
|
||||||
skullLore.add("§7StopLag: §e" + (region.isFreeze()?"Eingeschaltet":"Ausgeschaltet"));
|
skullLore.add("§7StopLag: §e" + (region.isFreeze() ? "Eingeschaltet" : "Ausgeschaltet"));
|
||||||
skullLore.add("§7Fire: §e" + (region.isFire()?"Ausgeschaltet":"Eingeschaltet"));
|
skullLore.add("§7Fire: §e" + (region.isFire() ? "Ausgeschaltet" : "Eingeschaltet"));
|
||||||
skullLore.add("§7Members: §e" + (BauweltMember.getMembers(BauSystem.getOwnerID()).size() - 1));
|
skullLore.add("§7Members: §e" + (BauweltMember.getMembers(BauSystem.getOwnerID()).size() - 1));
|
||||||
skull.setLore(skullLore);
|
skull.setLore(skullLore);
|
||||||
skull.setCallback(clickType -> {
|
skull.setCallback(clickType -> {
|
||||||
@ -144,7 +128,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(21, Material.OBSERVER, "§7Tracer", getNoPermsLore(Arrays.asList("§7Status: §e" + RecordStateMachine.getRecordStatus().getName()), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(21, Material.OBSERVER, "§7Tracer", getNoPermsLore(Arrays.asList("§7Status: §e" + RecordStateMachine.getRecordStatus().getName()), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
OPEN_TRACER_INVS.add(player);
|
OPEN_TRACER_INVS.add(player);
|
||||||
@ -152,7 +136,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(22, Material.DISPENSER, "§7Auto-Loader", getNoPermsLore(Arrays.asList("§7Status: " + (AutoLoader.hasLoader(player) ? "§aan" : "§caus")), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(22, Material.DISPENSER, "§7Auto-Loader", getNoPermsLore(Arrays.asList("§7Status: " + (AutoLoader.hasLoader(player) ? "§aan" : "§caus")), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
autoLoaderGUI(player);
|
autoLoaderGUI(player);
|
||||||
@ -165,39 +149,44 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
anvilInv.open();
|
anvilInv.open();
|
||||||
});
|
});
|
||||||
|
|
||||||
if(Region.GlobalRegion.isGlobalRegion(region)) {
|
if (Region.GlobalRegion.isGlobalRegion(region)) {
|
||||||
inv.setItem(9, Material.BARRIER, "§eKeine Region", clickType -> {});
|
inv.setItem(9, Material.BARRIER, "§eKeine Region", clickType -> {
|
||||||
inv.setItem(18, Material.BARRIER, "§eKeine Region", clickType -> {});
|
});
|
||||||
inv.setItem(27, Material.BARRIER, "§eKeine Region", clickType -> {});
|
inv.setItem(18, Material.BARRIER, "§eKeine Region", clickType -> {
|
||||||
}else {
|
});
|
||||||
|
inv.setItem(27, Material.BARRIER, "§eKeine Region", clickType -> {
|
||||||
|
});
|
||||||
|
} else {
|
||||||
inv.setItem(27, getMaterial("HEAVY_WEIGHTED_PRESSURE_PLATE", "IRON_PLATE"), "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(27, getMaterial("HEAVY_WEIGHTED_PRESSURE_PLATE", "IRON_PLATE"), "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player));
|
confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player));
|
||||||
});
|
});
|
||||||
|
|
||||||
if(region.hasProtection()) {
|
if (region.hasProtection()) {
|
||||||
inv.setItem(18, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(18, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player));
|
confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
inv.setItem(18, Material.BARRIER, "§eRegion nicht Protect bar", clickType -> {});
|
inv.setItem(18, Material.BARRIER, "§eRegion nicht Protect bar", clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(region.hasTestblock()) {
|
if (region.hasTestblock()) {
|
||||||
inv.setItem(9, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", getNoPermsLore(Arrays.asList("§8/§7testblock"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(9, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", getNoPermsLore(Arrays.asList("§8/§7testblock"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player));
|
confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
inv.setItem(9, Material.BARRIER, "§eDie Region hat keinen Testblock", clickType -> {});
|
inv.setItem(9, Material.BARRIER, "§eDie Region hat keinen Testblock", clickType -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
|
if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
|
||||||
inv.setItem(26, Material.POTION, "§7Nightvision: §eEingeschaltet", Collections.singletonList("§8/§7nv"), false, clickType -> {
|
inv.setItem(26, Material.POTION, "§7Nightvision: §eEingeschaltet", Collections.singletonList("§8/§7nv"), false, clickType -> {
|
||||||
CommandNV.toggleNightvision(player);
|
CommandNV.toggleNightvision(player);
|
||||||
openBauGui(player);
|
openBauGui(player);
|
||||||
@ -209,7 +198,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.hasPotionEffect(PotionEffectType.WATER_BREATHING)) {
|
if (player.hasPotionEffect(PotionEffectType.WATER_BREATHING)) {
|
||||||
inv.setItem(35, Material.WATER_BUCKET, "§7Waterbreathing: §eEingeschaltet", Collections.singletonList("§8/§7wv"), false, clickType -> {
|
inv.setItem(35, Material.WATER_BUCKET, "§7Waterbreathing: §eEingeschaltet", Collections.singletonList("§8/§7wv"), false, clickType -> {
|
||||||
CommandGills.toggleGills(player);
|
CommandGills.toggleGills(player);
|
||||||
openBauGui(player);
|
openBauGui(player);
|
||||||
@ -226,15 +215,15 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
switch (region.getTntMode()) {
|
switch (region.getTntMode()) {
|
||||||
case OFF:
|
case OFF:
|
||||||
inv.setItem(23, Material.MINECART, "§7TNT: §eAusgeschaltet", tntLore, false, clickType -> {
|
inv.setItem(23, Material.MINECART, "§7TNT: §eAusgeschaltet", tntLore, false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.performCommand("tnt " + (isBuildArea?"tb":"on"));
|
player.performCommand("tnt " + (isBuildArea ? "tb" : "on"));
|
||||||
updateInventories();
|
updateInventories();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case ONLY_TB:
|
case ONLY_TB:
|
||||||
inv.setItem(23, getMaterial("TNT_MINECART", "EXPLOSIVE_MINECART"), "§7TNT: §enur Testblock", tntLore, false, clickType -> {
|
inv.setItem(23, getMaterial("TNT_MINECART", "EXPLOSIVE_MINECART"), "§7TNT: §enur Testblock", tntLore, false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.performCommand("tnt on");
|
player.performCommand("tnt on");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
@ -242,39 +231,39 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
inv.setItem(23, Material.TNT, "§7TNT: §eEingeschaltet", tntLore, false, clickType -> {
|
inv.setItem(23, Material.TNT, "§7TNT: §eEingeschaltet", tntLore, false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.performCommand("tnt off");
|
player.performCommand("tnt off");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(region.isFreeze()) {
|
if (region.isFreeze()) {
|
||||||
inv.setItem(24, getMaterial("GUNPOWDER", "SULPHUR"), "§7Freeze: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(24, getMaterial("GUNPOWDER", "SULPHUR"), "§7Freeze: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.performCommand("freeze");
|
player.performCommand("freeze");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
inv.setItem(24, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(24, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.performCommand("freeze");
|
player.performCommand("freeze");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(region.isFire()) {
|
if (region.isFire()) {
|
||||||
inv.setItem(3, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(3, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.performCommand("fire");
|
player.performCommand("fire");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
inv.setItem(3, getMaterial("FIRE_CHARGE", "FIREBALL"), "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
inv.setItem(3, getMaterial("FIRE_CHARGE", "FIREBALL"), "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.world))
|
if (Welt.noPermission(player, Permission.world))
|
||||||
return;
|
return;
|
||||||
player.performCommand("fire");
|
player.performCommand("fire");
|
||||||
updateInventories();
|
updateInventories();
|
||||||
@ -282,11 +271,11 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inv.setItem(2, Material.ENDER_PEARL, "§7Teleporter", getNoPermsLore(Arrays.asList("§8/§7tp §8[§eSpieler§8]"), player, "§cDu hast keine Buildrechte", Permission.build), false, clickType -> {
|
inv.setItem(2, Material.ENDER_PEARL, "§7Teleporter", getNoPermsLore(Arrays.asList("§8/§7tp §8[§eSpieler§8]"), player, "§cDu hast keine Buildrechte", Permission.build), false, clickType -> {
|
||||||
if(Welt.noPermission(player, Permission.build))
|
if (Welt.noPermission(player, Permission.build))
|
||||||
return;
|
return;
|
||||||
List<SWListInv.SWListEntry<String>> playerSWListEntry = new ArrayList<>();
|
List<SWListInv.SWListEntry<String>> playerSWListEntry = new ArrayList<>();
|
||||||
Bukkit.getOnlinePlayers().forEach(player1 -> {
|
Bukkit.getOnlinePlayers().forEach(player1 -> {
|
||||||
if(player1.equals(player))
|
if (player1.equals(player))
|
||||||
return;
|
return;
|
||||||
playerSWListEntry.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(player1.getName()), player1.getName()));
|
playerSWListEntry.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(player1.getName()), player1.getName()));
|
||||||
});
|
});
|
||||||
@ -303,7 +292,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
private static void traceGUI(Player player) {
|
private static void traceGUI(Player player) {
|
||||||
SWInventory inv = new SWInventory(player, 9, "Tracer");
|
SWInventory inv = new SWInventory(player, 9, "Tracer");
|
||||||
inv.setCallback(-1, clickType -> {
|
inv.setCallback(-1, clickType -> {
|
||||||
if(!isRefreshing)
|
if (!isRefreshing)
|
||||||
OPEN_TRACER_INVS.remove(player);
|
OPEN_TRACER_INVS.remove(player);
|
||||||
});
|
});
|
||||||
List<String> stateLore = Arrays.asList("§7Aktuell: §e" + RecordStateMachine.getRecordStatus().getName(), "§8/§7trace §8[§estart§8, stop §8oder §eauto§8]");
|
List<String> stateLore = Arrays.asList("§7Aktuell: §e" + RecordStateMachine.getRecordStatus().getName(), "§8/§7trace §8[§estart§8, stop §8oder §eauto§8]");
|
||||||
@ -327,7 +316,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
updateInventories();
|
updateInventories();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(TraceShowManager.hasActiveShow(player)) {
|
if (TraceShowManager.hasActiveShow(player)) {
|
||||||
inv.setItem(2, Material.TNT, "§7Showstatus", Arrays.asList("§7Aktuell: §eGezeigt", "§8/§7trace §8[§eshow§8/§ehide§8]"), false, clickType -> {
|
inv.setItem(2, Material.TNT, "§7Showstatus", Arrays.asList("§7Aktuell: §eGezeigt", "§8/§7trace §8[§eshow§8/§ehide§8]"), false, clickType -> {
|
||||||
player.performCommand("trace hide");
|
player.performCommand("trace hide");
|
||||||
traceGUI(player);
|
traceGUI(player);
|
||||||
@ -344,7 +333,8 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
player.performCommand("trace show gui");
|
player.performCommand("trace show gui");
|
||||||
});
|
});
|
||||||
|
|
||||||
inv.setItem(6, Material.BARRIER, "§7Trace löschen", Arrays.asList("§8/§7trace delete"), false, clickType -> confirmationInventory(player, "Trace löschen", () -> player.performCommand("trace delete"), () -> {}));
|
inv.setItem(6, Material.BARRIER, "§7Trace löschen", Arrays.asList("§8/§7trace delete"), false, clickType -> confirmationInventory(player, "Trace löschen", () -> player.performCommand("trace delete"), () -> {
|
||||||
|
}));
|
||||||
|
|
||||||
inv.setItem(8, Material.ARROW, "§7Zurück", clickType -> {
|
inv.setItem(8, Material.ARROW, "§7Zurück", clickType -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
@ -358,7 +348,8 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
private static void scriptBooksGUI(Player player) {
|
private static void scriptBooksGUI(Player player) {
|
||||||
List<SWListInv.SWListEntry<PredefinedBook>> entries = new ArrayList<>();
|
List<SWListInv.SWListEntry<PredefinedBook>> entries = new ArrayList<>();
|
||||||
List<PredefinedBook> books = PredefinedBook.getBooks();
|
List<PredefinedBook> books = PredefinedBook.getBooks();
|
||||||
books.forEach(predefinedBook -> entries.add(new SWListInv.SWListEntry<>(new SWItem(predefinedBook.getBookMat(), predefinedBook.getName(), predefinedBook.getLore(), false, clickType -> {}), predefinedBook)));
|
books.forEach(predefinedBook -> entries.add(new SWListInv.SWListEntry<>(new SWItem(predefinedBook.getBookMat(), predefinedBook.getName(), predefinedBook.getLore(), false, clickType -> {
|
||||||
|
}), predefinedBook)));
|
||||||
SWListInv<PredefinedBook> inv = new SWListInv<>(player, "Script Bücher", entries, (clickType, predefinedBook) -> {
|
SWListInv<PredefinedBook> inv = new SWListInv<>(player, "Script Bücher", entries, (clickType, predefinedBook) -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.getInventory().addItem(predefinedBook.toItemStack());
|
player.getInventory().addItem(predefinedBook.toItemStack());
|
||||||
@ -371,9 +362,9 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
|
|
||||||
boolean hasLoader = AutoLoader.hasLoader(player);
|
boolean hasLoader = AutoLoader.hasLoader(player);
|
||||||
|
|
||||||
if(hasLoader) {
|
if (hasLoader) {
|
||||||
AutoLoader loader = AutoLoader.getLoader(player);
|
AutoLoader loader = AutoLoader.getLoader(player);
|
||||||
if(loader.isSetup()) {
|
if (loader.isSetup()) {
|
||||||
inv.setItem(0, Material.DROPPER, "§7Loader Starten", Collections.singletonList("§8/§7loader start"), false, clickType -> {
|
inv.setItem(0, Material.DROPPER, "§7Loader Starten", Collections.singletonList("§8/§7loader start"), false, clickType -> {
|
||||||
loader.start();
|
loader.start();
|
||||||
autoLoaderGUI(player);
|
autoLoaderGUI(player);
|
||||||
@ -436,20 +427,20 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
List<BauweltMember> members = BauweltMember.getMembers(BauSystem.getOwnerID());
|
List<BauweltMember> members = BauweltMember.getMembers(BauSystem.getOwnerID());
|
||||||
List<SWListInv.SWListEntry<BauweltMember>> items = new ArrayList<>();
|
List<SWListInv.SWListEntry<BauweltMember>> items = new ArrayList<>();
|
||||||
members.forEach(member -> {
|
members.forEach(member -> {
|
||||||
if(member.getMemberID() == BauSystem.getOwnerID())
|
if (member.getMemberID() == BauSystem.getOwnerID())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SteamwarUser user = SteamwarUser.get(member.getMemberID());
|
SteamwarUser user = SteamwarUser.get(member.getMemberID());
|
||||||
if(!user.getUserName().toLowerCase().contains(search.toLowerCase()))
|
if (!user.getUserName().toLowerCase().contains(search.toLowerCase()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SWItem item = SWItem.getPlayerSkull(user.getUserName());
|
SWItem item = SWItem.getPlayerSkull(user.getUserName());
|
||||||
item.setName("§7" + user.getUserName());
|
item.setName("§7" + user.getUserName());
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add("§7Online: §e" + (Bukkit.getPlayer(user.getUUID()) == null?"Offline":"Online"));
|
lore.add("§7Online: §e" + (Bukkit.getPlayer(user.getUUID()) == null ? "Offline" : "Online"));
|
||||||
lore.add("§7Bauen: §e" + (member.isBuild()?"Ja":"Nein"));
|
lore.add("§7Bauen: §e" + (member.isBuild() ? "Ja" : "Nein"));
|
||||||
lore.add("§7Worldedit: §e" + (member.isWorldEdit()?"Ja":"Nein"));
|
lore.add("§7Worldedit: §e" + (member.isWorldEdit() ? "Ja" : "Nein"));
|
||||||
lore.add("§7World: §e" + (member.isWorld()?"Ja":"Nein"));
|
lore.add("§7World: §e" + (member.isWorld() ? "Ja" : "Nein"));
|
||||||
item.setLore(lore);
|
item.setLore(lore);
|
||||||
items.add(new SWListInv.SWListEntry<>(item, member));
|
items.add(new SWListInv.SWListEntry<>(item, member));
|
||||||
});
|
});
|
||||||
@ -482,7 +473,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
private static void bauweltMemberGUI(Player player, BauweltMember member) {
|
private static void bauweltMemberGUI(Player player, BauweltMember member) {
|
||||||
SteamwarUser user = SteamwarUser.get(member.getMemberID());
|
SteamwarUser user = SteamwarUser.get(member.getMemberID());
|
||||||
SWInventory inv = new SWInventory(player, 9, "Member: " + user.getUserName());
|
SWInventory inv = new SWInventory(player, 9, "Member: " + user.getUserName());
|
||||||
if(member.isBuild())
|
if (member.isBuild())
|
||||||
inv.setItem(0, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7Bauen", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau togglebuild §8[§eSpieler§8]"), false, clickType -> {
|
inv.setItem(0, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7Bauen", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau togglebuild §8[§eSpieler§8]"), false, clickType -> {
|
||||||
member.setBuild(false);
|
member.setBuild(false);
|
||||||
bauweltMemberGUI(player, member);
|
bauweltMemberGUI(player, member);
|
||||||
@ -493,7 +484,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
bauweltMemberGUI(player, member);
|
bauweltMemberGUI(player, member);
|
||||||
});
|
});
|
||||||
|
|||||||
|
|
||||||
if(member.isWorldEdit())
|
if (member.isWorldEdit())
|
||||||
inv.setItem(2, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7Worldedit", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau togglewe §8[§eSpieler§8]"), false, clickType -> {
|
inv.setItem(2, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7Worldedit", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau togglewe §8[§eSpieler§8]"), false, clickType -> {
|
||||||
member.setWorldEdit(false);
|
member.setWorldEdit(false);
|
||||||
bauweltMemberGUI(player, member);
|
bauweltMemberGUI(player, member);
|
||||||
@ -504,7 +495,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
bauweltMemberGUI(player, member);
|
bauweltMemberGUI(player, member);
|
||||||
});
|
});
|
||||||
|
|
||||||
if(member.isWorld())
|
if (member.isWorld())
|
||||||
inv.setItem(4, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7World", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau toggleworld §8[§eSpieler§8]"), false, clickType -> {
|
inv.setItem(4, getMaterial("GREEN_WOOL", "WOOL"), (byte) 13, "§7World", Arrays.asList("§7Aktuell: §eJa", "§8/§7bau toggleworld §8[§eSpieler§8]"), false, clickType -> {
|
||||||
member.setWorld(false);
|
member.setWorld(false);
|
||||||
bauweltMemberGUI(player, member);
|
bauweltMemberGUI(player, member);
|
||||||
@ -534,7 +525,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> getNoPermsLore(List<String> lore, Player player, String noPerms, Permission perm) {
|
private static List<String> getNoPermsLore(List<String> lore, Player player, String noPerms, Permission perm) {
|
||||||
if(Welt.noPermission(player, perm)) {
|
if (Welt.noPermission(player, perm)) {
|
||||||
lore = new ArrayList<>(lore);
|
lore = new ArrayList<>(lore);
|
||||||
lore.add(noPerms);
|
lore.add(noPerms);
|
||||||
}
|
}
|
||||||
@ -551,9 +542,9 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
private static void confirmationInventory(Player player, String title, Runnable confirm, Runnable decline) {
|
private static void confirmationInventory(Player player, String title, Runnable confirm, Runnable decline) {
|
||||||
SWInventory inv = new SWInventory(player, 9, title);
|
SWInventory inv = new SWInventory(player, 9, title);
|
||||||
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§cAbbrechen", clickType -> {
|
inv.setItem(0, SWItem.getDye(1), (byte) 1, "§cAbbrechen", clickType -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
decline.run();
|
decline.run();
|
||||||
});
|
});
|
||||||
inv.setItem(8, SWItem.getDye(10), (byte) 10, "§aBestätigen", clickType -> {
|
inv.setItem(8, SWItem.getDye(10), (byte) 10, "§aBestätigen", clickType -> {
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
confirm.run();
|
confirm.run();
|
||||||
@ -562,19 +553,40 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Material getMaterial(String... names) {
|
private static Material getMaterial(String... names) {
|
||||||
for (String name:names) {
|
for (String name : names) {
|
||||||
try {
|
try {
|
||||||
return Material.valueOf(name);
|
return Material.valueOf(name);
|
||||||
}catch (IllegalArgumentException ignored) {}
|
} catch (IllegalArgumentException ignored) {
|
||||||
|
//Ignored /\
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
|
||||||
|
if (!(commandSender instanceof Player))
|
||||||
YoyoNow
hat
In den geschweiften Klammern des catch Blockes einfach In den geschweiften Klammern des catch Blockes einfach `// Ignored` als Kommentar schreiben
|
|||||||
|
return false;
|
||||||
|
Player player = ((Player) commandSender);
|
||||||
|
if (strings.length == 0) {
|
||||||
|
openBauGui(player);
|
||||||
|
OPEN_INVS.add(player);
|
||||||
|
} else {
|
||||||
|
if ("item".equalsIgnoreCase(strings[0])) {
|
||||||
|
if (player.getInventory().getItemInMainHand().getType() == Material.AIR)
|
||||||
|
player.getInventory().setItemInMainHand(new ItemStack(Material.NETHER_STAR));
|
||||||
|
else
|
||||||
|
player.getInventory().addItem(new ItemStack(Material.NETHER_STAR));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if(event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||||
return;
|
return;
|
||||||
if(event.getItem() == null || event.getItem().getType() != Material.NETHER_STAR)
|
if (event.getItem() == null || event.getItem().getType() != Material.NETHER_STAR)
|
||||||
return;
|
return;
|
||||||
openBauGui(event.getPlayer());
|
openBauGui(event.getPlayer());
|
||||||
OPEN_INVS.add(event.getPlayer());
|
OPEN_INVS.add(event.getPlayer());
|
||||||
@ -582,7 +594,7 @@ public class CommandGUI implements CommandExecutor, Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
|
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
|
||||||
if(LAST_F_PLAYER.contains(event.getPlayer())) {
|
if (LAST_F_PLAYER.contains(event.getPlayer())) {
|
||||||
openBauGui(event.getPlayer());
|
openBauGui(event.getPlayer());
|
||||||
OPEN_INVS.add(event.getPlayer());
|
OPEN_INVS.add(event.getPlayer());
|
||||||
} else {
|
} else {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Bitte sowohl um den if block als auch den else block geschweifte Klammern, damit man es besser lesen kann