Fixed chances for commands and money.

This commit is contained in:
Brianna O'Keefe 2019-02-14 09:33:07 -05:00
parent 8d56a71486
commit 18531addad
2 changed files with 17 additions and 2 deletions

View File

@ -219,10 +219,10 @@ public class Kit {
for (String line : is.getItemMeta().getLore()) {
command.append(line);
}
list.add(new KitItem(ChatColor.stripColor(command.toString())));
list.add(new KitItem(is, ChatColor.stripColor(command.toString())));
} else if (is.getType() == Material.PAPER && ChatColor.stripColor(is.getItemMeta().getDisplayName()).endsWith("Money")) {
String money = is.getItemMeta().getLore().get(0);
list.add(new KitItem(ChatColor.stripColor(money)));
list.add(new KitItem(is, ChatColor.stripColor(money)));
} else {
list.add(new KitItem(is));
}

View File

@ -36,6 +36,21 @@ public class KitItem {
}
}
public KitItem(ItemStack item, String line) {
ItemStack itemStack = item.clone();
ItemMeta meta = itemStack.getItemMeta();
if (itemStack.hasItemMeta() && meta.hasDisplayName() && meta.getDisplayName().contains(";")) {
translateLine(meta.getDisplayName());
}
if (line.startsWith(UltimateKits.getInstance().getConfig().getString("Main.Currency Symbol"))) {
this.content = new KitContentEconomy(Double.parseDouble(line.substring(1).trim()));
} else if (line.startsWith("/")) {
this.content = new KitContentCommand(line.substring(1));
} else {
this.content = new KitContentItem(UltimateKits.getInstance().getItemSerializer().deserializeLegacyItemStack(line));
}
}
public KitItem(ItemStack item) {
ItemStack itemStack = item.clone();
ItemMeta meta = itemStack.getItemMeta();