diff --git a/api-modules/FactionsM/pom.xml b/api-modules/FactionsM/pom.xml index 4d8b346..8032fe1 100644 --- a/api-modules/FactionsM/pom.xml +++ b/api-modules/FactionsM/pom.xml @@ -5,7 +5,7 @@ EpicBosses com.songoda.epicbosses - 1.2.9 + 1.2.10 ../../pom.xml 4.0.0 diff --git a/api-modules/FactionsOne/pom.xml b/api-modules/FactionsOne/pom.xml index 1f61a83..205a7df 100644 --- a/api-modules/FactionsOne/pom.xml +++ b/api-modules/FactionsOne/pom.xml @@ -5,7 +5,7 @@ EpicBosses com.songoda.epicbosses - 1.2.9 + 1.2.10 ../../pom.xml 4.0.0 diff --git a/api-modules/FactionsUUID/pom.xml b/api-modules/FactionsUUID/pom.xml index 429cc16..ab2d452 100644 --- a/api-modules/FactionsUUID/pom.xml +++ b/api-modules/FactionsUUID/pom.xml @@ -5,7 +5,7 @@ EpicBosses com.songoda.epicbosses - 1.2.9 + 1.2.10 ../../pom.xml 4.0.0 diff --git a/api-modules/LegacyFactions/pom.xml b/api-modules/LegacyFactions/pom.xml index 2288a22..1b25276 100644 --- a/api-modules/LegacyFactions/pom.xml +++ b/api-modules/LegacyFactions/pom.xml @@ -5,7 +5,7 @@ EpicBosses com.songoda.epicbosses - 1.2.9 + 1.2.10 ../../pom.xml 4.0.0 diff --git a/plugin-modules/Core/pom.xml b/plugin-modules/Core/pom.xml index 299aa43..5a8dfa9 100644 --- a/plugin-modules/Core/pom.xml +++ b/plugin-modules/Core/pom.xml @@ -5,7 +5,7 @@ EpicBosses com.songoda.epicbosses - 1.2.9 + 1.2.10 ../../pom.xml 4.0.0 diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandCreate.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandCreate.java index df85405..ac0c059 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandCreate.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandCreate.java @@ -6,7 +6,6 @@ import com.songoda.epicbosses.container.BossEntityContainer; import com.songoda.epicbosses.entity.BossEntity; import com.songoda.epicbosses.utils.EntityFinder; import com.songoda.epicbosses.utils.Message; -import com.songoda.epicbosses.utils.Permission; import com.songoda.epicbosses.utils.StringUtils; import org.bukkit.command.CommandSender; import org.bukkit.entity.EntityType; @@ -88,7 +87,7 @@ public class CommandCreate extends AbstractCommand { @Override public String getSyntax() { - return "create <[>name> "; + return "create "; } @Override diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandDebug.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandDebug.java index 719061f..9142ee7 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandDebug.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandDebug.java @@ -3,7 +3,6 @@ package com.songoda.epicbosses.commands; import com.songoda.core.commands.AbstractCommand; import com.songoda.epicbosses.managers.DebugManager; import com.songoda.epicbosses.utils.Message; -import com.songoda.epicbosses.utils.Permission; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -47,16 +46,16 @@ public class CommandDebug extends AbstractCommand { @Override public String getPermissionNode() { - return "boss.reload"; + return "boss.debug"; } @Override public String getSyntax() { - return "reload"; + return "debug"; } @Override public String getDescription() { - return "Reloads EpicBosses and its configurations."; + return "Toggles on and off the debug mode."; } } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandGiveEgg.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandGiveEgg.java index b38fd62..85907a5 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandGiveEgg.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandGiveEgg.java @@ -105,7 +105,7 @@ public class CommandGiveEgg extends AbstractCommand { @Override public String getSyntax() { - return "giveegg [amount]"; + return "give/giveegg [amount]"; } @Override diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandList.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandList.java index 2c81c89..21708cb 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandList.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandList.java @@ -39,7 +39,7 @@ public class CommandList extends AbstractCommand { @Override public String getSyntax() { - return "list"; + return "list/show"; } @Override diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandMenu.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandMenu.java index cb02167..5576216 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandMenu.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandMenu.java @@ -34,12 +34,12 @@ public class CommandMenu extends AbstractCommand { @Override public String getPermissionNode() { - return "menu"; + return "boss.menu"; } @Override public String getSyntax() { - return null; + return "menu"; } @Override diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandShop.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandShop.java index fd79b30..7578dc6 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandShop.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandShop.java @@ -46,7 +46,7 @@ public class CommandShop extends AbstractCommand { @Override public String getSyntax() { - return "shop"; + return "shop/buy/store"; } @Override diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandSkills.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandSkills.java index 3bc1eeb..cb740c5 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandSkills.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/CommandSkills.java @@ -39,7 +39,7 @@ public class CommandSkills extends AbstractCommand { @Override public String getSyntax() { - return "skills"; + return "skills/skill"; } @Override diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveBossHolder.java b/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveBossHolder.java index cf4a132..c3aaeab 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveBossHolder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveBossHolder.java @@ -111,12 +111,12 @@ public class ActiveBossHolder implements IActiveHolder { .filter(e -> e.getValue() != null && e.getValue().getWorld().isChunkLoaded( e.getValue().getLocation().getBlockX() >> 4, e.getValue().getLocation().getBlockZ() >> 4)) - .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())); + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); // remove everything we can - toRemove.entrySet().stream().forEach(e -> { - e.getValue().remove(); - livingEntityMap.remove(e.getKey()); + toRemove.forEach((key, value) -> { + value.remove(); + livingEntityMap.remove(key); }); return true; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/listeners/after/BossDeathListener.java b/plugin-modules/Core/src/com/songoda/epicbosses/listeners/after/BossDeathListener.java index 31a012a..9891de6 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/listeners/after/BossDeathListener.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/listeners/after/BossDeathListener.java @@ -160,6 +160,7 @@ public class BossDeathListener implements Listener { DeadBossHolder deadBossHolder = new DeadBossHolder(bossEntity, location, mapOfDamage, mapOfPercent); BossDeathEvent bossDeathEvent = new BossDeathEvent(activeBossHolder, autoSpawn); DropTable dropTable = this.bossEntityManager.getDropTable(bossEntity); + this.bossEntityManager.removeActiveBossHolder(activeBossHolder); if (dropTable == null) { Debug.FAILED_TO_FIND_DROP_TABLE.debug(activeBossHolder.getName(), bossEntity.getDrops().getDropTable()); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/listeners/during/BossDamageListener.java b/plugin-modules/Core/src/com/songoda/epicbosses/listeners/during/BossDamageListener.java index d0d299c..61e8df6 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/listeners/during/BossDamageListener.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/listeners/during/BossDamageListener.java @@ -13,9 +13,7 @@ import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; /** @@ -45,22 +43,25 @@ public class BossDamageListener implements Listener { double damage = event.getDamage(); Player player = null; - if (activeBossHolder == null) { + if (activeBossHolder == null && livingEntity.getCustomName() != null) { // Check to see if this was a boss and respawn it if so. - String convert = TextUtils.convertFromInvisibleString(livingEntity.getCustomName()); - if (convert.startsWith("BOSS:")) { + String convert = livingEntity.getCustomName(); + + if (convert.toUpperCase().startsWith(TextUtils.convertToInvisibleString("BOSS:"))) { String name = convert.split(":")[1]; BossEntity bossEntity = bossesFileManager.getBossEntity(name); - bossEntityManager.createActiveBossHolder(bossEntity, livingEntity.getLocation(), name, null); + if (bossEntity != null) { + bossEntityManager.createActiveBossHolder(bossEntity, livingEntity.getLocation(), name, null); - if (livingEntity.isInsideVehicle() && livingEntity.getVehicle() != null) - livingEntity.getVehicle().remove(); + if (livingEntity.isInsideVehicle() && livingEntity.getVehicle() != null) + livingEntity.getVehicle().remove(); - if (livingEntity.getPassenger() != null) - livingEntity.getPassenger().remove(); + if (livingEntity.getPassenger() != null) + livingEntity.getPassenger().remove(); - livingEntity.remove(); + livingEntity.remove(); + } } return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/managers/files/BossesFileManager.java b/plugin-modules/Core/src/com/songoda/epicbosses/managers/files/BossesFileManager.java index 8f20196..0775dea 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/managers/files/BossesFileManager.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/managers/files/BossesFileManager.java @@ -3,10 +3,13 @@ package com.songoda.epicbosses.managers.files; import com.songoda.epicbosses.EpicBosses; import com.songoda.epicbosses.container.BossEntityContainer; import com.songoda.epicbosses.entity.BossEntity; +import com.songoda.epicbosses.entity.elements.EntityStatsElement; +import com.songoda.epicbosses.entity.elements.MainStatsElement; import com.songoda.epicbosses.file.BossesFileHandler; import com.songoda.epicbosses.utils.ILoadable; import com.songoda.epicbosses.utils.IReloadable; import com.songoda.epicbosses.utils.ISavable; +import com.songoda.epicbosses.utils.StringUtils; import java.io.File; import java.util.ArrayList; @@ -54,6 +57,15 @@ public class BossesFileManager implements ILoadable, ISavable, IReloadable { } public BossEntity getBossEntity(String name) { + for (Map.Entry entry : this.bossEntityContainer.getData().entrySet()) { + for (EntityStatsElement entityStatsElement : entry.getValue().getEntityStats()) { + MainStatsElement mainStatsElement = entityStatsElement.getMainStats(); + String customName = mainStatsElement.getDisplayName(); + System.out.println(name + " : " + StringUtils.get().translateColor(customName)); + if (StringUtils.get().translateColor(customName).equals(name)) + return entry.getValue(); + } + } return this.bossEntityContainer.getData().getOrDefault(name, null); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/mechanics/boss/NameMechanic.java b/plugin-modules/Core/src/com/songoda/epicbosses/mechanics/boss/NameMechanic.java index 384f906..507156b 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/mechanics/boss/NameMechanic.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/mechanics/boss/NameMechanic.java @@ -10,6 +10,8 @@ import com.songoda.epicbosses.mechanics.IBossMechanic; import com.songoda.epicbosses.utils.StringUtils; import org.bukkit.entity.LivingEntity; +import java.util.Arrays; + /** * @author Charles Cullen * @version 1.0.0 @@ -29,7 +31,7 @@ public class NameMechanic implements IBossMechanic { if (livingEntity == null || customName == null) continue; String formattedName = StringUtils.get().translateColor(customName); - livingEntity.setCustomName(TextUtils.convertToInvisibleString("BOSS:" + activeBossHolder.getName() + ":") + formattedName); + livingEntity.setCustomName(TextUtils.convertToInvisibleString("BOSS:") + formattedName); livingEntity.setCustomNameVisible(true); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/Permission.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/Permission.java deleted file mode 100644 index 369eaee..0000000 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/Permission.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.songoda.epicbosses.utils; - -import org.bukkit.command.CommandSender; - -/** - * @author Charles Cullen - * @version 1.0.0 - * @since 04-Oct-18 - */ -public enum Permission { - - admin("boss.admin"), - create("boss.create"), - debug("boss.debug"), - edit("boss.edit"), - give("boss.give"), - help("boss.help"), - nearby("boss.nearby"), - reload("boss.reload"), - shop("boss.shop"), - time("boss.time"); - - private String permission; - - Permission(String permission) { - this.permission = permission; - } - - public boolean hasPermission(CommandSender commandSender) { - return commandSender.hasPermission(getPermission()); - } - - public String getPermission() { - return this.permission; - } -} diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/StringUtils.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/StringUtils.java index ef13281..ca9c453 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/StringUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/StringUtils.java @@ -35,6 +35,16 @@ public class StringUtils { return messages; } + public String toNum(String s) { + StringBuilder t = new StringBuilder(); + for (int i = 0; i < s.length(); ++i) { + char ch = s.charAt(i); + int n = (int)ch - (int)'a' + 1; + t.append(n); + } + return t.toString(); + } + public String stripColor(String string) { return ChatColor.stripColor(string); } diff --git a/plugin-modules/FactionHelper/pom.xml b/plugin-modules/FactionHelper/pom.xml index f712444..1369b66 100644 --- a/plugin-modules/FactionHelper/pom.xml +++ b/plugin-modules/FactionHelper/pom.xml @@ -5,7 +5,7 @@ EpicBosses com.songoda.epicbosses - 1.2.9 + 1.2.10 ../../pom.xml 4.0.0 diff --git a/pom.xml b/pom.xml index d704b4f..5a141d7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.songoda.epicbosses EpicBosses pom - 1.2.9 + 1.2.10 api-modules/FactionsM @@ -16,7 +16,7 @@ - 1.2.9 + 1.2.10 EpicBosses com.songoda.epicbosses.EpicBosses Songoda @@ -48,6 +48,10 @@ private http://repo.songoda.com/artifactory/private/ + + public + http://repo.songoda.com/artifactory/public/ +