mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-23 02:35:28 +01:00
Commands updated.
code cleaned up.
This commit is contained in:
parent
45d2c567ba
commit
91778f07be
@ -9,7 +9,7 @@ public class References {
|
||||
private boolean playSound = false;
|
||||
private Sound sound = null;
|
||||
|
||||
public References() {
|
||||
References() {
|
||||
try {
|
||||
prefix = Lang.PREFIX.getConfigValue() + " ";
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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));
|
||||
|
@ -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 <name>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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
|
||||
|
@ -74,7 +74,7 @@ public class CommandKey extends AbstractCommand {
|
||||
for (Key key : UltimateKits.getInstance().getKeyManager().getKeys()) {
|
||||
keys.append("/").append(key.getName());
|
||||
}
|
||||
return "/uk key <kit/all> <" + keys.substring(1) + "> <player/all> <amount>";
|
||||
return "/KitAdmin key <kit/all> <" + keys.substring(1) + "> <player/all> <amount>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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
|
||||
|
@ -25,7 +25,7 @@ public class CommandReload extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/uk reload";
|
||||
return "/KitAdmin reload";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +36,7 @@ public class CommandRemove extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/uk remove";
|
||||
return "/KitAdmin remove";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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 <kit>";
|
||||
return "/KitAdmin set <kit>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,7 @@ public class CommandSettings extends AbstractCommand {
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/uk settings";
|
||||
return "/KitAdmin settings";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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
|
||||
|
@ -24,10 +24,7 @@ import java.util.*;
|
||||
*/
|
||||
public class KitEditor {
|
||||
|
||||
public enum Action { NONE, CHANCE, DISPLAY_ITEM, DISPLAY_NAME, DISPLAY_LORE}
|
||||
|
||||
private final Map<UUID, KitEditorPlayerData> 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<ItemStack> list = kit.getReadableContents(player, false,true, true);
|
||||
List<ItemStack> 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}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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())
|
||||
|
@ -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<KitItem> 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<KitItem> 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<ItemStack> list = getReadableContents(p, true,true, false);
|
||||
List<ItemStack> 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) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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}
|
||||
}
|
||||
|
@ -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<KitItem> 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<KitItem> 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());
|
||||
}
|
||||
|
||||
|
@ -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: /<command> [reload]
|
||||
kit:
|
||||
description: Preview a kit
|
||||
default: true
|
||||
aliases: [kit]
|
||||
usage: /<commands>
|
||||
previewkit:
|
||||
description: Preview a kit
|
||||
default: true
|
||||
aliases: [pk, preview]
|
||||
usage: /<command> [kit]
|
||||
kits:
|
||||
description: Preview a kit
|
||||
default: true
|
||||
aliases: [kit]
|
||||
usage: /<command>
|
||||
permissions:
|
||||
ultimatekits.use:
|
||||
description: allows the user to preview kit
|
||||
|
Loading…
Reference in New Issue
Block a user