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>
|
<groupId>com.craftaro</groupId>
|
||||||
<artifactId>UltimateKits</artifactId>
|
<artifactId>UltimateKits</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>3.0.2</version>
|
||||||
|
|
||||||
<name>UltimateKits</name>
|
<name>UltimateKits</name>
|
||||||
<description>Creating and displaying your server's kits has never been easier</description>
|
<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()) {
|
if (itemStack.getItemMeta().hasLore()) {
|
||||||
ItemMeta meta = itemStack.getItemMeta();
|
ItemMeta meta = itemStack.getItemMeta();
|
||||||
List<String> newLore = new ArrayList<>();
|
List<String> newLore = new ArrayList<>();
|
||||||
for (String line : meta.getLore()) {
|
for (String line : meta.getLore())
|
||||||
if (line.contains("Moveable")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (line.equals(TextUtils.formatText("&8----"))) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
newLore.add(line);
|
newLore.add(line);
|
||||||
}
|
|
||||||
meta.setLore(newLore);
|
meta.setLore(newLore);
|
||||||
itemStack.setItemMeta(meta);
|
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()),
|
setButton(0, 0, GuiUtils.createButtonItem(buttonItem, plugin.getLocale().getMessage("interface.button.back").getMessage()),
|
||||||
event -> event.player.closeInventory());
|
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
|
// purchase button
|
||||||
if (buyable) {
|
if (buyable) {
|
||||||
|
|
|
@ -80,14 +80,10 @@ public class Kit implements Cloneable {
|
||||||
List<KitItem> list = new ArrayList<>();
|
List<KitItem> list = new ArrayList<>();
|
||||||
for (ItemStack is : items) {
|
for (ItemStack is : items) {
|
||||||
if (is != null && is.getType() != Material.AIR) {
|
if (is != null && is.getType() != Material.AIR) {
|
||||||
|
|
||||||
if (is.getItemMeta().hasLore()) {
|
if (is.getItemMeta().hasLore()) {
|
||||||
ItemMeta meta = is.getItemMeta();
|
ItemMeta meta = is.getItemMeta();
|
||||||
List<String> newLore = new ArrayList<>();
|
List<String> newLore = new ArrayList<>();
|
||||||
for (String line : meta.getLore()) {
|
for (String line : meta.getLore()) {
|
||||||
if (line.contains("Moveable")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (line.equals(TextUtils.formatText("&8----"))) {
|
if (line.equals(TextUtils.formatText("&8----"))) {
|
||||||
break;
|
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.
|
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();
|
ItemStack stack = moveable ? item.getMoveableItem() : item.getItem();
|
||||||
if (preview) {
|
if (preview) {
|
||||||
stack = item.getItemForDisplay();
|
stack = item.getItemForDisplay(this);
|
||||||
}
|
}
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -243,6 +239,15 @@ public class Kit implements Cloneable {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean all100Percent() {
|
||||||
|
for (KitItem item : this.contents) {
|
||||||
|
if (item.getChance() != 100) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getDisplayItem() {
|
public ItemStack getDisplayItem() {
|
||||||
return this.displayItem;
|
return this.displayItem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,18 +195,12 @@ public class KitItem implements Cloneable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ItemStack item = this.content.getItemForDisplay().clone();
|
ItemStack item = this.content.getItemForDisplay().clone();
|
||||||
ItemMeta meta = item.getItemMeta();
|
NBTItem nbtItem = new NBTItem(item);
|
||||||
List<String> lore = meta.hasLore() && meta.getLore().get(0).equals(TextUtils.formatText("&8&oMoveable"))
|
nbtItem.setBoolean("moveable", true);
|
||||||
? new ArrayList<>() : new ArrayList<>(Collections.singletonList(TextUtils.formatText("&8&oMoveable")));
|
return compileOptions(nbtItem.getItem());
|
||||||
if (meta.hasLore()) {
|
|
||||||
lore.addAll(meta.getLore());
|
|
||||||
}
|
|
||||||
meta.setLore(lore);
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
return compileOptions(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItemForDisplay() {
|
public ItemStack getItemForDisplay(Kit kit) {
|
||||||
if (this.content == null) {
|
if (this.content == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +219,7 @@ public class KitItem implements Cloneable {
|
||||||
meta.setLore(Collections.singletonList(ChatColor.translateAlternateColorCodes('&', this.displayLore)));
|
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;
|
ArrayDeque<String> lore;
|
||||||
if (meta.hasLore()) {
|
if (meta.hasLore()) {
|
||||||
lore = new ArrayDeque<>(meta.getLore());
|
lore = new ArrayDeque<>(meta.getLore());
|
||||||
|
|
|
@ -42,6 +42,7 @@ interface:
|
||||||
next: '&7Next Page'
|
next: '&7Next Page'
|
||||||
last: '&7Last Page'
|
last: '&7Last Page'
|
||||||
clickeco: '&7Click to buy for &a%price%&7.'
|
clickeco: '&7Click to buy for &a%price%&7.'
|
||||||
|
edit: '&6Edit'
|
||||||
preview:
|
preview:
|
||||||
title: '&9Previewing kit: &8%kit%'
|
title: '&9Previewing kit: &8%kit%'
|
||||||
yesno:
|
yesno:
|
||||||
|
|
Loading…
Reference in New Issue