SteamWar/BauSystem
Archiviert
13
0

ChaosBauGUI #183

Manuell gemergt
YoyoNow hat 20 Commits von ChaosBauGUI nach master 2021-02-24 19:16:17 +01:00 zusammengeführt
Nur Änderungen aus Commit 8c216527f7 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -44,25 +44,6 @@ public class CommandGUI implements CommandExecutor, Listener {
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) {
Region region = Region.getRegion(player.getLocation());
SWInventory inv = new SWInventory(player, 5 * 9, SteamwarUser.get(BauSystem.getOwner()).getUserName() + "s Bau");
@ -71,9 +52,12 @@ public class CommandGUI implements CommandExecutor, Listener {
OPEN_INVS.remove(player);
});
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(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(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.performCommand("gui item");
@ -166,9 +150,12 @@ public class CommandGUI implements CommandExecutor, Listener {
});
if (Region.GlobalRegion.isGlobalRegion(region)) {
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(9, Material.BARRIER, "§eKeine Region", clickType -> {
});
inv.setItem(18, Material.BARRIER, "§eKeine Region", clickType -> {
});
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 -> {
if (Welt.noPermission(player, Permission.world))
@ -183,7 +170,8 @@ public class CommandGUI implements CommandExecutor, Listener {
confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player));
});
} else {
inv.setItem(18, Material.BARRIER, "§eRegion nicht Protect bar", clickType -> {});
inv.setItem(18, Material.BARRIER, "§eRegion nicht Protect bar", clickType -> {
});
}
if (region.hasTestblock()) {
@ -193,7 +181,8 @@ public class CommandGUI implements CommandExecutor, Listener {
confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player));
});
} else {
inv.setItem(9, Material.BARRIER, "§eDie Region hat keinen Testblock", clickType -> {});
inv.setItem(9, Material.BARRIER, "§eDie Region hat keinen Testblock", clickType -> {
});
}
}
@ -344,7 +333,8 @@ public class CommandGUI implements CommandExecutor, Listener {
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 -> {
player.closeInventory();
@ -358,7 +348,8 @@ public class CommandGUI implements CommandExecutor, Listener {
private static void scriptBooksGUI(Player player) {
List<SWListInv.SWListEntry<PredefinedBook>> entries = new ArrayList<>();
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) -> {
player.closeInventory();
player.getInventory().addItem(predefinedBook.toItemStack());
@ -565,11 +556,32 @@ public class CommandGUI implements CommandExecutor, Listener {
for (String name : names) {
try {
return Material.valueOf(name);
}catch (IllegalArgumentException ignored) {}
} catch (IllegalArgumentException ignored) {
//Ignored /\
}
}
return null;
}
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (!(commandSender instanceof Player))
Review

In den geschweiften Klammern des catch Blockes einfach // Ignored als Kommentar schreiben

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
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)