From 0f80c831f481f11d5588813b6391b9162173782a Mon Sep 17 00:00:00 2001 From: Mykyta Date: Wed, 8 May 2019 06:58:23 -0700 Subject: [PATCH] Move GUI-related items to GUI package --- src/main/java/mykyta/Harbor/Commands/Sleeping.java | 6 +++--- src/main/java/mykyta/Harbor/Events/GUIEvent.java | 8 ++++---- .../mykyta/Harbor/{Holder.java => GUI/GUIHolder.java} | 10 +++++----- src/main/java/mykyta/Harbor/{ => GUI}/GUIType.java | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) rename src/main/java/mykyta/Harbor/{Holder.java => GUI/GUIHolder.java} (63%) rename src/main/java/mykyta/Harbor/{ => GUI}/GUIType.java (57%) diff --git a/src/main/java/mykyta/Harbor/Commands/Sleeping.java b/src/main/java/mykyta/Harbor/Commands/Sleeping.java index ebb8d51..a09f3a3 100644 --- a/src/main/java/mykyta/Harbor/Commands/Sleeping.java +++ b/src/main/java/mykyta/Harbor/Commands/Sleeping.java @@ -16,9 +16,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; import mykyta.Harbor.Config; -import mykyta.Harbor.GUIType; -import mykyta.Harbor.Holder; import mykyta.Harbor.Util; +import mykyta.Harbor.GUI.GUIHolder; +import mykyta.Harbor.GUI.GUIType; public class Sleeping implements CommandExecutor { @@ -33,7 +33,7 @@ public class Sleeping implements CommandExecutor { Config config = new Config(); ArrayList sleeping = Util.sleeping.get(w); int slots = Math.min(54, ((sleeping.size() - 1) / 9 + 1) * 9); - gui = Bukkit.createInventory(new Holder(GUIType.SLEEPING), slots, config.getString("gui.sleeping")); + gui = Bukkit.createInventory(new GUIHolder(GUIType.SLEEPING), slots, config.getString("gui.sleeping")); if (sleeping.size() > 0) sleeping.forEach(pl -> { ItemStack item = new ItemStack(Material.PLAYER_HEAD, 1); diff --git a/src/main/java/mykyta/Harbor/Events/GUIEvent.java b/src/main/java/mykyta/Harbor/Events/GUIEvent.java index 894ce9b..8bc8f29 100644 --- a/src/main/java/mykyta/Harbor/Events/GUIEvent.java +++ b/src/main/java/mykyta/Harbor/Events/GUIEvent.java @@ -6,15 +6,15 @@ import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryDragEvent; -import mykyta.Harbor.GUIType; -import mykyta.Harbor.Holder; +import mykyta.Harbor.GUI.GUIType; +import mykyta.Harbor.GUI.GUIHolder; public class GUIEvent implements Listener { @EventHandler public void onClick(InventoryClickEvent event) { if (event.getInventory().getHolder() != null && event.getInventory().getHolder() instanceof Holder) { Player p = ((Player) event.getWhoClicked()); - GUIType t = ((Holder) event.getInventory().getHolder()).getType(); + GUIType t = ((GUIHolder) event.getInventory().getHolder()).getType(); if (t.equals(GUIType.SLEEPING)) event.setCancelled(true); } } @@ -23,7 +23,7 @@ public class GUIEvent implements Listener { public void onDrag(InventoryDragEvent event) { if (event.getInventory().getHolder() != null && event.getInventory().getHolder() instanceof Holder) { Player p = ((Player) event.getWhoClicked()); - GUIType t = ((Holder) event.getInventory().getHolder()).getType(); + GUIType t = ((GUIHolder) event.getInventory().getHolder()).getType(); if (t.equals(GUIType.SLEEPING)) event.setCancelled(true); } } diff --git a/src/main/java/mykyta/Harbor/Holder.java b/src/main/java/mykyta/Harbor/GUI/GUIHolder.java similarity index 63% rename from src/main/java/mykyta/Harbor/Holder.java rename to src/main/java/mykyta/Harbor/GUI/GUIHolder.java index 76d9f97..fa4ed22 100644 --- a/src/main/java/mykyta/Harbor/Holder.java +++ b/src/main/java/mykyta/Harbor/GUI/GUIHolder.java @@ -1,13 +1,13 @@ -package mykyta.Harbor; +package mykyta.Harbor.GUI; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; -public class Holder implements InventoryHolder { - Inventory inv; - GUIType type; +public class GUIHolder implements InventoryHolder { + private Inventory inv; + private GUIType type; - public Holder(GUIType type) { + public GUIHolder(GUIType type) { this.type = type; } diff --git a/src/main/java/mykyta/Harbor/GUIType.java b/src/main/java/mykyta/Harbor/GUI/GUIType.java similarity index 57% rename from src/main/java/mykyta/Harbor/GUIType.java rename to src/main/java/mykyta/Harbor/GUI/GUIType.java index 2404acf..495eea0 100644 --- a/src/main/java/mykyta/Harbor/GUIType.java +++ b/src/main/java/mykyta/Harbor/GUI/GUIType.java @@ -1,4 +1,4 @@ -package mykyta.Harbor; +package mykyta.Harbor.GUI; public enum GUIType { SLEEPING