Some TM Fixes and Inventory Layout
Dieser Commit ist enthalten in:
Ursprung
032a4c75d6
Commit
d557e164ba
@ -27,6 +27,9 @@ class CommandDebugStick_15 {
|
||||
private CommandDebugStick_15(){}
|
||||
|
||||
static void giveStick(Player player){
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.DEBUG_STICK, 1));
|
||||
if(player.getInventory().getItemInMainHand().getType() == Material.AIR)
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.DEBUG_STICK, 1));
|
||||
else
|
||||
player.getInventory().setItemInOffHand(new ItemStack(Material.DEBUG_STICK, 1));
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.world.Detonator;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -62,7 +63,10 @@ public class CommandDetonator implements CommandExecutor {
|
||||
case "wand":
|
||||
case "detonator":
|
||||
case "item":
|
||||
player.getInventory().setItemInMainHand(Detonator.WAND);
|
||||
if(player.getInventory().getItemInMainHand().getType() == Material.AIR)
|
||||
player.getInventory().setItemInMainHand(Detonator.WAND);
|
||||
else
|
||||
player.getInventory().setItemInOffHand(Detonator.WAND);
|
||||
player.updateInventory();
|
||||
Detonator.getDetonator(player);
|
||||
break;
|
||||
|
@ -1,15 +1,24 @@
|
||||
package de.steamwar.bausystem.commands;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
||||
import de.steamwar.bausystem.tracer.record.RecordStatus;
|
||||
import de.steamwar.bausystem.tracer.show.TraceShowManager;
|
||||
import de.steamwar.bausystem.world.AutoLoader;
|
||||
import de.steamwar.bausystem.world.Detonator;
|
||||
import de.steamwar.bausystem.world.Region;
|
||||
import de.steamwar.bausystem.world.Welt;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -19,6 +28,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@ -29,8 +39,13 @@ public class CommandGUI implements CommandExecutor, Listener {
|
||||
|
||||
private static final Set<Player> OPEN_INVS = new HashSet<>();
|
||||
private static final Set<Player> OPEN_TRACER_INVS = new HashSet<>();
|
||||
private static final Set<Player> LAST_F_PLAYER = new HashSet<>();
|
||||
private static boolean isRefreshing = false;
|
||||
|
||||
public CommandGUI() {
|
||||
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))
|
||||
@ -49,143 +64,211 @@ public class CommandGUI implements CommandExecutor, Listener {
|
||||
OPEN_INVS.remove(player);
|
||||
});
|
||||
|
||||
inv.setItem(2, Material.GLASS_PANE, "§7Platzhalter", clickType -> {});
|
||||
inv.setItem(20, Material.GLASS_PANE, "§7Platzhalter", clickType -> {});
|
||||
inv.setItem(22, Material.GLASS_PANE, "§7Platzhalter", clickType -> {});
|
||||
inv.setItem(24, Material.GLASS_PANE, "§7Platzhalter", clickType -> {});
|
||||
|
||||
ItemStack dtWand = Detonator.WAND.clone();
|
||||
ItemMeta meta = dtWand.getItemMeta();
|
||||
List<String> lore = meta.getLore();
|
||||
lore.add("§8/§7dt wand");
|
||||
if(Welt.noPermission(player, Permission.world))
|
||||
lore.add("§cDu hast keine Worldrechte");
|
||||
meta.setLore(lore);
|
||||
dtWand.setItemMeta(meta);
|
||||
inv.setItem(3, dtWand, clickType -> {
|
||||
inv.setItem(38, dtWand, clickType -> {
|
||||
player.closeInventory();
|
||||
player.performCommand("dt wand");
|
||||
});
|
||||
|
||||
inv.setItem(4, getMaterial("WOODEN_AXE", "WOOD_AXE"), "§eWorldedit Axt", Arrays.asList("§8//§7wand"), 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))
|
||||
return;
|
||||
player.closeInventory();
|
||||
player.performCommand("/wand");
|
||||
});
|
||||
inv.setItem(5, Material.GLASS_PANE, "§7Platzhalter", clickType -> {});
|
||||
inv.setItem(6, Material.GLASS_PANE, "§7Platzhalter", clickType -> {});
|
||||
inv.setItem(41, Material.DEBUG_STICK, "§7Debugstick", Arrays.asList("§8/§7debugstick"), false, clickType -> {
|
||||
player.closeInventory();
|
||||
player.performCommand("debugstick");
|
||||
});
|
||||
inv.setItem(42, Material.GLASS_PANE, "§7Platzhalter", clickType -> {});
|
||||
|
||||
inv.setItem(9, Material.COMPASS, "§7TPS Limitieren", Arrays.asList("§7Aktuell: §e" + CommandTPSLimiter.getCurrentTPSLimit(), "§8/§7tpslimit §8[§e1 - 20§8]"), false, clickType -> {
|
||||
inv.setItem(26, 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 -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "TPS Limitieren");
|
||||
anvilInv.setItem(Material.COMPASS);
|
||||
anvilInv.setCallback(s -> player.performCommand("tpslimit " + s));
|
||||
anvilInv.open();
|
||||
});
|
||||
inv.setItem(18, Material.FEATHER, "§7Geschwindigkeit", Arrays.asList("§7Aktuell: §e" + player.getFlySpeed() * 10, "§8/§7speed §8[§e1 - 10§8]"), false, clickType -> {
|
||||
inv.setItem(6, Material.FEATHER, "§7Geschwindigkeit", Arrays.asList("§7Aktuell: §e" + player.getFlySpeed() * 10, "§8/§7speed §8[§e1 - 10§8]"), false, clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "Geschwindigkeit");
|
||||
anvilInv.setItem(Material.FEATHER);
|
||||
anvilInv.setCallback(s -> player.performCommand("speed " + s));
|
||||
anvilInv.open();
|
||||
});
|
||||
|
||||
inv.setItem(22, Material.OBSERVER, "§7Tracer", Arrays.asList("§7Status: §e" + RecordStateMachine.getRecordStatus().getName()), false, clickType -> {
|
||||
if(player.getUniqueId().equals(BauSystem.getOwner())) {
|
||||
SWItem skull = SWItem.getPlayerSkull(player.getName());
|
||||
skull.setName("§7Bau verwalten");
|
||||
List<String> skullLore = new ArrayList<>();
|
||||
skullLore.add("§7TNT: §e" + region.getTntMode().getName());
|
||||
skullLore.add("§7StopLag: §e" + (region.isFreeze()?"Eingeschaltet":"Ausgeschaltet"));
|
||||
skullLore.add("§7Fire: §e" + (region.isFire()?"Ausgeschaltet":"Eingeschaltet"));
|
||||
skullLore.add("§7Members: §e" + (BauweltMember.getMembers(BauSystem.getOwnerID()).size() - 1));
|
||||
skull.setLore(skullLore);
|
||||
skull.setCallback(clickType -> {
|
||||
player.closeInventory();
|
||||
bauManagementGUI(player);
|
||||
});
|
||||
inv.setItem(4, skull);
|
||||
}
|
||||
|
||||
inv.setItem(39, Material.BOOK, "§7Script Bücher", Arrays.asList("§7Aktuell §e" + 0 + " §7Bücher"), true, clickType -> {
|
||||
// TODO: 04.02.2021 Implement Script Book Database
|
||||
});
|
||||
|
||||
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))
|
||||
return;
|
||||
player.closeInventory();
|
||||
OPEN_TRACER_INVS.add(player);
|
||||
traceGUI(player);
|
||||
});
|
||||
|
||||
inv.setItem(27, getMaterial("PLAYER_HEAD", "SKULL_ITEM"), (byte) 3, "§7Spielerkopf geben", Arrays.asList("§8/§7skull §8[§eSpieler§8]"), false, clickType -> {
|
||||
inv.setItem(23, Material.DISPENSER, "§7Auto-Loader", getNoPermsLore(Collections.emptyList(), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||
if(Welt.noPermission(player, Permission.world))
|
||||
return;
|
||||
player.closeInventory();
|
||||
autoLoaderGUI(player);
|
||||
});
|
||||
|
||||
inv.setItem(8, getMaterial("PLAYER_HEAD", "SKULL_ITEM"), (byte) 3, "§7Spielerkopf geben", Arrays.asList("§8/§7skull §8[§eSpieler§8]"), false, clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "Spielerköpfe");
|
||||
anvilInv.setItem(Material.NAME_TAG);
|
||||
anvilInv.setCallback(s -> player.performCommand("skull " + s));
|
||||
anvilInv.open();
|
||||
});
|
||||
|
||||
if(region == Region.GlobalRegion.getInstance()) {
|
||||
inv.setItem(17, Material.BARRIER, "§eKeine Region", clickType -> {});
|
||||
inv.setItem(26, Material.BARRIER, "§eKeine Region", clickType -> {});
|
||||
inv.setItem(35, Material.BARRIER, "§eKeine Region", clickType -> {});
|
||||
if(Region.GlobalRegion.isGlobalRegion(region)) {
|
||||
inv.setItem(18, Material.BARRIER, "§eKeine Region", clickType -> {});
|
||||
inv.setItem(27, Material.BARRIER, "§eKeine Region", clickType -> {});
|
||||
inv.setItem(36, Material.BARRIER, "§eKeine Region", clickType -> {});
|
||||
}else {
|
||||
inv.setItem(17, Material.HEAVY_WEIGHTED_PRESSURE_PLATE, "§eRegion Reseten", Arrays.asList("§8/§7reset"), false, clickType ->
|
||||
inv.setItem(18, Material.HEAVY_WEIGHTED_PRESSURE_PLATE, "§eRegion Reseten", getNoPermsLore(Arrays.asList("§8/§7reset"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType ->
|
||||
confirmationInventory(player, "Region Reseten?", () -> player.performCommand("reset"), () -> openBauGui(player)));
|
||||
|
||||
if(region.hasProtection()) {
|
||||
inv.setItem(26, Material.OBSIDIAN, "§eRegion Protecten", Arrays.asList("§8/§7protect"), false, clickType ->
|
||||
inv.setItem(27, Material.OBSIDIAN, "§eRegion Protecten", getNoPermsLore(Arrays.asList("§8/§7protect"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType ->
|
||||
confirmationInventory(player, "Region Protecten", () -> player.performCommand("protect"), () -> openBauGui(player)));
|
||||
} else {
|
||||
inv.setItem(26, Material.BARRIER, "§eRegion nicht Protect bar", clickType -> {});
|
||||
inv.setItem(27, Material.BARRIER, "§eRegion nicht Protect bar", clickType -> {});
|
||||
}
|
||||
|
||||
if(region.hasTestblock()) {
|
||||
inv.setItem(35, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", Arrays.asList("§8/§7testblock"), false, clickType ->
|
||||
inv.setItem(36, getMaterial("END_STONE", "ENDER_STONE"), "§eTestblock erneuern", getNoPermsLore(Arrays.asList("§8/§7testblock"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType ->
|
||||
confirmationInventory(player, "Testblock erneuern", () -> player.performCommand("testblock"), () -> openBauGui(player)));
|
||||
} else {
|
||||
inv.setItem(35, Material.BARRIER, "§eDie Region hat keinen Testblock", clickType -> {});
|
||||
inv.setItem(36, Material.BARRIER, "§eDie Region hat keinen Testblock", clickType -> {});
|
||||
}
|
||||
}
|
||||
|
||||
if(player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
|
||||
inv.setItem(38, Material.POTION, "§7Nightvision: §eEingeschaltet", Arrays.asList("§8/§7nv"), false, clickType -> {
|
||||
inv.setItem(35, Material.POTION, "§7Nightvision: §eEingeschaltet", Collections.singletonList("§8/§7nv"), false, clickType -> {
|
||||
CommandNV.toggleNightvision(player);
|
||||
openBauGui(player);
|
||||
});
|
||||
} else {
|
||||
inv.setItem(38, Material.GLASS_BOTTLE, "§7Nightvision: §eAusgeschaltet", Arrays.asList("§8/§7nv"), false, clickType -> {
|
||||
inv.setItem(35, Material.GLASS_BOTTLE, "§7Nightvision: §eAusgeschaltet", Collections.singletonList("§8/§7nv"), false, clickType -> {
|
||||
CommandNV.toggleNightvision(player);
|
||||
openBauGui(player);
|
||||
});
|
||||
}
|
||||
|
||||
if(player.hasPotionEffect(PotionEffectType.WATER_BREATHING)) {
|
||||
inv.setItem(39, Material.WATER_BUCKET, "§7Waterbreathing: §eEingeschaltet", Arrays.asList("§8/§7wv"), false, clickType -> {
|
||||
inv.setItem(44, Material.WATER_BUCKET, "§7Waterbreathing: §eEingeschaltet", Collections.singletonList("§8/§7wv"), false, clickType -> {
|
||||
CommandGills.toggleGills(player);
|
||||
openBauGui(player);
|
||||
});
|
||||
} else {
|
||||
inv.setItem(39, Material.BUCKET, "§7Waterbreathing: §eAusgeschaltet", Arrays.asList("§8/§7wv"), false, clickType -> {
|
||||
inv.setItem(44, Material.BUCKET, "§7Waterbreathing: §eAusgeschaltet", Collections.singletonList("§8/§7wv"), false, clickType -> {
|
||||
CommandGills.toggleGills(player);
|
||||
openBauGui(player);
|
||||
});
|
||||
}
|
||||
|
||||
boolean isBuildArea = region.buildAreaEnabled();
|
||||
List<String> tntLore = getNoPermsLore(Arrays.asList("§8/§7tnt §8[" + (isBuildArea?"§eTB§7, ":"") + "§eOff §7oder §eOn§7]"), player, "§cDu hast keine Worldrechte", Permission.world);
|
||||
switch (region.getTntMode()) {
|
||||
case OFF:
|
||||
inv.setItem(40, Material.MINECART, "§7TNT: §eAusgeschaltet", Arrays.asList("§8/§7tnt §8[" + (region.buildAreaEnabled()?"§eTB§7, ":"") + "§eOff §7oder §eOn§7]"), false, clickType -> {
|
||||
region.setTntMode(region.buildAreaEnabled()?CommandTNT.TNTMode.ONLY_TB: CommandTNT.TNTMode.ON);
|
||||
inv.setItem(0, Material.MINECART, "§7TNT: §eAusgeschaltet", tntLore, false, clickType -> {
|
||||
if(Welt.noPermission(player, Permission.world))
|
||||
return;
|
||||
player.performCommand("tnt " + (isBuildArea?"tb":"on"));
|
||||
updateInventories();
|
||||
});
|
||||
break;
|
||||
case ONLY_TB:
|
||||
inv.setItem(40, Material.TNT_MINECART, "§7TNT: §enur Testblock", Arrays.asList("§8/§7tnt §8[" + (region.buildAreaEnabled()?"§eTB§7, ":"") + "§eOff §7oder §eOn§7]"), false, clickType -> {
|
||||
region.setTntMode(CommandTNT.TNTMode.ON);
|
||||
inv.setItem(0, Material.TNT_MINECART, "§7TNT: §enur Testblock", tntLore, false, clickType -> {
|
||||
if(Welt.noPermission(player, Permission.world))
|
||||
return;
|
||||
player.performCommand("tnt on");
|
||||
updateInventories();
|
||||
});
|
||||
break;
|
||||
default:
|
||||
inv.setItem(40, Material.TNT, "§7TNT: §eEingeschaltet", Arrays.asList("§8/§7tnt §8[" + (region.buildAreaEnabled()?"§eTB§7, ":"") + "§eOff §7oder §eOn§7]"), false, clickType -> {
|
||||
region.setTntMode(CommandTNT.TNTMode.OFF);
|
||||
inv.setItem(0, Material.TNT, "§7TNT: §eEingeschaltet", tntLore, false, clickType -> {
|
||||
if(Welt.noPermission(player, Permission.world))
|
||||
return;
|
||||
player.performCommand("tnt off");
|
||||
updateInventories();
|
||||
});
|
||||
}
|
||||
|
||||
if(region.isFreeze()) {
|
||||
inv.setItem(41, Material.GUNPOWDER, "§7Freeze: §eEingeschaltet", Arrays.asList("§8/§7freeze"), false, clickType -> {
|
||||
region.setFreeze(false);
|
||||
inv.setItem(1, Material.GUNPOWDER, "§7Freeze: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||
if(Welt.noPermission(player, Permission.world))
|
||||
return;
|
||||
player.performCommand("freeze");
|
||||
updateInventories();
|
||||
});
|
||||
} else {
|
||||
inv.setItem(41, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", Arrays.asList("§8/§7freeze"), false, clickType -> {
|
||||
region.setFreeze(true);
|
||||
inv.setItem(1, Material.REDSTONE, "§7Freeze: §eAusgeschaltet", getNoPermsLore(Arrays.asList("§8/§7freeze"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||
if(Welt.noPermission(player, Permission.world))
|
||||
return;
|
||||
player.performCommand("freeze");
|
||||
updateInventories();
|
||||
});
|
||||
}
|
||||
|
||||
if(region.isFire()) {
|
||||
inv.setItem(42, getMaterial("FIREWORK_STAR", "FIREWORK_CHARGE"), "§7Fire: §eAusgeschaltet", Arrays.asList("§8/§7fire"), false, clickType -> {
|
||||
region.setFire(false);
|
||||
inv.setItem(2, 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))
|
||||
return;
|
||||
player.performCommand("fire");
|
||||
updateInventories();
|
||||
});
|
||||
} else {
|
||||
inv.setItem(42, Material.FIRE_CHARGE, "§7Fire: §eEingeschaltet", Arrays.asList("§8/§7fire"), false, clickType -> {
|
||||
region.setFire(true);
|
||||
inv.setItem(2, Material.FIRE_CHARGE, "§7Fire: §eEingeschaltet", getNoPermsLore(Arrays.asList("§8/§7fire"), player, "§cDu hast keine Worldrechte", Permission.world), false, clickType -> {
|
||||
if(Welt.noPermission(player, Permission.world))
|
||||
return;
|
||||
player.performCommand("fire");
|
||||
updateInventories();
|
||||
});
|
||||
}
|
||||
|
||||
inv.setItem(7, Material.ENDER_PEARL, "§7Teleporter", getNoPermsLore(Arrays.asList("§8/§7tp §8[§eSpieler§8]"), player, "§cDu hast keine Buildrechte", Permission.build), false, clickType -> {
|
||||
List<SWListInv.SWListEntry<String>> playerSWListEntry = new ArrayList<>();
|
||||
Bukkit.getOnlinePlayers().forEach(player1 -> {
|
||||
if(player1.equals(player))
|
||||
return;
|
||||
playerSWListEntry.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(player1.getName()), player1.getName()));
|
||||
});
|
||||
SWListInv<String> playerSWListInv = new SWListInv<>(player, "Teleporter", playerSWListEntry, (clickType1, player1) -> {
|
||||
player.closeInventory();
|
||||
player.performCommand("tp " + player1);
|
||||
});
|
||||
playerSWListInv.open();
|
||||
});
|
||||
|
||||
inv.open();
|
||||
}
|
||||
|
||||
@ -216,12 +299,12 @@ public class CommandGUI implements CommandExecutor, Listener {
|
||||
});
|
||||
}
|
||||
if(TraceShowManager.hasActiveShow(player)) {
|
||||
inv.setItem(2, Material.TNT, "§7Showstatus", Arrays.asList("§7Aktuell: §eGezeigt"), false, clickType -> {
|
||||
inv.setItem(2, Material.TNT, "§7Showstatus", Arrays.asList("§7Aktuell: §eGezeigt", "§8/§7trace show§e/§7hide"), false, clickType -> {
|
||||
player.performCommand("trace hide");
|
||||
traceGUI(player);
|
||||
});
|
||||
} else {
|
||||
inv.setItem(2, Material.GLASS, "§7Showstatus", Arrays.asList("§7Aktuell: §eVersteckt"), false, clickType -> {
|
||||
inv.setItem(2, Material.GLASS, "§7Showstatus", Arrays.asList("§7Aktuell: §eVersteckt", "§8/§§7trace show§e/§7hide"), false, clickType -> {
|
||||
player.performCommand("trace show");
|
||||
traceGUI(player);
|
||||
});
|
||||
@ -232,13 +315,191 @@ public class CommandGUI implements CommandExecutor, Listener {
|
||||
player.performCommand("trace show gui");
|
||||
});
|
||||
|
||||
inv.setItem(6, getMaterial("GRAY_STAINED_GLASS_PANE", "STAINED_GLASS_PANE"), (byte) 7, "§7Coming soon.", Collections.emptyList(), false, clickType -> {});
|
||||
inv.setItem(6, Material.BARRIER, "§7Trace löschen", clickType -> confirmationInventory(player, "Trace löschen", () -> player.performCommand("trace delete"), () -> {}));
|
||||
|
||||
inv.setItem(8, Material.BARRIER, "§7Trace löschen", clickType -> confirmationInventory(player, "Trace löschen", () -> player.performCommand("trace delete"), () -> {}));
|
||||
inv.setItem(8, Material.ARROW, "§7Zurück", clickType -> {
|
||||
player.closeInventory();
|
||||
openBauGui(player);
|
||||
OPEN_INVS.add(player);
|
||||
});
|
||||
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void autoLoaderGUI(Player player) {
|
||||
SWInventory inv = new SWInventory(player, 9, "Autoloader");
|
||||
|
||||
boolean hasLoader = AutoLoader.hasLoader(player);
|
||||
|
||||
if(hasLoader) {
|
||||
AutoLoader loader = AutoLoader.getLoader(player);
|
||||
if(loader.isSetup()) {
|
||||
inv.setItem(0, Material.DROPPER, "§7Loader Starten", Collections.singletonList("§8/§7loader start"), false, clickType -> {
|
||||
loader.start();
|
||||
autoLoaderGUI(player);
|
||||
});
|
||||
|
||||
inv.setItem(2, Material.ARROW, "§7Letzte Aktion entfernen", Collections.singletonList("§8/§7loader undo"), false, clickType -> {
|
||||
|
||||
});
|
||||
} else {
|
||||
inv.setItem(0, Material.BLAZE_ROD, "§7Loader Bearbeiten", Collections.singletonList("§8/§7loader setup"), false, clickType -> {
|
||||
loader.setup();
|
||||
autoLoaderGUI(player);
|
||||
});
|
||||
}
|
||||
|
||||
inv.setItem(4, Material.COMPASS, "§7Schuss Delay", Arrays.asList("§7Aktuell: §e" + loader.getTicksBetweenShots(), "§8/§7loader wait §8[§eTicks§8]"), false, clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "Schuss Delay", loader.getTicksBetweenShots() + "");
|
||||
anvilInv.setItem(Material.STONE);
|
||||
anvilInv.setCallback(s -> {
|
||||
player.performCommand("loader wait " + s);
|
||||
autoLoaderGUI(player);
|
||||
});
|
||||
anvilInv.open();
|
||||
});
|
||||
|
||||
inv.setItem(6, Material.CLOCK, "§7Block platzier Geschwindigkeit", Arrays.asList("§7Aktuell: §e" + loader.getTicksBetweenBlocks(), "§8/§7loader speed §8[§eTicks§8]"), false, clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "Platzier Geschwindigkeit", loader.getTicksBetweenBlocks() + "");
|
||||
anvilInv.setItem(Material.STONE);
|
||||
anvilInv.setCallback(s -> {
|
||||
player.performCommand("loader speed " + s);
|
||||
autoLoaderGUI(player);
|
||||
});
|
||||
anvilInv.open();
|
||||
});
|
||||
|
||||
inv.setItem(8, Material.BARRIER, "§7Loader löschen", Collections.singletonList("§8/§7loader stop"), false, clickType -> confirmationInventory(player, "Loader löschen?", () -> {
|
||||
loader.stop();
|
||||
autoLoaderGUI(player);
|
||||
}, () -> autoLoaderGUI(player)));
|
||||
} else {
|
||||
inv.setItem(4, Material.GOLD_NUGGET, "§eNeuer Autoloader", clickType -> {
|
||||
AutoLoader.getLoader(player);
|
||||
player.closeInventory();
|
||||
});
|
||||
inv.setItem(8, Material.ARROW, "§7Zurück", clickType -> {
|
||||
player.closeInventory();
|
||||
openBauGui(player);
|
||||
OPEN_INVS.add(player);
|
||||
});
|
||||
}
|
||||
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void bauManagementGUI(Player player) {
|
||||
bauManagementGUI(player, "");
|
||||
}
|
||||
|
||||
private static void bauManagementGUI(Player player, String search) {
|
||||
List<BauweltMember> members = BauweltMember.getMembers(BauSystem.getOwnerID());
|
||||
List<SWListInv.SWListEntry<BauweltMember>> items = new ArrayList<>();
|
||||
members.forEach(member -> {
|
||||
if(member.getMemberID() == BauSystem.getOwnerID())
|
||||
return;
|
||||
|
||||
SteamwarUser user = SteamwarUser.get(member.getMemberID());
|
||||
if(!user.getUserName().toLowerCase().contains(search.toLowerCase()))
|
||||
return;
|
||||
|
||||
SWItem item = SWItem.getPlayerSkull(user.getUserName());
|
||||
item.setName("§7" + user.getUserName());
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("§7Online: §e" + (Bukkit.getPlayer(user.getUUID()) == null?"Offline":"Online"));
|
||||
lore.add("§7Bauen: §e" + (member.isBuild()?"Ja":"Nein"));
|
||||
lore.add("§7Worldedit: §e" + (member.isWorldEdit()?"Ja":"Nein"));
|
||||
lore.add("§7World: §e" + (member.isWorld()?"Ja":"Nein"));
|
||||
item.setLore(lore);
|
||||
items.add(new SWListInv.SWListEntry<>(item, member));
|
||||
});
|
||||
|
||||
SWListInv<BauweltMember> inv = new SWListInv<>(player, "Bauweltmembers", false, items, (clickType, member) -> bauweltMemberGUI(player, member));
|
||||
|
||||
inv.setItem(48, Material.NETHER_STAR, "§7Member hinzufühgen", clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "Member hinzufühgen");
|
||||
anvilInv.setItem(Material.NAME_TAG);
|
||||
anvilInv.setCallback(s -> {
|
||||
player.closeInventory();
|
||||
confirmChatMessage(player, "/bau addmember " + s);
|
||||
});
|
||||
anvilInv.open();
|
||||
});
|
||||
|
||||
inv.setItem(50, Material.NAME_TAG, "§7Suchen", clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(player, "Member suchen");
|
||||
anvilInv.setItem(Material.PAPER);
|
||||
anvilInv.setCallback(s -> {
|
||||
player.closeInventory();
|
||||
bauManagementGUI(player, s);
|
||||
});
|
||||
anvilInv.open();
|
||||
});
|
||||
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void bauweltMemberGUI(Player player, BauweltMember member) {
|
||||
SteamwarUser user = SteamwarUser.get(member.getMemberID());
|
||||
SWInventory inv = new SWInventory(player, 9, "Member: " + user.getUserName());
|
||||
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 -> {
|
||||
member.setBuild(false);
|
||||
bauweltMemberGUI(player, member);
|
||||
});
|
||||
else
|
||||
inv.setItem(2, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7Bauen", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau togglebuild §8[§eSpieler§8]"), false, clickType -> {
|
||||
member.setBuild(true);
|
||||
bauweltMemberGUI(player, member);
|
||||
});
|
||||
|
||||
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 -> {
|
||||
member.setWorldEdit(false);
|
||||
bauweltMemberGUI(player, member);
|
||||
});
|
||||
else
|
||||
inv.setItem(4, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7Worldedit", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau togglewe §8[§eSpieler§8]"), false, clickType -> {
|
||||
member.setWorldEdit(true);
|
||||
bauweltMemberGUI(player, member);
|
||||
});
|
||||
|
||||
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 -> {
|
||||
member.setWorld(false);
|
||||
bauweltMemberGUI(player, member);
|
||||
});
|
||||
else
|
||||
inv.setItem(6, getMaterial("RED_WOOL", "WOOL"), (byte) 14, "§7World", Arrays.asList("§7Aktuell: §eNein", "§8/§7bau toggleworld §8[§eSpieler§8]"), false, clickType -> {
|
||||
member.setWorld(true);
|
||||
bauweltMemberGUI(player, member);
|
||||
});
|
||||
|
||||
inv.setItem(8, Material.BARRIER, "§7Member entfernen", clickType -> {
|
||||
player.closeInventory();
|
||||
confirmChatMessage(player, "/bau delmember " + user.getUserName());
|
||||
});
|
||||
inv.open();
|
||||
}
|
||||
|
||||
private static void confirmChatMessage(Player player, String command) {
|
||||
player.sendMessage(BauSystem.PREFIX + "§7Klicke auf die Nachricht zum bestätigen");
|
||||
TextComponent t = new TextComponent();
|
||||
t.setText("[Hier]");
|
||||
t.setColor(ChatColor.YELLOW);
|
||||
t.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command));
|
||||
t.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§8/§7" + command)));
|
||||
player.spigot().sendMessage(t);
|
||||
}
|
||||
|
||||
private static List<String> getNoPermsLore(List<String> lore, Player player, String noPerms, Permission perm) {
|
||||
if(Welt.noPermission(player, perm)) {
|
||||
lore = new ArrayList<>(lore);
|
||||
lore.add(noPerms);
|
||||
}
|
||||
return lore;
|
||||
}
|
||||
|
||||
private static void updateInventories() {
|
||||
isRefreshing = true;
|
||||
OPEN_INVS.forEach(CommandGUI::openBauGui);
|
||||
@ -272,9 +533,19 @@ public class CommandGUI implements CommandExecutor, Listener {
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
if(event.getItem().getType() != Material.NETHER_STAR)
|
||||
if(event.getItem() == null || event.getItem().getType() != Material.NETHER_STAR)
|
||||
return;
|
||||
openBauGui(event.getPlayer());
|
||||
OPEN_INVS.add(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
|
||||
if(LAST_F_PLAYER.contains(event.getPlayer())) {
|
||||
openBauGui(event.getPlayer());
|
||||
OPEN_INVS.add(event.getPlayer());
|
||||
} else {
|
||||
LAST_F_PLAYER.add(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,6 +140,14 @@ public class AutoLoader extends IAutoLoader implements Listener {
|
||||
ticksBetweenBlocks = time;
|
||||
}
|
||||
|
||||
public int getTicksBetweenShots() {
|
||||
return ticksBetweenShots;
|
||||
}
|
||||
|
||||
public int getTicksBetweenBlocks() {
|
||||
return ticksBetweenBlocks;
|
||||
}
|
||||
|
||||
public boolean isSetup() {
|
||||
return setup;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class Detonator implements Listener {
|
||||
|
||||
|
||||
static {
|
||||
WAND = new ItemStack(Material.TRIPWIRE_HOOK, 1);
|
||||
WAND = new ItemStack(Material.BLAZE_ROD, 1);
|
||||
ItemMeta im = WAND.getItemMeta();
|
||||
|
||||
im.setDisplayName("§6Fernzünder");
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren