Compare commits
4 Commits
94b9832f3a
...
0bb306f90f
Author | SHA1 | Date |
---|---|---|
Brianna O'Keefe | 0bb306f90f | |
Brianna O'Keefe | 635d20f8d9 | |
Brianna O'Keefe | d8bcb4b9a7 | |
Brianna O'Keefe | 3680f9bfec |
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>com.craftaro</groupId>
|
||||
<artifactId>UltimateKits</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.0.2</version>
|
||||
|
||||
<name>UltimateKits</name>
|
||||
<description>Creating and displaying your server's kits has never been easier</description>
|
||||
|
|
|
@ -377,15 +377,8 @@ public class KitEditorGui extends DoubleGui {
|
|||
if (itemStack.getItemMeta().hasLore()) {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
List<String> newLore = new ArrayList<>();
|
||||
for (String line : meta.getLore()) {
|
||||
if (line.contains("Moveable")) {
|
||||
continue;
|
||||
}
|
||||
if (line.equals(TextUtils.formatText("&8----"))) {
|
||||
break;
|
||||
}
|
||||
for (String line : meta.getLore())
|
||||
newLore.add(line);
|
||||
}
|
||||
meta.setLore(newLore);
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
|
|
|
@ -94,6 +94,15 @@ public class PreviewKitGui extends Gui {
|
|||
setButton(0, 0, GuiUtils.createButtonItem(buttonItem, plugin.getLocale().getMessage("interface.button.back").getMessage()),
|
||||
event -> event.player.closeInventory());
|
||||
}
|
||||
|
||||
if (player.hasPermission("ultimatekits.admin")) {
|
||||
setButton(0, 4, GuiUtils.createButtonItem(XMaterial.REDSTONE,
|
||||
plugin.getLocale().getMessage("interface.button.edit").getMessage()),
|
||||
event -> {
|
||||
exit();
|
||||
plugin.getGuiManager().showGUI(player, new KitEditorGui(plugin, player, kit, this));
|
||||
});
|
||||
}
|
||||
}
|
||||
// purchase button
|
||||
if (buyable) {
|
||||
|
|
|
@ -80,14 +80,10 @@ public class Kit implements Cloneable {
|
|||
List<KitItem> list = new ArrayList<>();
|
||||
for (ItemStack is : items) {
|
||||
if (is != null && is.getType() != Material.AIR) {
|
||||
|
||||
if (is.getItemMeta().hasLore()) {
|
||||
ItemMeta meta = is.getItemMeta();
|
||||
List<String> newLore = new ArrayList<>();
|
||||
for (String line : meta.getLore()) {
|
||||
if (line.contains("Moveable")) {
|
||||
continue;
|
||||
}
|
||||
if (line.equals(TextUtils.formatText("&8----"))) {
|
||||
break;
|
||||
}
|
||||
|
@ -126,7 +122,7 @@ public class Kit implements Cloneable {
|
|||
if ((!item.getSerialized().startsWith("/") && !item.getSerialized().startsWith(Settings.CURRENCY_SYMBOL.getString())) || commands) { //ToDO: I doubt this is correct.
|
||||
ItemStack stack = moveable ? item.getMoveableItem() : item.getItem();
|
||||
if (preview) {
|
||||
stack = item.getItemForDisplay();
|
||||
stack = item.getItemForDisplay(this);
|
||||
}
|
||||
if (stack == null) {
|
||||
continue;
|
||||
|
@ -243,6 +239,15 @@ public class Kit implements Cloneable {
|
|||
return this.name;
|
||||
}
|
||||
|
||||
public boolean all100Percent() {
|
||||
for (KitItem item : this.contents) {
|
||||
if (item.getChance() != 100) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getDisplayItem() {
|
||||
return this.displayItem;
|
||||
}
|
||||
|
|
|
@ -195,18 +195,12 @@ public class KitItem implements Cloneable {
|
|||
return null;
|
||||
}
|
||||
ItemStack item = this.content.getItemForDisplay().clone();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = meta.hasLore() && meta.getLore().get(0).equals(TextUtils.formatText("&8&oMoveable"))
|
||||
? new ArrayList<>() : new ArrayList<>(Collections.singletonList(TextUtils.formatText("&8&oMoveable")));
|
||||
if (meta.hasLore()) {
|
||||
lore.addAll(meta.getLore());
|
||||
}
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
return compileOptions(item);
|
||||
NBTItem nbtItem = new NBTItem(item);
|
||||
nbtItem.setBoolean("moveable", true);
|
||||
return compileOptions(nbtItem.getItem());
|
||||
}
|
||||
|
||||
public ItemStack getItemForDisplay() {
|
||||
public ItemStack getItemForDisplay(Kit kit) {
|
||||
if (this.content == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -225,7 +219,7 @@ public class KitItem implements Cloneable {
|
|||
meta.setLore(Collections.singletonList(ChatColor.translateAlternateColorCodes('&', this.displayLore)));
|
||||
}
|
||||
|
||||
if (UltimateKits.getInstance().getConfig().getBoolean("Main.Display Chance In Preview")) {
|
||||
if (UltimateKits.getInstance().getConfig().getBoolean("Main.Display Chance In Preview") && !kit.all100Percent()) {
|
||||
ArrayDeque<String> lore;
|
||||
if (meta.hasLore()) {
|
||||
lore = new ArrayDeque<>(meta.getLore());
|
||||
|
|
|
@ -42,6 +42,7 @@ interface:
|
|||
next: '&7Next Page'
|
||||
last: '&7Last Page'
|
||||
clickeco: '&7Click to buy for &a%price%&7.'
|
||||
edit: '&6Edit'
|
||||
preview:
|
||||
title: '&9Previewing kit: &8%kit%'
|
||||
yesno:
|
||||
|
|
Loading…
Reference in New Issue