diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/SteamEditSelectAdjacent.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/SteamEditSelectAdjacent.java index d30752aaf..fd6d07134 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/SteamEditSelectAdjacent.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/SteamEditSelectAdjacent.java @@ -48,6 +48,7 @@ public class SteamEditSelectAdjacent { private LinkedHashSet frontier = new LinkedHashSet<>(); public SteamEditSelectAdjacent(Location origin) { + // TODO: Fix the flood fill algorithm! min = origin.clone(); max = origin.clone(); frontier.add(origin); diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/SteamEditWand.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/SteamEditWand.java index 85b85d580..9d42538d8 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/SteamEditWand.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/SteamEditWand.java @@ -134,7 +134,7 @@ public class SteamEditWand implements Listener { private Packet leftClick(Player player, Packet packet) { if (noWand(player)) return packet; - if (player.getOpenInventory().getType() != InventoryType.CRAFTING) return packet; + if (player.getOpenInventory().getType() != InventoryType.CREATIVE) return packet; double distance = WorldEditRendererCUIEditor.Type.CURSOR.getWidth(player).blocks; RayTraceResult result = player.rayTraceBlocks(distance, FluidCollisionMode.NEVER); if (result == null) return packet; @@ -373,7 +373,7 @@ public class SteamEditWand implements Listener { if (noWand(player)) return packet; if (packet.getAction() != ServerboundPlayerActionPacket.Action.SWAP_ITEM_WITH_OFFHAND) return packet; Bukkit.getScheduler().runTask(Core.getInstance(), () -> { - WorldEditRendererCUIEditor.open(player); + WorldEditRendererCUIEditor.open(player, true); }); return null; } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/WorldEditRendererCUIEditor.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/WorldEditRendererCUIEditor.java index 43f716fdd..032d0fbed 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/WorldEditRendererCUIEditor.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/worldedit/WorldEditRendererCUIEditor.java @@ -126,9 +126,9 @@ public class WorldEditRendererCUIEditor implements Listener { command = new Command(); } - public static void open(Player player) { + public static void open(Player player, boolean steamEditWand) { if (command == null) return; - command.cuiEditor(player); + command.cuiEditor(player, steamEditWand); } private static class Command extends SWCommand { @@ -139,10 +139,14 @@ public class WorldEditRendererCUIEditor implements Listener { @Register public void cuiEditor(Player player) { + cuiEditor(player, false); + } + + public void cuiEditor(Player player, boolean steamEditWand) { SWInventory inv = new SWInventory(player, 9 * 2, Core.MESSAGE.parse("WORLDEDIT_CUI_TITLE", player)); - if (SteamEdit.isInitialized()) { - setElement(inv, player, 1, "WORLDEDIT_CUI_SELECTION", Type.SELECTION); - setElement(inv, player, 2, "WORLDEDIT_CUI_CLIPBOARD", Type.CLIPBOARD); + if (SteamEdit.isInitialized() && steamEditWand) { + setElement(inv, player, true, 1, "WORLDEDIT_CUI_SELECTION", Type.SELECTION); + setElement(inv, player, true, 2, "WORLDEDIT_CUI_CLIPBOARD", Type.CLIPBOARD); setCursor(inv, player, 3, "WORLDEDIT_CUI_CURSOR"); inv.setItem(5, new SWItem(Material.PAPER, "WORLDEDIT_CUI_TOOL_COPY").setLore("WORLDEDIT_CUI_TOOL_COPY_LORE").translate(player, Core.MESSAGE).getItemStack(), click -> { player.performCommand("/copy"); @@ -161,18 +165,18 @@ public class WorldEditRendererCUIEditor implements Listener { inv.setItem(15, new SWItem(Material.STRUCTURE_VOID, "WORLDEDIT_CUI_TOOL_SOON").translate(player, Core.MESSAGE).getItemStack(), click -> {}); inv.setItem(16, new SWItem(Material.STRUCTURE_VOID, "WORLDEDIT_CUI_TOOL_SOON").translate(player, Core.MESSAGE).getItemStack(), click -> {}); } else { - setElement(inv, player, 3, "WORLDEDIT_CUI_SELECTION", Type.SELECTION); - setElement(inv, player, 5, "WORLDEDIT_CUI_CLIPBOARD", Type.CLIPBOARD); + setElement(inv, player, false, 3, "WORLDEDIT_CUI_SELECTION", Type.SELECTION); + setElement(inv, player, false, 5, "WORLDEDIT_CUI_CLIPBOARD", Type.CLIPBOARD); } inv.open(); } - private void setElement(SWInventory inv, Player player, int index, String uiName, Type type) { + private void setElement(SWInventory inv, Player player, boolean steamEditWand, int index, String uiName, Type type) { Material material = type.getMaterial(player); Width width = type.getWidth(player); inv.setItem(index, new SWItem(material, Core.MESSAGE.parse("WORLDEDIT_CUI_MATERIAL_NAME", player, Core.MESSAGE.parse(uiName, player)), Arrays.asList(Core.MESSAGE.parse("WORLDEDIT_CUI_MATERIAL_CLICK", player)), false, click -> { - cuiMaterial(player, uiName, type, material); + cuiMaterial(player, steamEditWand, uiName, type, material); })); List lore = new ArrayList<>(); @@ -187,7 +191,7 @@ public class WorldEditRendererCUIEditor implements Listener { } SWItem lightItem = new SWItem(Material.LIGHT, Core.MESSAGE.parse("WORLDEDIT_CUI_WIDTH_NAME", player, Core.MESSAGE.parse(uiName, player)), lore, false, click -> { type.setWidth(player, Width.values()[(width.ordinal() + 1) % Width.values().length]); - setElement(inv, player, index, uiName, type); + setElement(inv, player, steamEditWand, index, uiName, type); }); ItemMeta itemMeta = lightItem.getItemMeta(); Light light = (Light) Material.LIGHT.createBlockData(); @@ -202,7 +206,7 @@ public class WorldEditRendererCUIEditor implements Listener { Width width = Type.CURSOR.getWidth(player); inv.setItem(index, new SWItem(material, Core.MESSAGE.parse("WORLDEDIT_CUI_MATERIAL_NAME", player, Core.MESSAGE.parse(uiName, player)), Arrays.asList(Core.MESSAGE.parse("WORLDEDIT_CUI_MATERIAL_CLICK", player)), false, click -> { - cuiMaterial(player, uiName, Type.CURSOR, material); + cuiMaterial(player, true, uiName, Type.CURSOR, material); })); List lore = new ArrayList<>(); @@ -224,14 +228,14 @@ public class WorldEditRendererCUIEditor implements Listener { private final Material[] materials = {Material.WHITE_CONCRETE, Material.LIGHT_GRAY_CONCRETE, Material.GRAY_CONCRETE, Material.BLACK_CONCRETE, Material.BROWN_CONCRETE, Material.RED_CONCRETE, Material.ORANGE_CONCRETE, Material.YELLOW_CONCRETE, Material.LIME_CONCRETE, Material.GREEN_CONCRETE, Material.CYAN_CONCRETE, Material.LIGHT_BLUE_CONCRETE, Material.BLUE_CONCRETE, Material.PURPLE_CONCRETE, Material.MAGENTA_CONCRETE, Material.PINK_CONCRETE, null, Material.BARRIER}; - private void cuiMaterial(Player player, String subMenu, Type type, Material currentSelection) { + private void cuiMaterial(Player player, boolean steamEditWand, String subMenu, Type type, Material currentSelection) { SWInventory inv = new SWInventory(player, 9 * 2, Core.MESSAGE.parse("WORLDEDIT_CUI_TITLE_SUBMENU", player, Core.MESSAGE.parse(subMenu, player))); for (int i = 0; i < materials.length; i++) { Material material = materials[i]; if (material == null) continue; inv.setItem(i, new SWItem(material, "", Collections.emptyList(), material == currentSelection, click -> { type.setMaterial(player, material); - cuiEditor(player); + cuiEditor(player, steamEditWand); })); } inv.open();