SteamWar/BauSystem
Archiviert
13
0

Improve some Stuff

Dieser Commit ist enthalten in:
Chaoscaot 2021-02-13 22:52:26 +01:00
Ursprung 94c4d8107e
Commit 35902fac56
2 geänderte Dateien mit 24 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -71,9 +71,9 @@ public class CommandGUI implements CommandExecutor, Listener {
OPEN_INVS.remove(player); OPEN_INVS.remove(player);
}); });
inv.setItem(37, Material.GLASS_PANE, "§7Platzhalter", clickType -> {}); inv.setItem(37, getMaterial("GLASS_PANE", "THIN_GLASS"), "§7Platzhalter", clickType -> {});
inv.setItem(38, Material.GLASS_PANE, "§7Platzhalter", clickType -> {}); inv.setItem(38, getMaterial("GLASS_PANE", "THIN_GLASS"), "§7Platzhalter", clickType -> {});
inv.setItem(43, Material.GLASS_PANE, "§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");
@ -107,7 +107,7 @@ public class CommandGUI implements CommandExecutor, Listener {
player.performCommand("debugstick"); player.performCommand("debugstick");
}); });
inv.setItem(20, Material.COMPASS, "§7TPS Limitieren", getNoPermsLore(Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e1 - 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");
@ -273,7 +273,7 @@ public class CommandGUI implements CommandExecutor, Listener {
updateInventories(); updateInventories();
}); });
} else { } else {
inv.setItem(3, Material.FIRE_CHARGE, "§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");
@ -306,22 +306,23 @@ public class CommandGUI implements CommandExecutor, Listener {
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]");
switch (RecordStateMachine.getRecordStatus()) { switch (RecordStateMachine.getRecordStatus()) {
case IDLE: case IDLE:
inv.setItem(0, getMaterial("SNOWBALL", "SNOW_BALL"), "§7Tracerstatus", Arrays.asList("§7Aktuell: §e" + RecordStateMachine.getRecordStatus().getName()), false, clickType -> { inv.setItem(0, getMaterial("SNOWBALL", "SNOW_BALL"), "§7Tracerstatus", stateLore, false, clickType -> {
RecordStateMachine.commandAuto(); RecordStateMachine.commandAuto();
updateInventories(); updateInventories();
}); });
break; break;
case IDLE_AUTO: case IDLE_AUTO:
inv.setItem(0, Material.ENDER_PEARL, "§7Tracerstatus", Arrays.asList("§7Aktuell: §e" + RecordStateMachine.getRecordStatus().getName()), false, clickType -> { inv.setItem(0, Material.ENDER_PEARL, "§7Tracerstatus", stateLore, false, clickType -> {
RecordStateMachine.commandStart(); RecordStateMachine.commandStart();
updateInventories(); updateInventories();
}); });
break; break;
case RECORD: case RECORD:
case RECORD_AUTO: case RECORD_AUTO:
inv.setItem(0, getMaterial("ENDER_EYE", "EYE_OF_ENDER"), "§7Tracerstatus", Arrays.asList("§7Aktuell: §e" + RecordStateMachine.getRecordStatus().getName()), false, clickType -> { inv.setItem(0, getMaterial("ENDER_EYE", "EYE_OF_ENDER"), "§7Tracerstatus", stateLore, false, clickType -> {
RecordStateMachine.commandStop(); RecordStateMachine.commandStop();
updateInventories(); updateInventories();
}); });
@ -343,7 +344,7 @@ public class CommandGUI implements CommandExecutor, Listener {
player.performCommand("trace show gui"); player.performCommand("trace show gui");
}); });
inv.setItem(6, Material.BARRIER, "§7Trace löschen", 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();
@ -482,42 +483,43 @@ public class CommandGUI implements CommandExecutor, Listener {
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(2, 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);
}); });
else else
inv.setItem(2, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7Bauen", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau togglebuild §8[§eSpieler§8]"), false, clickType -> { inv.setItem(0, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7Bauen", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau togglebuild §8[§eSpieler§8]"), false, clickType -> {
member.setBuild(true); member.setBuild(true);
bauweltMemberGUI(player, member); bauweltMemberGUI(player, member);
}); });
if(member.isWorldEdit()) if(member.isWorldEdit())
inv.setItem(4, 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);
}); });
else else
inv.setItem(4, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7Worldedit", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau togglewe §8[§eSpieler§8]"), false, clickType -> { inv.setItem(2, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7Worldedit", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau togglewe §8[§eSpieler§8]"), false, clickType -> {
member.setWorldEdit(true); member.setWorldEdit(true);
bauweltMemberGUI(player, member); bauweltMemberGUI(player, member);
}); });
if(member.isWorld()) if(member.isWorld())
inv.setItem(6, 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);
}); });
else else
inv.setItem(6, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7World", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau toggleworld §8[§eSpieler§8]"), false, clickType -> { inv.setItem(4, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7World", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau toggleworld §8[§eSpieler§8]"), false, clickType -> {
member.setWorld(true); member.setWorld(true);
bauweltMemberGUI(player, member); bauweltMemberGUI(player, member);
}); });
inv.setItem(8, Material.BARRIER, "§7Member entfernen", clickType -> { inv.setItem(6, Material.BARRIER, "§7Member entfernen", clickType -> {
player.closeInventory(); player.closeInventory();
confirmChatMessage(player, "/bau delmember " + user.getUserName()); confirmChatMessage(player, "/bau delmember " + user.getUserName());
}); });
inv.setItem(8, Material.ARROW, "§7Zurück", clickType -> bauManagementGUI(player));
inv.open(); inv.open();
} }
@ -527,7 +529,7 @@ public class CommandGUI implements CommandExecutor, Listener {
t.setText("[Hier]"); t.setText("[Hier]");
t.setColor(ChatColor.YELLOW); t.setColor(ChatColor.YELLOW);
t.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command)); t.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command));
t.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§8/§7" + command))); t.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§7" + command)));
player.spigot().sendMessage(t); player.spigot().sendMessage(t);
} }
@ -563,7 +565,7 @@ public class CommandGUI implements CommandExecutor, Listener {
for (String name:names) { for (String name:names) {
try { try {
return Material.valueOf(name); return Material.valueOf(name);
}catch (NullPointerException ignored) {} }catch (IllegalArgumentException ignored) {}
} }
return null; return null;
} }

Datei anzeigen

@ -42,6 +42,7 @@ public class PredefinedBook {
private List<String> lore; private List<String> lore;
private String author; private String author;
private String name; private String name;
private ItemStack finishedBook;
PredefinedBook(ConfigurationSection section) { PredefinedBook(ConfigurationSection section) {
this.lines = section.getStringList("lines"); this.lines = section.getStringList("lines");
@ -51,6 +52,8 @@ public class PredefinedBook {
} }
public ItemStack toItemStack() { public ItemStack toItemStack() {
if(finishedBook != null)
return finishedBook;
ItemStack book = new ItemStack(getBookMat()); ItemStack book = new ItemStack(getBookMat());
BookMeta meta = (BookMeta) book.getItemMeta(); BookMeta meta = (BookMeta) book.getItemMeta();
meta.setPages(getPages()); meta.setPages(getPages());
@ -60,6 +63,7 @@ public class PredefinedBook {
meta.setGeneration(BookMeta.Generation.ORIGINAL); meta.setGeneration(BookMeta.Generation.ORIGINAL);
meta.setLore(lore); meta.setLore(lore);
book.setItemMeta(meta); book.setItemMeta(meta);
finishedBook = book;
return book; return book;
} }