From cd26b925846a8fdb78697b659081c6d4435f40f8 Mon Sep 17 00:00:00 2001 From: Esophose Date: Sat, 3 Aug 2019 15:36:24 -0600 Subject: [PATCH] Non-material differences --- plugin-modules/Core/pom.xml | 2 +- .../handlers/AutoSpawnVariableHandler.java | 6 ++-- .../handlers/BossDisplayNameHandler.java | 4 ++- .../handlers/BossShopPriceHandler.java | 4 ++- .../handlers/SkillDisplayNameHandler.java | 4 ++- .../epicbosses/managers/BossPanelManager.java | 6 ++-- .../epicbosses/panel/AddItemsPanel.java | 2 -- .../skills/custom/PotionSkillEditorPanel.java | 11 ++++++++ .../epicbosses/utils/EntityFinder.java | 1 + .../epicbosses/utils/PotionEffectFinder.java | 3 ++ .../entity/handlers/IllusionerHandler.java | 28 +++++++++++++++++++ .../utils/itemstack/ItemStackConverter.java | 15 +--------- .../utils/itemstack/ItemStackUtils.java | 5 ++-- .../itemstack/holder/ItemStackHolder.java | 4 +-- .../songoda/epicbosses/utils/panel/Panel.java | 24 ++++++++++------ .../utils/panel/builder/PanelBuilder.java | 5 +++- 16 files changed, 83 insertions(+), 41 deletions(-) create mode 100644 plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/IllusionerHandler.java diff --git a/plugin-modules/Core/pom.xml b/plugin-modules/Core/pom.xml index ad33df0..0668f83 100644 --- a/plugin-modules/Core/pom.xml +++ b/plugin-modules/Core/pom.xml @@ -71,7 +71,7 @@ - ${parent.artifactId}-${plugin.version} (Legacy) + ${parent.artifactId}-${plugin.version} org.apache.maven.plugins diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/AutoSpawnVariableHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/AutoSpawnVariableHandler.java index 22f066a..2aa4c55 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/AutoSpawnVariableHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/AutoSpawnVariableHandler.java @@ -1,5 +1,6 @@ package com.songoda.epicbosses.handlers; +import com.songoda.epicbosses.CustomBosses; import com.songoda.epicbosses.api.BossAPI; import com.songoda.epicbosses.autospawns.AutoSpawn; import com.songoda.epicbosses.autospawns.types.IntervalSpawnElement; @@ -9,6 +10,7 @@ import com.songoda.epicbosses.utils.ServerUtils; import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler; import lombok.Getter; import lombok.Setter; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -67,7 +69,7 @@ public abstract class AutoSpawnVariableHandler implements IHandler { } if(input == null) { - finish(); + Bukkit.getScheduler().scheduleSyncDelayedTask(CustomBosses.get(), AutoSpawnVariableHandler.this::finish); return; } @@ -78,7 +80,7 @@ public abstract class AutoSpawnVariableHandler implements IHandler { event.setCancelled(true); setHandled(true); - finish(); + Bukkit.getScheduler().scheduleSyncDelayedTask(CustomBosses.get(), AutoSpawnVariableHandler.this::finish); } }; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossDisplayNameHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossDisplayNameHandler.java index 2c1b092..9e0724d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossDisplayNameHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossDisplayNameHandler.java @@ -1,5 +1,6 @@ package com.songoda.epicbosses.handlers; +import com.songoda.epicbosses.CustomBosses; import com.songoda.epicbosses.entity.BossEntity; import com.songoda.epicbosses.entity.elements.EntityStatsElement; import com.songoda.epicbosses.managers.files.BossesFileManager; @@ -8,6 +9,7 @@ import com.songoda.epicbosses.utils.ServerUtils; import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler; import lombok.Getter; import lombok.Setter; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -68,7 +70,7 @@ public class BossDisplayNameHandler implements IHandler { event.setCancelled(true); setHandled(true); - finish(); + Bukkit.getScheduler().scheduleSyncDelayedTask(CustomBosses.get(), BossDisplayNameHandler.this::finish); } }; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossShopPriceHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossShopPriceHandler.java index 437f315..95794db 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossShopPriceHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossShopPriceHandler.java @@ -1,5 +1,6 @@ package com.songoda.epicbosses.handlers; +import com.songoda.epicbosses.CustomBosses; import com.songoda.epicbosses.api.BossAPI; import com.songoda.epicbosses.entity.BossEntity; import com.songoda.epicbosses.managers.files.BossesFileManager; @@ -10,6 +11,7 @@ import com.songoda.epicbosses.utils.ServerUtils; import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler; import lombok.Getter; import lombok.Setter; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -72,7 +74,7 @@ public class BossShopPriceHandler implements IHandler { setHandled(true); Message.Boss_Edit_PriceSet.msg(getPlayer(), BossAPI.getBossEntityName(getBossEntity()), NumberUtils.get().formatDouble(amount)); - finish(); + Bukkit.getScheduler().scheduleSyncDelayedTask(CustomBosses.get(), BossShopPriceHandler.this::finish); } else { Message.Boss_Edit_Price.msg(getPlayer(), BossAPI.getBossEntityName(getBossEntity())); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/SkillDisplayNameHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/SkillDisplayNameHandler.java index 9972d00..8dc2b2e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/SkillDisplayNameHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/SkillDisplayNameHandler.java @@ -1,5 +1,6 @@ package com.songoda.epicbosses.handlers; +import com.songoda.epicbosses.CustomBosses; import com.songoda.epicbosses.managers.files.SkillsFileManager; import com.songoda.epicbosses.skills.Skill; import com.songoda.epicbosses.utils.IHandler; @@ -7,6 +8,7 @@ import com.songoda.epicbosses.utils.ServerUtils; import com.songoda.epicbosses.utils.panel.base.IVariablePanelHandler; import lombok.Getter; import lombok.Setter; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -64,7 +66,7 @@ public class SkillDisplayNameHandler implements IHandler { event.setCancelled(true); setHandled(true); - finish(); + Bukkit.getScheduler().scheduleSyncDelayedTask(CustomBosses.get(), SkillDisplayNameHandler.this::finish); } }; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossPanelManager.java b/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossPanelManager.java index 8467bdc..225d7e1 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossPanelManager.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/managers/BossPanelManager.java @@ -805,15 +805,15 @@ public class BossPanelManager implements ILoadable, IReloadable { private void loadAddItemsMenu() { PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("AddItemsMenu")); - this.addItemsBuilder = panelBuilder.cloneBuilder(); - this.customItemAddItemsMenu = new AddItemsPanel(this, panelBuilder.cloneBuilder(), this.customBosses, new CustomItemsAddItemsParentPanelHandler(this)); + this.addItemsBuilder = this.addItemsBuilder.cloneBuilder(); + this.customItemAddItemsMenu = new AddItemsPanel(this, panelBuilder, this.customBosses, new CustomItemsAddItemsParentPanelHandler(this)); } private void reloadAddItemsMenu() { PanelBuilder panelBuilder = new PanelBuilder(this.customBosses.getEditor().getConfigurationSection("AddItemsMenu")); this.addItemsBuilder = this.addItemsBuilder.cloneBuilder(); - this.customItemAddItemsMenu.initializePanel(panelBuilder.cloneBuilder()); + this.customItemAddItemsMenu.initializePanel(panelBuilder); } //--------------------------------------------- diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/AddItemsPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/AddItemsPanel.java index 84e61aa..f6ecd4d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/AddItemsPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/AddItemsPanel.java @@ -123,7 +123,6 @@ public class AddItemsPanel extends PanelHandler { } openParentPanel(player); -// this.bossPanelManager.getCustomItems().openFor(player); }; } @@ -142,7 +141,6 @@ public class AddItemsPanel extends PanelHandler { } openParentPanel(player); -// this.bossPanelManager.getCustomItems().openFor(player); }; } } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/PotionSkillEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/PotionSkillEditorPanel.java index 5d4b9e4..e1b539e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/PotionSkillEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/PotionSkillEditorPanel.java @@ -11,6 +11,7 @@ import com.songoda.epicbosses.skills.types.PotionSkillElement; import com.songoda.epicbosses.utils.NumberUtils; import com.songoda.epicbosses.utils.ServerUtils; import com.songoda.epicbosses.utils.StringUtils; +import com.songoda.epicbosses.utils.Versions; import com.songoda.epicbosses.utils.itemstack.ItemStackUtils; import com.songoda.epicbosses.utils.panel.Panel; import com.songoda.epicbosses.utils.panel.base.handlers.VariablePanelHandler; @@ -18,10 +19,12 @@ import com.songoda.epicbosses.utils.panel.builder.PanelBuilder; import com.songoda.epicbosses.utils.panel.builder.PanelBuilderCounter; import com.songoda.epicbosses.utils.potion.PotionEffectConverter; import com.songoda.epicbosses.utils.potion.holder.PotionEffectHolder; +import com.songoda.epicbosses.utils.version.VersionHandler; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.PotionMeta; +import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionType; @@ -107,6 +110,14 @@ public class PotionSkillEditorPanel extends VariablePanelHandler { ItemStack itemStack = new ItemStack(Material.POTION); PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta(); + if (new VersionHandler().getVersion().isHigherThanOrEqualTo(Versions.v1_13_R1)) { + PotionType potionType = PotionType.getByEffect(PotionEffectType.BLINDNESS); + + if (potionType == null) potionType = PotionType.WATER; + + potionMeta.setBasePotionData(new PotionData(potionType)); + } + potionMeta.addCustomEffect(potionEffect, true); itemStack.setItemMeta(potionMeta); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/EntityFinder.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/EntityFinder.java index 3255acf..17b4b0d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/EntityFinder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/EntityFinder.java @@ -30,6 +30,7 @@ public enum EntityFinder { EVOKER("Evoker", new EvokerHandler(), "evoker"), VEX("Vex", new VexHandler(), "vex"), VINDICATOR("Vindicator", new VindicatorHandler(), "vindicator"), + ILLUSIONER("Illusioner", new IllusionerHandler(), "illusioner"), CREEPER("Creeper", EntityType.CREEPER, "creeper"), SKELETON("Skeleton", EntityType.SKELETON, "skeleton"), SPIDER("Spider", EntityType.SPIDER, "spider"), diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/PotionEffectFinder.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/PotionEffectFinder.java index c9daa8d..881a2e5 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/PotionEffectFinder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/PotionEffectFinder.java @@ -17,8 +17,10 @@ public enum PotionEffectFinder { Absorption("Absorption", PotionEffectType.ABSORPTION), Blindness("Blind", PotionEffectType.BLINDNESS, "blindness", "cantsee"), + ConduitPower("ConduitPower", PotionEffectType.getByName("CONDUIT_POWER"), "conduit", "conduit_power"), Confusion("Confusion", PotionEffectType.CONFUSION, "nausea"), Resistance("Resistance", PotionEffectType.DAMAGE_RESISTANCE, "damage_resistance", "res", "damageresistance"), + DolphinsGrace("DolphinsGrace", PotionEffectType.getByName("DOLPHINS_GRACE"), "grace", "dolphins_grace"), Haste("Haste", PotionEffectType.FAST_DIGGING, "fast_digging", "haste"), Fire_Resistance("FireResistance", PotionEffectType.FIRE_RESISTANCE, "fire_resistance", "fire_resist", "fire_res", "fireresist", "fireres"), Glowing("Glowing", PotionEffectType.getByName("GLOWING")), @@ -36,6 +38,7 @@ public enum PotionEffectFinder { Regen("regen", PotionEffectType.REGENERATION, "regeneration"), Saturation("Saturation", PotionEffectType.SATURATION, "saturated"), Slow("Slow", PotionEffectType.SLOW, "tank"), + SlowFalling("SlowFalling", PotionEffectType.getByName("SLOW_FALLING"), "slow_falling"), MiningFatigue("MiningFatigue", PotionEffectType.SLOW_DIGGING, "slow_digging"), Speed("Speed", PotionEffectType.SPEED, "fast", "fastboots"), Unluck("Unlucky", PotionEffectType.getByName("UNLUCK"), "unluck", "notlucky"), diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/IllusionerHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/IllusionerHandler.java new file mode 100644 index 0000000..8e81c9c --- /dev/null +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/IllusionerHandler.java @@ -0,0 +1,28 @@ +package com.songoda.epicbosses.utils.entity.handlers; + +import com.songoda.epicbosses.utils.Versions; +import com.songoda.epicbosses.utils.entity.ICustomEntityHandler; +import com.songoda.epicbosses.utils.version.VersionHandler; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +/** + * - * @author Charles Cullen + * - * @version 1.0.0 + * - * @since 01-Jul-18 + * - + */ +public class IllusionerHandler implements ICustomEntityHandler { + + private VersionHandler versionHandler = new VersionHandler(); + + @Override + public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { + if (this.versionHandler.getVersion().isLessThan(Versions.v1_11_R1)) { + throw new NullPointerException("This feature is only implemented in version 1.11 and above of Minecraft."); + } + + return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.ILLUSIONER); + } +} \ No newline at end of file diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackConverter.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackConverter.java index 4f1d71d..5c89d81 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackConverter.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackConverter.java @@ -40,7 +40,6 @@ public class ItemStackConverter implements IReplaceableConverter lore = null, enchants = null; - Boolean isGlowing = null; if(durability == 0) { durability = null; @@ -87,14 +86,7 @@ public class ItemStackConverter implements IReplaceableConverter lore = itemStackHolder.getLore(), enchants = itemStackHolder.getEnchants(); - Boolean isGlowing = itemStackHolder.getIsGlowing(); if(type.contains(":")) { durability = Short.valueOf(type.split(":")[1]); @@ -174,10 +165,6 @@ public class ItemStackConverter implements IReplaceableConverter 1) { itemStack.setAmount(amount); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackUtils.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackUtils.java index d26fc25..b8ade9c 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackUtils.java @@ -3,7 +3,6 @@ package com.songoda.epicbosses.utils.itemstack; import com.songoda.epicbosses.utils.NumberUtils; import com.songoda.epicbosses.utils.ServerUtils; import com.songoda.epicbosses.utils.StringUtils; -//import com.songoda.epicbosses.utils.factory.NbtFactory; import com.songoda.epicbosses.utils.itemstack.enchants.GlowEnchant; import com.songoda.epicbosses.utils.itemstack.holder.ItemStackHolder; import org.bukkit.ChatColor; @@ -341,9 +340,9 @@ public class ItemStackUtils { List enchants = (List) configurationSection.getList("enchants", null); String skullOwner = configurationSection.getString("skullOwner", null); Short spawnerId = (Short) configurationSection.get("spawnerId", null); - Boolean isGlowing = (Boolean) configurationSection.get("isGlowing", null); + //Boolean isGlowing = (Boolean) configurationSection.get("isGlowing", null); - return new ItemStackHolder(amount, type, durability, name, lore, enchants, skullOwner, spawnerId, isGlowing); + return new ItemStackHolder(amount, type, durability, name, lore, enchants, skullOwner, spawnerId); } public static boolean isItemStackSame(ItemStack itemStack1, ItemStack itemStack2) { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/holder/ItemStackHolder.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/holder/ItemStackHolder.java index bbb60da..a3aa356 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/holder/ItemStackHolder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/holder/ItemStackHolder.java @@ -20,9 +20,8 @@ public class ItemStackHolder { @Expose @Getter private List enchants; @Expose @Getter private String skullOwner; @Expose @Getter private Short spawnerId; - @Expose @Getter private Boolean isGlowing; - public ItemStackHolder(Integer amount, String type, Short durability, String name, List lore, List enchants, String skullOwner, Short spawnerId, Boolean isGlowing) { + public ItemStackHolder(Integer amount, String type, Short durability, String name, List lore, List enchants, String skullOwner, Short spawnerId) { this.amount = amount; this.type = type; this.durability = durability; @@ -31,7 +30,6 @@ public class ItemStackHolder { this.enchants = enchants; this.skullOwner = skullOwner; this.spawnerId = spawnerId; - this.isGlowing = isGlowing; } } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/Panel.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/Panel.java index a5968bd..5a05536 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/Panel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/Panel.java @@ -61,6 +61,7 @@ public class Panel implements Listener, ICloneable { @Getter private PanelBuilderSettings panelBuilderSettings; @Getter private PanelBuilderCounter panelBuilderCounter; @Getter private Sound clickSound = null; + @Getter private String title; @Getter private Inventory inventory; @Getter private int viewers = 0; @@ -86,7 +87,8 @@ public class Panel implements Listener, ICloneable { throw new UnsupportedOperationException("Inventory size must be a multiple of 9 or 5"); } - this.inventory = size % 9 == 0 ? Bukkit.createInventory(null, size, StringUtils.get().translateColor(title)) : Bukkit.createInventory(null, InventoryType.HOPPER, StringUtils.get().translateColor(title)); + this.title = StringUtils.get().translateColor(title); + this.inventory = size % 9 == 0 ? Bukkit.createInventory(null, size, this.title) : Bukkit.createInventory(null, InventoryType.HOPPER, StringUtils.get().translateColor(title)); this.connectedInventories.add(this.inventory); PANELS.add(this); } @@ -95,19 +97,24 @@ public class Panel implements Listener, ICloneable { * Creates a Panel with the specified arguments * * @param inventory - Panel inventory + * @param title - Panel title */ - public Panel(Inventory inventory) { - this(inventory, null, null); + public Panel(Inventory inventory, String title) { + this(inventory, title, null, null); } /** * Creates a Panel with the specified arguments * * @param inventory - Panel inventory + * @param title - Panel title + * @param panelBuilderSettings - Panel builder settings + * @param panelBuilderCounter - Panel builder counter */ - public Panel(Inventory inventory, PanelBuilderSettings panelBuilderSettings, PanelBuilderCounter panelBuilderCounter) { + public Panel(Inventory inventory, String title, PanelBuilderSettings panelBuilderSettings, PanelBuilderCounter panelBuilderCounter) { Bukkit.getPluginManager().registerEvents(this, PLUGIN); + this.title = StringUtils.get().translateColor(title); this.inventory = inventory; this.panelBuilderSettings = panelBuilderSettings; this.panelBuilderCounter = panelBuilderCounter; @@ -477,11 +484,10 @@ public class Panel implements Listener, ICloneable { * @return Inventory instance of the cloned inventory */ public Inventory cloneInventory() { - Inventory thisInventory = getInventory(); - Inventory newInventory = Bukkit.createInventory(thisInventory.getHolder(), thisInventory.getSize(), thisInventory.getTitle()); + Inventory newInventory = Bukkit.createInventory(this.inventory.getHolder(), this.inventory.getSize(), this.title); - for(int i = 0; i < thisInventory.getSize(); i++) { - ItemStack itemStack = thisInventory.getItem(i); + for(int i = 0; i < this.inventory.getSize(); i++) { + ItemStack itemStack = this.inventory.getItem(i); if(itemStack == null) continue; @@ -495,7 +501,7 @@ public class Panel implements Listener, ICloneable { @Override public Panel clone() { - Panel panel = new Panel(this.inventory.getTitle(), this.inventory.getSize()); + Panel panel = new Panel(this.title, this.inventory.getSize()); panel.targettedSlotActions.putAll(this.targettedSlotActions); panel.allSlotActions.addAll(this.allSlotActions); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilder.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilder.java index 3c1b16d..5fb2b88 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilder.java @@ -30,6 +30,7 @@ public class PanelBuilder { @Getter private PanelBuilderCounter panelBuilderCounter; + private String title; private Inventory inventory; private int size = 0; @@ -62,6 +63,7 @@ public class PanelBuilder { public PanelBuilder cloneBuilder() { PanelBuilder panelBuilder = new PanelBuilder(this.configurationSection, this.replaceMap); + panelBuilder.title = this.title; panelBuilder.inventory = this.inventory; panelBuilder.size = this.size; panelBuilder.defaultSlots.addAll(this.defaultSlots); @@ -73,7 +75,7 @@ public class PanelBuilder { public Panel getPanel() { build(); - Panel panel = new Panel(this.inventory, this.panelBuilderSettings, this.panelBuilderCounter); + Panel panel = new Panel(this.inventory, this.title, this.panelBuilderSettings, this.panelBuilderCounter); Map itemStackMap = this.panelBuilderCounter.getItemStacks(); Map clickActionMap = this.panelBuilderCounter.getClickActions(); @@ -96,6 +98,7 @@ public class PanelBuilder { ConfigurationSection itemSection = configurationSection.contains("Items")? configurationSection.getConfigurationSection("Items") : null; name = replace(name); + this.title = name; this.inventory = Bukkit.createInventory(null, slots, name); if(itemSection != null) {