diff --git a/src/main/java/com/songoda/ultimatekits/References.java b/src/main/java/com/songoda/ultimatekits/References.java index 24f83bf..8ccc146 100644 --- a/src/main/java/com/songoda/ultimatekits/References.java +++ b/src/main/java/com/songoda/ultimatekits/References.java @@ -9,7 +9,7 @@ public class References { private boolean playSound = false; private Sound sound = null; - public References() { + References() { try { prefix = Lang.PREFIX.getConfigValue() + " "; diff --git a/src/main/java/com/songoda/ultimatekits/UltimateKits.java b/src/main/java/com/songoda/ultimatekits/UltimateKits.java index 7c972de..0f4a097 100644 --- a/src/main/java/com/songoda/ultimatekits/UltimateKits.java +++ b/src/main/java/com/songoda/ultimatekits/UltimateKits.java @@ -1,17 +1,18 @@ package com.songoda.ultimatekits; +import com.songoda.arconix.api.methods.formatting.TextComponent; import com.songoda.arconix.api.utils.ConfigWrapper; import com.songoda.arconix.plugin.Arconix; import com.songoda.ultimatekits.command.CommandManager; import com.songoda.ultimatekits.conversion.Convert; +import com.songoda.ultimatekits.editor.BlockEditor; +import com.songoda.ultimatekits.editor.KitEditor; import com.songoda.ultimatekits.events.*; import com.songoda.ultimatekits.handlers.DisplayItemHandler; import com.songoda.ultimatekits.handlers.HologramHandler; import com.songoda.ultimatekits.handlers.ParticleHandler; import com.songoda.ultimatekits.key.Key; import com.songoda.ultimatekits.key.KeyManager; -import com.songoda.ultimatekits.editor.BlockEditor; -import com.songoda.ultimatekits.editor.KitEditor; import com.songoda.ultimatekits.kit.*; import com.songoda.ultimatekits.player.PlayerData; import com.songoda.ultimatekits.player.PlayerDataManager; @@ -24,14 +25,15 @@ import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.bukkit.plugin.java.JavaPlugin; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; public class UltimateKits extends JavaPlugin { private static UltimateKits INSTANCE; private static CommandSender console = Bukkit.getConsoleSender(); private References references; - private DisplayItemHandler displayItemHandler; private ConfigWrapper langFile = new ConfigWrapper(this, "", "lang.yml"); private ConfigWrapper kitFile = new ConfigWrapper(this, "", "kit.yml"); @@ -46,6 +48,7 @@ public class UltimateKits extends JavaPlugin { private BlockEditor blockEditor; private HologramHandler hologramHandler; private PlayerDataManager playerDataManager; + private DisplayItemHandler displayItemHandler; /** * Grab instance of UltimateKits @@ -84,11 +87,11 @@ public class UltimateKits extends JavaPlugin { INSTANCE = this; Arconix.pl().hook(this); - console.sendMessage(Arconix.pl().getApi().format().formatText("&a=============================")); - console.sendMessage(Arconix.pl().getApi().format().formatText("&7UltimateKits " + this.getDescription().getVersion() + " by &5Songoda <3!")); - console.sendMessage(Arconix.pl().getApi().format().formatText("&7Action: &aEnabling&7...")); + console.sendMessage(TextComponent.formatText("&a=============================")); + console.sendMessage(TextComponent.formatText("&7UltimateKits " + this.getDescription().getVersion() + " by &5Songoda <3!")); + console.sendMessage(TextComponent.formatText("&7Action: &aEnabling&7...")); - loadLanguageFile(); + this.loadLanguageFile(); new Convert(this); @@ -109,11 +112,11 @@ public class UltimateKits extends JavaPlugin { this.playerDataManager = new PlayerDataManager(); this.hologramHandler = new HologramHandler(this); - loadFromFile(); + this.loadFromFile(); Bukkit.getScheduler().scheduleSyncRepeatingTask(this, this::saveToFile, 6000, 6000); - console.sendMessage(Arconix.pl().getApi().format().formatText("&a=============================")); + console.sendMessage(TextComponent.formatText("&a=============================")); getServer().getPluginManager().registerEvents(new BlockListeners(this), this); getServer().getPluginManager().registerEvents(new ChatListeners(this), this); @@ -133,10 +136,10 @@ public class UltimateKits extends JavaPlugin { } saveToFile(); kitManager.clearKits(); - console.sendMessage(Arconix.pl().getApi().format().formatText("&a=============================")); - console.sendMessage(Arconix.pl().getApi().format().formatText("&7UltimateKits " + this.getDescription().getVersion() + " by &5Songoda <3!")); - console.sendMessage(Arconix.pl().getApi().format().formatText("&7Action: &cDisabling&7...")); - console.sendMessage(Arconix.pl().getApi().format().formatText("&a=============================")); + console.sendMessage(TextComponent.formatText("&a=============================")); + console.sendMessage(TextComponent.formatText("&7UltimateKits " + this.getDescription().getVersion() + " by &5Songoda <3!")); + console.sendMessage(TextComponent.formatText("&7Action: &cDisabling&7...")); + console.sendMessage(TextComponent.formatText("&a=============================")); } /* @@ -170,7 +173,7 @@ public class UltimateKits extends JavaPlugin { Kit kit = new Kit(kitName, title, link, price, material, delay, hidden, contents, KitAnimation.valueOf(kitAnimation)); kitManager.addKit(kit); } catch (Exception ex) { - console.sendMessage(Arconix.pl().getApi().format().formatText("&cYour kit &4" + kitName + " &cis setup incorrectly.")); + console.sendMessage(TextComponent.formatText("&cYour kit &4" + kitName + " &cis setup incorrectly.")); Debugger.runReport(ex); } } @@ -311,7 +314,6 @@ public class UltimateKits extends JavaPlugin { } catch (Exception ex) { Debugger.runReport(ex); } - } /** diff --git a/src/main/java/com/songoda/ultimatekits/command/CommandManager.java b/src/main/java/com/songoda/ultimatekits/command/CommandManager.java index d75ee9b..25de564 100644 --- a/src/main/java/com/songoda/ultimatekits/command/CommandManager.java +++ b/src/main/java/com/songoda/ultimatekits/command/CommandManager.java @@ -22,14 +22,13 @@ public class CommandManager implements CommandExecutor { public CommandManager(UltimateKits plugin) { this.plugin = plugin; - plugin.getCommand("UltimateKits").setExecutor(this); - plugin.getCommand("PreviewKit").setExecutor(this); - plugin.getCommand("Kits").setExecutor(this); + plugin.getCommand("kitadmin").setExecutor(this); + plugin.getCommand("kit").setExecutor(this); + plugin.getCommand("previewkit").setExecutor(this); - AbstractCommand commandUltimateKits = addCommand(new CommandUltimateKits()); - - addCommand(new CommandPreviewKit()); addCommand(new CommandKits()); + addCommand(new CommandPreviewKit()); + AbstractCommand commandUltimateKits = addCommand(new CommandUltimateKits()); addCommand(new CommandReload(commandUltimateKits)); addCommand(new CommandSettings(commandUltimateKits)); diff --git a/src/main/java/com/songoda/ultimatekits/command/commands/CommandCreatekit.java b/src/main/java/com/songoda/ultimatekits/command/commands/CommandCreatekit.java index 28c8106..3555fc6 100644 --- a/src/main/java/com/songoda/ultimatekits/command/commands/CommandCreatekit.java +++ b/src/main/java/com/songoda/ultimatekits/command/commands/CommandCreatekit.java @@ -16,18 +16,18 @@ public class CommandCreatekit extends AbstractCommand { @Override protected ReturnType runCommand(UltimateKits instance, CommandSender sender, String... args) { - Player p = (Player) sender; + Player player = (Player) sender; if (args.length != 2) return ReturnType.SYNTAX_ERROR; String kitStr = args[1].toLowerCase(); if (instance.getKitManager().getKit(kitStr) != null) { - p.sendMessage(instance.getReferences().getPrefix() + Lang.KIT_ALREADY_EXISTS.getConfigValue(kitStr)); + player.sendMessage(instance.getReferences().getPrefix() + Lang.KIT_ALREADY_EXISTS.getConfigValue(kitStr)); return ReturnType.FAILURE; } - p.sendMessage(UltimateKits.getInstance().getReferences().getPrefix() + Arconix.pl().getApi().format().formatText("&aThat kit doesn't exist. Creating it now.")); + player.sendMessage(UltimateKits.getInstance().getReferences().getPrefix() + Arconix.pl().getApi().format().formatText("&aThat kit doesn't exist. Creating it now.")); Kit kit = new Kit(kitStr.trim()); UltimateKits.getInstance().getKitManager().addKit(kit); - instance.getKitEditor().openOverview(kit, p, false, null, 0); + instance.getKitEditor().openOverview(kit, player, false, null, 0); return ReturnType.SUCCESS; } @@ -38,7 +38,7 @@ public class CommandCreatekit extends AbstractCommand { @Override public String getSyntax() { - return "/uk createkit"; + return "/KitAdmin createkit "; } @Override diff --git a/src/main/java/com/songoda/ultimatekits/command/commands/CommandEdit.java b/src/main/java/com/songoda/ultimatekits/command/commands/CommandEdit.java index 68b9ec9..165d43b 100644 --- a/src/main/java/com/songoda/ultimatekits/command/commands/CommandEdit.java +++ b/src/main/java/com/songoda/ultimatekits/command/commands/CommandEdit.java @@ -4,8 +4,7 @@ import com.songoda.arconix.plugin.Arconix; import com.songoda.ultimatekits.Lang; import com.songoda.ultimatekits.UltimateKits; import com.songoda.ultimatekits.command.AbstractCommand; -import com.songoda.ultimatekits.utils.Methods; -import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -48,7 +47,7 @@ public class CommandEdit extends AbstractCommand { @Override public String getSyntax() { - return "/uk edit"; + return "/KitAdmin edit"; } @Override diff --git a/src/main/java/com/songoda/ultimatekits/command/commands/CommandKey.java b/src/main/java/com/songoda/ultimatekits/command/commands/CommandKey.java index 5efc6cd..76a64a9 100644 --- a/src/main/java/com/songoda/ultimatekits/command/commands/CommandKey.java +++ b/src/main/java/com/songoda/ultimatekits/command/commands/CommandKey.java @@ -74,7 +74,7 @@ public class CommandKey extends AbstractCommand { for (Key key : UltimateKits.getInstance().getKeyManager().getKeys()) { keys.append("/").append(key.getName()); } - return "/uk key <" + keys.substring(1) + "> "; + return "/KitAdmin key <" + keys.substring(1) + "> "; } @Override diff --git a/src/main/java/com/songoda/ultimatekits/command/commands/CommandKits.java b/src/main/java/com/songoda/ultimatekits/command/commands/CommandKits.java index c55c0be..90e05bf 100644 --- a/src/main/java/com/songoda/ultimatekits/command/commands/CommandKits.java +++ b/src/main/java/com/songoda/ultimatekits/command/commands/CommandKits.java @@ -4,8 +4,8 @@ import com.songoda.arconix.plugin.Arconix; import com.songoda.ultimatekits.Lang; import com.songoda.ultimatekits.UltimateKits; import com.songoda.ultimatekits.command.AbstractCommand; -import com.songoda.ultimatekits.kit.KitsGUI; import com.songoda.ultimatekits.kit.Kit; +import com.songoda.ultimatekits.kit.KitsGUI; import com.songoda.ultimatekits.utils.Methods; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -24,17 +24,17 @@ public class CommandKits extends AbstractCommand { return ReturnType.SUCCESS; } if (args.length == 1) { - Player p = (Player) sender; + Player player = (Player) sender; String kitName = args[0].toLowerCase(); if (instance.getKitManager().getKit(kitName) == null) { - p.sendMessage(instance.getReferences().getPrefix() + Lang.KIT_DOESNT_EXIST.getConfigValue(kitName)); + player.sendMessage(instance.getReferences().getPrefix() + Lang.KIT_DOESNT_EXIST.getConfigValue(kitName)); return ReturnType.FAILURE; } Kit kit = instance.getKitManager().getKit(kitName); if (sender.hasPermission("ultimatekits.admin")) { - kit.give(p, false, false, true); + kit.give(player, false, false, true); } else { - kit.buy(p); + kit.buy(player); } return ReturnType.SUCCESS; } @@ -49,17 +49,17 @@ public class CommandKits extends AbstractCommand { sender.sendMessage(instance.getReferences().getPrefix() + Lang.PLAYER_NOT_FOUND.getConfigValue(kitName)); return ReturnType.FAILURE; } - Player p2 = Bukkit.getPlayer(args[1]); + Player player2 = Bukkit.getPlayer(args[1]); if (sender instanceof Player) { - Player p = (Player) sender; - if (!Methods.canGiveKit(p)) { - p.sendMessage(instance.getReferences().getPrefix() + Lang.NO_PERM.getConfigValue()); + Player player = (Player) sender; + if (!Methods.canGiveKit(player)) { + player.sendMessage(instance.getReferences().getPrefix() + Lang.NO_PERM.getConfigValue()); return ReturnType.FAILURE; } } Kit kit = instance.getKitManager().getKit(kitName); - kit.give(p2, false, false, true); - sender.sendMessage(instance.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText("&7You gave &9" + p2.getDisplayName() + "&7 kit &9" + kit.getShowableName() + "&7.")); + kit.give(player2, false, false, true); + sender.sendMessage(instance.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText("&7You gave &9" + player2.getDisplayName() + "&7 kit &9" + kit.getShowableName() + "&7.")); return ReturnType.SUCCESS; } sender.sendMessage(instance.getReferences().getPrefix() + Arconix.pl().getApi().format().formatText(Lang.SYNTAX.getConfigValue())); @@ -73,7 +73,7 @@ public class CommandKits extends AbstractCommand { @Override public String getSyntax() { - return "/Kits"; + return "/Kit & /Kits"; } @Override diff --git a/src/main/java/com/songoda/ultimatekits/command/commands/CommandReload.java b/src/main/java/com/songoda/ultimatekits/command/commands/CommandReload.java index f107215..d5722af 100644 --- a/src/main/java/com/songoda/ultimatekits/command/commands/CommandReload.java +++ b/src/main/java/com/songoda/ultimatekits/command/commands/CommandReload.java @@ -25,7 +25,7 @@ public class CommandReload extends AbstractCommand { @Override public String getSyntax() { - return "/uk reload"; + return "/KitAdmin reload"; } @Override diff --git a/src/main/java/com/songoda/ultimatekits/command/commands/CommandRemove.java b/src/main/java/com/songoda/ultimatekits/command/commands/CommandRemove.java index ac36e5a..1b9c4b9 100644 --- a/src/main/java/com/songoda/ultimatekits/command/commands/CommandRemove.java +++ b/src/main/java/com/songoda/ultimatekits/command/commands/CommandRemove.java @@ -36,7 +36,7 @@ public class CommandRemove extends AbstractCommand { @Override public String getSyntax() { - return "/uk remove"; + return "/KitAdmin remove"; } @Override diff --git a/src/main/java/com/songoda/ultimatekits/command/commands/CommandSet.java b/src/main/java/com/songoda/ultimatekits/command/commands/CommandSet.java index 1eac904..c202283 100644 --- a/src/main/java/com/songoda/ultimatekits/command/commands/CommandSet.java +++ b/src/main/java/com/songoda/ultimatekits/command/commands/CommandSet.java @@ -4,7 +4,7 @@ import com.songoda.arconix.plugin.Arconix; import com.songoda.ultimatekits.Lang; import com.songoda.ultimatekits.UltimateKits; import com.songoda.ultimatekits.command.AbstractCommand; -import com.songoda.ultimatekits.utils.Methods; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -40,7 +40,7 @@ public class CommandSet extends AbstractCommand { @Override public String getSyntax() { - return "/uk set "; + return "/KitAdmin set "; } @Override diff --git a/src/main/java/com/songoda/ultimatekits/command/commands/CommandSettings.java b/src/main/java/com/songoda/ultimatekits/command/commands/CommandSettings.java index 8b6d53c..7aec25a 100644 --- a/src/main/java/com/songoda/ultimatekits/command/commands/CommandSettings.java +++ b/src/main/java/com/songoda/ultimatekits/command/commands/CommandSettings.java @@ -24,7 +24,7 @@ public class CommandSettings extends AbstractCommand { @Override public String getSyntax() { - return "/uk settings"; + return "/KitAdmin settings"; } @Override diff --git a/src/main/java/com/songoda/ultimatekits/command/commands/CommandUltimateKits.java b/src/main/java/com/songoda/ultimatekits/command/commands/CommandUltimateKits.java index 4fe26eb..0d7ee8e 100644 --- a/src/main/java/com/songoda/ultimatekits/command/commands/CommandUltimateKits.java +++ b/src/main/java/com/songoda/ultimatekits/command/commands/CommandUltimateKits.java @@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender; public class CommandUltimateKits extends AbstractCommand { public CommandUltimateKits() { - super("UltimateKits", null, false, true); + super("KitAdmin", null, false, true); } @Override @@ -33,7 +33,7 @@ public class CommandUltimateKits extends AbstractCommand { @Override public String getSyntax() { - return "/UltimateKits"; + return "/KitAdmin"; } @Override diff --git a/src/main/java/com/songoda/ultimatekits/editor/KitEditor.java b/src/main/java/com/songoda/ultimatekits/editor/KitEditor.java index beb1f9f..b1108a9 100644 --- a/src/main/java/com/songoda/ultimatekits/editor/KitEditor.java +++ b/src/main/java/com/songoda/ultimatekits/editor/KitEditor.java @@ -24,10 +24,7 @@ import java.util.*; */ public class KitEditor { - public enum Action { NONE, CHANCE, DISPLAY_ITEM, DISPLAY_NAME, DISPLAY_LORE} - private final Map editorPlayerData = new HashMap<>(); - private UltimateKits instance; public KitEditor(UltimateKits instance) { @@ -81,7 +78,7 @@ public class KitEditor { i.setItem(8, exit); int num = 10; - List list = kit.getReadableContents(player, false,true, true); + List list = kit.getReadableContents(player, false, true, true); for (ItemStack iss : list) { if (num == 17 || num == 36) num++; @@ -726,7 +723,6 @@ public class KitEditor { } - public void createMoney(Player player) { try { KitEditorPlayerData playerData = getDataFor(player); @@ -972,4 +968,6 @@ public class KitEditor { public void removeFromInstance(Player player) { editorPlayerData.remove(player); } + + public enum Action {NONE, CHANCE, DISPLAY_ITEM, DISPLAY_NAME, DISPLAY_LORE} } diff --git a/src/main/java/com/songoda/ultimatekits/editor/KitEditorPlayerData.java b/src/main/java/com/songoda/ultimatekits/editor/KitEditorPlayerData.java index 7ca533a..3292515 100644 --- a/src/main/java/com/songoda/ultimatekits/editor/KitEditorPlayerData.java +++ b/src/main/java/com/songoda/ultimatekits/editor/KitEditorPlayerData.java @@ -44,6 +44,11 @@ public class KitEditorPlayerData { public boolean isInInventory() { return showInventory; } + + public void setInInventory(boolean showInventory) { + this.showInventory = showInventory; + } + public boolean isInFuction() { return showFuctions; } @@ -52,10 +57,6 @@ public class KitEditorPlayerData { this.showFuctions = showFuctions; } - public void setInInventory(boolean showInventory) { - this.showInventory = showInventory; - } - public ItemStack[] getInventory() { return Arrays.copyOf(inventory, inventory.length); } diff --git a/src/main/java/com/songoda/ultimatekits/events/ChatListeners.java b/src/main/java/com/songoda/ultimatekits/events/ChatListeners.java index f7e7c02..5c78a12 100644 --- a/src/main/java/com/songoda/ultimatekits/events/ChatListeners.java +++ b/src/main/java/com/songoda/ultimatekits/events/ChatListeners.java @@ -4,11 +4,10 @@ import com.songoda.arconix.plugin.Arconix; import com.songoda.ultimatekits.Lang; import com.songoda.ultimatekits.UltimateKits; import com.songoda.ultimatekits.editor.KitEditor; -import com.songoda.ultimatekits.kit.Kit; import com.songoda.ultimatekits.editor.KitEditorPlayerData; +import com.songoda.ultimatekits.kit.Kit; import com.songoda.ultimatekits.kit.KitItem; import com.songoda.ultimatekits.utils.Debugger; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/com/songoda/ultimatekits/events/InventoryListeners.java b/src/main/java/com/songoda/ultimatekits/events/InventoryListeners.java index 3f8b4f9..f69e4ca 100644 --- a/src/main/java/com/songoda/ultimatekits/events/InventoryListeners.java +++ b/src/main/java/com/songoda/ultimatekits/events/InventoryListeners.java @@ -4,11 +4,11 @@ import com.songoda.arconix.plugin.Arconix; import com.songoda.ultimatekits.Lang; import com.songoda.ultimatekits.UltimateKits; import com.songoda.ultimatekits.editor.BlockEditor; -import com.songoda.ultimatekits.editor.KitEditor; -import com.songoda.ultimatekits.kit.KitsGUI; import com.songoda.ultimatekits.editor.BlockEditorPlayerData; -import com.songoda.ultimatekits.kit.Kit; +import com.songoda.ultimatekits.editor.KitEditor; import com.songoda.ultimatekits.editor.KitEditorPlayerData; +import com.songoda.ultimatekits.kit.Kit; +import com.songoda.ultimatekits.kit.KitsGUI; import com.songoda.ultimatekits.player.PlayerData; import com.songoda.ultimatekits.utils.Debugger; import org.bukkit.ChatColor; @@ -59,9 +59,9 @@ public class InventoryListeners implements Listener { int page = playerData.getKitsPage(); if (event.getClick() == ClickType.MIDDLE && player.hasPermission("ultimatekits.admin")) { - + playerData.setKitMode(!playerData.isKitsMode()); - + KitsGUI.show(player, page); return; } @@ -311,7 +311,7 @@ public class InventoryListeners implements Listener { @EventHandler public void onDrag(InventoryDragEvent event) { try { - if (instance.getPlayerDataManager().getPlayerAction((Player)event.getWhoClicked()).getGuiLocation() != PlayerData.GUILocation.DISPLAY) + if (instance.getPlayerDataManager().getPlayerAction((Player) event.getWhoClicked()).getGuiLocation() != PlayerData.GUILocation.DISPLAY) return; event.setCancelled(true); if (instance.getReferences().isPlaySound()) @@ -325,7 +325,7 @@ public class InventoryListeners implements Listener { @EventHandler public void onInteract(InventoryInteractEvent event) { try { - if (instance.getPlayerDataManager().getPlayerAction((Player)event.getWhoClicked()).getGuiLocation() != PlayerData.GUILocation.DISPLAY) + if (instance.getPlayerDataManager().getPlayerAction((Player) event.getWhoClicked()).getGuiLocation() != PlayerData.GUILocation.DISPLAY) return; event.setCancelled(true); if (instance.getReferences().isPlaySound()) diff --git a/src/main/java/com/songoda/ultimatekits/kit/Kit.java b/src/main/java/com/songoda/ultimatekits/kit/Kit.java index 10b6724..a7bb114 100644 --- a/src/main/java/com/songoda/ultimatekits/kit/Kit.java +++ b/src/main/java/com/songoda/ultimatekits/kit/Kit.java @@ -28,7 +28,6 @@ import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.plugin.RegisteredServiceProvider; import java.util.*; -import java.util.concurrent.atomic.AtomicReference; /** * Created by songoda on 2/24/2017. @@ -36,22 +35,15 @@ import java.util.concurrent.atomic.AtomicReference; public class Kit { private final String name, showableName; - + private final UltimateKits plugin; private double price; private String link, title; - private int delay; - private boolean hidden; - private Material displayItem; - private List contents; - private KitAnimation kitAnimation; - private final UltimateKits plugin; - public Kit(String name, String title, String link, double price, Material displayItem, int delay, boolean hidden, List contents, KitAnimation kitAnimation) { this.name = name; this.showableName = Arconix.pl().getApi().format().formatText(name, true); @@ -206,7 +198,7 @@ public class Kit { guititle = Arconix.pl().getApi().format().formatText(guititle); - List list = getReadableContents(p, true,true, false); + List list = getReadableContents(p, true, true, false); int amt = 0; for (ItemStack is : list) { @@ -473,20 +465,20 @@ public class Kit { } catch (NumberFormatException ex) { Debugger.runReport(ex); } - amtToGive --; + amtToGive--; continue; } else if (item.getContent() instanceof KitContentCommand) { String parsed = ((KitContentCommand) item.getContent()).getCommand(); parsed = parsed.replace("{player}", player.getName()); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), parsed); - amtToGive --; + amtToGive--; continue; } - ItemStack parseStack = ((KitContentItem)item.getContent()).getItemStack(); + ItemStack parseStack = ((KitContentItem) item.getContent()).getItemStack(); if (parseStack.getType() == Material.AIR) continue; - amtToGive --; + amtToGive--; if (kitAnimation != KitAnimation.NONE) { final CrateAnimateTask cTask = new CrateAnimateTask(plugin, player, this, item.getItem()); @@ -498,7 +490,7 @@ public class Kit { player.getWorld().dropItemNaturally(player.getLocation(), item2); } } - num ++; + num++; } } if (task != null) { diff --git a/src/main/java/com/songoda/ultimatekits/kit/KitItem.java b/src/main/java/com/songoda/ultimatekits/kit/KitItem.java index fda4115..382c751 100644 --- a/src/main/java/com/songoda/ultimatekits/kit/KitItem.java +++ b/src/main/java/com/songoda/ultimatekits/kit/KitItem.java @@ -1,14 +1,12 @@ package com.songoda.ultimatekits.kit; import com.songoda.arconix.api.methods.formatting.TextComponent; -import com.songoda.arconix.api.methods.math.AMath; import com.songoda.ultimatekits.UltimateKits; import com.songoda.ultimatekits.kit.type.KitContent; import com.songoda.ultimatekits.kit.type.KitContentCommand; import com.songoda.ultimatekits.kit.type.KitContentEconomy; import com.songoda.ultimatekits.kit.type.KitContentItem; import com.songoda.ultimatekits.utils.Methods; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -66,7 +64,7 @@ public class KitItem { String option = sSplit[0].toLowerCase(); String value = sSplit[1].trim(); - switch(option) { + switch (option) { case "chance": chance = Integer.parseInt(value); break; @@ -107,7 +105,8 @@ public class KitItem { } public String getSerialized() { - if (chance == 0 && displayItem == null && displayName == null && displayLore == null) return this.content.getSerialized(); + if (chance == 0 && displayItem == null && displayName == null && displayLore == null) + return this.content.getSerialized(); return compileOptions() + ";" + this.content.getSerialized(); } diff --git a/src/main/java/com/songoda/ultimatekits/player/PlayerData.java b/src/main/java/com/songoda/ultimatekits/player/PlayerData.java index 6c5725f..8070458 100644 --- a/src/main/java/com/songoda/ultimatekits/player/PlayerData.java +++ b/src/main/java/com/songoda/ultimatekits/player/PlayerData.java @@ -8,16 +8,12 @@ import java.util.UUID; public class PlayerData { - public enum GUILocation { NOT_IN, BUY_FINAL, KITS, DISPLAY } - - private boolean isInCrate = false; - private final UUID playerUUID; + private boolean isInCrate = false; private boolean kitMode; private Kit inKit = null; private int kitsPage = 0; private GUILocation guiLocation = GUILocation.NOT_IN; - PlayerData(UUID playerUUID) { this.playerUUID = playerUUID; } @@ -65,4 +61,6 @@ public class PlayerData { public void setInCrate(boolean inCrate) { isInCrate = inCrate; } + + public enum GUILocation {NOT_IN, BUY_FINAL, KITS, DISPLAY} } diff --git a/src/main/java/com/songoda/ultimatekits/tasks/CrateAnimateTask.java b/src/main/java/com/songoda/ultimatekits/tasks/CrateAnimateTask.java index 7199748..00123a7 100644 --- a/src/main/java/com/songoda/ultimatekits/tasks/CrateAnimateTask.java +++ b/src/main/java/com/songoda/ultimatekits/tasks/CrateAnimateTask.java @@ -19,22 +19,17 @@ import java.util.*; public class CrateAnimateTask extends BukkitRunnable { - private CrateAnimateTask instance; - private final UltimateKits plugin; - private final Player player; - private final Inventory inventory; - private final ArrayDeque items; - private final ItemStack give; - + private CrateAnimateTask instance; private boolean slow = false; private boolean finish = false; private boolean done = false; private boolean last = false; + private int num = 0; public CrateAnimateTask(UltimateKits plugin, Player player, Kit kit, ItemStack give) { this.plugin = plugin; @@ -64,8 +59,6 @@ public class CrateAnimateTask extends BukkitRunnable { }, 60); } - private int num = 0; - @Override public void run() { if (slow && num == 1) { @@ -74,7 +67,7 @@ public class CrateAnimateTask extends BukkitRunnable { } num = slow ? 1 : 0; - for (int i = 0; i < 27; i ++) { + for (int i = 0; i < 27; i++) { inventory.setItem(i, AInventory.toGlass(true, 0)); } @@ -93,7 +86,7 @@ public class CrateAnimateTask extends BukkitRunnable { } List items = new ArrayList<>(this.items); - for (int i = 0; i < 9; i ++) { + for (int i = 0; i < 9; i++) { inventory.setItem(9 + i, items.get(i).getItem()); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 56df1f5..954233c 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -7,21 +7,21 @@ description: View a kit before you purchase it! author: Songoda api-version: 1.13 commands: - ultimatekits: + kitadmin: description: View information on this plugin. default: true - aliases: [kp, uk] + aliases: [ultimatekits, kp, uk] usage: / [reload] + kit: + description: Preview a kit + default: true + aliases: [kit] + usage: / previewkit: description: Preview a kit default: true aliases: [pk, preview] usage: / [kit] - kits: - description: Preview a kit - default: true - aliases: [kit] - usage: / permissions: ultimatekits.use: description: allows the user to preview kit