Removed Arconix as a hard dependency.

This commit is contained in:
Brianna O'Keefe 2019-01-10 15:27:01 -05:00
parent 26537a85fd
commit d9f21c9ef7
16 changed files with 210 additions and 67 deletions

View File

@ -1,8 +1,5 @@
package com.songoda.ultimatestacker;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.methods.serialize.Serialize;
import com.songoda.arconix.api.utils.ConfigWrapper;
import com.songoda.ultimatestacker.command.CommandManager;
import com.songoda.ultimatestacker.entity.EntityStack;
import com.songoda.ultimatestacker.entity.EntityStackManager;
@ -16,6 +13,8 @@ import com.songoda.ultimatestacker.storage.StorageRow;
import com.songoda.ultimatestacker.storage.types.StorageMysql;
import com.songoda.ultimatestacker.storage.types.StorageYaml;
import com.songoda.ultimatestacker.tasks.StackingTask;
import com.songoda.ultimatestacker.utils.ConfigWrapper;
import com.songoda.ultimatestacker.utils.Methods;
import com.songoda.ultimatestacker.utils.ServerVersion;
import com.songoda.ultimatestacker.utils.SettingsManager;
import org.apache.commons.lang.ArrayUtils;
@ -63,10 +62,10 @@ public class UltimateStacker extends JavaPlugin {
this.storage.closeConnection();
ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(TextComponent.formatText("&a============================="));
console.sendMessage(TextComponent.formatText("&7UltimateStacker " + this.getDescription().getVersion() + " by &5Brianna <3!"));
console.sendMessage(TextComponent.formatText("&7Action: &cDisabling&7..."));
console.sendMessage(TextComponent.formatText("&a============================="));
console.sendMessage(Methods.formatText("&a============================="));
console.sendMessage(Methods.formatText("&7UltimateStacker " + this.getDescription().getVersion() + " by &5Brianna <3!"));
console.sendMessage(Methods.formatText("&7Action: &cDisabling&7..."));
console.sendMessage(Methods.formatText("&a============================="));
}
private boolean checkVersion() {
@ -93,9 +92,9 @@ public class UltimateStacker extends JavaPlugin {
if (!checkVersion()) return;
ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(TextComponent.formatText("&a============================="));
console.sendMessage(TextComponent.formatText("&7UltimateStacker " + this.getDescription().getVersion() + " by &5Brianna <3&7!"));
console.sendMessage(TextComponent.formatText("&7Action: &aEnabling&7..."));
console.sendMessage(Methods.formatText("&a============================="));
console.sendMessage(Methods.formatText("&7UltimateStacker " + this.getDescription().getVersion() + " by &5Brianna <3&7!"));
console.sendMessage(Methods.formatText("&7Action: &aEnabling&7..."));
this.settingsManager = new SettingsManager(this);
this.commandManager = new CommandManager(this);
@ -114,7 +113,7 @@ public class UltimateStacker extends JavaPlugin {
for (Material value : Material.values()) {
itemFile.getConfig().addDefault("Items." + value.name() + ".Has Hologram", true);
itemFile.getConfig().addDefault("Items." + value.name() + ".Max Stack Size", -1);
itemFile.getConfig().addDefault("Items." + value.name() + ".Display Name", TextComponent.formatText(value.name().toLowerCase().replace("_", " "), true));
itemFile.getConfig().addDefault("Items." + value.name() + ".Display Name", Methods.formatText(value.name().toLowerCase().replace("_", " "), true));
}
itemFile.getConfig().options().copyDefaults(true);
itemFile.saveConfig();
@ -122,7 +121,7 @@ public class UltimateStacker extends JavaPlugin {
for (EntityType value : EntityType.values()) {
if (value.isSpawnable() && value.isAlive() && !value.toString().contains("ARMOR")) {
spawnerFile.getConfig().addDefault("Spawners." + value.name() + ".Max Stack Size", -1);
spawnerFile.getConfig().addDefault("Spawners." + value.name() + ".Display Name", TextComponent.formatText(value.name().toLowerCase().replace("_", " "), true));
spawnerFile.getConfig().addDefault("Spawners." + value.name() + ".Display Name", Methods.formatText(value.name().toLowerCase().replace("_", " "), true));
}
}
spawnerFile.getConfig().options().copyDefaults(true);
@ -166,7 +165,7 @@ public class UltimateStacker extends JavaPlugin {
if (storage.containsGroup("spawners")) {
for (StorageRow row : storage.getRowsByGroup("spawners")) {
try {
Location location = Serialize.getInstance().unserializeLocation(row.getKey());
Location location = Methods.unserializeLocation(row.getKey());
if (location.getWorld() == null || !location.getBlock().getType().name().contains("SPAWNER")) {
if (location.getWorld() != null && !location.getBlock().getType().name().contains("SPAWNER")) {
@ -187,12 +186,14 @@ public class UltimateStacker extends JavaPlugin {
}
for (SpawnerStack stack : spawnerStackManager.getStacks()) {
storage.prepareSaveItem("spawners", new StorageItem("location", Serialize.getInstance().serializeLocation(stack.getLocation())),
storage.prepareSaveItem("spawners", new StorageItem("location", Methods.serializeLocation(stack.getLocation())),
new StorageItem("amount", stack.getAmount()));
}
// Save data initially so that if the person reloads again fast they don't lose all their data.
this.saveToFile();
this.hologramHandler = new HologramHandler(this);
if (Bukkit.getPluginManager().isPluginEnabled("Arconix")) {
this.hologramHandler = new HologramHandler(this);
}
}, 10);
Bukkit.getPluginManager().registerEvents(new SpawnerListeners(this), this);
@ -206,7 +207,7 @@ public class UltimateStacker extends JavaPlugin {
Bukkit.getScheduler().runTaskTimerAsynchronously(this, this::saveToFile, 6000, 6000);
console.sendMessage(TextComponent.formatText("&a============================="));
console.sendMessage(Methods.formatText("&a============================="));
}
private void update() {
@ -260,7 +261,7 @@ public class UltimateStacker extends JavaPlugin {
}
for (SpawnerStack stack : spawnerStackManager.getStacks()) {
storage.prepareSaveItem("spawners", new StorageItem("location", Serialize.getInstance().serializeLocation(stack.getLocation())),
storage.prepareSaveItem("spawners", new StorageItem("location", Methods.serializeLocation(stack.getLocation())),
new StorageItem("amount", stack.getAmount()));
}

View File

@ -1,8 +1,8 @@
package com.songoda.ultimatestacker.command;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.command.commands.*;
import com.songoda.ultimatestacker.utils.Methods;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -51,7 +51,7 @@ public class CommandManager implements CommandExecutor {
}
}
}
commandSender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&7The command you entered does not exist or is spelt incorrectly."));
commandSender.sendMessage(instance.getReferences().getPrefix() + Methods.formatText("&7The command you entered does not exist or is spelt incorrectly."));
return true;
}
@ -63,8 +63,8 @@ public class CommandManager implements CommandExecutor {
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
AbstractCommand.ReturnType returnType = command.runCommand(instance, sender, strings);
if (returnType == AbstractCommand.ReturnType.SYNTAX_ERROR) {
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&cInvalid Syntax!"));
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
sender.sendMessage(instance.getReferences().getPrefix() + Methods.formatText("&cInvalid Syntax!"));
sender.sendMessage(instance.getReferences().getPrefix() + Methods.formatText("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
}
return;
}

View File

@ -1,6 +1,5 @@
package com.songoda.ultimatestacker.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.command.AbstractCommand;
import com.songoda.ultimatestacker.utils.Methods;
@ -34,13 +33,13 @@ public class CommandGive extends AbstractCommand {
}
if (type == null) {
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText(instance.getReferences().getPrefix() + "&7The entity Type &6" + args[2] + " &7does not exist. Try one of these:"));
sender.sendMessage(instance.getReferences().getPrefix() + Methods.formatText(instance.getReferences().getPrefix() + "&7The entity Type &6" + args[2] + " &7does not exist. Try one of these:"));
StringBuilder list = new StringBuilder();
for (EntityType types : EntityType.values()) {
list.append(types.name().toUpperCase().replace(" ", "_")).append("&7, &6");
}
sender.sendMessage(TextComponent.formatText("&6" + list));
sender.sendMessage(Methods.formatText("&6" + list));
} else {
int amt = Integer.parseInt(args[3]);
@ -48,11 +47,11 @@ public class CommandGive extends AbstractCommand {
if (!args[1].trim().toLowerCase().equals("all")) {
Player player = Bukkit.getOfflinePlayer(args[1]).getPlayer();
player.getInventory().addItem(itemStack);
player.sendMessage(TextComponent.formatText(instance.getLocale().getMessage("command.give.success", Methods.compileSpawnerName(type, amt))));
player.sendMessage(Methods.formatText(instance.getLocale().getMessage("command.give.success", Methods.compileSpawnerName(type, amt))));
} else {
for (Player player : Bukkit.getOnlinePlayers()) {
player.getInventory().addItem(itemStack);
player.sendMessage(TextComponent.formatText(instance.getLocale().getMessage("command.give.success", Methods.compileSpawnerName(type, amt))));
player.sendMessage(Methods.formatText(instance.getLocale().getMessage("command.give.success", Methods.compileSpawnerName(type, amt))));
}
}
}

View File

@ -1,8 +1,8 @@
package com.songoda.ultimatestacker.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.command.AbstractCommand;
import com.songoda.ultimatestacker.utils.Methods;
import org.bukkit.command.CommandSender;
public class CommandReload extends AbstractCommand {
@ -14,7 +14,7 @@ public class CommandReload extends AbstractCommand {
@Override
protected ReturnType runCommand(UltimateStacker instance, CommandSender sender, String... args) {
instance.reload();
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Configuration and Language files reloaded."));
sender.sendMessage(Methods.formatText(instance.getReferences().getPrefix() + "&7Configuration and Language files reloaded."));
return ReturnType.SUCCESS;
}

View File

@ -1,9 +1,9 @@
package com.songoda.ultimatestacker.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.command.AbstractCommand;
import com.songoda.ultimatestacker.entity.EntityStackManager;
import com.songoda.ultimatestacker.utils.Methods;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
@ -42,7 +42,7 @@ public class CommandRemoveAll extends AbstractCommand {
amountRemoved ++;
} else if (entityO.getType() == EntityType.DROPPED_ITEM && type.equalsIgnoreCase("items")) {
ItemStack item = ((Item) entityO).getItemStack();
if (entityO.isCustomNameVisible() && !entityO.getCustomName().contains(TextComponent.convertToInvisibleString("IS")) || item.hasItemMeta() && item.getItemMeta().hasDisplayName())
if (entityO.isCustomNameVisible() && !entityO.getCustomName().contains(Methods.convertToInvisibleString("IS")) || item.hasItemMeta() && item.getItemMeta().hasDisplayName())
continue;
entityO.remove();
amountRemoved ++;
@ -55,9 +55,9 @@ public class CommandRemoveAll extends AbstractCommand {
if (type.equalsIgnoreCase("items") && amountRemoved == 1) type = "Item";
if (amountRemoved == 0) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7No stacked " + type + " exist that could be removed."));
sender.sendMessage(Methods.formatText(instance.getReferences().getPrefix() + "&7No stacked " + type + " exist that could be removed."));
} else {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Removed &6" + amountRemoved + " stacked " + TextComponent.formatText(type.toLowerCase(), true) + " &7Successfully."));
sender.sendMessage(Methods.formatText(instance.getReferences().getPrefix() + "&7Removed &6" + amountRemoved + " stacked " + Methods.formatText(type.toLowerCase(), true) + " &7Successfully."));
}
return ReturnType.SUCCESS;
}

View File

@ -1,8 +1,8 @@
package com.songoda.ultimatestacker.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.command.AbstractCommand;
import com.songoda.ultimatestacker.utils.Methods;
import org.bukkit.command.CommandSender;
public class CommandUltimateStacker extends AbstractCommand {
@ -14,11 +14,11 @@ public class CommandUltimateStacker extends AbstractCommand {
@Override
protected ReturnType runCommand(UltimateStacker instance, CommandSender sender, String... args) {
sender.sendMessage("");
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oBrianna"));
sender.sendMessage(Methods.formatText(instance.getReferences().getPrefix() + "&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oBrianna"));
for (AbstractCommand command : instance.getCommandManager().getCommands()) {
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
sender.sendMessage(TextComponent.formatText("&8 - &a" + command.getSyntax() + "&7 - " + command.getDescription()));
sender.sendMessage(Methods.formatText("&8 - &a" + command.getSyntax() + "&7 - " + command.getDescription()));
}
}
sender.sendMessage("");

View File

@ -1,7 +1,7 @@
package com.songoda.ultimatestacker.storage;
import com.songoda.arconix.api.utils.ConfigWrapper;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.utils.ConfigWrapper;
import java.util.List;

View File

@ -1,6 +1,5 @@
package com.songoda.ultimatestacker.tasks;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.entity.EntityStack;
import com.songoda.ultimatestacker.entity.EntityStackManager;
@ -62,7 +61,7 @@ public class StackingTask extends BukkitRunnable {
if (entityO.hasMetadata("grabbed")
|| item == null
|| entityO.isCustomNameVisible() && !entityO.getCustomName().contains(TextComponent.convertToInvisibleString("IS"))
|| entityO.isCustomNameVisible() && !entityO.getCustomName().contains(Methods.convertToInvisibleString("IS"))
|| item.hasItemMeta() && item.getItemMeta().hasDisplayName())
continue;
@ -76,7 +75,7 @@ public class StackingTask extends BukkitRunnable {
int size = item.getAmount();
String name = TextComponent.convertToInvisibleString("IS") + Methods.compileItemName(item.getType(), size);
String name = Methods.convertToInvisibleString("IS") + Methods.compileItemName(item.getType(), size);
if (instance.getItemFile().getConfig().getBoolean("Items." + item.getType().name() + ".Has Hologram")) {
entityO.setCustomName(name);

View File

@ -0,0 +1,67 @@
package com.songoda.ultimatestacker.utils;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
/**
* ConfigWrapper made by @clip
*/
public class ConfigWrapper {
private final JavaPlugin plugin;
private final String folderName, fileName;
private FileConfiguration config;
private File configFile;
public ConfigWrapper(final JavaPlugin instance, final String folderName, final String fileName) {
this.plugin = instance;
this.folderName = folderName;
this.fileName = fileName;
}
public void createNewFile(final String message, final String header) {
reloadConfig();
saveConfig();
loadConfig(header);
if (message != null) {
plugin.getLogger().info(message);
}
}
public FileConfiguration getConfig() {
if (config == null) {
reloadConfig();
}
return config;
}
public void loadConfig(final String header) {
config.options().header(header);
config.options().copyDefaults(true);
saveConfig();
}
public void reloadConfig() {
if (configFile == null) {
configFile = new File(plugin.getDataFolder() + folderName, fileName);
}
config = YamlConfiguration.loadConfiguration(configFile);
}
public void saveConfig() {
if (config == null || configFile == null) {
return;
}
try {
getConfig().save(configFile);
} catch (final IOException ex) {
plugin.getLogger().log(Level.SEVERE, "Could not save config to " + configFile, ex);
}
}
}

View File

@ -1,16 +1,18 @@
package com.songoda.ultimatestacker.utils;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.ultimatestacker.UltimateStacker;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockStateMeta;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Methods {
@ -51,37 +53,37 @@ public class Methods {
public static String compileSpawnerName(EntityType entityType, int amount) {
String nameFormat = UltimateStacker.getInstance().getConfig().getString("Spawners.Name Format");
String displayName = TextComponent.formatText(UltimateStacker.getInstance().getSpawnerFile().getConfig().getString("Spawners." + entityType.name() + ".Display Name"));
String displayName = Methods.formatText(UltimateStacker.getInstance().getSpawnerFile().getConfig().getString("Spawners." + entityType.name() + ".Display Name"));
nameFormat = nameFormat.replace("{TYPE}", displayName);
nameFormat = nameFormat.replace("{AMT}", Integer.toString(amount));
String info = TextComponent.convertToInvisibleString(amount + ":");
return info + TextComponent.formatText(nameFormat).trim();
String info = Methods.convertToInvisibleString(amount + ":");
return info + Methods.formatText(nameFormat).trim();
}
public static String compileItemName(Material type, int amount) {
String nameFormat = UltimateStacker.getInstance().getConfig().getString("Item.Name Format");
String displayName = TextComponent.formatText(UltimateStacker.getInstance().getItemFile().getConfig().getString("Items." + type.name() + ".Display Name"));
String displayName = Methods.formatText(UltimateStacker.getInstance().getItemFile().getConfig().getString("Items." + type.name() + ".Display Name"));
nameFormat = nameFormat.replace("{TYPE}", displayName);
nameFormat = nameFormat.replace("{AMT}", Integer.toString(amount));
String info = TextComponent.convertToInvisibleString(amount + ":");
String info = Methods.convertToInvisibleString(amount + ":");
return info + TextComponent.formatText(nameFormat).trim();
return info + Methods.formatText(nameFormat).trim();
}
public static String compileEntityName(Entity entity, int amount) {
String nameFormat = UltimateStacker.getInstance().getConfig().getString("Entity.Name Format");
String displayName = TextComponent.formatText(entity.getType().name().toLowerCase().replace("_", " "), true);
String displayName = Methods.formatText(entity.getType().name().toLowerCase().replace("_", " "), true);
nameFormat = nameFormat.replace("{TYPE}", displayName);
nameFormat = nameFormat.replace("{AMT}", Integer.toString(amount));
String info = TextComponent.convertToInvisibleString(amount + ":");
String info = Methods.convertToInvisibleString(amount + ":");
return info + TextComponent.formatText(nameFormat).trim();
return info + Methods.formatText(nameFormat).trim();
}
public static void takeItem(Player player, int amount) {
@ -107,4 +109,85 @@ public class Methods {
return item;
}
/**
* Serializes the location of the block specified.
*
* @param b The block whose location is to be saved.
* @return The serialized data.
*/
public static String serializeLocation(Block b) {
if (b == null)
return "";
return serializeLocation(b.getLocation());
}
/**
* Serializes the location specified.
*
* @param location The location that is to be saved.
* @return The serialized data.
*/
public static String serializeLocation(Location location) {
if (location == null)
return "";
String w = location.getWorld().getName();
double x = location.getX();
double y = location.getY();
double z = location.getZ();
String str = w + ":" + x + ":" + y + ":" + z;
str = str.replace(".0", "").replace("/", "");
return str;
}
private static Map<String, Location> serializeCache = new HashMap<>();
/**
* Deserializes a location from the string.
*
* @param str The string to parse.
* @return The location that was serialized in the string.
*/
public static Location unserializeLocation(String str) {
if (str == null || str.equals(""))
return null;
if (serializeCache.containsKey(str)) {
return serializeCache.get(str).clone();
}
String cacheKey = str;
str = str.replace("y:", ":").replace("z:", ":").replace("w:", "").replace("x:", ":").replace("/", ".");
List<String> args = Arrays.asList(str.split("\\s*:\\s*"));
World world = Bukkit.getWorld(args.get(0));
double x = Double.parseDouble(args.get(1)), y = Double.parseDouble(args.get(2)), z = Double.parseDouble(args.get(3));
Location location = new Location(world, x, y, z, 0, 0);
serializeCache.put(cacheKey, location.clone());
return location;
}
public static String convertToInvisibleString(String s) {
if (s == null || s.equals(""))
return "";
StringBuilder hidden = new StringBuilder();
for (char c : s.toCharArray()) hidden.append(ChatColor.COLOR_CHAR + "").append(c);
return hidden.toString();
}
public static String formatText(String text) {
if (text == null || text.equals(""))
return "";
return formatText(text, false);
}
public static String formatText(String text, boolean cap) {
if (text == null || text.equals(""))
return "";
if (cap)
text = text.substring(0, 1).toUpperCase() + text.substring(1);
return ChatColor.translateAlternateColorCodes('&', text);
}
}

View File

@ -1,7 +1,5 @@
package com.songoda.ultimatestacker.utils;
import com.songoda.arconix.api.ArconixAPI;
import com.songoda.arconix.plugin.Arconix;
import org.bukkit.Bukkit;
import org.bukkit.block.CreatureSpawner;

View File

@ -1,8 +1,5 @@
package com.songoda.ultimatestacker.utils;
import com.songoda.arconix.api.methods.GUI;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.utils.ConfigWrapper;
import com.songoda.ultimatestacker.UltimateStacker;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -106,23 +103,22 @@ public class SettingsManager implements Listener {
player.closeInventory();
player.sendMessage("");
player.sendMessage(TextComponent.formatText("&7Please enter a value for &6" + current + "&7."));
player.sendMessage(Methods.formatText("&7Please enter a value for &6" + current + "&7."));
if (instance.getConfig().isInt(current) || instance.getConfig().isDouble(current)) {
player.sendMessage(TextComponent.formatText("&cUse only numbers."));
player.sendMessage(Methods.formatText("&cUse only numbers."));
}
player.sendMessage("");
}
public void openSettingsManager(Player player) {
Inventory inventory = Bukkit.createInventory(null, 27, pluginName + " Settings Manager");
GUI.fillGlass(inventory, 7);
int slot = 10;
for (String key : instance.getConfig().getDefaultSection().getKeys(false)) {
ItemStack item = new ItemStack(Material.WOOL, 1, (byte) (slot - 9)); //ToDo: Make this function as it was meant to.
ItemMeta meta = item.getItemMeta();
meta.setLore(Collections.singletonList(TextComponent.formatText("&6Click To Edit This Category.")));
meta.setDisplayName(TextComponent.formatText("&f&l" + key));
meta.setLore(Collections.singletonList(Methods.formatText("&6Click To Edit This Category.")));
meta.setDisplayName(Methods.formatText("&f&l" + key));
item.setItemMeta(meta);
inventory.setItem(slot, item);
slot++;
@ -140,18 +136,18 @@ public class SettingsManager implements Listener {
String fKey = cat.get(player) + "." + key;
ItemStack item = new ItemStack(Material.DIAMOND_HELMET);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(TextComponent.formatText("&6" + key));
meta.setDisplayName(Methods.formatText("&6" + key));
List<String> lore = new ArrayList<>();
if (config.isBoolean(fKey)) {
item.setType(Material.LEVER);
lore.add(TextComponent.formatText(config.getBoolean(fKey) ? "&atrue" : "&cfalse"));
lore.add(Methods.formatText(config.getBoolean(fKey) ? "&atrue" : "&cfalse"));
} else if (config.isString(fKey)) {
item.setType(Material.PAPER);
lore.add(TextComponent.formatText("&9" + config.getString(fKey)));
lore.add(Methods.formatText("&9" + config.getString(fKey)));
} else if (config.isInt(fKey)) {
item.setType(Material.WATCH);
lore.add(TextComponent.formatText("&5" + config.getInt(fKey)));
lore.add(Methods.formatText("&5" + config.getInt(fKey)));
}
if (defs.getConfig().contains(fKey)) {
@ -160,7 +156,7 @@ public class SettingsManager implements Listener {
Matcher m = SETTINGS_PATTERN.matcher(text);
while (m.find()) {
if (m.end() != text.length() || m.group().length() != 0)
lore.add(TextComponent.formatText("&7" + m.group()));
lore.add(Methods.formatText("&7" + m.group()));
}
}

View File

@ -1,7 +1,7 @@
name: UltimateStacker
description: UltimateStacker
version: maven-version-number
depend: [Arconix]
soft-depend: [Arconix]
main: com.songoda.ultimatestacker.UltimateStacker
author: songoda
commands: