From 5b8c5f47e0bb233d8aff346b3125535f44a5f9c8 Mon Sep 17 00:00:00 2001 From: Brianna Date: Mon, 7 Oct 2019 17:25:54 -0400 Subject: [PATCH] Formatting clean up. --- api-modules/FactionsM/pom.xml | 4 +- .../src/utils/factions/FactionsM.java | 44 +-- api-modules/FactionsOne/pom.xml | 4 +- .../src/utils/factions/FactionsOne.java | 46 +-- api-modules/FactionsUUID/pom.xml | 4 +- .../src/utils/factions/FactionsUUID.java | 34 +-- api-modules/LegacyFactions/pom.xml | 4 +- .../src/utils/factions/LegacyFactions.java | 18 +- plugin-modules/Core/pom.xml | 4 +- .../com/songoda/epicbosses/api/BossAPI.java | 89 +++--- .../songoda/epicbosses/commands/BossCmd.java | 4 +- .../commands/boss/BossCreateCmd.java | 8 +- .../commands/boss/BossDebugCmd.java | 6 +- .../commands/boss/BossDropTableCmd.java | 4 +- .../epicbosses/commands/boss/BossEditCmd.java | 8 +- .../commands/boss/BossGiveEggCmd.java | 14 +- .../epicbosses/commands/boss/BossHelpCmd.java | 6 +- .../epicbosses/commands/boss/BossInfoCmd.java | 6 +- .../commands/boss/BossItemsCmd.java | 4 +- .../commands/boss/BossKillAllCmd.java | 8 +- .../epicbosses/commands/boss/BossListCmd.java | 4 +- .../epicbosses/commands/boss/BossMenuCmd.java | 4 +- .../commands/boss/BossNearbyCmd.java | 12 +- .../epicbosses/commands/boss/BossNewCmd.java | 48 +-- .../commands/boss/BossReloadCmd.java | 3 +- .../epicbosses/commands/boss/BossShopCmd.java | 6 +- .../commands/boss/BossSkillsCmd.java | 4 +- .../commands/boss/BossSpawnCmd.java | 12 +- .../epicbosses/commands/boss/BossTimeCmd.java | 8 +- .../songoda/epicbosses/entity/BossEntity.java | 77 +++-- .../epicbosses/entity/MinionEntity.java | 8 +- .../entity/elements/CommandsElement.java | 8 +- .../entity/elements/DropsElement.java | 16 +- .../entity/elements/EntityStatsElement.java | 24 +- .../entity/elements/EquipmentElement.java | 24 +- .../entity/elements/HandsElement.java | 8 +- .../entity/elements/MainStatsElement.java | 24 +- .../entity/elements/MessagesElement.java | 16 +- .../elements/OnDeathMessageElement.java | 24 +- .../elements/OnSpawnMessageElement.java | 8 +- .../entity/elements/SkillsElement.java | 16 +- .../entity/elements/TauntElement.java | 16 +- .../epicbosses/events/BossDamageEvent.java | 6 +- .../epicbosses/events/BossDeathEvent.java | 6 +- .../epicbosses/events/BossSkillEvent.java | 6 +- .../epicbosses/events/BossSpawnEvent.java | 6 +- .../epicbosses/events/PreBossDeathEvent.java | 6 +- .../epicbosses/events/PreBossSkillEvent.java | 6 +- .../epicbosses/events/PreBossSpawnEvent.java | 6 +- .../events/PreBossSpawnItemEvent.java | 6 +- .../epicbosses/file/AutoSpawnFileHandler.java | 5 +- .../epicbosses/file/BossesFileHandler.java | 5 +- .../epicbosses/file/CommandsFileHandler.java | 8 +- .../epicbosses/file/DropTableFileHandler.java | 5 +- .../epicbosses/file/ItemStackFileHandler.java | 5 +- .../epicbosses/file/MessagesFileHandler.java | 8 +- .../epicbosses/file/MinionsFileHandler.java | 5 +- .../epicbosses/file/SkillsFileHandler.java | 5 +- .../handlers/BossShopPriceHandler.java | 8 +- .../droptable/GetDropTableCommand.java | 2 +- .../droptable/GetDropTableItemStack.java | 4 +- .../AutoSpawnLocationVariableHandler.java | 2 +- .../epicbosses/holder/ActiveBossHolder.java | 16 +- .../epicbosses/holder/ActiveMinionHolder.java | 23 +- .../ActiveIntervalAutoSpawnHolder.java | 30 +- .../epicbosses/panel/AddItemsPanel.java | 16 +- .../epicbosses/panel/AutoSpawnsPanel.java | 23 +- .../epicbosses/panel/CustomBossesPanel.java | 17 +- .../epicbosses/panel/CustomItemsPanel.java | 17 +- .../epicbosses/panel/CustomSkillsPanel.java | 15 +- .../epicbosses/panel/DropTablePanel.java | 9 +- .../panel/EntityTypeEditorPanel.java | 13 +- .../epicbosses/panel/MainMenuPanel.java | 20 +- .../songoda/epicbosses/panel/ShopPanel.java | 15 +- .../AutoSpawnCustomSettingsEditorPanel.java | 23 +- .../AutoSpawnEntitiesEditorPanel.java | 15 +- .../AutoSpawnSpecialSettingsEditorPanel.java | 26 +- .../autospawns/AutoSpawnTypeEditorPanel.java | 2 +- .../autospawns/MainAutoSpawnEditorPanel.java | 8 +- .../panel/bosses/BossListEditorPanel.java | 4 +- .../panel/bosses/BossShopEditorPanel.java | 6 +- .../panel/bosses/DropsEditorPanel.java | 13 +- .../panel/bosses/DropsMainEditorPanel.java | 14 +- .../panel/bosses/MainBossEditPanel.java | 4 +- .../panel/bosses/SkillListEditorPanel.java | 13 +- .../panel/bosses/SkillMainEditorPanel.java | 20 +- .../panel/bosses/SpawnItemEditorPanel.java | 15 +- .../bosses/StatisticMainEditorPanel.java | 22 +- .../panel/bosses/TargetingEditorPanel.java | 6 +- .../bosses/commands/OnDeathCommandEditor.java | 17 +- .../bosses/commands/OnSpawnCommandEditor.java | 17 +- .../bosses/equipment/BootsEditorPanel.java | 2 +- .../equipment/ChestplateEditorPanel.java | 2 +- .../bosses/equipment/HelmetEditorPanel.java | 2 +- .../bosses/equipment/LeggingsEditorPanel.java | 2 +- .../bosses/text/DeathTextEditorPanel.java | 36 +-- .../bosses/text/SpawnTextEditorPanel.java | 20 +- .../bosses/text/TauntTextEditorPanel.java | 38 +-- .../droptables/MainDropTableEditorPanel.java | 6 +- .../DropTableNewRewardEditorPanel.java | 9 +- .../DropTableRewardMainEditorPanel.java | 12 +- .../DropTableRewardsListEditorPanel.java | 11 +- .../drop/DropDropTableMainEditorPanel.java | 20 +- .../types/give/GiveRewardMainEditPanel.java | 36 +-- .../give/GiveRewardPositionListPanel.java | 13 +- .../give/GiveRewardRewardsListPanel.java | 17 +- .../commands/GiveCommandNewRewardPanel.java | 16 +- .../commands/GiveCommandRewardListPanel.java | 11 +- .../GiveCommandRewardMainEditPanel.java | 12 +- .../spray/SprayDropTableMainEditorPanel.java | 34 +-- .../ItemStackSubListPanelHandler.java | 15 +- .../panel/handlers/ListCommandListEditor.java | 15 +- .../panel/handlers/ListMessageListEditor.java | 15 +- .../handlers/SingleMessageListEditor.java | 15 +- .../panel/skills/MainSkillEditorPanel.java | 34 +-- .../custom/CommandSkillEditorPanel.java | 11 +- .../skills/custom/CustomSkillEditorPanel.java | 22 +- .../skills/custom/GroupSkillEditorPanel.java | 21 +- .../skills/custom/PotionSkillEditorPanel.java | 8 +- .../commands/CommandListSkillEditorPanel.java | 21 +- .../commands/ModifyCommandEditorPanel.java | 22 +- .../custom/CustomSkillTypeEditorPanel.java | 15 +- .../custom/MaterialTypeEditorPanel.java | 15 +- .../custom/MinionSelectEditorPanel.java | 11 +- .../custom/SpecialSettingsEditorPanel.java | 13 +- .../CreatePotionEffectEditorPanel.java | 22 +- .../com/songoda/epicbosses/skills/Skill.java | 40 +-- .../songoda/epicbosses/skills/SkillMode.java | 22 +- .../epicbosses/skills/custom/Cage.java | 28 +- .../epicbosses/skills/custom/Disarm.java | 4 +- .../epicbosses/skills/custom/Fireball.java | 4 +- .../epicbosses/skills/custom/Grapple.java | 2 +- .../epicbosses/skills/custom/Insidious.java | 2 +- .../epicbosses/skills/custom/Knockback.java | 2 +- .../skills/custom/cage/CageLocationData.java | 19 +- .../skills/custom/cage/CagePlayerData.java | 14 +- .../elements/CustomCageSkillElement.java | 24 +- .../elements/CustomMinionSkillElement.java | 8 +- .../elements/SubCommandSkillElement.java | 8 +- .../elements/SubCustomSkillElement.java | 12 +- .../skills/types/CommandSkillElement.java | 8 +- .../skills/types/GroupSkillElement.java | 2 +- .../skills/types/PotionSkillElement.java | 8 +- .../com/songoda/epicbosses/utils/Debug.java | 22 +- .../epicbosses/utils/EnchantFinder.java | 14 +- .../epicbosses/utils/EntityFinder.java | 22 +- .../songoda/epicbosses/utils/MapUtils.java | 8 +- .../com/songoda/epicbosses/utils/Message.java | 131 ++++---- .../epicbosses/utils/MessageUtils.java | 14 +- .../songoda/epicbosses/utils/NumberUtils.java | 14 +- .../songoda/epicbosses/utils/ObjectUtils.java | 2 +- .../epicbosses/utils/PotionEffectFinder.java | 12 +- .../songoda/epicbosses/utils/RandomUtils.java | 8 +- .../epicbosses/utils/ReflectionUtil.java | 12 +- .../songoda/epicbosses/utils/ServerUtils.java | 10 +- .../songoda/epicbosses/utils/StringUtils.java | 36 +-- .../adapters/PotionEffectTypeAdapter.java | 2 +- .../utils/command/CommandService.java | 23 +- .../utils/command/SubCommandService.java | 4 +- .../utils/command/attributes/Alias.java | 2 +- .../utils/command/attributes/Description.java | 2 +- .../utils/command/attributes/Name.java | 2 +- .../command/attributes/NoPermission.java | 2 +- .../utils/command/attributes/Permission.java | 2 +- .../utils/command/attributes/Suggest.java | 2 +- .../utils/dependencies/ASkyblockHelper.java | 2 +- .../utils/entity/handlers/CatHandler.java | 2 +- .../utils/entity/handlers/DrownedHandler.java | 2 +- .../entity/handlers/ElderGuardianHandler.java | 2 +- .../entity/handlers/EndermiteHandler.java | 2 +- .../utils/entity/handlers/EvokerHandler.java | 2 +- .../utils/entity/handlers/FishHandler.java | 2 +- .../utils/entity/handlers/FoxHandler.java | 2 +- .../entity/handlers/KillerBunnyHandler.java | 2 +- .../utils/entity/handlers/PandaHandler.java | 2 +- .../utils/entity/handlers/ParrotHandler.java | 2 +- .../entity/handlers/PolarBearHandler.java | 3 +- .../utils/entity/handlers/RavagerHandler.java | 3 +- .../utils/entity/handlers/ShulkerHandler.java | 2 +- .../entity/handlers/StraySkeletonHandler.java | 5 +- .../utils/entity/handlers/TurtleHandler.java | 2 +- .../utils/entity/handlers/VexHandler.java | 1 - .../entity/handlers/VillagerHandler.java | 2 +- .../handlers/WitherSkeletonHandler.java | 2 +- .../epicbosses/utils/file/FileUtils.java | 8 +- .../utils/file/reader/SpigotYmlReader.java | 8 +- .../utils/itemstack/ItemStackConverter.java | 50 ++-- .../itemstack/ItemStackHolderConverter.java | 2 +- .../utils/itemstack/MaterialUtils.java | 4 +- .../converters/EnchantConverter.java | 8 +- .../converters/MaterialConverter.java | 4 +- .../songoda/epicbosses/utils/panel/Panel.java | 283 +++++++++--------- .../panel/base/handlers/BasePanelHandler.java | 3 +- .../utils/panel/builder/PanelBuilder.java | 44 +-- .../panel/builder/PanelBuilderCounter.java | 6 +- .../panel/builder/PanelBuilderSettings.java | 10 +- .../utils/potion/PotionEffectConverter.java | 12 +- .../converters/PotionEffectTypeConverter.java | 6 +- .../potion/holder/PotionEffectHolder.java | 16 +- .../utils/target/TargetHandler.java | 3 +- .../epicbosses/utils/time/TimeUnit.java | 48 +-- .../epicbosses/utils/time/TimeUtil.java | 44 +-- plugin-modules/FactionHelper/pom.xml | 4 +- pom.xml | 4 +- 204 files changed, 1502 insertions(+), 1472 deletions(-) diff --git a/api-modules/FactionsM/pom.xml b/api-modules/FactionsM/pom.xml index 7fb43b9..2258409 100644 --- a/api-modules/FactionsM/pom.xml +++ b/api-modules/FactionsM/pom.xml @@ -1,6 +1,6 @@ - EpicBosses diff --git a/api-modules/FactionsM/src/utils/factions/FactionsM.java b/api-modules/FactionsM/src/utils/factions/FactionsM.java index 4ba4ee1..2453d43 100644 --- a/api-modules/FactionsM/src/utils/factions/FactionsM.java +++ b/api-modules/FactionsM/src/utils/factions/FactionsM.java @@ -24,15 +24,15 @@ public class FactionsM implements IFactionHelper { Faction mp2Fac = mp2.getFaction(); Rel relation = mp1.getRelationTo(mp2); - if(ChatColor.stripColor(mp2Fac.getName()).equalsIgnoreCase("Wilderness")) return false; - if(relation == Rel.ENEMY) return false; - if(relation == Rel.NEUTRAL) return false; - if(relation == Rel.ALLY) return true; - if(relation == Rel.TRUCE) return false; - if(relation == Rel.LEADER) return true; - if(relation == Rel.OFFICER) return true; - if(relation == Rel.MEMBER) return true; - if(relation == Rel.RECRUIT) return true; + if (ChatColor.stripColor(mp2Fac.getName()).equalsIgnoreCase("Wilderness")) return false; + if (relation == Rel.ENEMY) return false; + if (relation == Rel.NEUTRAL) return false; + if (relation == Rel.ALLY) return true; + if (relation == Rel.TRUCE) return false; + if (relation == Rel.LEADER) return true; + if (relation == Rel.OFFICER) return true; + if (relation == Rel.MEMBER) return true; + if (relation == Rel.RECRUIT) return true; return false; } @@ -43,15 +43,15 @@ public class FactionsM implements IFactionHelper { Faction locFac = BoardColl.get().getFactionAt(PS.valueOf(location)); Rel relation = mp1Fac.getRelationTo(locFac); - if(ChatColor.stripColor(locFac.getName()).equalsIgnoreCase("Wilderness")) return true; - if(relation == Rel.ENEMY) return false; - if(relation == Rel.NEUTRAL) return false; - if(relation == Rel.ALLY) return true; - if(relation == Rel.TRUCE) return true; - if(relation == Rel.LEADER) return true; - if(relation == Rel.OFFICER) return true; - if(relation == Rel.MEMBER) return true; - if(relation == Rel.RECRUIT) return true; + if (ChatColor.stripColor(locFac.getName()).equalsIgnoreCase("Wilderness")) return true; + if (relation == Rel.ENEMY) return false; + if (relation == Rel.NEUTRAL) return false; + if (relation == Rel.ALLY) return true; + if (relation == Rel.TRUCE) return true; + if (relation == Rel.LEADER) return true; + if (relation == Rel.OFFICER) return true; + if (relation == Rel.MEMBER) return true; + if (relation == Rel.RECRUIT) return true; return false; } @@ -59,7 +59,7 @@ public class FactionsM implements IFactionHelper { public boolean isInWarzone(Location location) { Faction locFac = BoardColl.get().getFactionAt(PS.valueOf(location)); - if(ChatColor.stripColor(locFac.getName()).equalsIgnoreCase("WarZone")) return true; + if (ChatColor.stripColor(locFac.getName()).equalsIgnoreCase("WarZone")) return true; return false; } @@ -68,9 +68,9 @@ public class FactionsM implements IFactionHelper { Faction locFac = BoardColl.get().getFactionAt(PS.valueOf(location)); String string = ChatColor.stripColor(locFac.getName()); - if(string.equalsIgnoreCase("WarZone")) return false; - if(string.equalsIgnoreCase("SafeZone")) return false; - if(string.equalsIgnoreCase("Wilderness")) return false; + if (string.equalsIgnoreCase("WarZone")) return false; + if (string.equalsIgnoreCase("SafeZone")) return false; + if (string.equalsIgnoreCase("Wilderness")) return false; return true; } } diff --git a/api-modules/FactionsOne/pom.xml b/api-modules/FactionsOne/pom.xml index db6871c..eb96e29 100644 --- a/api-modules/FactionsOne/pom.xml +++ b/api-modules/FactionsOne/pom.xml @@ -1,6 +1,6 @@ - EpicBosses diff --git a/api-modules/FactionsOne/src/utils/factions/FactionsOne.java b/api-modules/FactionsOne/src/utils/factions/FactionsOne.java index 53836fa..8d5bf8d 100644 --- a/api-modules/FactionsOne/src/utils/factions/FactionsOne.java +++ b/api-modules/FactionsOne/src/utils/factions/FactionsOne.java @@ -23,16 +23,16 @@ public class FactionsOne implements IFactionHelper { Faction zFac = FPlayers.i.get(b).getFaction(); Rel r = pFac.getRelationTo(zFac); - if(ChatColor.stripColor(zFac.getId()).equalsIgnoreCase("Wilderness")) return false; - if(a == b) return true; - if(r.equals(Rel.ALLY)) return true; - if(r.equals(Rel.TRUCE)) return true; - if(r.equals(Rel.LEADER)) return true; - if(r.equals(Rel.MEMBER)) return true; - if(r.equals(Rel.OFFICER)) return true; - if(r.equals(Rel.RECRUIT)) return true; - if(r.equals(Rel.ENEMY)) return false; - if(r.equals(Rel.NEUTRAL)) return false; + if (ChatColor.stripColor(zFac.getId()).equalsIgnoreCase("Wilderness")) return false; + if (a == b) return true; + if (r.equals(Rel.ALLY)) return true; + if (r.equals(Rel.TRUCE)) return true; + if (r.equals(Rel.LEADER)) return true; + if (r.equals(Rel.MEMBER)) return true; + if (r.equals(Rel.OFFICER)) return true; + if (r.equals(Rel.RECRUIT)) return true; + if (r.equals(Rel.ENEMY)) return false; + if (r.equals(Rel.NEUTRAL)) return false; return false; } @@ -43,15 +43,15 @@ public class FactionsOne implements IFactionHelper { Faction locFac = Board.getFactionAt(fLoc); Rel r = pFac.getRelationTo(locFac); - if(ChatColor.stripColor(locFac.getComparisonTag()).equalsIgnoreCase("Wilderness")) return false; - if(r.equals(Rel.ALLY)) return true; - if(r.equals(Rel.TRUCE)) return true; - if(r.equals(Rel.LEADER)) return true; - if(r.equals(Rel.MEMBER)) return true; - if(r.equals(Rel.OFFICER)) return true; - if(r.equals(Rel.RECRUIT)) return true; - if(r.equals(Rel.ENEMY)) return false; - if(r.equals(Rel.NEUTRAL)) return false; + if (ChatColor.stripColor(locFac.getComparisonTag()).equalsIgnoreCase("Wilderness")) return false; + if (r.equals(Rel.ALLY)) return true; + if (r.equals(Rel.TRUCE)) return true; + if (r.equals(Rel.LEADER)) return true; + if (r.equals(Rel.MEMBER)) return true; + if (r.equals(Rel.OFFICER)) return true; + if (r.equals(Rel.RECRUIT)) return true; + if (r.equals(Rel.ENEMY)) return false; + if (r.equals(Rel.NEUTRAL)) return false; return false; } @@ -60,7 +60,7 @@ public class FactionsOne implements IFactionHelper { FLocation fLoc = new FLocation(location); Faction locFac = Board.getFactionAt(fLoc); - if(ChatColor.stripColor(locFac.getComparisonTag()).equalsIgnoreCase("WarZone")) return true; + if (ChatColor.stripColor(locFac.getComparisonTag()).equalsIgnoreCase("WarZone")) return true; return false; } @@ -70,9 +70,9 @@ public class FactionsOne implements IFactionHelper { Faction locFac = Board.getFactionAt(fLoc); String string = ChatColor.stripColor(locFac.getComparisonTag()); - if(string.equalsIgnoreCase("WarZone")) return false; - if(string.equalsIgnoreCase("SafeZone")) return false; - if(string.equalsIgnoreCase("Wilderness")) return false; + if (string.equalsIgnoreCase("WarZone")) return false; + if (string.equalsIgnoreCase("SafeZone")) return false; + if (string.equalsIgnoreCase("Wilderness")) return false; return true; } } diff --git a/api-modules/FactionsUUID/pom.xml b/api-modules/FactionsUUID/pom.xml index 90d8396..de88390 100644 --- a/api-modules/FactionsUUID/pom.xml +++ b/api-modules/FactionsUUID/pom.xml @@ -1,6 +1,6 @@ - EpicBosses diff --git a/api-modules/FactionsUUID/src/utils/factions/FactionsUUID.java b/api-modules/FactionsUUID/src/utils/factions/FactionsUUID.java index 4e6e916..ae1d001 100644 --- a/api-modules/FactionsUUID/src/utils/factions/FactionsUUID.java +++ b/api-modules/FactionsUUID/src/utils/factions/FactionsUUID.java @@ -23,13 +23,13 @@ public class FactionsUUID implements IFactionHelper { Faction zFac = FPlayers.getInstance().getByPlayer(b).getFaction(); Relation r = pFac.getRelationTo(zFac); - if(ChatColor.stripColor(zFac.getId()).equalsIgnoreCase("Wilderness")) return false; - if(a == b) return true; - if(r.isEnemy()) return false; - if(r.isNeutral()) return false; - if(r.isTruce()) return true; - if(r.isAlly()) return true; - if(r.isMember()) return true; + if (ChatColor.stripColor(zFac.getId()).equalsIgnoreCase("Wilderness")) return false; + if (a == b) return true; + if (r.isEnemy()) return false; + if (r.isNeutral()) return false; + if (r.isTruce()) return true; + if (r.isAlly()) return true; + if (r.isMember()) return true; return false; } @@ -40,12 +40,12 @@ public class FactionsUUID implements IFactionHelper { Faction locFac = Board.getInstance().getFactionAt(fLoc); Relation r = pFac.getRelationTo(locFac); - if(ChatColor.stripColor(locFac.getComparisonTag()).equalsIgnoreCase("Wilderness")) return false; - if(r.isEnemy()) return false; - if(r.isNeutral()) return false; - if(r.isTruce()) return true; - if(r.isAlly()) return true; - if(r.isMember()) return true; + if (ChatColor.stripColor(locFac.getComparisonTag()).equalsIgnoreCase("Wilderness")) return false; + if (r.isEnemy()) return false; + if (r.isNeutral()) return false; + if (r.isTruce()) return true; + if (r.isAlly()) return true; + if (r.isMember()) return true; return false; } @@ -54,7 +54,7 @@ public class FactionsUUID implements IFactionHelper { FLocation fLoc = new FLocation(location); Faction locFac = Board.getInstance().getFactionAt(fLoc); - if(ChatColor.stripColor(locFac.getComparisonTag()).equalsIgnoreCase("WarZone")) return true; + if (ChatColor.stripColor(locFac.getComparisonTag()).equalsIgnoreCase("WarZone")) return true; return false; } @@ -64,9 +64,9 @@ public class FactionsUUID implements IFactionHelper { Faction locFac = Board.getInstance().getFactionAt(fLoc); String string = ChatColor.stripColor(locFac.getComparisonTag()); - if(string.equalsIgnoreCase("WarZone")) return false; - if(string.equalsIgnoreCase("SafeZone")) return false; - if(string.equalsIgnoreCase("Wilderness")) return false; + if (string.equalsIgnoreCase("WarZone")) return false; + if (string.equalsIgnoreCase("SafeZone")) return false; + if (string.equalsIgnoreCase("Wilderness")) return false; return true; } } diff --git a/api-modules/LegacyFactions/pom.xml b/api-modules/LegacyFactions/pom.xml index 2a8cd1a..0cea1b1 100644 --- a/api-modules/LegacyFactions/pom.xml +++ b/api-modules/LegacyFactions/pom.xml @@ -1,6 +1,6 @@ - EpicBosses diff --git a/api-modules/LegacyFactions/src/utils/factions/LegacyFactions.java b/api-modules/LegacyFactions/src/utils/factions/LegacyFactions.java index 93de9ae..8997141 100644 --- a/api-modules/LegacyFactions/src/utils/factions/LegacyFactions.java +++ b/api-modules/LegacyFactions/src/utils/factions/LegacyFactions.java @@ -22,13 +22,13 @@ public class LegacyFactions implements IFactionHelper { Faction bFac = FPlayerColl.get(b).getFaction(); Relation relation = aFac.getRelationTo(bFac); - if(bFac.isWilderness()) return false; - if(aFac == bFac) return true; - if(relation.isEnemy()) return false; - if(relation.isNeutral()) return false; - if(relation.isTruce()) return true; - if(relation.isAlly()) return true; - if(relation.isMember()) return true; + if (bFac.isWilderness()) return false; + if (aFac == bFac) return true; + if (relation.isEnemy()) return false; + if (relation.isNeutral()) return false; + if (relation.isTruce()) return true; + if (relation.isAlly()) return true; + if (relation.isMember()) return true; return false; } @@ -38,8 +38,8 @@ public class LegacyFactions implements IFactionHelper { Faction bFac = Board.get().getFactionAt(Locality.of(location)); Relation relation = aFac.getRelationTo(bFac); - if(bFac.isWilderness() || relation.isEnemy() || relation.isNeutral()) return false; - if(relation.isTruce() || relation.isAlly() || relation.isMember()) return true; + if (bFac.isWilderness() || relation.isEnemy() || relation.isNeutral()) return false; + if (relation.isTruce() || relation.isAlly() || relation.isMember()) return true; return false; } diff --git a/plugin-modules/Core/pom.xml b/plugin-modules/Core/pom.xml index 8364903..aa62cd0 100644 --- a/plugin-modules/Core/pom.xml +++ b/plugin-modules/Core/pom.xml @@ -1,6 +1,6 @@ - EpicBosses diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/api/BossAPI.java b/plugin-modules/Core/src/com/songoda/epicbosses/api/BossAPI.java index 53a0e45..97766ae 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/api/BossAPI.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/api/BossAPI.java @@ -56,14 +56,14 @@ public class BossAPI { * plugin instance so the methods can * pull variables in the main class to use * in their method. - * + *

* This should only ever be used in house and * never to be used by an outside party. * * @param plugin - the plugin instance. */ public BossAPI(EpicBosses plugin) { - if(PLUGIN != null) { + if (PLUGIN != null) { Debug.ATTEMPTED_TO_UPDATE_PLUGIN.debug(); return; } @@ -78,29 +78,30 @@ public class BossAPI { * using the BossAPI#createBaseBossEntity * method or by manually creating a BossEntity. * - * @param name - Name for the boss section. + * @param name - Name for the boss section. * @param bossEntity - The boss section. * @return false if it failed, true if it saved successfully. */ public static boolean registerBossEntity(String name, BossEntity bossEntity) { - if(name == null || bossEntity == null) return false; + if (name == null || bossEntity == null) return false; PLUGIN.getBossEntityContainer().saveData(name, bossEntity); PLUGIN.getBossesFileManager().save(); return true; } + /** * Used to register a Minion Entity into * the plugin after it has been created * using the BossAPI#createBaseMinionEntity * method or by manually creating a MinionEntity. * - * @param name - Name for the minion section. + * @param name - Name for the minion section. * @param minionEntity - The minion section. * @return false if it failed, true if it saved successfully. */ public static boolean registerMinionEntity(String name, MinionEntity minionEntity) { - if(name == null || minionEntity == null) return false; + if (name == null || minionEntity == null) return false; PLUGIN.getMinionEntityContainer().saveData(name, minionEntity); PLUGIN.getMinionsFileManager().save(); @@ -144,8 +145,8 @@ public class BossAPI { * @return name of the boss from the BossContainer or null if not found. */ public static String getBossEntityName(BossEntity bossEntity) { - for(Map.Entry entry : PLUGIN.getBossEntityContainer().getData().entrySet()) { - if(entry.getValue().equals(bossEntity)) { + for (Map.Entry entry : PLUGIN.getBossEntityContainer().getData().entrySet()) { + if (entry.getValue().equals(bossEntity)) { return entry.getKey(); } } @@ -172,8 +173,8 @@ public class BossAPI { * @return name of the skill from the SkillsFileManager or null if not found. */ public static String getSkillName(Skill skill) { - for(Map.Entry entry : PLUGIN.getSkillsFileManager().getSkillMap().entrySet()) { - if(entry.getValue().equals(skill)) return entry.getKey(); + for (Map.Entry entry : PLUGIN.getSkillsFileManager().getSkillMap().entrySet()) { + if (entry.getValue().equals(skill)) return entry.getKey(); } return null; @@ -187,8 +188,8 @@ public class BossAPI { * @return name of the skill from the SkillsFileManager or null if not found. */ public static String getAutoSpawnName(AutoSpawn autoSpawn) { - for(Map.Entry entry : PLUGIN.getAutoSpawnFileManager().getAutoSpawnMap().entrySet()) { - if(entry.getValue().equals(autoSpawn)) return entry.getKey(); + for (Map.Entry entry : PLUGIN.getAutoSpawnFileManager().getAutoSpawnMap().entrySet()) { + if (entry.getValue().equals(autoSpawn)) return entry.getKey(); } return null; @@ -202,8 +203,8 @@ public class BossAPI { * @return name of the dropTable from the DropTableFileManager or null if not found. */ public static String getDropTableName(DropTable dropTable) { - for(Map.Entry entry : PLUGIN.getDropTableFileManager().getDropTables().entrySet()) { - if(entry.getValue().equals(dropTable)) return entry.getKey(); + for (Map.Entry entry : PLUGIN.getDropTableFileManager().getDropTables().entrySet()) { + if (entry.getValue().equals(dropTable)) return entry.getKey(); } return null; @@ -217,8 +218,8 @@ public class BossAPI { * @return name of the minion from the MinionContainer or null if not found. */ public static String getMinionEntityName(MinionEntity minionEntity) { - for(Map.Entry entry : PLUGIN.getMinionEntityContainer().getData().entrySet()) { - if(entry.getValue().equals(minionEntity)) { + for (Map.Entry entry : PLUGIN.getMinionEntityContainer().getData().entrySet()) { + if (entry.getValue().equals(minionEntity)) { return entry.getKey(); } } @@ -227,15 +228,15 @@ public class BossAPI { } public static JsonObject createNewDropTableRewards(String type) { - if(type.equalsIgnoreCase("SPRAY")) { + if (type.equalsIgnoreCase("SPRAY")) { SprayTableElement sprayTableElement = new SprayTableElement(new HashMap<>(), false, 15, 15); return convertObjectToJsonObject(sprayTableElement); - } else if(type.equalsIgnoreCase("DROP")) { + } else if (type.equalsIgnoreCase("DROP")) { DropTableElement dropTableElement = new DropTableElement(new HashMap<>(), false, 15); return convertObjectToJsonObject(dropTableElement); - } else if(type.equalsIgnoreCase("GIVE")) { + } else if (type.equalsIgnoreCase("GIVE")) { GiveTableElement giveTableElement = new GiveTableElement(new HashMap<>()); return convertObjectToJsonObject(giveTableElement); @@ -248,19 +249,19 @@ public class BossAPI { JsonParser jsonParser = new JsonParser(); String jsonString; - if(type.equalsIgnoreCase("COMMAND")) { + if (type.equalsIgnoreCase("COMMAND")) { CommandSkillElement commandSkillElement = new CommandSkillElement(new ArrayList<>()); jsonString = BossesGson.get().toJson(commandSkillElement); - } else if(type.equalsIgnoreCase("POTION")) { + } else if (type.equalsIgnoreCase("POTION")) { PotionSkillElement potionSkillElement = new PotionSkillElement(new ArrayList<>()); jsonString = BossesGson.get().toJson(potionSkillElement); - } else if(type.equalsIgnoreCase("CUSTOM")) { + } else if (type.equalsIgnoreCase("CUSTOM")) { CustomSkillElement customSkillElement = new CustomSkillElement(new SubCustomSkillElement("", 0.0, null)); jsonString = BossesGson.get().toJson(customSkillElement); - } else if(type.equalsIgnoreCase("GROUP")) { + } else if (type.equalsIgnoreCase("GROUP")) { GroupSkillElement groupSkillElement = new GroupSkillElement(new ArrayList<>()); jsonString = BossesGson.get().toJson(groupSkillElement); @@ -295,7 +296,7 @@ public class BossAPI { * @return an instance of the drop table if successful */ public static Skill createBaseSkill(String name, String type, String mode) { - if(PLUGIN.getSkillsFileManager().getSkill(name) != null) { + if (PLUGIN.getSkillsFileManager().getSkill(name) != null) { Debug.SKILL_NAME_EXISTS.debug(name); return null; } @@ -310,12 +311,12 @@ public class BossAPI { * Used to create a new base drop table * with the specified arguments. * - * @param name - name of the drop table. + * @param name - name of the drop table. * @param dropType - drop table type. * @return an instance of the drop table if successful */ public static DropTable createBaseDropTable(String name, String dropType) { - if(PLUGIN.getDropTableFileManager().getDropTable(name) != null) { + if (PLUGIN.getDropTableFileManager().getDropTable(name) != null) { Debug.DROPTABLE_NAME_EXISTS.debug(name); return null; } @@ -323,15 +324,15 @@ public class BossAPI { JsonParser jsonParser = new JsonParser(); String jsonString; - if(dropType.equalsIgnoreCase("SPRAY")) { + if (dropType.equalsIgnoreCase("SPRAY")) { SprayTableElement sprayTableElement = new SprayTableElement(new HashMap<>(), false, 100, 10); jsonString = BossesGson.get().toJson(sprayTableElement); - } else if(dropType.equalsIgnoreCase("GIVE")) { + } else if (dropType.equalsIgnoreCase("GIVE")) { GiveTableElement giveTableElement = new GiveTableElement(new HashMap<>()); jsonString = BossesGson.get().toJson(giveTableElement); - } else if(dropType.equalsIgnoreCase("DROP")) { + } else if (dropType.equalsIgnoreCase("DROP")) { DropTableElement dropTableElement = new DropTableElement(new HashMap<>(), false, 10); jsonString = BossesGson.get().toJson(dropTableElement); @@ -353,7 +354,7 @@ public class BossAPI { * elements are filled in editing can be disabled * and the boss can be spawned. * - * @param name - boss name + * @param name - boss name * @param entityTypeInput - entity type * @return null if something went wrong, or the BossEntity that was created. */ @@ -361,7 +362,7 @@ public class BossAPI { String input = entityTypeInput.split(":")[0]; EntityFinder entityFinder = EntityFinder.get(input); - if(PLUGIN.getBossEntityContainer().exists(name)) { + if (PLUGIN.getBossEntityContainer().exists(name)) { Debug.BOSS_NAME_EXISTS.debug(name); return null; } @@ -399,7 +400,7 @@ public class BossAPI { * elements are filled in editing can be disabled * and the minion can be spawned in skills. * - * @param name - minion name + * @param name - minion name * @param entityTypeInput - entity type * @return null if something went wrong, or the MinionEntity that was created. */ @@ -407,7 +408,7 @@ public class BossAPI { String input = entityTypeInput.split(":")[0]; EntityFinder entityFinder = EntityFinder.get(input); - if(PLUGIN.getMinionEntityContainer().exists(name)) { + if (PLUGIN.getMinionEntityContainer().exists(name)) { Debug.MINION_NAME_EXISTS.debug(name); return null; } @@ -420,7 +421,7 @@ public class BossAPI { entityStatsElements.add(entityStatsElement); - MinionEntity minionEntity = new MinionEntity(true,entityStatsElements); + MinionEntity minionEntity = new MinionEntity(true, entityStatsElements); boolean result = PLUGIN.getMinionEntityContainer().saveData(name, minionEntity); if (!result) { @@ -441,7 +442,7 @@ public class BossAPI { * @return an instance of the auto spawn if successful */ public static AutoSpawn createBaseAutoSpawn(String name) { - if(PLUGIN.getAutoSpawnFileManager().getAutoSpawn(name) != null) { + if (PLUGIN.getAutoSpawnFileManager().getAutoSpawn(name) != null) { Debug.AUTOSPAWN_NAME_EXISTS.debug(name); return null; } @@ -461,13 +462,13 @@ public class BossAPI { * specified bossEntity. * * @param bossEntity - targetted BossEntity - * @param location - Location to spawn the boss. - * @param player - Player who spawned the boss. - * @param itemStack - The itemstack used to spawn the boss. + * @param location - Location to spawn the boss. + * @param player - Player who spawned the boss. + * @param itemStack - The itemstack used to spawn the boss. * @return ActiveBossHolder class with stored information */ public static ActiveBossHolder spawnNewBoss(BossEntity bossEntity, Location location, Player player, ItemStack itemStack, boolean customSpawnMessage) { - if(bossEntity.isEditing()) { + if (bossEntity.isEditing()) { Debug.ATTEMPTED_TO_SPAWN_WHILE_DISABLED.debug(); return null; } @@ -476,7 +477,7 @@ public class BossAPI { ActiveBossHolder activeBossHolder = PLUGIN.getBossEntityManager().createActiveBossHolder(bossEntity, location, name, player); - if(activeBossHolder == null) { + if (activeBossHolder == null) { Debug.FAILED_TO_CREATE_ACTIVE_BOSS_HOLDER.debug(); return null; } @@ -485,7 +486,7 @@ public class BossAPI { PreBossSpawnEvent preBossSpawnEvent; - if(player != null && itemStack != null) { + if (player != null && itemStack != null) { preBossSpawnEvent = new PreBossSpawnItemEvent(activeBossHolder, player, itemStack); } else { preBossSpawnEvent = new PreBossSpawnEvent(activeBossHolder); @@ -502,13 +503,13 @@ public class BossAPI { * bossEntity, under the activebossholder. * * @param activeBossHolder - targeted active boss - * @param skill - the skill from the skills.json + * @param skill - the skill from the skills.json */ public static void spawnNewMinion(ActiveBossHolder activeBossHolder, Skill skill) { - if(skill.getType().equalsIgnoreCase("CUSTOM")) { + if (skill.getType().equalsIgnoreCase("CUSTOM")) { CustomSkillElement customSkillElement = PLUGIN.getBossSkillManager().getCustomSkillElement(skill); - if(customSkillElement.getCustom().getType().equalsIgnoreCase("MINIONS")) { + if (customSkillElement.getCustom().getType().equalsIgnoreCase("MINIONS")) { CustomMinionSkillElement customMinionSkillElement = customSkillElement.getCustom().getCustomMinionSkillData(); PLUGIN.getBossEntityManager().spawnMinionsOnBossHolder(activeBossHolder, skill, customMinionSkillElement); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/BossCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/BossCmd.java index 3453765..c7563d3 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/BossCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/BossCmd.java @@ -24,12 +24,12 @@ public class BossCmd extends SubCommandService { @Override public void execute(CommandSender sender, String[] args) { - if(args.length == 0) { + if (args.length == 0) { Bukkit.dispatchCommand(sender, "boss help"); return; } - if(handleSubCommand(sender, args)) return; + if (handleSubCommand(sender, args)) return; Bukkit.dispatchCommand(sender, "boss help"); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossCreateCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossCreateCmd.java index b8ba412..023537e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossCreateCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossCreateCmd.java @@ -31,7 +31,7 @@ public class BossCreateCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.create.hasPermission(sender)) { + if (!Permission.create.hasPermission(sender)) { Message.Boss_Create_NoPermission.msg(sender); return; } @@ -47,21 +47,21 @@ public class BossCreateCmd extends SubCommand { String name = args[1]; String entityTypeInput = args[2]; - if(this.bossEntityContainer.exists(name)) { + if (this.bossEntityContainer.exists(name)) { Message.Boss_Create_NameAlreadyExists.msg(sender, name); return; } EntityFinder entityFinder = EntityFinder.get(entityTypeInput); - if(entityFinder == null) { + if (entityFinder == null) { Message.Boss_Create_EntityTypeNotFound.msg(sender, entityTypeInput); return; } BossEntity bossEntity = BossAPI.createBaseBossEntity(name, entityTypeInput); - if(bossEntity == null) { + if (bossEntity == null) { Message.Boss_Create_SomethingWentWrong.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossDebugCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossDebugCmd.java index 2266508..ff04bb7 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossDebugCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossDebugCmd.java @@ -24,12 +24,12 @@ public class BossDebugCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.debug.hasPermission(sender)) { + if (!Permission.debug.hasPermission(sender)) { Message.Boss_Debug_NoPermission.msg(sender); return; } - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.General_MustBePlayer.msg(sender); return; } @@ -37,7 +37,7 @@ public class BossDebugCmd extends SubCommand { Player player = (Player) sender; String toggled; - if(this.debugManager.isToggled(player.getUniqueId())) { + if (this.debugManager.isToggled(player.getUniqueId())) { this.debugManager.togglePlayerOff(player.getUniqueId()); toggled = "Off"; } else { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossDropTableCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossDropTableCmd.java index fca3648..427641d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossDropTableCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossDropTableCmd.java @@ -24,12 +24,12 @@ public class BossDropTableCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_DropTable_NoPermission.msg(sender); return; } - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.General_MustBePlayer.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossEditCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossEditCmd.java index be1e5b7..a164b64 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossEditCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossEditCmd.java @@ -28,19 +28,19 @@ public class BossEditCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_Edit_NoPermission.msg(sender); return; } - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.General_MustBePlayer.msg(sender); return; } Player player = (Player) sender; - switch(args.length) { + switch (args.length) { default: case 1: this.bossPanelManager.getBosses().openFor(player); @@ -48,7 +48,7 @@ public class BossEditCmd extends SubCommand { case 2: String input = args[1]; - if(!this.bossEntityContainer.exists(input)) { + if (!this.bossEntityContainer.exists(input)) { Message.Boss_Edit_DoesntExist.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossGiveEggCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossGiveEggCmd.java index 39d4d86..42aa340 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossGiveEggCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossGiveEggCmd.java @@ -31,22 +31,22 @@ public class BossGiveEggCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.give.hasPermission(sender)) { + if (!Permission.give.hasPermission(sender)) { Message.Boss_GiveEgg_NoPermission.msg(sender); return; } - if(args.length < 3) { + if (args.length < 3) { Message.Boss_GiveEgg_InvalidArgs.msg(sender); return; } int amount = 1; - if(args.length == 4) { + if (args.length == 4) { String amountInput = args[3]; - if(NumberUtils.get().isInt(amountInput)) { + if (NumberUtils.get().isInt(amountInput)) { amount = Integer.valueOf(amountInput); } else { Message.General_NotNumber.msg(sender); @@ -57,7 +57,7 @@ public class BossGiveEggCmd extends SubCommand { String playerInput = args[2]; Player player = Bukkit.getPlayer(playerInput); - if(player == null) { + if (player == null) { Message.General_NotOnline.msg(sender, playerInput); return; } @@ -65,14 +65,14 @@ public class BossGiveEggCmd extends SubCommand { String bossInput = args[1]; BossEntity bossEntity = this.bossesFileManager.getBossEntity(bossInput); - if(bossEntity == null) { + if (bossEntity == null) { Message.Boss_GiveEgg_InvalidBoss.msg(sender); return; } ItemStack spawnItem = this.bossEntityManager.getSpawnItem(bossEntity); - if(spawnItem == null) { + if (spawnItem == null) { Message.Boss_GiveEgg_NotSet.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossHelpCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossHelpCmd.java index 146fade..f286afd 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossHelpCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossHelpCmd.java @@ -21,13 +21,13 @@ public class BossHelpCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(Permission.admin.hasPermission(sender) || Permission.help.hasPermission(sender)) { + if (Permission.admin.hasPermission(sender) || Permission.help.hasPermission(sender)) { int pageNumber = 0; - if(args.length > 1) { + if (args.length > 1) { Integer newNumber = NumberUtils.get().getInteger(args[1]); - if(newNumber != null) pageNumber = newNumber; + if (newNumber != null) pageNumber = newNumber; } switch (pageNumber) { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossInfoCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossInfoCmd.java index e5d372a..98e2760 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossInfoCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossInfoCmd.java @@ -27,12 +27,12 @@ public class BossInfoCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_Info_NoPermission.msg(sender); return; } - if(args.length != 2) { + if (args.length != 2) { Message.Boss_Info_InvalidArgs.msg(sender); return; } @@ -40,7 +40,7 @@ public class BossInfoCmd extends SubCommand { String input = args[1]; BossEntity bossEntity = this.bossesFileManager.getBossEntity(input); - if(bossEntity == null) { + if (bossEntity == null) { Message.Boss_Info_CouldntFindBoss.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossItemsCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossItemsCmd.java index 9489d6e..4535a9c 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossItemsCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossItemsCmd.java @@ -24,12 +24,12 @@ public class BossItemsCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_Items_NoPermission.msg(sender); return; } - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.General_MustBePlayer.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossKillAllCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossKillAllCmd.java index cb1bec8..74df466 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossKillAllCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossKillAllCmd.java @@ -25,19 +25,19 @@ public class BossKillAllCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_KillAll_NoPermission.msg(sender); return; } World world = null; - if(args.length == 2) { + if (args.length == 2) { String worldArgs = args[1]; world = Bukkit.getWorld(worldArgs); - if(world == null) { + if (world == null) { Message.Boss_KillAll_WorldNotFound.msg(sender); return; } @@ -45,7 +45,7 @@ public class BossKillAllCmd extends SubCommand { int amount = this.bossEntityManager.killAllHolders(world); - if(args.length == 2) Message.Boss_KillAll_KilledWorld.msg(sender, amount, world.getName()); + if (args.length == 2) Message.Boss_KillAll_KilledWorld.msg(sender, amount, world.getName()); else Message.Boss_KillAll_KilledAll.msg(sender, amount); } } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossListCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossListCmd.java index 449079f..bca8f17 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossListCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossListCmd.java @@ -24,12 +24,12 @@ public class BossListCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_List_NoPermission.msg(sender); return; } - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.General_MustBePlayer.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossMenuCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossMenuCmd.java index 2a008db..bda711c 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossMenuCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossMenuCmd.java @@ -24,12 +24,12 @@ public class BossMenuCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_Menu_NoPermission.msg(sender); return; } - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.General_MustBePlayer.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossNearbyCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossNearbyCmd.java index 59fd569..c28fa39 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossNearbyCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossNearbyCmd.java @@ -29,12 +29,12 @@ public class BossNearbyCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.nearby.hasPermission(sender)) { + if (!Permission.nearby.hasPermission(sender)) { Message.Boss_Nearby_NoPermission.msg(sender); return; } - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.General_MustBePlayer.msg(sender); return; } @@ -45,12 +45,12 @@ public class BossNearbyCmd extends SubCommand { double maxRadius = this.plugin.getConfig().getDouble("Limits.maxNearbyRadius", 500.0); String nearbyFormat = this.plugin.getConfig().getString("Settings.nearbyFormat", "{name} ({distance}m)"); - if(args.length == 2) { + if (args.length == 2) { Integer newNumber = NumberUtils.get().getInteger(args[1]); - if(newNumber != null) radius = newNumber; + if (newNumber != null) radius = newNumber; - if(radius > maxRadius) { + if (radius > maxRadius) { Message.Boss_Nearby_MaxRadius.msg(player, maxRadius); return; } @@ -59,7 +59,7 @@ public class BossNearbyCmd extends SubCommand { Map nearbyBosses = this.plugin.getBossEntityManager().getActiveBossHoldersWithinRadius(radius, location); Map sortedMap = MapUtils.get().sortByValue(nearbyBosses); - if(sortedMap.isEmpty()) { + if (sortedMap.isEmpty()) { Message.Boss_Nearby_NoneNearby.msg(player); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossNewCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossNewCmd.java index d039c08..9ebe925 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossNewCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossNewCmd.java @@ -22,7 +22,7 @@ import java.util.List; * @author Charles Cullen * @version 1.0.0 * @since 19-Nov-18 - * + *

* boss new droptable [name] [type] * boss new skill [name] [type] [mode] * boss new command [name] [commands] @@ -53,7 +53,7 @@ public class BossNewCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_New_NoPermission.msg(sender); return; } @@ -61,17 +61,17 @@ public class BossNewCmd extends SubCommand { //-------------------- // A U T O S P A W N //-------------------- - if(args.length == 3 && args[1].equalsIgnoreCase("autospawn")) { + if (args.length == 3 && args[1].equalsIgnoreCase("autospawn")) { String nameInput = args[2]; - if(this.autoSpawnFileManager.getAutoSpawn(nameInput) != null) { + if (this.autoSpawnFileManager.getAutoSpawn(nameInput) != null) { Message.Boss_New_AlreadyExists.msg(sender, "AutoSpawn"); return; } AutoSpawn autoSpawn = BossAPI.createBaseAutoSpawn(nameInput); - if(autoSpawn == null) { + if (autoSpawn == null) { Message.Boss_New_SomethingWentWrong.msg(sender, "AutoSpawn"); } else { Message.Boss_New_AutoSpawn.msg(sender, nameInput); @@ -84,10 +84,10 @@ public class BossNewCmd extends SubCommand { //------------------- // C O M M A N D //------------------- - if(args.length >= 4 && args[1].equalsIgnoreCase("command")) { + if (args.length >= 4 && args[1].equalsIgnoreCase("command")) { String nameInput = args[2]; - if(this.commandsFileManager.getCommands(nameInput) != null) { + if (this.commandsFileManager.getCommands(nameInput) != null) { Message.Boss_New_AlreadyExists.msg(sender, "Command"); return; } @@ -104,10 +104,10 @@ public class BossNewCmd extends SubCommand { //------------------- // M E S S A G E //------------------- - if(args.length >= 4 && args[1].equalsIgnoreCase("message")) { + if (args.length >= 4 && args[1].equalsIgnoreCase("message")) { String nameInput = args[2]; - if(this.commandsFileManager.getCommands(nameInput) != null) { + if (this.commandsFileManager.getCommands(nameInput) != null) { Message.Boss_New_AlreadyExists.msg(sender, "Message"); return; } @@ -124,31 +124,31 @@ public class BossNewCmd extends SubCommand { //---------------------- // D R O P T A B L E //---------------------- - if(args.length == 4 && args[1].equalsIgnoreCase("droptable")) { + if (args.length == 4 && args[1].equalsIgnoreCase("droptable")) { String nameInput = args[2]; String typeInput = args[3]; boolean validType = false; - if(this.dropTableFileManager.getDropTable(nameInput) != null) { + if (this.dropTableFileManager.getDropTable(nameInput) != null) { Message.Boss_New_AlreadyExists.msg(sender, "DropTable"); return; } - for(String s : this.bossDropTableManager.getValidDropTableTypes()) { - if(s.equalsIgnoreCase(typeInput)) { + for (String s : this.bossDropTableManager.getValidDropTableTypes()) { + if (s.equalsIgnoreCase(typeInput)) { validType = true; break; } } - if(!validType) { + if (!validType) { Message.Boss_New_InvalidDropTableType.msg(sender); return; } DropTable dropTable = BossAPI.createBaseDropTable(nameInput, typeInput); - if(dropTable == null) { + if (dropTable == null) { Message.Boss_New_SomethingWentWrong.msg(sender, "DropTable"); } else { Message.Boss_New_DropTable.msg(sender, nameInput, typeInput); @@ -160,45 +160,45 @@ public class BossNewCmd extends SubCommand { //------------------- // S K I L L //------------------- - if(args.length == 5 && args[1].equalsIgnoreCase("skill")) { + if (args.length == 5 && args[1].equalsIgnoreCase("skill")) { String nameInput = args[2]; String typeInput = args[3]; String modeInput = args[4]; boolean validType = false, validMode = false; List skillModes = SkillMode.getSkillModes(); - if(this.skillsFileManager.getSkill(nameInput) != null) { + if (this.skillsFileManager.getSkill(nameInput) != null) { Message.Boss_New_AlreadyExists.msg(sender, "Skill"); return; } - for(String s : this.bossSkillManager.getValidSkillTypes()) { - if(s.equalsIgnoreCase(typeInput)) { + for (String s : this.bossSkillManager.getValidSkillTypes()) { + if (s.equalsIgnoreCase(typeInput)) { validType = true; break; } } - for(SkillMode skillMode : skillModes) { - if(skillMode.name().equalsIgnoreCase(modeInput)) { + for (SkillMode skillMode : skillModes) { + if (skillMode.name().equalsIgnoreCase(modeInput)) { validMode = true; break; } } - if(!validType) { + if (!validType) { Message.Boss_New_InvalidSkillType.msg(sender); return; } - if(!validMode) { + if (!validMode) { Message.Boss_New_InvalidSkillMode.msg(sender); return; } Skill skill = BossAPI.createBaseSkill(nameInput, typeInput, modeInput); - if(skill == null) { + if (skill == null) { Message.Boss_New_SomethingWentWrong.msg(sender, "Skill"); } else { Message.Boss_New_Skill.msg(sender, nameInput, typeInput); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossReloadCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossReloadCmd.java index 67aa097..7d253a9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossReloadCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossReloadCmd.java @@ -1,6 +1,5 @@ package com.songoda.epicbosses.commands.boss; -import com.songoda.epicbosses.EpicBosses; import com.songoda.epicbosses.managers.BossEntityManager; import com.songoda.epicbosses.utils.IReloadable; import com.songoda.epicbosses.utils.Message; @@ -28,7 +27,7 @@ public class BossReloadCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.reload.hasPermission(sender)) { + if (!Permission.reload.hasPermission(sender)) { Message.Boss_Reload_NoPermission.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossShopCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossShopCmd.java index 0cf0dea..45bd6bc 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossShopCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossShopCmd.java @@ -24,17 +24,17 @@ public class BossShopCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.shop.hasPermission(sender)) { + if (!Permission.shop.hasPermission(sender)) { Message.Boss_Shop_NoPermission.msg(sender); return; } - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.General_MustBePlayer.msg(sender); return; } - if(!this.plugin.getConfig().getBoolean("Toggles.bossShop", true)) { + if (!this.plugin.getConfig().getBoolean("Toggles.bossShop", true)) { Message.Boss_Shop_Disabled.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossSkillsCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossSkillsCmd.java index d56bb38..2f237f9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossSkillsCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossSkillsCmd.java @@ -24,12 +24,12 @@ public class BossSkillsCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_Skills_NoPermission.msg(sender); return; } - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.General_MustBePlayer.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossSpawnCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossSpawnCmd.java index 3852f57..ebaa047 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossSpawnCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossSpawnCmd.java @@ -28,29 +28,29 @@ public class BossSpawnCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.admin.hasPermission(sender)) { + if (!Permission.admin.hasPermission(sender)) { Message.Boss_Spawn_NoPermission.msg(sender); return; } - if(args.length < 2) { + if (args.length < 2) { Message.Boss_Spawn_InvalidArgs.msg(sender); return; } Location spawnLocation; - if(args.length == 3) { + if (args.length == 3) { Location input = StringUtils.get().fromStringToLocation(args[2]); - if(input == null) { + if (input == null) { Message.Boss_Spawn_InvalidLocation.msg(sender); return; } spawnLocation = input; } else { - if(!(sender instanceof Player)) { + if (!(sender instanceof Player)) { Message.Boss_Spawn_MustBePlayer.msg(sender); return; } @@ -61,7 +61,7 @@ public class BossSpawnCmd extends SubCommand { String bossInput = args[1]; BossEntity bossEntity = this.bossesFileManager.getBossEntity(bossInput); - if(bossEntity == null) { + if (bossEntity == null) { Message.Boss_Spawn_InvalidBoss.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossTimeCmd.java b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossTimeCmd.java index ab579ce..c76da7a 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossTimeCmd.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/commands/boss/BossTimeCmd.java @@ -31,12 +31,12 @@ public class BossTimeCmd extends SubCommand { @Override public void execute(CommandSender sender, String[] args) { - if(!Permission.time.hasPermission(sender)) { + if (!Permission.time.hasPermission(sender)) { Message.Boss_Time_NoPermission.msg(sender); return; } - if(args.length != 2) { + if (args.length != 2) { Message.Boss_Time_InvalidArgs.msg(sender); return; } @@ -45,7 +45,7 @@ public class BossTimeCmd extends SubCommand { boolean exists = this.autoSpawnManager.exists(section); List currentActive = this.autoSpawnManager.getIntervalAutoSpawns(); - if(!exists) { + if (!exists) { Message.Boss_Time_DoesntExist.msg(sender, StringUtils.get().appendList(currentActive)); return; } @@ -54,7 +54,7 @@ public class BossTimeCmd extends SubCommand { ActiveIntervalAutoSpawnHolder activeIntervalAutoSpawnHolder = (ActiveIntervalAutoSpawnHolder) activeAutoSpawnHolder; long remainingMs = activeIntervalAutoSpawnHolder.getRemainingMs(); - if(remainingMs == 0 && activeIntervalAutoSpawnHolder.isSpawnAfterLastBossIsKilled()) { + if (remainingMs == 0 && activeIntervalAutoSpawnHolder.isSpawnAfterLastBossIsKilled()) { Message.Boss_Time_CurrentlyActive.msg(sender); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/BossEntity.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/BossEntity.java index e23cc93..54fd6be 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/BossEntity.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/BossEntity.java @@ -13,13 +13,6 @@ import java.util.List; */ public class BossEntity { - @Expose - private String spawnItem, targeting; - @Expose - private boolean editing, buyable; - @Expose - private Double price; - @Expose private final List entityStats; @Expose @@ -30,6 +23,12 @@ public class BossEntity { private final SkillsElement skills; @Expose private final DropsElement drops; + @Expose + private String spawnItem, targeting; + @Expose + private boolean editing, buyable; + @Expose + private Double price; public BossEntity(boolean editing, String spawnItem, String targeting, boolean buyable, Double price, List entityStats, SkillsElement skills, DropsElement drops, MessagesElement messages, CommandsElement commands) { this.editing = editing; @@ -45,11 +44,11 @@ public class BossEntity { } public String getEditingValue() { - return this.editing? "Enabled" : "Disabled"; + return this.editing ? "Enabled" : "Disabled"; } public String getTargetingValue() { - if(getTargeting() == null || getTargeting().isEmpty() || getTargeting().equalsIgnoreCase("")) { + if (getTargeting() == null || getTargeting().isEmpty() || getTargeting().equalsIgnoreCase("")) { return "N/A"; } else { return getTargeting(); @@ -59,24 +58,24 @@ public class BossEntity { public List getIncompleteSectionsToEnable() { List incompleteList = new ArrayList<>(); - if(this.entityStats == null) incompleteList.add("EntityStats"); + if (this.entityStats == null) incompleteList.add("EntityStats"); else { EntityStatsElement entityStatsElement = this.entityStats.get(0); - if(entityStatsElement == null) incompleteList.add("EntityStatsElement"); + if (entityStatsElement == null) incompleteList.add("EntityStatsElement"); else { MainStatsElement mainStatsElement = entityStatsElement.getMainStats(); - if(mainStatsElement == null) incompleteList.add("MainStatsElement"); + if (mainStatsElement == null) incompleteList.add("MainStatsElement"); else { Integer position = mainStatsElement.getPosition(); String entityType = mainStatsElement.getEntityType(); Double health = mainStatsElement.getHealth(); - if(position == null) incompleteList.add("Entity Position"); - if(health == null) incompleteList.add("Entity Health"); - if(entityType == null || entityType.isEmpty()) incompleteList.add("Entity Type"); - if(getSpawnItem() == null || getSpawnItem().isEmpty()) incompleteList.add("Spawn Item"); + if (position == null) incompleteList.add("Entity Position"); + if (health == null) incompleteList.add("Entity Health"); + if (entityType == null || entityType.isEmpty()) incompleteList.add("Entity Type"); + if (getSpawnItem() == null || getSpawnItem().isEmpty()) incompleteList.add("Spawn Item"); } } } @@ -85,15 +84,15 @@ public class BossEntity { } public boolean isCompleteEnoughToSpawn() { - if(this.entityStats == null) return false; + if (this.entityStats == null) return false; EntityStatsElement entityStatsElement = this.entityStats.get(0); - if(entityStatsElement == null) return false; + if (entityStatsElement == null) return false; MainStatsElement mainStatsElement = entityStatsElement.getMainStats(); - if(mainStatsElement == null) return false; + if (mainStatsElement == null) return false; Integer position = mainStatsElement.getPosition(); String entityType = mainStatsElement.getEntityType(); @@ -110,22 +109,42 @@ public class BossEntity { return this.spawnItem; } + public void setSpawnItem(String spawnItem) { + this.spawnItem = spawnItem; + } + public String getTargeting() { return this.targeting; } + public void setTargeting(String targeting) { + this.targeting = targeting; + } + public boolean isEditing() { return this.editing; } + public void setEditing(boolean editing) { + this.editing = editing; + } + public boolean isBuyable() { return this.buyable; } + public void setBuyable(boolean buyable) { + this.buyable = buyable; + } + public Double getPrice() { return this.price; } + public void setPrice(Double price) { + this.price = price; + } + public List getEntityStats() { return this.entityStats; } @@ -145,24 +164,4 @@ public class BossEntity { public DropsElement getDrops() { return this.drops; } - - public void setSpawnItem(String spawnItem) { - this.spawnItem = spawnItem; - } - - public void setTargeting(String targeting) { - this.targeting = targeting; - } - - public void setEditing(boolean editing) { - this.editing = editing; - } - - public void setBuyable(boolean buyable) { - this.buyable = buyable; - } - - public void setPrice(Double price) { - this.price = price; - } } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/MinionEntity.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/MinionEntity.java index a6103c8..031837d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/MinionEntity.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/MinionEntity.java @@ -33,14 +33,14 @@ public class MinionEntity { return this.targeting; } - public boolean isEditing() { - return this.editing; - } - public void setTargeting(String targeting) { this.targeting = targeting; } + public boolean isEditing() { + return this.editing; + } + public void setEditing(boolean editing) { this.editing = editing; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/CommandsElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/CommandsElement.java index ca7cc33..8358295 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/CommandsElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/CommandsElement.java @@ -21,14 +21,14 @@ public class CommandsElement { return this.onSpawn; } - public String getOnDeath() { - return this.onDeath; - } - public void setOnSpawn(String onSpawn) { this.onSpawn = onSpawn; } + public String getOnDeath() { + return this.onDeath; + } + public void setOnDeath(String onDeath) { this.onDeath = onDeath; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/DropsElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/DropsElement.java index cc91d83..c1a41d0 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/DropsElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/DropsElement.java @@ -24,22 +24,22 @@ public class DropsElement { return this.naturalDrops; } - public Boolean getDropExp() { - return this.dropExp; - } - - public String getDropTable() { - return this.dropTable; - } - public void setNaturalDrops(Boolean naturalDrops) { this.naturalDrops = naturalDrops; } + public Boolean getDropExp() { + return this.dropExp; + } + public void setDropExp(Boolean dropExp) { this.dropExp = dropExp; } + public String getDropTable() { + return this.dropTable; + } + public void setDropTable(String dropTable) { this.dropTable = dropTable; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/EntityStatsElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/EntityStatsElement.java index b439959..984933d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/EntityStatsElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/EntityStatsElement.java @@ -32,30 +32,30 @@ public class EntityStatsElement { return this.mainStats; } - public EquipmentElement getEquipment() { - return this.equipment; - } - - public HandsElement getHands() { - return this.hands; - } - - public List getPotions() { - return this.potions; - } - public void setMainStats(MainStatsElement mainStats) { this.mainStats = mainStats; } + public EquipmentElement getEquipment() { + return this.equipment; + } + public void setEquipment(EquipmentElement equipment) { this.equipment = equipment; } + public HandsElement getHands() { + return this.hands; + } + public void setHands(HandsElement hands) { this.hands = hands; } + public List getPotions() { + return this.potions; + } + public void setPotions(List potions) { this.potions = potions; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/EquipmentElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/EquipmentElement.java index ca4962d..547e327 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/EquipmentElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/EquipmentElement.java @@ -23,30 +23,30 @@ public class EquipmentElement { return this.helmet; } - public String getChestplate() { - return this.chestplate; - } - - public String getLeggings() { - return this.leggings; - } - - public String getBoots() { - return this.boots; - } - public void setHelmet(String helmet) { this.helmet = helmet; } + public String getChestplate() { + return this.chestplate; + } + public void setChestplate(String chestplate) { this.chestplate = chestplate; } + public String getLeggings() { + return this.leggings; + } + public void setLeggings(String leggings) { this.leggings = leggings; } + public String getBoots() { + return this.boots; + } + public void setBoots(String boots) { this.boots = boots; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/HandsElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/HandsElement.java index a196dbf..0e61e76 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/HandsElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/HandsElement.java @@ -21,14 +21,14 @@ public class HandsElement { return this.mainHand; } - public String getOffHand() { - return this.offHand; - } - public void setMainHand(String mainHand) { this.mainHand = mainHand; } + public String getOffHand() { + return this.offHand; + } + public void setOffHand(String offHand) { this.offHand = offHand; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/MainStatsElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/MainStatsElement.java index 5cf2012..9eab1d9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/MainStatsElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/MainStatsElement.java @@ -29,30 +29,30 @@ public class MainStatsElement { return this.position; } - public String getEntityType() { - return this.entityType; - } - - public Double getHealth() { - return this.health; - } - - public String getDisplayName() { - return this.displayName; - } - public void setPosition(Integer position) { this.position = position; } + public String getEntityType() { + return this.entityType; + } + public void setEntityType(String entityType) { this.entityType = entityType; } + public Double getHealth() { + return this.health; + } + public void setHealth(Double health) { this.health = health; } + public String getDisplayName() { + return this.displayName; + } + public void setDisplayName(String displayName) { this.displayName = displayName; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/MessagesElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/MessagesElement.java index d1db06b..b4f30f4 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/MessagesElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/MessagesElement.java @@ -26,22 +26,22 @@ public class MessagesElement { return this.onSpawn; } - public OnDeathMessageElement getOnDeath() { - return this.onDeath; - } - - public TauntElement getTaunts() { - return this.taunts; - } - public void setOnSpawn(OnSpawnMessageElement onSpawn) { this.onSpawn = onSpawn; } + public OnDeathMessageElement getOnDeath() { + return this.onDeath; + } + public void setOnDeath(OnDeathMessageElement onDeath) { this.onDeath = onDeath; } + public TauntElement getTaunts() { + return this.taunts; + } + public void setTaunts(TauntElement taunts) { this.taunts = taunts; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/OnDeathMessageElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/OnDeathMessageElement.java index a3a3596..f2acf29 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/OnDeathMessageElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/OnDeathMessageElement.java @@ -25,30 +25,30 @@ public class OnDeathMessageElement { return this.message; } - public String getPositionMessage() { - return this.positionMessage; - } - - public Integer getRadius() { - return this.radius; - } - - public Integer getOnlyShow() { - return this.onlyShow; - } - public void setMessage(String message) { this.message = message; } + public String getPositionMessage() { + return this.positionMessage; + } + public void setPositionMessage(String positionMessage) { this.positionMessage = positionMessage; } + public Integer getRadius() { + return this.radius; + } + public void setRadius(Integer radius) { this.radius = radius; } + public Integer getOnlyShow() { + return this.onlyShow; + } + public void setOnlyShow(Integer onlyShow) { this.onlyShow = onlyShow; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/OnSpawnMessageElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/OnSpawnMessageElement.java index a498547..38140fb 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/OnSpawnMessageElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/OnSpawnMessageElement.java @@ -23,14 +23,14 @@ public class OnSpawnMessageElement { return this.message; } - public Integer getRadius() { - return this.radius; - } - public void setMessage(String message) { this.message = message; } + public Integer getRadius() { + return this.radius; + } + public void setRadius(Integer radius) { this.radius = radius; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/SkillsElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/SkillsElement.java index 168040c..c226258 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/SkillsElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/SkillsElement.java @@ -28,22 +28,22 @@ public class SkillsElement { return this.overallChance; } - public String getMasterMessage() { - return this.masterMessage; - } - - public List getSkills() { - return this.skills; - } - public void setOverallChance(Double overallChance) { this.overallChance = overallChance; } + public String getMasterMessage() { + return this.masterMessage; + } + public void setMasterMessage(String masterMessage) { this.masterMessage = masterMessage; } + public List getSkills() { + return this.skills; + } + public void setSkills(List skills) { this.skills = skills; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/TauntElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/TauntElement.java index 99c5ec4..024fea9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/TauntElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/entity/elements/TauntElement.java @@ -26,22 +26,22 @@ public class TauntElement { return this.delay; } - public Integer getRadius() { - return this.radius; - } - - public List getTaunts() { - return this.taunts; - } - public void setDelay(Integer delay) { this.delay = delay; } + public Integer getRadius() { + return this.radius; + } + public void setRadius(Integer radius) { this.radius = radius; } + public List getTaunts() { + return this.taunts; + } + public void setTaunts(List taunts) { this.taunts = taunts; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/events/BossDamageEvent.java b/plugin-modules/Core/src/com/songoda/epicbosses/events/BossDamageEvent.java index 3a4cabc..3f325ee 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/events/BossDamageEvent.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/events/BossDamageEvent.java @@ -27,12 +27,12 @@ public class BossDamageEvent extends Event { this.damage = damageAmount; } - @Override - public HandlerList getHandlers() { + public static HandlerList getHandlerList() { return handlers; } - public static HandlerList getHandlerList() { + @Override + public HandlerList getHandlers() { return handlers; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/events/BossDeathEvent.java b/plugin-modules/Core/src/com/songoda/epicbosses/events/BossDeathEvent.java index 1b326dc..e26c927 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/events/BossDeathEvent.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/events/BossDeathEvent.java @@ -21,12 +21,12 @@ public class BossDeathEvent extends Event { this.autoSpawn = autoSpawn; } - @Override - public HandlerList getHandlers() { + public static HandlerList getHandlerList() { return handlers; } - public static HandlerList getHandlerList() { + @Override + public HandlerList getHandlers() { return handlers; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/events/BossSkillEvent.java b/plugin-modules/Core/src/com/songoda/epicbosses/events/BossSkillEvent.java index 121057a..621b797 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/events/BossSkillEvent.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/events/BossSkillEvent.java @@ -25,12 +25,12 @@ public class BossSkillEvent extends Event { this.skill = skill; } - @Override - public HandlerList getHandlers() { + public static HandlerList getHandlerList() { return handlers; } - public static HandlerList getHandlerList() { + @Override + public HandlerList getHandlers() { return handlers; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/events/BossSpawnEvent.java b/plugin-modules/Core/src/com/songoda/epicbosses/events/BossSpawnEvent.java index 8c57912..7034503 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/events/BossSpawnEvent.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/events/BossSpawnEvent.java @@ -21,12 +21,12 @@ public class BossSpawnEvent extends Event { this.autoSpawn = autoSpawn; } - @Override - public HandlerList getHandlers() { + public static HandlerList getHandlerList() { return handlers; } - public static HandlerList getHandlerList() { + @Override + public HandlerList getHandlers() { return handlers; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossDeathEvent.java b/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossDeathEvent.java index 74858f4..1a66142 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossDeathEvent.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossDeathEvent.java @@ -25,12 +25,12 @@ public class PreBossDeathEvent extends Event { this.killer = killer; } - @Override - public HandlerList getHandlers() { + public static HandlerList getHandlerList() { return handlers; } - public static HandlerList getHandlerList() { + @Override + public HandlerList getHandlers() { return handlers; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSkillEvent.java b/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSkillEvent.java index d79cb25..6b751de 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSkillEvent.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSkillEvent.java @@ -23,12 +23,12 @@ public class PreBossSkillEvent extends Event { this.damagingEntity = damagingEntity; } - @Override - public HandlerList getHandlers() { + public static HandlerList getHandlerList() { return handlers; } - public static HandlerList getHandlerList() { + @Override + public HandlerList getHandlers() { return handlers; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSpawnEvent.java b/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSpawnEvent.java index ec9a476..3f32f54 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSpawnEvent.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSpawnEvent.java @@ -19,12 +19,12 @@ public class PreBossSpawnEvent extends Event { this.activeBossHolder = activeBossHolder; } - @Override - public HandlerList getHandlers() { + public static HandlerList getHandlerList() { return handlers; } - public static HandlerList getHandlerList() { + @Override + public HandlerList getHandlers() { return handlers; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSpawnItemEvent.java b/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSpawnItemEvent.java index 1f62f0e..7686d73 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSpawnItemEvent.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/events/PreBossSpawnItemEvent.java @@ -24,12 +24,12 @@ public class PreBossSpawnItemEvent extends PreBossSpawnEvent { this.player = player; } - @Override - public HandlerList getHandlers() { + public static HandlerList getHandlerList() { return handlers; } - public static HandlerList getHandlerList() { + @Override + public HandlerList getHandlers() { return handlers; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/file/AutoSpawnFileHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/file/AutoSpawnFileHandler.java index 9426fb6..b463673 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/file/AutoSpawnFileHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/file/AutoSpawnFileHandler.java @@ -44,7 +44,7 @@ public class AutoSpawnFileHandler extends FileHandler> { fileReader.close(); - if(jsonObject != null) { + if (jsonObject != null) { jsonObject.entrySet().forEach(entry -> { String id = entry.getKey(); AutoSpawn autoSpawn = GSON.fromJson(entry.getValue(), AutoSpawn.class); @@ -63,7 +63,8 @@ public class AutoSpawnFileHandler extends FileHandler> { public void saveFile(Map map) { try { FileWriter fileWriter = new FileWriter(getFile()); - Type type = new TypeToken>(){}.getType(); + Type type = new TypeToken>() { + }.getType(); fileWriter.write(GSON.toJson(new HashMap<>(map), type)); fileWriter.flush(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/file/BossesFileHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/file/BossesFileHandler.java index 68d3d0f..47f47c9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/file/BossesFileHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/file/BossesFileHandler.java @@ -44,7 +44,7 @@ public class BossesFileHandler extends FileHandler> { fileReader.close(); - if(jsonObject != null) { + if (jsonObject != null) { jsonObject.entrySet().forEach(entry -> { String id = entry.getKey(); BossEntity bossEntity = GSON.fromJson(entry.getValue(), BossEntity.class); @@ -63,7 +63,8 @@ public class BossesFileHandler extends FileHandler> { public void saveFile(Map map) { try { FileWriter fileWriter = new FileWriter(getFile()); - Type type = new TypeToken>(){}.getType(); + Type type = new TypeToken>() { + }.getType(); fileWriter.write(GSON.toJson(new HashMap<>(map), type)); fileWriter.flush(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/file/CommandsFileHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/file/CommandsFileHandler.java index 27957ce..be2916c 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/file/CommandsFileHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/file/CommandsFileHandler.java @@ -44,8 +44,9 @@ public class CommandsFileHandler extends FileHandler>> fileReader.close(); - if(jsonObject != null) { - Type listType = new TypeToken>(){}.getType(); + if (jsonObject != null) { + Type listType = new TypeToken>() { + }.getType(); jsonObject.entrySet().forEach(entry -> { String id = entry.getKey(); @@ -65,7 +66,8 @@ public class CommandsFileHandler extends FileHandler>> public void saveFile(Map> stringListMap) { try { FileWriter fileWriter = new FileWriter(getFile()); - Type type = new TypeToken>>(){}.getType(); + Type type = new TypeToken>>() { + }.getType(); fileWriter.write(GSON.toJson(new HashMap<>(stringListMap), type)); fileWriter.flush(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/file/DropTableFileHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/file/DropTableFileHandler.java index f1cd85f..4febffa 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/file/DropTableFileHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/file/DropTableFileHandler.java @@ -45,7 +45,7 @@ public class DropTableFileHandler extends FileHandler> { fileReader.close(); - if(jsonObject != null) { + if (jsonObject != null) { jsonObject.entrySet().forEach(entry -> { String id = entry.getKey(); DropTable dropTable = GSON.fromJson(entry.getValue(), DropTable.class); @@ -64,7 +64,8 @@ public class DropTableFileHandler extends FileHandler> { public void saveFile(Map stringDropTableMap) { try { FileWriter fileWriter = new FileWriter(getFile()); - Type type = new TypeToken>(){}.getType(); + Type type = new TypeToken>() { + }.getType(); fileWriter.write(GSON.toJson(new HashMap<>(stringDropTableMap), type)); fileWriter.flush(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/file/ItemStackFileHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/file/ItemStackFileHandler.java index 589d544..ff97eae 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/file/ItemStackFileHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/file/ItemStackFileHandler.java @@ -44,7 +44,7 @@ public class ItemStackFileHandler extends FileHandler { String id = entry.getKey(); ItemStackHolder itemStackHolder = GSON.fromJson(entry.getValue(), ItemStackHolder.class); @@ -63,7 +63,8 @@ public class ItemStackFileHandler extends FileHandler map) { try { FileWriter fileWriter = new FileWriter(getFile()); - Type type = new TypeToken>(){}.getType(); + Type type = new TypeToken>() { + }.getType(); fileWriter.write(GSON.toJson(new HashMap<>(map), type)); fileWriter.flush(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/file/MessagesFileHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/file/MessagesFileHandler.java index 5cd10f3..0f8bf64 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/file/MessagesFileHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/file/MessagesFileHandler.java @@ -44,8 +44,9 @@ public class MessagesFileHandler extends FileHandler>> fileReader.close(); - if(jsonObject != null) { - Type listType = new TypeToken>(){}.getType(); + if (jsonObject != null) { + Type listType = new TypeToken>() { + }.getType(); jsonObject.entrySet().forEach(entry -> { String id = entry.getKey(); @@ -65,7 +66,8 @@ public class MessagesFileHandler extends FileHandler>> public void saveFile(Map> stringListMap) { try { FileWriter fileWriter = new FileWriter(getFile()); - Type type = new TypeToken>>(){}.getType(); + Type type = new TypeToken>>() { + }.getType(); fileWriter.write(GSON.toJson(new HashMap<>(stringListMap), type)); fileWriter.flush(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/file/MinionsFileHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/file/MinionsFileHandler.java index 89be6d0..9700f19 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/file/MinionsFileHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/file/MinionsFileHandler.java @@ -44,7 +44,7 @@ public class MinionsFileHandler extends FileHandler> { fileReader.close(); - if(jsonObject != null) { + if (jsonObject != null) { jsonObject.entrySet().forEach(entry -> { String id = entry.getKey(); MinionEntity minionEntity = GSON.fromJson(entry.getValue(), MinionEntity.class); @@ -63,7 +63,8 @@ public class MinionsFileHandler extends FileHandler> { public void saveFile(Map stringMinionEntityMap) { try { FileWriter fileWriter = new FileWriter(getFile()); - Type type = new TypeToken>(){}.getType(); + Type type = new TypeToken>() { + }.getType(); fileWriter.write(GSON.toJson(new HashMap<>(stringMinionEntityMap), type)); fileWriter.flush(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/file/SkillsFileHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/file/SkillsFileHandler.java index 1c2fc78..1ce5ec8 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/file/SkillsFileHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/file/SkillsFileHandler.java @@ -44,7 +44,7 @@ public class SkillsFileHandler extends FileHandler> { fileReader.close(); - if(jsonObject != null) { + if (jsonObject != null) { jsonObject.entrySet().forEach(entry -> { String id = entry.getKey(); Skill bossEntity = GSON.fromJson(entry.getValue(), Skill.class); @@ -63,7 +63,8 @@ public class SkillsFileHandler extends FileHandler> { public void saveFile(Map skillMap) { try { FileWriter fileWriter = new FileWriter(getFile()); - Type type = new TypeToken>(){}.getType(); + Type type = new TypeToken>() { + }.getType(); fileWriter.write(GSON.toJson(new HashMap<>(skillMap), type)); fileWriter.flush(); 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 5a60c42..19871e7 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossShopPriceHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/BossShopPriceHandler.java @@ -54,18 +54,18 @@ public class BossShopPriceHandler implements IHandler { Player player = event.getPlayer(); UUID uuid = player.getUniqueId(); - if(!uuid.equals(getPlayer().getUniqueId())) return; - if(isHandled()) return; + if (!uuid.equals(getPlayer().getUniqueId())) return; + if (isHandled()) return; String input = event.getMessage(); - if(input.equalsIgnoreCase("-")) { + if (input.equalsIgnoreCase("-")) { input = null; } event.setCancelled(true); - if(NumberUtils.get().isDouble(input)) { + if (NumberUtils.get().isDouble(input)) { double amount = NumberUtils.get().getDouble(input); getBossEntity().setPrice(amount); getBossesFileManager().save(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/droptable/GetDropTableCommand.java b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/droptable/GetDropTableCommand.java index 70e7f29..c11e7f5 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/droptable/GetDropTableCommand.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/droptable/GetDropTableCommand.java @@ -17,7 +17,7 @@ public class GetDropTableCommand implements IGetDropTableListItem> public List getListItem(String id) { List commands = BossAPI.getStoredCommands(id); - if(commands == null) { + if (commands == null) { Debug.FAILED_TO_LOAD_COMMANDS.debug(id); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/droptable/GetDropTableItemStack.java b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/droptable/GetDropTableItemStack.java index 6eed199..15b6c58 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/droptable/GetDropTableItemStack.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/droptable/GetDropTableItemStack.java @@ -25,14 +25,14 @@ public class GetDropTableItemStack implements IGetDropTableListItem { public ItemStack getListItem(String id) { ItemStackHolder itemStackHolder = BossAPI.getStoredItemStack(id); - if(itemStackHolder == null) { + if (itemStackHolder == null) { Debug.FAILED_TO_LOAD_CUSTOM_ITEM.debug(id); return null; } ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(itemStackHolder); - if(itemStack == null) { + if (itemStack == null) { Debug.FAILED_TO_LOAD_CUSTOM_ITEM.debug(id); return null; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/variables/AutoSpawnLocationVariableHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/variables/AutoSpawnLocationVariableHandler.java index 5443d0f..479f695 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/handlers/variables/AutoSpawnLocationVariableHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/handlers/variables/AutoSpawnLocationVariableHandler.java @@ -25,7 +25,7 @@ public class AutoSpawnLocationVariableHandler extends AutoSpawnVariableHandler { protected boolean confirmValue(String input, IntervalSpawnElement intervalSpawnElement) { Location location = StringUtils.get().fromStringToLocation(input); - if(location == null) { + if (location == null) { Message.Boss_AutoSpawn_InvalidLocation.msg(getPlayer(), input); return false; } 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 0619ec5..e850cac 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveBossHolder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveBossHolder.java @@ -134,22 +134,22 @@ public class ActiveBossHolder implements IActiveHolder { return this.targetHandler; } - public boolean isDead() { - return this.isDead; - } - - public boolean isCustomSpawnMessage() { - return this.customSpawnMessage; - } - public void setTargetHandler(TargetHandler targetHandler) { this.targetHandler = targetHandler; } + public boolean isDead() { + return this.isDead; + } + public void setDead(boolean isDead) { this.isDead = isDead; } + public boolean isCustomSpawnMessage() { + return this.customSpawnMessage; + } + public void setCustomSpawnMessage(boolean customSpawnMessage) { this.customSpawnMessage = customSpawnMessage; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveMinionHolder.java b/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveMinionHolder.java index b8a4349..503f324 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveMinionHolder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/holder/ActiveMinionHolder.java @@ -17,13 +17,12 @@ import java.util.UUID; */ public class ActiveMinionHolder implements IActiveHolder { - private TargetHandler targetHandler = null; - - private Map livingEntityMap = new HashMap<>(); - private ActiveBossHolder activeBossHolder; private final MinionEntity minionEntity; private final Location location; private final String name; + private TargetHandler targetHandler = null; + private Map livingEntityMap = new HashMap<>(); + private ActiveBossHolder activeBossHolder; public ActiveMinionHolder(ActiveBossHolder activeBossHolder, MinionEntity minionEntity, Location spawnLocation, String name) { this.activeBossHolder = activeBossHolder; @@ -39,7 +38,7 @@ public class ActiveMinionHolder implements IActiveHolder { @Override public void setLivingEntity(int position, LivingEntity livingEntity) { - if(this.livingEntityMap.containsKey(position)) { + if (this.livingEntityMap.containsKey(position)) { LivingEntity target = (LivingEntity) ServerUtils.get().getEntity(this.livingEntityMap.get(position)); if (target != null) target.remove(); @@ -69,11 +68,11 @@ public class ActiveMinionHolder implements IActiveHolder { @Override public boolean isDead() { - if(this.livingEntityMap.isEmpty()) return true; + if (this.livingEntityMap.isEmpty()) return true; - for(UUID uuid : this.livingEntityMap.values()) { + for (UUID uuid : this.livingEntityMap.values()) { LivingEntity livingEntity = (LivingEntity) ServerUtils.get().getEntity(uuid); - if(livingEntity == null || livingEntity.isDead()) return true; + if (livingEntity == null || livingEntity.isDead()) return true; } return false; @@ -88,6 +87,10 @@ public class ActiveMinionHolder implements IActiveHolder { return this.targetHandler; } + public void setTargetHandler(TargetHandler targetHandler) { + this.targetHandler = targetHandler; + } + public Map getLivingEntityMap() { return this.livingEntityMap; } @@ -107,8 +110,4 @@ public class ActiveMinionHolder implements IActiveHolder { public String getName() { return this.name; } - - public void setTargetHandler(TargetHandler targetHandler) { - this.targetHandler = targetHandler; - } } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/holder/autospawn/ActiveIntervalAutoSpawnHolder.java b/plugin-modules/Core/src/com/songoda/epicbosses/holder/autospawn/ActiveIntervalAutoSpawnHolder.java index 04aa976..f77971c 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/holder/autospawn/ActiveIntervalAutoSpawnHolder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/holder/autospawn/ActiveIntervalAutoSpawnHolder.java @@ -35,11 +35,11 @@ public class ActiveIntervalAutoSpawnHolder extends ActiveAutoSpawnHolder { @Override public boolean canSpawn() { - if(getAutoSpawn().isEditing()) { + if (getAutoSpawn().isEditing()) { ServerUtils.get().logDebug("AutoSpawn failed to spawn due to editing enabled."); return false; } - if(!getAutoSpawn().getType().equalsIgnoreCase("INTERVAL")) { + if (!getAutoSpawn().getType().equalsIgnoreCase("INTERVAL")) { ServerUtils.get().logDebug("AutoSpawn failed to spawn due to interval type not set."); return false; } @@ -50,22 +50,22 @@ public class ActiveIntervalAutoSpawnHolder extends ActiveAutoSpawnHolder { Location location = this.intervalSpawnElement.getSpawnLocation(); boolean spawnIfChunkNotLoaded = ObjectUtils.getValue(getAutoSpawn().getAutoSpawnSettings().getSpawnWhenChunkIsntLoaded(), false); - if(location == null) { + if (location == null) { ServerUtils.get().logDebug("AutoSpawn failed to spawn due to location is null."); return false; } - if(!spawnIfChunkNotLoaded && !location.getChunk().isLoaded()) { + if (!spawnIfChunkNotLoaded && !location.getChunk().isLoaded()) { ServerUtils.get().logDebug("AutoSpawn failed to spawn due to spawnIfChunkNotLoaded was false and chunk wasn't loaded."); return false; } - if(isSpawnAfterLastBossIsKilled() && !getActiveBossHolders().isEmpty()) { + if (isSpawnAfterLastBossIsKilled() && !getActiveBossHolders().isEmpty()) { ServerUtils.get().logDebug("AutoSpawn failed due to spawnAfterLastBossKilled is true and activeBossHolders is not empty."); return false; } boolean returnStatement = currentActiveAmount < maxAmount; - if(!returnStatement) { + if (!returnStatement) { ServerUtils.get().logDebug("AutoSpawn failed to spawn due to currentActiveAmount is greater then maxAmount of bosses."); } @@ -79,11 +79,11 @@ public class ActiveIntervalAutoSpawnHolder extends ActiveAutoSpawnHolder { public void restartInterval() { stopInterval(); - if(getAutoSpawn().isEditing()) return; + if (getAutoSpawn().isEditing()) return; Integer delay = this.intervalSpawnElement.getSpawnRate(); - if(delay == null) { + if (delay == null) { Debug.AUTOSPAWN_INTERVALNOTREAL.debug("null", BossAPI.getAutoSpawnName(getAutoSpawn())); return; } @@ -96,7 +96,7 @@ public class ActiveIntervalAutoSpawnHolder extends ActiveAutoSpawnHolder { this.intervalTask = ServerUtils.get().runTimer(delayTick, delayTick, () -> { boolean canSpawn = canSpawn(); - if(!canSpawn) { + if (!canSpawn) { ServerUtils.get().logDebug("--- Failed to AutoSpawn. ---"); updateNextCompleteTime(); return; @@ -104,7 +104,7 @@ public class ActiveIntervalAutoSpawnHolder extends ActiveAutoSpawnHolder { ServerUtils.get().logDebug("AutoSpawn Spawn Attempt: " + this.intervalSpawnElement.attemptSpawn(this)); - if(isSpawnAfterLastBossIsKilled()) { + if (isSpawnAfterLastBossIsKilled()) { cancelCurrentInterval(); return; } @@ -129,7 +129,7 @@ public class ActiveIntervalAutoSpawnHolder extends ActiveAutoSpawnHolder { public long getRemainingMs() { long currentMs = System.currentTimeMillis(); - if(currentMs > this.nextCompletedTime) return 0; + if (currentMs > this.nextCompletedTime) return 0; return this.nextCompletedTime - currentMs; } @@ -139,10 +139,10 @@ public class ActiveIntervalAutoSpawnHolder extends ActiveAutoSpawnHolder { boolean spawnAfterLastBossIsKilled = ObjectUtils.getValue(this.intervalSpawnElement.getSpawnAfterLastBossIsKilled(), false); ActiveBossHolder activeBossHolder = event.getActiveBossHolder(); - if(getActiveBossHolders().contains(activeBossHolder)) { + if (getActiveBossHolders().contains(activeBossHolder)) { getActiveBossHolders().remove(activeBossHolder); - if(spawnAfterLastBossIsKilled) { + if (spawnAfterLastBossIsKilled) { restartInterval(); updateNextCompleteTime(); } @@ -151,7 +151,7 @@ public class ActiveIntervalAutoSpawnHolder extends ActiveAutoSpawnHolder { } private void cancelCurrentInterval() { - if(this.intervalTask != null) ServerUtils.get().cancelTask(this.intervalTask); + if (this.intervalTask != null) ServerUtils.get().cancelTask(this.intervalTask); this.nextCompletedTime = 0; } @@ -159,7 +159,7 @@ public class ActiveIntervalAutoSpawnHolder extends ActiveAutoSpawnHolder { private void updateNextCompleteTime() { Integer delay = this.intervalSpawnElement.getSpawnRate(); - if(delay == null) { + if (delay == null) { Debug.AUTOSPAWN_INTERVALNOTREAL.debug("null", BossAPI.getAutoSpawnName(getAutoSpawn())); return; } 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 532cc50..bdeebfb 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/AddItemsPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/AddItemsPanel.java @@ -67,8 +67,8 @@ public class AddItemsPanel extends PanelHandler { int rawSlot = event.getRawSlot(); int slot = event.getSlot(); - if(panel.isLowerClick(rawSlot)) { - if(this.storedItemStacks.containsKey(uuid)) { + if (panel.isLowerClick(rawSlot)) { + if (this.storedItemStacks.containsKey(uuid)) { Message.Boss_Items_AlreadySet.msg(playerWhoClicked); return; } @@ -93,12 +93,12 @@ public class AddItemsPanel extends PanelHandler { return event -> { int rawSlot = event.getRawSlot(); - if(panel.isLowerClick(rawSlot)) return; + if (panel.isLowerClick(rawSlot)) return; Player player = (Player) event.getWhoClicked(); UUID uuid = player.getUniqueId(); - if(this.storedItemStacks.containsKey(uuid)) { + if (this.storedItemStacks.containsKey(uuid)) { player.getInventory().addItem(this.storedItemStacks.get(uuid)); this.storedItemStacks.remove(uuid); @@ -111,12 +111,12 @@ public class AddItemsPanel extends PanelHandler { return event -> { int rawSlot = event.getRawSlot(); - if(panel.isLowerClick(rawSlot)) return; + if (panel.isLowerClick(rawSlot)) return; Player player = (Player) event.getWhoClicked(); UUID uuid = player.getUniqueId(); - if(this.storedItemStacks.containsKey(uuid)) { + if (this.storedItemStacks.containsKey(uuid)) { this.itemsFileManager.addItemStack(UUID.randomUUID().toString(), this.storedItemStacks.get(uuid)); Message.Boss_Items_Added.msg(player); this.storedItemStacks.remove(uuid); @@ -130,12 +130,12 @@ public class AddItemsPanel extends PanelHandler { return event -> { int rawSlot = event.getRawSlot(); - if(panel.isLowerClick(rawSlot)) return; + if (panel.isLowerClick(rawSlot)) return; Player player = (Player) event.getWhoClicked(); UUID uuid = player.getUniqueId(); - if(this.storedItemStacks.containsKey(uuid)) { + if (this.storedItemStacks.containsKey(uuid)) { player.getInventory().addItem(this.storedItemStacks.get(uuid)); this.storedItemStacks.remove(uuid); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/AutoSpawnsPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/AutoSpawnsPanel.java index b278027..9fa0a70 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/AutoSpawnsPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/AutoSpawnsPanel.java @@ -47,7 +47,7 @@ public class AutoSpawnsPanel extends MainListPanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, autoSpawnMap, entryList); return true; @@ -58,31 +58,32 @@ public class AutoSpawnsPanel extends MainListPanelHandler { private void loadPage(Panel panel, int requestedPage, Map autoSpawnMap, List entryList) { panel.loadPage(requestedPage, (slot, realisticSlot) -> { - if(slot >= entryList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= entryList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); AutoSpawn autoSpawn = autoSpawnMap.get(name); ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(this.itemsFileManager.getItemStackHolder("DefaultAutoSpawnListItem")); - if(itemStack == null) { + if (itemStack == null) { itemStack = new ItemStack(Material.BARRIER); } Map replaceMap = new HashMap<>(); List entities = ObjectUtils.getValue(autoSpawn.getEntities(), new ArrayList<>()); AutoSpawnSettings settings = autoSpawn.getAutoSpawnSettings(); - String entitiesSize = entities.size()+""; - String maxAlive = ""+ObjectUtils.getValue(settings.getMaxAliveAtOnce(), 1); - String amountToSpawn = ""+ObjectUtils.getValue(settings.getAmountPerSpawn(), 1); - String chunkIsntLoaded = ""+ObjectUtils.getValue(settings.getSpawnWhenChunkIsntLoaded(), false); - String overrideMessage = ""+ObjectUtils.getValue(settings.getOverrideDefaultSpawnMessage(), true); - String shuffleEntities = ""+ObjectUtils.getValue(settings.getShuffleEntitiesList(), false); + String entitiesSize = entities.size() + ""; + String maxAlive = "" + ObjectUtils.getValue(settings.getMaxAliveAtOnce(), 1); + String amountToSpawn = "" + ObjectUtils.getValue(settings.getAmountPerSpawn(), 1); + String chunkIsntLoaded = "" + ObjectUtils.getValue(settings.getSpawnWhenChunkIsntLoaded(), false); + String overrideMessage = "" + ObjectUtils.getValue(settings.getOverrideDefaultSpawnMessage(), true); + String shuffleEntities = "" + ObjectUtils.getValue(settings.getShuffleEntitiesList(), false); String spawnMessage = ObjectUtils.getValue(settings.getSpawnMessage(), ""); replaceMap.put("{name}", name); replaceMap.put("{type}", StringUtils.get().formatString(autoSpawn.getType())); - replaceMap.put("{enabled}", (autoSpawn.isEditing())+""); + replaceMap.put("{enabled}", (autoSpawn.isEditing()) + ""); replaceMap.put("{entities}", entitiesSize); replaceMap.put("{maxAlive}", maxAlive); replaceMap.put("{amountPerSpawn}", amountToSpawn); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomBossesPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomBossesPanel.java index 1d465ea..8848ca0 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomBossesPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomBossesPanel.java @@ -46,7 +46,7 @@ public class CustomBossesPanel extends MainListPanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentEntities, entryList); return true; @@ -57,33 +57,34 @@ public class CustomBossesPanel extends MainListPanelHandler { private void loadPage(Panel panel, int page, Map bossEntityMap, List entryList) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= bossEntityMap.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= bossEntityMap.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); BossEntity entity = bossEntityMap.get(name); ItemStack itemStack = this.bossEntityManager.getDisplaySpawnItem(entity); - if(itemStack == null) { + if (itemStack == null) { itemStack = new ItemStack(Material.BARRIER); } Map replaceMap = new HashMap<>(); replaceMap.put("{name}", name); - replaceMap.put("{enabled}", ""+entity.isEditing()); + replaceMap.put("{enabled}", "" + entity.isEditing()); ItemStackUtils.applyDisplayName(itemStack, this.epicBosses.getDisplay().getString("Display.Bosses.name"), replaceMap); ItemStackUtils.applyDisplayLore(itemStack, this.epicBosses.getDisplay().getStringList("Display.Bosses.lore"), replaceMap); panel.setItem(realisticSlot, itemStack, e -> { - if(e.getClick() == ClickType.RIGHT || e.getClick() == ClickType.SHIFT_RIGHT) { + if (e.getClick() == ClickType.RIGHT || e.getClick() == ClickType.SHIFT_RIGHT) { this.bossPanelManager.getMainBossEditMenu().openFor((Player) e.getWhoClicked(), entity); - } else if(e.getClick() == ClickType.LEFT || e.getClick() == ClickType.SHIFT_LEFT) { + } else if (e.getClick() == ClickType.LEFT || e.getClick() == ClickType.SHIFT_LEFT) { ItemStack spawnItem = this.bossEntityManager.getSpawnItem(entity); - if(spawnItem == null) { + if (spawnItem == null) { Debug.FAILED_TO_GIVE_SPAWN_EGG.debug(e.getWhoClicked().getName(), name); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomItemsPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomItemsPanel.java index de404b8..e376694 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomItemsPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomItemsPanel.java @@ -40,7 +40,7 @@ public class CustomItemsPanel extends MainListPanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentItemStacks, entryList); return true; @@ -52,8 +52,9 @@ public class CustomItemsPanel extends MainListPanelHandler { private void loadPage(Panel panel, int requestedPage, Map currentItemStacks, List entryList) { panel.loadPage(requestedPage, (slot, realisticSlot) -> { - if(slot >= currentItemStacks.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= currentItemStacks.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); ItemStackHolder itemStackHolder = currentItemStacks.get(name); @@ -62,12 +63,12 @@ public class CustomItemsPanel extends MainListPanelHandler { panel.setItem(realisticSlot, itemStack.clone(), e -> { ClickType clickType = e.getClick(); - if(clickType == ClickType.RIGHT || clickType == ClickType.SHIFT_RIGHT) { + if (clickType == ClickType.RIGHT || clickType == ClickType.SHIFT_RIGHT) { int timesUsed = this.bossPanelManager.isItemStackUsed(name); - if(timesUsed > 0) { + if (timesUsed > 0) { Message.Boss_Items_CannotBeRemoved.msg(e.getWhoClicked(), timesUsed); - } else if(name.contains("Default")) { + } else if (name.contains("Default")) { Message.Boss_Items_DefaultCannotBeRemoved.msg(e.getWhoClicked(), timesUsed); } else { this.itemsFileManager.removeItemStack(name); @@ -77,9 +78,9 @@ public class CustomItemsPanel extends MainListPanelHandler { loadPage(panel, requestedPage, currentItemStacks, entryList); Message.Boss_Items_Removed.msg(e.getWhoClicked()); } - } else if(clickType == ClickType.LEFT || clickType == ClickType.SHIFT_LEFT) { + } else if (clickType == ClickType.LEFT || clickType == ClickType.SHIFT_LEFT) { e.getWhoClicked().getInventory().addItem(itemStack.clone()); - } else if(clickType == ClickType.MIDDLE) { + } else if (clickType == ClickType.MIDDLE) { String newName = UUID.randomUUID().toString(); ItemStack newItemStack = itemStack.clone(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomSkillsPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomSkillsPanel.java index e50cf39..25d4906 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomSkillsPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/CustomSkillsPanel.java @@ -47,7 +47,7 @@ public class CustomSkillsPanel extends MainListPanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentSkills, entryList); return true; @@ -58,8 +58,9 @@ public class CustomSkillsPanel extends MainListPanelHandler { private void loadPage(Panel panel, int requestedPage, Map currentSkills, List entryList) { panel.loadPage(requestedPage, (slot, realisticSlot) -> { - if(slot >= currentSkills.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= currentSkills.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); Skill skill = currentSkills.get(name); @@ -72,10 +73,10 @@ public class CustomSkillsPanel extends MainListPanelHandler { Double radius = skill.getRadius(); String type = skill.getType(); - if(customMessage == null || customMessage.equals("")) customMessage = "N/A"; - if(radius == null) radius = 100.0; - if(displayName == null || displayName.equals("")) displayName = "N/A"; - if(type == null || type.equals("")) type = "N/A"; + if (customMessage == null || customMessage.equals("")) customMessage = "N/A"; + if (radius == null) radius = 100.0; + if (displayName == null || displayName.equals("")) displayName = "N/A"; + if (type == null || type.equals("")) type = "N/A"; replaceMap.put("{name}", name); replaceMap.put("{type}", type); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/DropTablePanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/DropTablePanel.java index ff8de28..848c74b 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/DropTablePanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/DropTablePanel.java @@ -47,7 +47,7 @@ public class DropTablePanel extends MainListPanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, dropTableMap, entryList); return true; @@ -58,15 +58,16 @@ public class DropTablePanel extends MainListPanelHandler { private void loadPage(Panel panel, int requestedPage, Map dropTableMap, List entryList) { panel.loadPage(requestedPage, (slot, realisticSlot) -> { - if(slot >= dropTableMap.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= dropTableMap.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); DropTable dropTable = dropTableMap.get(name); ItemStackHolder itemStackHolder = BossAPI.getStoredItemStack("DefaultDropTableMenuItem"); ItemStack itemStack = this.itemStackConverter.from(itemStackHolder); - if(itemStack == null) { + if (itemStack == null) { itemStack = new ItemStack(Material.BARRIER); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/EntityTypeEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/EntityTypeEditorPanel.java index 008990d..1015b24 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/EntityTypeEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/EntityTypeEditorPanel.java @@ -43,7 +43,7 @@ public class EntityTypeEditorPanel extends SubVariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, list, bossEntity, entityStatsElement); return true; @@ -80,8 +80,9 @@ public class EntityTypeEditorPanel extends SubVariablePanelHandler panel.loadPage(requestedPage, ((slot, realisticSlot) -> { - if(slot >= filteredList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= filteredList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { EntityType entityType = filteredList.get(slot); ItemStack itemStack = ItemStackUtils.getSpawnEggForEntity(entityType); @@ -90,7 +91,7 @@ public class EntityTypeEditorPanel extends SubVariablePanelHandler { EntityFinder entityFinder = EntityFinder.get(entityType.name()); - if(entityFinder != null) { + if (entityFinder != null) { Message.Boss_Statistics_SetEntityFinder.msg(e.getWhoClicked(), entityFinder.getFancyName()); entityStatsElement.getMainStats().setEntityType(entityFinder.getFancyName()); this.plugin.getBossesFileManager().save(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/MainMenuPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/MainMenuPanel.java index 3c4420d..537eaa9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/MainMenuPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/MainMenuPanel.java @@ -52,9 +52,9 @@ public class MainMenuPanel extends PanelHandler { return event -> { Player player = (Player) event.getWhoClicked(); - if(event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { + if (event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { this.bossPanelManager.getBosses().openFor(player); - } else if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { + } else if (event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { Message.Boss_Create_InvalidArgs.msg(player); player.closeInventory(); } @@ -65,9 +65,9 @@ public class MainMenuPanel extends PanelHandler { return event -> { Player player = (Player) event.getWhoClicked(); - if(event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { + if (event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { this.bossPanelManager.getCustomItems().openFor(player); - } else if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { + } else if (event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { this.bossPanelManager.getCustomItemAddItemsMenu().openFor(player); } }; @@ -77,9 +77,9 @@ public class MainMenuPanel extends PanelHandler { return event -> { Player player = (Player) event.getWhoClicked(); - if(event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { + if (event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { this.bossPanelManager.getAutoSpawns().openFor(player); - } else if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { + } else if (event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { Message.Boss_New_CreateArgumentsAutoSpawn.msg(event.getWhoClicked()); player.closeInventory(); } @@ -90,9 +90,9 @@ public class MainMenuPanel extends PanelHandler { return event -> { Player player = (Player) event.getWhoClicked(); - if(event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { + if (event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { this.bossPanelManager.getDropTables().openFor(player); - } else if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { + } else if (event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { Message.Boss_New_CreateArgumentsDropTable.msg(player); player.closeInventory(); } @@ -103,9 +103,9 @@ public class MainMenuPanel extends PanelHandler { return event -> { Player player = (Player) event.getWhoClicked(); - if(event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { + if (event.getClick() == ClickType.LEFT || event.getClick() == ClickType.SHIFT_LEFT) { this.bossPanelManager.getCustomSkills().openFor(player); - } else if(event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { + } else if (event.getClick() == ClickType.RIGHT || event.getClick() == ClickType.SHIFT_RIGHT) { Message.Boss_New_CreateArgumentsSkill.msg(player); player.closeInventory(); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/ShopPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/ShopPanel.java index 79122d3..ff6bdf2 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/ShopPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/ShopPanel.java @@ -50,7 +50,7 @@ public class ShopPanel extends PanelHandler { int maxPage = panel.getMaxPage(filteredMap); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, entryList, filteredMap); return true; @@ -69,15 +69,16 @@ public class ShopPanel extends PanelHandler { private void loadPage(Panel panel, int page, List entryList, Map filteredMap) { panel.loadPage(page, ((slot, realisticSlot) -> { - if(slot >= filteredMap.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= filteredMap.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); BossEntity bossEntity = filteredMap.get(name); ItemStack itemStack = this.bossEntityManager.getDisplaySpawnItem(bossEntity); double price = bossEntity.getPrice(); - if(itemStack == null) { + if (itemStack == null) { itemStack = new ItemStack(Material.BARRIER); } @@ -93,13 +94,13 @@ public class ShopPanel extends PanelHandler { ItemStack spawnItem = this.bossEntityManager.getSpawnItem(bossEntity); Player player = (Player) e.getWhoClicked(); - if(spawnItem == null) { + if (spawnItem == null) { Debug.FAILED_TO_GIVE_SPAWN_EGG.debug(e.getWhoClicked().getName(), name); return; } - if(EconomyManager.hasBalance(player, price)) { + if (EconomyManager.hasBalance(player, price)) { Message.Boss_Shop_NotEnoughBalance.msg(player, NumberUtils.get().formatDouble(price)); return; } @@ -116,7 +117,7 @@ public class ShopPanel extends PanelHandler { Map newMap = new HashMap<>(); originalMap.forEach((s, bossEntity) -> { - if(bossEntity.canBeBought()) { + if (bossEntity.canBeBought()) { newMap.put(s, bossEntity); } }); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnCustomSettingsEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnCustomSettingsEditorPanel.java index e9cbc9e..32a48c4 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnCustomSettingsEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnCustomSettingsEditorPanel.java @@ -41,12 +41,12 @@ public class AutoSpawnCustomSettingsEditorPanel extends VariablePanelHandler customButtons = autoSpawn.getIntervalSpawnData().getCustomSettingActions(autoSpawn, this); - if(customButtons == null || customButtons.isEmpty()) return; + if (customButtons == null || customButtons.isEmpty()) return; int maxPage = panel.getMaxPage(customButtons); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, customButtons, autoSpawn); return true; @@ -80,8 +80,9 @@ public class AutoSpawnCustomSettingsEditorPanel extends VariablePanelHandler clickActions, AutoSpawn autoSpawn) { panel.loadPage(page, ((slot, realisticSlot) -> { - if(slot >= clickActions.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= clickActions.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { ICustomSettingAction customSettingAction = clickActions.get(slot); ClickAction clickAction = customSettingAction.getAction(); @@ -95,7 +96,7 @@ public class AutoSpawnCustomSettingsEditorPanel extends VariablePanelHandler lore = this.plugin.getDisplay().getStringList("Display.AutoSpawns.CustomSettings.lore"); List newLore = new ArrayList<>(); - for(String s : lore) { - if(s.contains("{extraInformation}")) { - if(extraInfo == null || extraInfo.isEmpty()) continue; + for (String s : lore) { + if (s.contains("{extraInformation}")) { + if (extraInfo == null || extraInfo.isEmpty()) continue; newLore.add("&7"); newLore.addAll(extraInfo); } else { - for(String replaceKey : replaceMap.keySet()) { - if(s.contains(replaceKey)) { + for (String replaceKey : replaceMap.keySet()) { + if (s.contains(replaceKey)) { s = s.replace(replaceKey, replaceMap.get(replaceKey)); } } @@ -125,7 +126,7 @@ public class AutoSpawnCustomSettingsEditorPanel extends VariablePanelHandler { - if(!autoSpawn.isEditing()) { + if (!autoSpawn.isEditing()) { Message.Boss_AutoSpawn_MustToggleEditing.msg(event.getWhoClicked()); } else { clickAction.onClick(event); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnEntitiesEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnEntitiesEditorPanel.java index bfa772d..08b350b 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnEntitiesEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnEntitiesEditorPanel.java @@ -53,7 +53,7 @@ public class AutoSpawnEntitiesEditorPanel extends VariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentEntities, entryList, autoSpawn); return true; @@ -86,8 +86,9 @@ public class AutoSpawnEntitiesEditorPanel extends VariablePanelHandler current = ObjectUtils.getValue(autoSpawn.getEntities(), new ArrayList<>()); panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= entryList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{}); + if (slot >= entryList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); BossEntity bossEntity = currentEntities.get(name); @@ -96,11 +97,11 @@ public class AutoSpawnEntitiesEditorPanel extends VariablePanelHandler replaceMap = new HashMap<>(); replaceMap.put("{name}", name); - replaceMap.put("{editing}", ""+bossEntity.isEditing()); + replaceMap.put("{editing}", "" + bossEntity.isEditing()); replaceMap.put("{targeting}", bossEntity.getTargeting()); replaceMap.put("{dropTable}", bossEntity.getDrops().getDropTable()); - if(current.contains(name)) { + if (current.contains(name)) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.AutoSpawns.Entities.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.AutoSpawns.Entities.name"), replaceMap); @@ -109,12 +110,12 @@ public class AutoSpawnEntitiesEditorPanel extends VariablePanelHandler { - if(!autoSpawn.isEditing()) { + if (!autoSpawn.isEditing()) { Message.Boss_AutoSpawn_MustToggleEditing.msg(event.getWhoClicked()); return; } - if(current.contains(name)) { + if (current.contains(name)) { current.remove(name); } else { current.add(name); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnSpecialSettingsEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnSpecialSettingsEditorPanel.java index f406dd0..15a75ce 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnSpecialSettingsEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/AutoSpawnSpecialSettingsEditorPanel.java @@ -47,11 +47,11 @@ public class AutoSpawnSpecialSettingsEditorPanel extends VariablePanelHandler replaceMap = new HashMap<>(); PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); AutoSpawnSettings autoSpawnSettings = autoSpawn.getAutoSpawnSettings(); - String shuffleEntities = ObjectUtils.getValue(autoSpawnSettings.getShuffleEntitiesList(), false)+""; + String shuffleEntities = ObjectUtils.getValue(autoSpawnSettings.getShuffleEntitiesList(), false) + ""; String maxAliveAtOnce = NumberUtils.get().formatDouble(ObjectUtils.getValue(autoSpawnSettings.getMaxAliveAtOnce(), 1)); String amountPerSpawn = NumberUtils.get().formatDouble(ObjectUtils.getValue(autoSpawnSettings.getAmountPerSpawn(), 1)); - String chunkIsntLoaded = ObjectUtils.getValue(autoSpawnSettings.getSpawnWhenChunkIsntLoaded(), false)+""; - String overrideSpawnMessage = ObjectUtils.getValue(autoSpawnSettings.getOverrideDefaultSpawnMessage(), false)+""; + String chunkIsntLoaded = ObjectUtils.getValue(autoSpawnSettings.getSpawnWhenChunkIsntLoaded(), false) + ""; + String overrideSpawnMessage = ObjectUtils.getValue(autoSpawnSettings.getOverrideDefaultSpawnMessage(), false) + ""; String spawnMessage = ObjectUtils.getValue(autoSpawnSettings.getSpawnMessage(), ""); replaceMap.put("{name}", BossAPI.getAutoSpawnName(autoSpawn)); @@ -86,7 +86,7 @@ public class AutoSpawnSpecialSettingsEditorPanel extends VariablePanelHandler { - if(isBlocked(autoSpawn, event)) return; + if (isBlocked(autoSpawn, event)) return; AutoSpawnSettings settings = autoSpawn.getAutoSpawnSettings(); @@ -97,13 +97,13 @@ public class AutoSpawnSpecialSettingsEditorPanel extends VariablePanelHandler { - if(isBlocked(autoSpawn, event)) return; + if (isBlocked(autoSpawn, event)) return; AutoSpawnSettings settings = autoSpawn.getAutoSpawnSettings(); ClickType clickType = event.getClick(); int amountToModifyBy; - if(clickType.name().contains("RIGHT")) { + if (clickType.name().contains("RIGHT")) { amountToModifyBy = -1; } else { amountToModifyBy = +1; @@ -112,7 +112,7 @@ public class AutoSpawnSpecialSettingsEditorPanel extends VariablePanelHandler { - if(isBlocked(autoSpawn, event)) return; + if (isBlocked(autoSpawn, event)) return; AutoSpawnSettings settings = autoSpawn.getAutoSpawnSettings(); ClickType clickType = event.getClick(); int amountToModifyBy; - if(clickType.name().contains("RIGHT")) { + if (clickType.name().contains("RIGHT")) { amountToModifyBy = -1; } else { amountToModifyBy = +1; @@ -136,7 +136,7 @@ public class AutoSpawnSpecialSettingsEditorPanel extends VariablePanelHandler { - if(isBlocked(autoSpawn, event)) return; + if (isBlocked(autoSpawn, event)) return; AutoSpawnSettings settings = autoSpawn.getAutoSpawnSettings(); @@ -156,7 +156,7 @@ public class AutoSpawnSpecialSettingsEditorPanel extends VariablePanelHandler { - if(isBlocked(autoSpawn, event)) return; + if (isBlocked(autoSpawn, event)) return; AutoSpawnSettings settings = autoSpawn.getAutoSpawnSettings(); @@ -166,7 +166,7 @@ public class AutoSpawnSpecialSettingsEditorPanel extends VariablePanelHandler { private ClickAction getIntervalSystem(AutoSpawn autoSpawn) { return event -> { - if(!autoSpawn.isEditing()) { + if (!autoSpawn.isEditing()) { Message.Boss_AutoSpawn_MustToggleEditing.msg(event.getWhoClicked()); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/MainAutoSpawnEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/MainAutoSpawnEditorPanel.java index a8cc81f..ee8ee5b 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/MainAutoSpawnEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/autospawns/MainAutoSpawnEditorPanel.java @@ -46,7 +46,7 @@ public class MainAutoSpawnEditorPanel extends VariablePanelHandler { public void openFor(Player player, AutoSpawn autoSpawn) { Map replaceMap = new HashMap<>(); String type = ObjectUtils.getValue(autoSpawn.getType(), "INTERVAL"); - String editing = ""+ObjectUtils.getValue(autoSpawn.isEditing(), false); + String editing = "" + ObjectUtils.getValue(autoSpawn.isEditing(), false); String entities = StringUtils.get().appendList(autoSpawn.getEntities()); PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); @@ -80,10 +80,10 @@ public class MainAutoSpawnEditorPanel extends VariablePanelHandler { Player player = (Player) event.getWhoClicked(); boolean editing = autoSpawn.isEditing(); - if(!editing) { + if (!editing) { autoSpawn.setEditing(true); } else { - if(!autoSpawn.isCompleteEnoughToSpawn()) { + if (!autoSpawn.isCompleteEnoughToSpawn()) { Message.Boss_AutoSpawn_NotCompleteEnough.msg(player); return; } @@ -95,7 +95,7 @@ public class MainAutoSpawnEditorPanel extends VariablePanelHandler { this.autoSpawnFileManager.save(); player.closeInventory(); - if(autoSpawn.isEditing()) { + if (autoSpawn.isEditing()) { this.autoSpawnManager.removeActiveAutoSpawnHolder(autoSpawn); } else { this.autoSpawnManager.addAndCreateActiveAutoSpawnHolder(autoSpawn); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/BossListEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/BossListEditorPanel.java index 9e83a77..f362bef 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/BossListEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/BossListEditorPanel.java @@ -75,7 +75,7 @@ public abstract class BossListEditorPanel extends VariablePanelHandler panel.setOnClick(slot, event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/BossShopEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/BossShopEditorPanel.java index 9fd5277..e0d164f 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/BossShopEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/BossShopEditorPanel.java @@ -46,7 +46,7 @@ public class BossShopEditorPanel extends VariablePanelHandler { PanelBuilderCounter counter = panelBuilder.getPanelBuilderCounter(); replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); - replaceMap.put("{buyable}", bossEntity.isBuyable()+""); + replaceMap.put("{buyable}", bossEntity.isBuyable() + ""); replaceMap.put("{price}", NumberUtils.get().formatDouble(ObjectUtils.getValue(bossEntity.getPrice(), 0.0))); panelBuilder.addReplaceData(replaceMap); @@ -55,7 +55,7 @@ public class BossShopEditorPanel extends VariablePanelHandler { counter.getSlotsWith("Buyable").forEach(slot -> panel.setOnClick(slot, getBuyableAction(bossEntity))); counter.getSlotsWith("Price").forEach(slot -> panel.setOnClick(slot, event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -78,7 +78,7 @@ public class BossShopEditorPanel extends VariablePanelHandler { public ClickAction getBuyableAction(BossEntity bossEntity) { return event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/DropsEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/DropsEditorPanel.java index c73faaa..405270f 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/DropsEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/DropsEditorPanel.java @@ -59,7 +59,7 @@ public class DropsEditorPanel extends VariablePanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, dropTableMap, entryList, bossEntity); return true; @@ -103,14 +103,15 @@ public class DropsEditorPanel extends VariablePanelHandler { String dropTableName = bossEntity.getDrops().getDropTable(); panel.loadPage(requestedPage, (slot, realisticSlot) -> { - if(slot >= dropTableMap.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= dropTableMap.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); DropTable dropTable = dropTableMap.get(name); ItemStackHolder itemStackHolder; - if(dropTableName.equalsIgnoreCase(name)) { + if (dropTableName.equalsIgnoreCase(name)) { itemStackHolder = BossAPI.getStoredItemStack("DefaultSelectedDropTableItem"); } else { itemStackHolder = BossAPI.getStoredItemStack("DefaultDropTableMenuItem"); @@ -118,7 +119,7 @@ public class DropsEditorPanel extends VariablePanelHandler { ItemStack itemStack = this.itemStackConverter.from(itemStackHolder); - if(itemStack == null) { + if (itemStack == null) { itemStack = new ItemStack(Material.BARRIER); } @@ -131,7 +132,7 @@ public class DropsEditorPanel extends VariablePanelHandler { ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getDisplay().getStringList("Display.Boss.Drops.lore"), replaceMap); panel.setItem(realisticSlot, itemStack, e -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(e.getWhoClicked()); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/DropsMainEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/DropsMainEditorPanel.java index a427e50..90b2b59 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/DropsMainEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/DropsMainEditorPanel.java @@ -45,13 +45,13 @@ public class DropsMainEditorPanel extends VariablePanelHandler { String dropTable = bossEntity.getDrops().getDropTable(); PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); - if(naturalDrops == null) naturalDrops = true; - if(naturalExp == null) naturalExp = true; - if(dropTable == null) dropTable = "N/A"; + if (naturalDrops == null) naturalDrops = true; + if (naturalExp == null) naturalExp = true; + if (dropTable == null) dropTable = "N/A"; replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); - replaceMap.put("{naturalDrops}", ""+naturalDrops); - replaceMap.put("{naturalExp}", ""+naturalExp); + replaceMap.put("{naturalDrops}", "" + naturalDrops); + replaceMap.put("{naturalExp}", "" + naturalExp); replaceMap.put("{dropTable}", dropTable); panelBuilder.addReplaceData(replaceMap); @@ -81,7 +81,7 @@ public class DropsMainEditorPanel extends VariablePanelHandler { private ClickAction getNaturalDropsAction(BossEntity bossEntity, Boolean current) { return event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -95,7 +95,7 @@ public class DropsMainEditorPanel extends VariablePanelHandler { private ClickAction getNaturalExpAction(BossEntity bossEntity, Boolean current) { return event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/MainBossEditPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/MainBossEditPanel.java index 5c5c270..44377b2 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/MainBossEditPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/MainBossEditPanel.java @@ -88,12 +88,12 @@ public class MainBossEditPanel extends VariablePanelHandler { return event -> { Player player = (Player) event.getWhoClicked(); - if(bossEntity.isCompleteEnoughToSpawn()) { + if (bossEntity.isCompleteEnoughToSpawn()) { bossEntity.setEditing(!bossEntity.isEditing()); this.bossesFileManager.save(); Message.Boss_Edit_Toggled.msg(player, BossAPI.getBossEntityName(bossEntity), bossEntity.getEditingValue()); - if(bossEntity.isEditing()) { + if (bossEntity.isEditing()) { this.bossEntityManager.killAllHolders(bossEntity); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SkillListEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SkillListEditorPanel.java index 3c77897..fc4409d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SkillListEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SkillListEditorPanel.java @@ -51,7 +51,7 @@ public class SkillListEditorPanel extends VariablePanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentSkills, entryList, bossEntity); return true; @@ -86,8 +86,9 @@ public class SkillListEditorPanel extends VariablePanelHandler { private void loadPage(Panel panel, int requestedPage, Map currentSkills, List entryList, BossEntity bossEntity) { panel.loadPage(requestedPage, (slot, realisticSlot) -> { - if(slot >= currentSkills.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= currentSkills.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); Skill skill = currentSkills.get(name); @@ -102,7 +103,7 @@ public class SkillListEditorPanel extends VariablePanelHandler { replaceMap.put("{customMessage}", StringUtils.get().formatString(skill.getCustomMessage())); replaceMap.put("{radius}", NumberUtils.get().formatDouble(skill.getRadius())); - if(bossEntity.getSkills().getSkills().contains(name)) { + if (bossEntity.getSkills().getSkills().contains(name)) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Skills.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Skills.name"), replaceMap); @@ -111,14 +112,14 @@ public class SkillListEditorPanel extends VariablePanelHandler { ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getDisplay().getStringList("Display.Boss.Skills.lore"), replaceMap); panel.setItem(realisticSlot, itemStack, e -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(e.getWhoClicked()); return; } List currentSkillList = bossEntity.getSkills().getSkills(); - if(currentSkillList.contains(name)) { + if (currentSkillList.contains(name)) { currentSkillList.remove(name); } else { currentSkillList.add(name); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SkillMainEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SkillMainEditorPanel.java index ad71084..5847bac 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SkillMainEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SkillMainEditorPanel.java @@ -45,7 +45,7 @@ public class SkillMainEditorPanel extends VariablePanelHandler { Double chance = bossEntity.getSkills().getOverallChance(); PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); - if(chance == null) chance = 0.0; + if (chance == null) chance = 0.0; replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); replaceMap.put("{chance}", NumberUtils.get().formatDouble(chance)); @@ -74,7 +74,7 @@ public class SkillMainEditorPanel extends VariablePanelHandler { private ClickAction getOverallChanceAction(BossEntity bossEntity) { return event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -82,28 +82,28 @@ public class SkillMainEditorPanel extends VariablePanelHandler { ClickType clickType = event.getClick(); double chanceToModifyBy = 0.0; - if(clickType == ClickType.LEFT) { + if (clickType == ClickType.LEFT) { chanceToModifyBy = 1.0; - } else if(clickType == ClickType.SHIFT_LEFT) { + } else if (clickType == ClickType.SHIFT_LEFT) { chanceToModifyBy = 0.1; - } else if(clickType == ClickType.RIGHT) { + } else if (clickType == ClickType.RIGHT) { chanceToModifyBy = -1.0; - } else if(clickType == ClickType.SHIFT_RIGHT) { + } else if (clickType == ClickType.SHIFT_RIGHT) { chanceToModifyBy = -0.1; } - String modifyValue = chanceToModifyBy > 0.0? "increased" : "decreased"; + String modifyValue = chanceToModifyBy > 0.0 ? "increased" : "decreased"; Double currentChance = bossEntity.getSkills().getOverallChance(); - if(currentChance == null) currentChance = 0.0; + if (currentChance == null) currentChance = 0.0; double newChance = currentChance + chanceToModifyBy; - if(newChance < 0.0) { + if (newChance < 0.0) { newChance = 0.0; } - if(newChance > 100.0) { + if (newChance > 100.0) { newChance = 100.0; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SpawnItemEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SpawnItemEditorPanel.java index 63e7d01..5125803 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SpawnItemEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/SpawnItemEditorPanel.java @@ -53,7 +53,7 @@ public class SpawnItemEditorPanel extends VariablePanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, itemStackHolderMap, entryList, bossEntity); return true; @@ -77,7 +77,7 @@ public class SpawnItemEditorPanel extends VariablePanelHandler { ServerUtils.get().runTaskAsync(() -> { panelBuilderCounter.getSlotsWith("AddNew").forEach(slot -> panel.setOnClick(slot, event -> openAddItemsPanel(player, bossEntity))); panelBuilderCounter.getSlotsWith("Remove").forEach(slot -> panel.setOnClick(slot, event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -110,18 +110,19 @@ public class SpawnItemEditorPanel extends VariablePanelHandler { String current = ObjectUtils.getValue(bossEntity.getSpawnItem(), ""); panel.loadPage(requestedPage, (slot, realisticSlot) -> { - if(slot >= filteredMap.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= filteredMap.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); ItemStackHolder itemStackHolder = filteredMap.get(name); ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(itemStackHolder); - if(itemStack == null) { + if (itemStack == null) { itemStack = new ItemStack(Material.BARRIER); } - if(name.equalsIgnoreCase(current)) { + if (name.equalsIgnoreCase(current)) { Map replaceMap = new HashMap<>(); replaceMap.put("{name}", ItemStackUtils.getName(itemStack)); @@ -130,7 +131,7 @@ public class SpawnItemEditorPanel extends VariablePanelHandler { } panel.setItem(realisticSlot, itemStack, e -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(e.getWhoClicked()); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/StatisticMainEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/StatisticMainEditorPanel.java index 13adde5..e8395fe 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/StatisticMainEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/StatisticMainEditorPanel.java @@ -49,8 +49,8 @@ public class StatisticMainEditorPanel extends SubVariablePanelHandler { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -101,7 +101,7 @@ public class StatisticMainEditorPanel extends SubVariablePanelHandler { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -109,24 +109,24 @@ public class StatisticMainEditorPanel extends SubVariablePanelHandler 0.0? "increased" : "decreased"; + String modifyValue = healthToModifyBy > 0.0 ? "increased" : "decreased"; Double currentChance = entityStatsElement.getMainStats().getHealth(); - if(currentChance == null) currentChance = 0.0; + if (currentChance == null) currentChance = 0.0; double newHealth = currentChance + healthToModifyBy; - if(newHealth < 0.0) { + if (newHealth < 0.0) { newHealth = 1.0; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/TargetingEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/TargetingEditorPanel.java index c00bfcd..08f2e31 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/TargetingEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/TargetingEditorPanel.java @@ -58,8 +58,8 @@ public class TargetingEditorPanel extends VariablePanelHandler { ItemStack currentStack = panel.getInventory().getItem(slot); ItemStack newItemStack = getItemStack(current, (String) returnValue, currentStack); - panel.setItem(slot, newItemStack , event -> { - if(!bossEntity.isEditing()) { + panel.setItem(slot, newItemStack, event -> { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -84,7 +84,7 @@ public class TargetingEditorPanel extends VariablePanelHandler { ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(this.itemsFileManager.getItemStackHolder("DefaultSelectedTargetingItem")); ItemStack cloneStack = currentItemStack.clone(); - if(thisType.equalsIgnoreCase(current)) { + if (thisType.equalsIgnoreCase(current)) { cloneStack.setType(itemStack.getType()); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/commands/OnDeathCommandEditor.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/commands/OnDeathCommandEditor.java index 019e41f..724faf9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/commands/OnDeathCommandEditor.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/commands/OnDeathCommandEditor.java @@ -50,7 +50,7 @@ public class OnDeathCommandEditor extends VariablePanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentCommands, entryList, bossEntity); return true; @@ -85,8 +85,9 @@ public class OnDeathCommandEditor extends VariablePanelHandler { private void loadPage(Panel panel, int page, Map> currentCommands, List entryList, BossEntity bossEntity) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= entryList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= entryList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); List commands = currentCommands.get(name); @@ -97,7 +98,7 @@ public class OnDeathCommandEditor extends VariablePanelHandler { replaceMap.put("{name}", name); - if(bossEntity.getCommands().getOnDeath() != null && bossEntity.getCommands().getOnDeath().equalsIgnoreCase(name)) { + if (bossEntity.getCommands().getOnDeath() != null && bossEntity.getCommands().getOnDeath().equalsIgnoreCase(name)) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Commands.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Commands.name"), replaceMap); @@ -107,9 +108,9 @@ public class OnDeathCommandEditor extends VariablePanelHandler { List presetLore = this.plugin.getDisplay().getStringList("Display.Boss.Commands.lore"); List newLore = new ArrayList<>(); - for(String s : presetLore) { - if(s.contains("{commands}")) { - for(String command : commands) { + for (String s : presetLore) { + if (s.contains("{commands}")) { + for (String command : commands) { newLore.add(StringUtils.get().translateColor("&7" + command)); } } else { @@ -121,7 +122,7 @@ public class OnDeathCommandEditor extends VariablePanelHandler { itemStack.setItemMeta(itemMeta); panel.setItem(realisticSlot, itemStack, e -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(e.getWhoClicked()); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/commands/OnSpawnCommandEditor.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/commands/OnSpawnCommandEditor.java index 0319c63..de924b5 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/commands/OnSpawnCommandEditor.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/commands/OnSpawnCommandEditor.java @@ -50,7 +50,7 @@ public class OnSpawnCommandEditor extends VariablePanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentCommands, entryList, bossEntity); return true; @@ -85,8 +85,9 @@ public class OnSpawnCommandEditor extends VariablePanelHandler { private void loadPage(Panel panel, int page, Map> currentCommands, List entryList, BossEntity bossEntity) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= entryList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= entryList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); List commands = currentCommands.get(name); @@ -97,7 +98,7 @@ public class OnSpawnCommandEditor extends VariablePanelHandler { replaceMap.put("{name}", name); - if(bossEntity.getCommands().getOnSpawn() != null && bossEntity.getCommands().getOnSpawn().equalsIgnoreCase(name)) { + if (bossEntity.getCommands().getOnSpawn() != null && bossEntity.getCommands().getOnSpawn().equalsIgnoreCase(name)) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Commands.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Commands.name"), replaceMap); @@ -107,9 +108,9 @@ public class OnSpawnCommandEditor extends VariablePanelHandler { List presetLore = this.plugin.getDisplay().getStringList("Display.Boss.Commands.lore"); List newLore = new ArrayList<>(); - for(String s : presetLore) { - if(s.contains("{commands}")) { - for(String command : commands) { + for (String s : presetLore) { + if (s.contains("{commands}")) { + for (String command : commands) { newLore.add(StringUtils.get().translateColor("&7" + command)); } } else { @@ -121,7 +122,7 @@ public class OnSpawnCommandEditor extends VariablePanelHandler { itemStack.setItemMeta(itemMeta); panel.setItem(realisticSlot, itemStack, e -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(e.getWhoClicked()); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/BootsEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/BootsEditorPanel.java index 78dd427..8dcd465 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/BootsEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/BootsEditorPanel.java @@ -31,7 +31,7 @@ public class BootsEditorPanel extends ItemStackSubListPanelHandler { originalMap.forEach((string, holder) -> { ItemStack itemStack = this.itemStackConverter.from(holder); - if(itemStack.getType().name().contains("BOOTS")) { + if (itemStack.getType().name().contains("BOOTS")) { newMap.put(string, holder); } }); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/ChestplateEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/ChestplateEditorPanel.java index 76c15b7..f3469d4 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/ChestplateEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/ChestplateEditorPanel.java @@ -31,7 +31,7 @@ public class ChestplateEditorPanel extends ItemStackSubListPanelHandler { originalMap.forEach((string, holder) -> { ItemStack itemStack = this.itemStackConverter.from(holder); - if(itemStack.getType().name().contains("CHESTPLATE")) { + if (itemStack.getType().name().contains("CHESTPLATE")) { newMap.put(string, holder); } }); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/HelmetEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/HelmetEditorPanel.java index 46f2cf2..f456d1d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/HelmetEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/HelmetEditorPanel.java @@ -31,7 +31,7 @@ public class HelmetEditorPanel extends ItemStackSubListPanelHandler { originalMap.forEach((string, holder) -> { ItemStack itemStack = this.itemStackConverter.from(holder); - if(itemStack.getType().name().contains("HELMET") || itemStack.getType().isBlock()) { + if (itemStack.getType().name().contains("HELMET") || itemStack.getType().isBlock()) { newMap.put(string, holder); } }); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/LeggingsEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/LeggingsEditorPanel.java index df8ec95..c32a823 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/LeggingsEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/equipment/LeggingsEditorPanel.java @@ -31,7 +31,7 @@ public class LeggingsEditorPanel extends ItemStackSubListPanelHandler { originalMap.forEach((string, holder) -> { ItemStack itemStack = this.itemStackConverter.from(holder); - if(itemStack.getType().name().contains("LEGGINGS")) { + if (itemStack.getType().name().contains("LEGGINGS")) { newMap.put(string, holder); } }); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/DeathTextEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/DeathTextEditorPanel.java index b8374e9..12f20fc 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/DeathTextEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/DeathTextEditorPanel.java @@ -50,10 +50,10 @@ public class DeathTextEditorPanel extends VariablePanelHandler { String positionMessage = onDeathMessageElement.getPositionMessage(); PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); - if(radius == null) radius = 0; - if(onlyShow == null) onlyShow = 3; - if(mainMessage == null) mainMessage = "N/A"; - if(positionMessage == null) positionMessage = "N/A"; + if (radius == null) radius = 0; + if (onlyShow == null) onlyShow = 3; + if (mainMessage == null) mainMessage = "N/A"; + if (positionMessage == null) positionMessage = "N/A"; replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); replaceMap.put("{radius}", NumberUtils.get().formatDouble(radius)); @@ -86,7 +86,7 @@ public class DeathTextEditorPanel extends VariablePanelHandler { private ClickAction getRadiusAction(BossEntity bossEntity) { return event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -94,24 +94,24 @@ public class DeathTextEditorPanel extends VariablePanelHandler { ClickType clickType = event.getClick(); int radiusToModifyBy = 0; - if(clickType == ClickType.LEFT) { + if (clickType == ClickType.LEFT) { radiusToModifyBy = 1; - } else if(clickType == ClickType.SHIFT_LEFT) { + } else if (clickType == ClickType.SHIFT_LEFT) { radiusToModifyBy = 10; - } else if(clickType == ClickType.RIGHT) { + } else if (clickType == ClickType.RIGHT) { radiusToModifyBy = -1; - } else if(clickType == ClickType.SHIFT_RIGHT) { + } else if (clickType == ClickType.SHIFT_RIGHT) { radiusToModifyBy = -10; } - String modifyValue = radiusToModifyBy > 0? "increased" : "decreased"; + String modifyValue = radiusToModifyBy > 0 ? "increased" : "decreased"; Integer currentRadius = bossEntity.getMessages().getOnDeath().getRadius(); - if(currentRadius == null) currentRadius = 0; + if (currentRadius == null) currentRadius = 0; int newRadius = currentRadius + radiusToModifyBy; - if(newRadius < -1) { + if (newRadius < -1) { newRadius = -1; } @@ -124,7 +124,7 @@ public class DeathTextEditorPanel extends VariablePanelHandler { private ClickAction getOnlyShowAction(BossEntity bossEntity) { return event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -132,20 +132,20 @@ public class DeathTextEditorPanel extends VariablePanelHandler { ClickType clickType = event.getClick(); int amountToModifyBy = 0; - if(clickType.name().contains("LEFT")) { + if (clickType.name().contains("LEFT")) { amountToModifyBy = 1; - } else if(clickType.name().contains("RIGHT")) { + } else if (clickType.name().contains("RIGHT")) { amountToModifyBy = -1; } - String modifyValue = amountToModifyBy > 0? "increased" : "decreased"; + String modifyValue = amountToModifyBy > 0 ? "increased" : "decreased"; Integer currentAmount = bossEntity.getMessages().getOnDeath().getOnlyShow(); - if(currentAmount == null) currentAmount = 3; + if (currentAmount == null) currentAmount = 3; int newAmount = currentAmount + amountToModifyBy; - if(newAmount < -1) { + if (newAmount < -1) { newAmount = -1; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/SpawnTextEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/SpawnTextEditorPanel.java index 35d8760..988b1df 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/SpawnTextEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/SpawnTextEditorPanel.java @@ -46,8 +46,8 @@ public class SpawnTextEditorPanel extends VariablePanelHandler { String message = bossEntity.getMessages().getOnSpawn().getMessage(); PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); - if(radius == null) radius = 0; - if(message == null) message = "N/A"; + if (radius == null) radius = 0; + if (message == null) message = "N/A"; replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); replaceMap.put("{radius}", NumberUtils.get().formatDouble(radius)); @@ -77,7 +77,7 @@ public class SpawnTextEditorPanel extends VariablePanelHandler { private ClickAction getRadiusAction(BossEntity bossEntity) { return event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -85,24 +85,24 @@ public class SpawnTextEditorPanel extends VariablePanelHandler { ClickType clickType = event.getClick(); int radiusToModifyBy = 0; - if(clickType == ClickType.LEFT) { + if (clickType == ClickType.LEFT) { radiusToModifyBy = 1; - } else if(clickType == ClickType.SHIFT_LEFT) { + } else if (clickType == ClickType.SHIFT_LEFT) { radiusToModifyBy = 10; - } else if(clickType == ClickType.RIGHT) { + } else if (clickType == ClickType.RIGHT) { radiusToModifyBy = -1; - } else if(clickType == ClickType.SHIFT_RIGHT) { + } else if (clickType == ClickType.SHIFT_RIGHT) { radiusToModifyBy = -10; } - String modifyValue = radiusToModifyBy > 0? "increased" : "decreased"; + String modifyValue = radiusToModifyBy > 0 ? "increased" : "decreased"; Integer currentRadius = bossEntity.getMessages().getOnSpawn().getRadius(); - if(currentRadius == null) currentRadius = 0; + if (currentRadius == null) currentRadius = 0; int newRadius = currentRadius + radiusToModifyBy; - if(newRadius < -1) { + if (newRadius < -1) { newRadius = -1; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/TauntTextEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/TauntTextEditorPanel.java index ac364a1..8378c26 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/TauntTextEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/bosses/text/TauntTextEditorPanel.java @@ -52,9 +52,9 @@ public class TauntTextEditorPanel extends VariablePanelHandler { List taunts = tauntElement.getTaunts(); PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); - if(radius == null) radius = 100; - if(delay == null) delay = 60; - if(taunts == null || taunts.isEmpty()) taunts = Arrays.asList("N/A"); + if (radius == null) radius = 100; + if (delay == null) delay = 60; + if (taunts == null || taunts.isEmpty()) taunts = Arrays.asList("N/A"); replaceMap.put("{name}", BossAPI.getBossEntityName(bossEntity)); replaceMap.put("{radius}", NumberUtils.get().formatDouble(radius)); @@ -85,7 +85,7 @@ public class TauntTextEditorPanel extends VariablePanelHandler { private ClickAction getRadiusAction(BossEntity bossEntity) { return event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -93,24 +93,24 @@ public class TauntTextEditorPanel extends VariablePanelHandler { ClickType clickType = event.getClick(); int radiusToModifyBy = 0; - if(clickType == ClickType.LEFT) { + if (clickType == ClickType.LEFT) { radiusToModifyBy = 1; - } else if(clickType == ClickType.SHIFT_LEFT) { + } else if (clickType == ClickType.SHIFT_LEFT) { radiusToModifyBy = 10; - } else if(clickType == ClickType.RIGHT) { + } else if (clickType == ClickType.RIGHT) { radiusToModifyBy = -1; - } else if(clickType == ClickType.SHIFT_RIGHT) { + } else if (clickType == ClickType.SHIFT_RIGHT) { radiusToModifyBy = -10; } - String modifyValue = radiusToModifyBy > 0? "increased" : "decreased"; + String modifyValue = radiusToModifyBy > 0 ? "increased" : "decreased"; Integer currentRadius = bossEntity.getMessages().getTaunts().getRadius(); - if(currentRadius == null) currentRadius = 0; + if (currentRadius == null) currentRadius = 0; int newRadius = currentRadius + radiusToModifyBy; - if(newRadius < -1) { + if (newRadius < -1) { newRadius = -1; } @@ -123,7 +123,7 @@ public class TauntTextEditorPanel extends VariablePanelHandler { private ClickAction getDelayAction(BossEntity bossEntity) { return event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -131,24 +131,24 @@ public class TauntTextEditorPanel extends VariablePanelHandler { ClickType clickType = event.getClick(); int delayToModifyBy = 0; - if(clickType == ClickType.LEFT) { + if (clickType == ClickType.LEFT) { delayToModifyBy = 1; - } else if(clickType == ClickType.SHIFT_LEFT) { + } else if (clickType == ClickType.SHIFT_LEFT) { delayToModifyBy = 10; - } else if(clickType == ClickType.RIGHT) { + } else if (clickType == ClickType.RIGHT) { delayToModifyBy = -1; - } else if(clickType == ClickType.SHIFT_RIGHT) { + } else if (clickType == ClickType.SHIFT_RIGHT) { delayToModifyBy = -10; } - String modifyValue = delayToModifyBy > 0? "increased" : "decreased"; + String modifyValue = delayToModifyBy > 0 ? "increased" : "decreased"; Integer currentDelay = bossEntity.getMessages().getTaunts().getDelay(); - if(currentDelay == null) currentDelay = 0; + if (currentDelay == null) currentDelay = 0; int newDelay = currentDelay + delayToModifyBy; - if(newDelay < -1) { + if (newDelay < -1) { newDelay = -1; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/MainDropTableEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/MainDropTableEditorPanel.java index 3316624..78e16ce 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/MainDropTableEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/MainDropTableEditorPanel.java @@ -63,11 +63,11 @@ public class MainDropTableEditorPanel extends VariablePanelHandler { String dropTableType = dropTable.getDropType(); Player player = (Player) event.getWhoClicked(); - if(dropTableType.equalsIgnoreCase("SPRAY")) { + if (dropTableType.equalsIgnoreCase("SPRAY")) { this.bossPanelManager.getSprayDropTableMainEditMenu().openFor(player, dropTable, dropTable.getSprayTableData()); - } else if(dropTableType.equalsIgnoreCase("GIVE")) { + } else if (dropTableType.equalsIgnoreCase("GIVE")) { this.bossPanelManager.getGiveRewardPositionListMenu().openFor(player, dropTable, dropTable.getGiveTableData()); - } else if(dropTableType.equalsIgnoreCase("DROP")) { + } else if (dropTableType.equalsIgnoreCase("DROP")) { this.bossPanelManager.getDropDropTableMainEditMenu().openFor(player, dropTable, dropTable.getDropTableData()); } else { Debug.FAILED_TO_FIND_DROP_TABLE_TYPE.debug(dropTableType); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableNewRewardEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableNewRewardEditorPanel.java index 577a80d..442e009 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableNewRewardEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableNewRewardEditorPanel.java @@ -45,7 +45,7 @@ public abstract class DropTableNewRewardEditorPanel extends SubVari int maxPage = panel.getMaxPage(filteredKeys); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, dropTable, subVariable, filteredKeys, itemStacks); return true; @@ -70,8 +70,9 @@ public abstract class DropTableNewRewardEditorPanel extends SubVari private void loadPage(Panel panel, int page, DropTable dropTable, SubVariable subVariable, List filteredKeys, Map itemStacks) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= filteredKeys.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{}); + if (slot >= filteredKeys.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = filteredKeys.get(slot); ItemStackHolder itemStackHolder = itemStacks.get(name); @@ -94,7 +95,7 @@ public abstract class DropTableNewRewardEditorPanel extends SubVari List filteredList = new ArrayList<>(); itemStacks.keySet().forEach(string -> { - if(currentKeys.contains(string)) return; + if (currentKeys.contains(string)) return; filteredList.add(string); }); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableRewardMainEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableRewardMainEditorPanel.java index c72691e..9cdb952 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableRewardMainEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableRewardMainEditorPanel.java @@ -69,26 +69,26 @@ public abstract class DropTableRewardMainEditorPanel extends SubSub ClickType clickType = event.getClick(); double amountToModifyBy; - if(clickType == ClickType.SHIFT_LEFT) { + if (clickType == ClickType.SHIFT_LEFT) { amountToModifyBy = 0.1; - } else if(clickType == ClickType.RIGHT) { + } else if (clickType == ClickType.RIGHT) { amountToModifyBy = -1.0; - } else if(clickType == ClickType.SHIFT_RIGHT) { + } else if (clickType == ClickType.SHIFT_RIGHT) { amountToModifyBy = -0.1; } else { amountToModifyBy = 1.0; } - String modifyValue = amountToModifyBy > 0? "increased" : "decreased"; + String modifyValue = amountToModifyBy > 0 ? "increased" : "decreased"; Map rewards = getRewards(subVariable); double currentValue = rewards.getOrDefault(name, 50.0); double newValue = currentValue + amountToModifyBy; - if(newValue < 0) { + if (newValue < 0) { newValue = 0; } - if(newValue > 100) { + if (newValue > 100) { newValue = 100; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableRewardsListEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableRewardsListEditorPanel.java index c9af3d2..f5e5f28 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableRewardsListEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/rewards/DropTableRewardsListEditorPanel.java @@ -47,7 +47,7 @@ public abstract class DropTableRewardsListEditorPanel extends SubVa int maxPage = panel.getMaxPage(keyList); panel.setOnPageChange((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, dropTable, subVariable, rewardMap, keyList); return true; @@ -83,14 +83,15 @@ public abstract class DropTableRewardsListEditorPanel extends SubVa private void loadPage(Panel panel, int page, DropTable dropTable, SubVariable subVariable, Map rewardMap, List keyList) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= keyList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= keyList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = keyList.get(slot); Double chance = rewardMap.get(name); Map replaceMap = new HashMap<>(); - if(chance == null) chance = 100.0; + if (chance == null) chance = 100.0; replaceMap.put("{itemName}", name); replaceMap.put("{chance}", NumberUtils.get().formatDouble(chance)); @@ -103,7 +104,7 @@ public abstract class DropTableRewardsListEditorPanel extends SubVa ItemStack itemStack = this.itemsFileManager.getItemStackConverter().from(itemStackHolder); - if(itemStack == null || itemStack.getType() == Material.AIR) return; + if (itemStack == null || itemStack.getType() == Material.AIR) return; ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.DropTable.RewardList.name"), replaceMap); ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getDisplay().getStringList("Display.DropTable.RewardList.lore"), replaceMap); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/drop/DropDropTableMainEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/drop/DropDropTableMainEditorPanel.java index c36737a..20d6397 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/drop/DropDropTableMainEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/drop/DropDropTableMainEditorPanel.java @@ -48,11 +48,11 @@ public class DropDropTableMainEditorPanel extends SubVariablePanelHandler { Boolean currentValue = dropTableElement.getRandomDrops(); - if(currentValue == null) currentValue = false; + if (currentValue == null) currentValue = false; boolean newValue = !currentValue; @@ -94,24 +94,24 @@ public class DropDropTableMainEditorPanel extends SubVariablePanelHandler 0? "increased" : "decreased"; + String modifyValue = amountToModifyBy > 0 ? "increased" : "decreased"; Integer currentAmount = dropTableElement.getDropMaxDrops(); - if(currentAmount == null) currentAmount = -1; + if (currentAmount == null) currentAmount = -1; int newAmount = currentAmount + amountToModifyBy; - if(newAmount < -1) { + if (newAmount < -1) { newAmount = -1; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardMainEditPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardMainEditPanel.java index 88f9b90..b27e0d6 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardMainEditPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardMainEditPanel.java @@ -53,13 +53,13 @@ public class GiveRewardMainEditPanel extends SubVariablePanelHandler 0? "increased" : "decreased"; + String modifyValue = amountToModifyBy > 0 ? "increased" : "decreased"; double currentAmount = ObjectUtils.getValue(giveTableSubElement.getRequiredPercentage(), 0.0); double newAmount = currentAmount + amountToModifyBy; - if(newAmount < 0) { + if (newAmount < 0) { newAmount = 0; } - if(newAmount > 100) { + if (newAmount > 100) { newAmount = 100; } @@ -131,22 +131,22 @@ public class GiveRewardMainEditPanel extends SubVariablePanelHandler 0? "increased" : "decreased"; + String modifyValue = amountToModifyBy > 0 ? "increased" : "decreased"; int currentAmount = ObjectUtils.getValue(giveTableSubElement.getMaxCommands(), 3); int newAmount = currentAmount + amountToModifyBy; - if(newAmount < -1) { + if (newAmount < -1) { newAmount = -1; } @@ -163,22 +163,22 @@ public class GiveRewardMainEditPanel extends SubVariablePanelHandler 0? "increased" : "decreased"; + String modifyValue = amountToModifyBy > 0 ? "increased" : "decreased"; int currentAmount = ObjectUtils.getValue(giveTableSubElement.getMaxDrops(), 3); int newAmount = currentAmount + amountToModifyBy; - if(newAmount < -1) { + if (newAmount < -1) { newAmount = -1; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardPositionListPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardPositionListPanel.java index f20024d..43b2e76 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardPositionListPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardPositionListPanel.java @@ -51,7 +51,7 @@ public class GiveRewardPositionListPanel extends SubVariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, dropTable, giveTableElement, keys, rewardSections); return true; @@ -87,8 +87,9 @@ public class GiveRewardPositionListPanel extends SubVariablePanelHandler keys, Map> rewards) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= keys.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{}); + if (slot >= keys.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String position = keys.get(slot); Map innerRewards = rewards.get(position); @@ -105,7 +106,7 @@ public class GiveRewardPositionListPanel extends SubVariablePanelHandler { ClickType clickType = event.getClick(); - if(clickType == ClickType.SHIFT_RIGHT) { + if (clickType == ClickType.SHIFT_RIGHT) { rewards.remove(position); giveTableElement.setGiveRewards(rewards); saveDropTable((Player) event.getWhoClicked(), dropTable, giveTableElement, BossAPI.convertObjectToJsonObject(giveTableElement)); @@ -122,9 +123,9 @@ public class GiveRewardPositionListPanel extends SubVariablePanelHandler> rewards = giveTableElement.getGiveRewards(); List keys = new ArrayList<>(giveTableElement.getGiveRewards().keySet()); int nextAvailable = NumberUtils.get().getNextAvailablePosition(keys); - String nextKey = ""+nextAvailable; + String nextKey = "" + nextAvailable; - if(rewards.containsKey(nextKey)) { + if (rewards.containsKey(nextKey)) { Debug.FAILED_TO_CREATE_NEWPOSITION.debug(nextKey, BossAPI.getDropTableName(dropTable)); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardRewardsListPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardRewardsListPanel.java index 46bb602..43d528e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardRewardsListPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/GiveRewardRewardsListPanel.java @@ -77,7 +77,7 @@ public class GiveRewardRewardsListPanel extends SubSubVariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, dropTable, giveTableElement, key, keys, rewardSections); return true; @@ -91,8 +91,9 @@ public class GiveRewardRewardsListPanel extends SubSubVariablePanelHandler { - if(slot >= keys.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{}); + if (slot >= keys.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String rewardSectionPosition = keys.get(slot); GiveTableSubElement giveTableSubElement = rewards.get(rewardSectionPosition); @@ -112,10 +113,10 @@ public class GiveRewardRewardsListPanel extends SubSubVariablePanelHandler { ClickType clickType = event.getClick(); - if(clickType == ClickType.SHIFT_RIGHT) { + if (clickType == ClickType.SHIFT_RIGHT) { rewards.remove(rewardSectionPosition); rewardSections.put(key, rewards); giveTableElement.setGiveRewards(rewardSections); @@ -144,9 +145,9 @@ public class GiveRewardRewardsListPanel extends SubSubVariablePanelHandler rewards = rewardSections.get(key); List keys = new ArrayList<>(rewards.keySet()); int nextAvailable = NumberUtils.get().getNextAvailablePosition(keys); - String nextKey = ""+nextAvailable; + String nextKey = "" + nextAvailable; - if(rewards.containsKey(nextKey)) { + if (rewards.containsKey(nextKey)) { Debug.FAILED_TO_CREATE_NEWPOSITION.debug(nextKey, BossAPI.getDropTableName(dropTable)); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandNewRewardPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandNewRewardPanel.java index 4b089b4..77b3fd1 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandNewRewardPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandNewRewardPanel.java @@ -57,7 +57,7 @@ public class GiveCommandNewRewardPanel extends SubVariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, dropTable, giveRewardEditHandler, filteredKeys, commands); return true; @@ -82,8 +82,9 @@ public class GiveCommandNewRewardPanel extends SubVariablePanelHandler filteredKeys, Map> commands) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= filteredKeys.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{}); + if (slot >= filteredKeys.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = filteredKeys.get(slot); List innerCommands = commands.get(name); @@ -100,9 +101,9 @@ public class GiveCommandNewRewardPanel extends SubVariablePanelHandler presetLore = this.plugin.getDisplay().getStringList("Display.Boss.Commands.lore"); List newLore = new ArrayList<>(); - for(String s : presetLore) { - if(s.contains("{commands}")) { - for(String command : innerCommands) { + for (String s : presetLore) { + if (s.contains("{commands}")) { + for (String command : innerCommands) { newLore.add(StringUtils.get().translateColor("&7" + command)); } } else { @@ -127,7 +128,6 @@ public class GiveCommandNewRewardPanel extends SubVariablePanelHandler getCurrentKeys(GiveRewardEditHandler giveRewardEditHandler) { return new ArrayList<>(giveRewardEditHandler.getGiveTableSubElement().getCommands().keySet()); } @@ -136,7 +136,7 @@ public class GiveCommandNewRewardPanel extends SubVariablePanelHandler filteredList = new ArrayList<>(); commands.keySet().forEach(string -> { - if(currentKeys.contains(string)) return; + if (currentKeys.contains(string)) return; filteredList.add(string); }); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandRewardListPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandRewardListPanel.java index de9aa65..9ca49df 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandRewardListPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandRewardListPanel.java @@ -47,7 +47,7 @@ public class GiveCommandRewardListPanel extends SubVariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, dropTable, giveRewardEditHandler, rewardMap, keyList); return true; @@ -68,7 +68,7 @@ public class GiveCommandRewardListPanel extends SubVariablePanelHandler{ + ServerUtils.get().runTaskAsync(() -> { panelBuilderCounter.getSlotsWith("NewReward").forEach(slot -> panel.setOnClick(slot, event -> this.bossPanelManager.getGiveCommandNewRewardPanel().openFor((Player) event.getWhoClicked(), dropTable, giveRewardEditHandler))); fillPanel(panel, dropTable, giveRewardEditHandler); }); @@ -83,14 +83,15 @@ public class GiveCommandRewardListPanel extends SubVariablePanelHandler rewardMap, List keyList) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= keyList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= keyList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = keyList.get(slot); Double chance = rewardMap.get(name); Map replaceMap = new HashMap<>(); - if(chance == null) chance = 100.0; + if (chance == null) chance = 100.0; replaceMap.put("{commandName}", name); replaceMap.put("{chance}", NumberUtils.get().formatDouble(chance)); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandRewardMainEditPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandRewardMainEditPanel.java index c6967d5..c1f163b 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandRewardMainEditPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/give/commands/GiveCommandRewardMainEditPanel.java @@ -72,26 +72,26 @@ public class GiveCommandRewardMainEditPanel extends SubSubVariablePanelHandler 0? "increased" : "decreased"; + String modifyValue = amountToModifyBy > 0 ? "increased" : "decreased"; Map rewards = giveRewardEditHandler.getGiveTableSubElement().getCommands(); double currentValue = rewards.getOrDefault(name, 50.0); double newValue = currentValue + amountToModifyBy; - if(newValue < 0) { + if (newValue < 0) { newValue = 0; } - if(newValue > 100) { + if (newValue > 100) { newValue = 100; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/spray/SprayDropTableMainEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/spray/SprayDropTableMainEditorPanel.java index 6f2d9e1..a31f52a 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/spray/SprayDropTableMainEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/droptables/types/spray/SprayDropTableMainEditorPanel.java @@ -49,12 +49,12 @@ public class SprayDropTableMainEditorPanel extends SubVariablePanelHandler { Boolean currentValue = sprayTableElement.getRandomSprayDrops(); - if(currentValue == null) currentValue = false; + if (currentValue == null) currentValue = false; boolean newValue = !currentValue; @@ -99,24 +99,24 @@ public class SprayDropTableMainEditorPanel extends SubVariablePanelHandler 0? "increased" : "decreased"; + String modifyValue = amountToModifyBy > 0 ? "increased" : "decreased"; Integer currentAmount = sprayTableElement.getSprayMaxDistance(); - if(currentAmount == null) currentAmount = 100; + if (currentAmount == null) currentAmount = 100; int newAmount = currentAmount + amountToModifyBy; - if(newAmount < 0) { + if (newAmount < 0) { newAmount = 0; } @@ -132,24 +132,24 @@ public class SprayDropTableMainEditorPanel extends SubVariablePanelHandler 0? "increased" : "decreased"; + String modifyValue = amountToModifyBy > 0 ? "increased" : "decreased"; Integer currentAmount = sprayTableElement.getSprayMaxDrops(); - if(currentAmount == null) currentAmount = -1; + if (currentAmount == null) currentAmount = -1; int newAmount = currentAmount + amountToModifyBy; - if(newAmount < -1) { + if (newAmount < -1) { newAmount = -1; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ItemStackSubListPanelHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ItemStackSubListPanelHandler.java index fac55f4..1712c3d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ItemStackSubListPanelHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ItemStackSubListPanelHandler.java @@ -65,7 +65,7 @@ public abstract class ItemStackSubListPanelHandler extends SubVariablePanelHandl int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, filteredMap, entryList, bossEntity, entityStatsElement); return true; @@ -94,7 +94,7 @@ public abstract class ItemStackSubListPanelHandler extends SubVariablePanelHandl ServerUtils.get().runTaskAsync(() -> { panelBuilderCounter.getSlotsWith("AddNew").forEach(slot -> panel.setOnClick(slot, event -> openAddItemsPanel(player, bossEntity, entityStatsElement))); panelBuilderCounter.getSlotsWith("Remove").forEach(slot -> panel.setOnClick(slot, event -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(event.getWhoClicked()); return; } @@ -127,18 +127,19 @@ public abstract class ItemStackSubListPanelHandler extends SubVariablePanelHandl String current = getCurrent(entityStatsElement); panel.loadPage(requestedPage, (slot, realisticSlot) -> { - if(slot >= filteredMap.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= filteredMap.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); ItemStackHolder itemStackHolder = filteredMap.get(name); ItemStack itemStack = this.itemStackConverter.from(itemStackHolder); - if(itemStack == null) { + if (itemStack == null) { itemStack = new ItemStack(Material.BARRIER); } - if(name.equalsIgnoreCase(current)) { + if (name.equalsIgnoreCase(current)) { Map replaceMap = new HashMap<>(); replaceMap.put("{name}", ItemStackUtils.getName(itemStack)); @@ -147,7 +148,7 @@ public abstract class ItemStackSubListPanelHandler extends SubVariablePanelHandl } panel.setItem(realisticSlot, itemStack, e -> { - if(!bossEntity.isEditing()) { + if (!bossEntity.isEditing()) { Message.Boss_Edit_CannotBeModified.msg(e.getWhoClicked()); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ListCommandListEditor.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ListCommandListEditor.java index 15cc136..bb514ee 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ListCommandListEditor.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ListCommandListEditor.java @@ -57,7 +57,7 @@ public abstract class ListCommandListEditor extends VariablePanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentTexts, entryList, object); return true; @@ -94,8 +94,9 @@ public abstract class ListCommandListEditor extends VariablePanelHandler { List current = getCurrent(object); panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= entryList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= entryList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); List messages = currentMessages.get(name); @@ -106,7 +107,7 @@ public abstract class ListCommandListEditor extends VariablePanelHandler { replaceMap.put("{name}", name); - if(current.contains(name)) { + if (current.contains(name)) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Commands.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Command.name"), replaceMap); @@ -116,9 +117,9 @@ public abstract class ListCommandListEditor extends VariablePanelHandler { List presetLore = this.plugin.getDisplay().getStringList("Display.Boss.Commands.lore"); List newLore = new ArrayList<>(); - for(String s : presetLore) { - if(s.contains("{commands}")) { - for(String message : messages) { + for (String s : presetLore) { + if (s.contains("{commands}")) { + for (String message : messages) { List split = StringUtils.get().splitString(message, 45); split.forEach(string -> newLore.add(StringUtils.get().translateColor("&7") + string)); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ListMessageListEditor.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ListMessageListEditor.java index 556d65a..1d012eb 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ListMessageListEditor.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/ListMessageListEditor.java @@ -57,7 +57,7 @@ public abstract class ListMessageListEditor extends VariablePanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentTexts, entryList, object); return true; @@ -94,8 +94,9 @@ public abstract class ListMessageListEditor extends VariablePanelHandler { List current = getCurrent(object); panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= entryList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= entryList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); List messages = currentMessages.get(name); @@ -106,7 +107,7 @@ public abstract class ListMessageListEditor extends VariablePanelHandler { replaceMap.put("{name}", name); - if(current.contains(name)) { + if (current.contains(name)) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Text.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Text.name"), replaceMap); @@ -116,9 +117,9 @@ public abstract class ListMessageListEditor extends VariablePanelHandler { List presetLore = this.plugin.getDisplay().getStringList("Display.Boss.Text.lore"); List newLore = new ArrayList<>(); - for(String s : presetLore) { - if(s.contains("{message}")) { - for(String message : messages) { + for (String s : presetLore) { + if (s.contains("{message}")) { + for (String message : messages) { List split = StringUtils.get().splitString(message, 45); split.forEach(string -> newLore.add(StringUtils.get().translateColor("&7") + string)); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/SingleMessageListEditor.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/SingleMessageListEditor.java index 1154584..a06330c 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/SingleMessageListEditor.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/handlers/SingleMessageListEditor.java @@ -57,7 +57,7 @@ public abstract class SingleMessageListEditor extends VariablePanelHandler int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentTexts, entryList, object); return true; @@ -93,8 +93,9 @@ public abstract class SingleMessageListEditor extends VariablePanelHandler String current = getCurrent(object); panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= entryList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= entryList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); List messages = currentMessages.get(name); @@ -105,7 +106,7 @@ public abstract class SingleMessageListEditor extends VariablePanelHandler replaceMap.put("{name}", name); - if(current != null && current.equalsIgnoreCase(name)) { + if (current != null && current.equalsIgnoreCase(name)) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Text.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Boss.Text.name"), replaceMap); @@ -115,9 +116,9 @@ public abstract class SingleMessageListEditor extends VariablePanelHandler List presetLore = this.plugin.getDisplay().getStringList("Display.Boss.Text.lore"); List newLore = new ArrayList<>(); - for(String s : presetLore) { - if(s.contains("{message}")) { - for(String message : messages) { + for (String s : presetLore) { + if (s.contains("{message}")) { + for (String message : messages) { List split = StringUtils.get().splitString(message, 45); split.forEach(string -> newLore.add(StringUtils.get().translateColor("&7") + string)); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/MainSkillEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/MainSkillEditorPanel.java index 31b08b3..f592871 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/MainSkillEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/MainSkillEditorPanel.java @@ -51,11 +51,11 @@ public class MainSkillEditorPanel extends VariablePanelHandler { String type = skill.getType(); PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); - if(customMessage == null || customMessage.equals("")) customMessage = "N/A"; - if(radius == null) radius = 100.0; - if(mode == null || mode.equals("")) mode = "N/A"; - if(displayName == null || displayName.equals("")) displayName = "N/A"; - if(type == null || type.equals("")) type = "N/A"; + if (customMessage == null || customMessage.equals("")) customMessage = "N/A"; + if (radius == null) radius = 100.0; + if (mode == null || mode.equals("")) mode = "N/A"; + if (displayName == null || displayName.equals("")) displayName = "N/A"; + if (type == null || type.equals("")) type = "N/A"; replaceMap.put("{name}", BossAPI.getSkillName(skill)); replaceMap.put("{customMessage}", customMessage); @@ -93,13 +93,13 @@ public class MainSkillEditorPanel extends VariablePanelHandler { String type = skill.getType(); Player player = (Player) event.getWhoClicked(); - if(type.equalsIgnoreCase("POTION")) { + if (type.equalsIgnoreCase("POTION")) { this.bossPanelManager.getPotionSkillEditorPanel().openFor(player, skill); - } else if(type.equalsIgnoreCase("GROUP")) { + } else if (type.equalsIgnoreCase("GROUP")) { this.bossPanelManager.getGroupSkillEditorPanel().openFor(player, skill); - } else if(type.equalsIgnoreCase("CUSTOM")) { + } else if (type.equalsIgnoreCase("CUSTOM")) { this.bossPanelManager.getCustomSkillEditorPanel().openFor(player, skill); - } else if(type.equalsIgnoreCase("COMMAND")) { + } else if (type.equalsIgnoreCase("COMMAND")) { this.bossPanelManager.getCommandSkillEditorPanel().openFor(player, skill); } }; @@ -121,7 +121,7 @@ public class MainSkillEditorPanel extends VariablePanelHandler { ClickType clickType = event.getClick(); Player player = (Player) event.getWhoClicked(); - if(clickType.name().contains("RIGHT")) { + if (clickType.name().contains("RIGHT")) { skill.setCustomMessage(""); saveSkill(skill, player); } else { @@ -147,24 +147,24 @@ public class MainSkillEditorPanel extends VariablePanelHandler { ClickType clickType = event.getClick(); int radiusToModifyBy = 0; - if(clickType == ClickType.LEFT) { + if (clickType == ClickType.LEFT) { radiusToModifyBy = 1; - } else if(clickType == ClickType.SHIFT_LEFT) { + } else if (clickType == ClickType.SHIFT_LEFT) { radiusToModifyBy = 10; - } else if(clickType == ClickType.RIGHT) { + } else if (clickType == ClickType.RIGHT) { radiusToModifyBy = -1; - } else if(clickType == ClickType.SHIFT_RIGHT) { + } else if (clickType == ClickType.SHIFT_RIGHT) { radiusToModifyBy = -10; } - String modifyValue = radiusToModifyBy > 0? "increased" : "decreased"; + String modifyValue = radiusToModifyBy > 0 ? "increased" : "decreased"; Double currentRadius = skill.getRadius(); - if(currentRadius == null) currentRadius = 0.0; + if (currentRadius == null) currentRadius = 0.0; double newRadius = currentRadius + radiusToModifyBy; - if(newRadius < 0) { + if (newRadius < 0) { newRadius = 0; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/CommandSkillEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/CommandSkillEditorPanel.java index 52e1b5a..9f200ca 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/CommandSkillEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/CommandSkillEditorPanel.java @@ -44,7 +44,7 @@ public class CommandSkillEditorPanel extends VariablePanelHandler { int maxPage = panel.getMaxPage(subCommandSkillElements); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, subCommandSkillElements, skill); return true; @@ -101,16 +101,17 @@ public class CommandSkillEditorPanel extends VariablePanelHandler { private void loadPage(Panel panel, int page, List subCommandSkillElements, Skill skill) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= subCommandSkillElements.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= subCommandSkillElements.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { SubCommandSkillElement subCommandSkillElement = subCommandSkillElements.get(slot); Map replaceMap = new HashMap<>(); Double chance = subCommandSkillElement.getChance(); List commands = subCommandSkillElement.getCommands(); - if(chance == null) chance = 100.0; - if(commands == null) commands = new ArrayList<>(); + if (chance == null) chance = 100.0; + if (commands == null) commands = new ArrayList<>(); replaceMap.put("{chance}", NumberUtils.get().formatDouble(chance)); replaceMap.put("{commands}", StringUtils.get().appendList(commands)); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/CustomSkillEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/CustomSkillEditorPanel.java index 27e1663..ce9322b 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/CustomSkillEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/CustomSkillEditorPanel.java @@ -47,7 +47,7 @@ public class CustomSkillEditorPanel extends VariablePanelHandler { PanelBuilder panelBuilder = getPanelBuilder().cloneBuilder(); CustomSkillElement customSkillElement = this.bossSkillManager.getCustomSkillElement(skill); Double multiplier = customSkillElement.getCustom().getMultiplier(); - String multiplierValue = multiplier == null? "N/A" : NumberUtils.get().formatDouble(multiplier); + String multiplierValue = multiplier == null ? "N/A" : NumberUtils.get().formatDouble(multiplier); replaceMap.put("{name}", BossAPI.getSkillName(skill)); replaceMap.put("{type}", customSkillElement.getCustom().getType()); @@ -82,13 +82,13 @@ public class CustomSkillEditorPanel extends VariablePanelHandler { ClickType clickType = event.getClick(); Double amountToModifyBy; - if(clickType == ClickType.SHIFT_LEFT) { + if (clickType == ClickType.SHIFT_LEFT) { amountToModifyBy = 0.1; - } else if(clickType == ClickType.RIGHT) { + } else if (clickType == ClickType.RIGHT) { amountToModifyBy = -1.0; - } else if(clickType == ClickType.SHIFT_RIGHT) { + } else if (clickType == ClickType.SHIFT_RIGHT) { amountToModifyBy = -0.1; - } else if(clickType == ClickType.MIDDLE) { + } else if (clickType == ClickType.MIDDLE) { amountToModifyBy = null; } else { amountToModifyBy = 1.0; @@ -98,12 +98,12 @@ public class CustomSkillEditorPanel extends VariablePanelHandler { String modifyValue; Double newAmount; - if(currentAmount == null) currentAmount = 0.0; + if (currentAmount == null) currentAmount = 0.0; - if(amountToModifyBy == null) { + if (amountToModifyBy == null) { modifyValue = "removed"; newAmount = null; - } else if(amountToModifyBy > 0.0) { + } else if (amountToModifyBy > 0.0) { modifyValue = "increased"; newAmount = currentAmount + amountToModifyBy; } else { @@ -111,8 +111,8 @@ public class CustomSkillEditorPanel extends VariablePanelHandler { newAmount = currentAmount + amountToModifyBy; } - if(newAmount != null) { - if(newAmount <= 0.0) { + if (newAmount != null) { + if (newAmount <= 0.0) { newAmount = null; modifyValue = "removed"; } @@ -124,7 +124,7 @@ public class CustomSkillEditorPanel extends VariablePanelHandler { skill.setCustomData(jsonObject); this.skillsFileManager.save(); - Message.Boss_Skills_SetMultiplier.msg(event.getWhoClicked(), modifyValue, NumberUtils.get().formatDouble((newAmount == null? 0.0 : newAmount))); + Message.Boss_Skills_SetMultiplier.msg(event.getWhoClicked(), modifyValue, NumberUtils.get().formatDouble((newAmount == null ? 0.0 : newAmount))); openFor((Player) event.getWhoClicked(), skill); }; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/GroupSkillEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/GroupSkillEditorPanel.java index 4c2af52..d237077 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/GroupSkillEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/GroupSkillEditorPanel.java @@ -50,7 +50,7 @@ public class GroupSkillEditorPanel extends VariablePanelHandler { int maxPage = panel.getMaxPage(entryList); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, skill, groupSkillElement, skillMap, entryList); return true; @@ -84,8 +84,9 @@ public class GroupSkillEditorPanel extends VariablePanelHandler { List currentSkills = groupSkillElement.getGroupedSkills(); panel.loadPage(page, ((slot, realisticSlot) -> { - if(slot >= skillMap.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= skillMap.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); Skill innerSkill = skillMap.get(name); @@ -98,11 +99,11 @@ public class GroupSkillEditorPanel extends VariablePanelHandler { ItemStack itemStack = this.itemStackConverter.from(this.itemsFileManager.getItemStackHolder("DefaultSkillMenuItem")); boolean isCurrent = currentSkills.contains(name); - if(customMessage == null || customMessage.equals("")) customMessage = "N/A"; - if(radius == null) radius = 100.0; - if(mode == null || mode.equals("")) mode = "N/A"; - if(displayName == null || displayName.equals("")) displayName = "N/A"; - if(type == null || type.equals("")) type = "N/A"; + if (customMessage == null || customMessage.equals("")) customMessage = "N/A"; + if (radius == null) radius = 100.0; + if (mode == null || mode.equals("")) mode = "N/A"; + if (displayName == null || displayName.equals("")) displayName = "N/A"; + if (type == null || type.equals("")) type = "N/A"; replaceMap.put("{name}", BossAPI.getSkillName(skill)); replaceMap.put("{customMessage}", customMessage); @@ -111,7 +112,7 @@ public class GroupSkillEditorPanel extends VariablePanelHandler { replaceMap.put("{displayName}", displayName); replaceMap.put("{type}", type); - if(isCurrent) { + if (isCurrent) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Skills.Group.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Skills.Group.name"), replaceMap); @@ -120,7 +121,7 @@ public class GroupSkillEditorPanel extends VariablePanelHandler { ItemStackUtils.applyDisplayLore(itemStack, this.plugin.getDisplay().getStringList("Display.Skills.Group.lore"), replaceMap); panel.setItem(realisticSlot, itemStack, event -> { - if(isCurrent) { + if (isCurrent) { currentSkills.remove(name); } else { currentSkills.add(name); 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 6bdd34f..fef437f 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 @@ -19,7 +19,6 @@ 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; @@ -61,7 +60,7 @@ public class PotionSkillEditorPanel extends VariablePanelHandler { int maxPage = panel.getMaxPage(potionEffectHolders); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, potionEffectHolders, potionSkillElement, skill); return true; @@ -101,8 +100,9 @@ public class PotionSkillEditorPanel extends VariablePanelHandler { private void loadPage(Panel panel, int page, List potionEffectHolders, PotionSkillElement potionSkillElement, Skill skill) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= potionEffectHolders.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= potionEffectHolders.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { PotionEffectHolder potionEffectHolder = potionEffectHolders.get(slot); PotionEffect potionEffect = this.potionEffectConverter.from(potionEffectHolder); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/commands/CommandListSkillEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/commands/CommandListSkillEditorPanel.java index 5a19f20..e9392e2 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/commands/CommandListSkillEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/commands/CommandListSkillEditorPanel.java @@ -56,7 +56,7 @@ public class CommandListSkillEditorPanel extends SubVariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, commands, currentCommands, entryList, skill, subCommandSkillElement); return true; @@ -88,8 +88,9 @@ public class CommandListSkillEditorPanel extends SubVariablePanelHandler commands, Map> allCommands, List entryList, Skill skill, SubCommandSkillElement subCommandSkillElement) { panel.loadPage(page, (slot, realisticSlot) -> { - if(slot >= allCommands.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= allCommands.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); List boundCommands = allCommands.get(name); @@ -100,7 +101,7 @@ public class CommandListSkillEditorPanel extends SubVariablePanelHandler presetLore = this.plugin.getDisplay().getStringList("Display.Skills.CommandList.lore"); List newLore = new ArrayList<>(); - for(String s : presetLore) { - if(s.contains("{commands}")) { - for(String command : boundCommands) { + for (String s : presetLore) { + if (s.contains("{commands}")) { + for (String command : boundCommands) { List split = StringUtils.get().splitString(command, 45); split.forEach(string -> newLore.add(StringUtils.get().translateColor("&7") + string)); @@ -127,7 +128,7 @@ public class CommandListSkillEditorPanel extends SubVariablePanelHandler { - if(commands.contains(name)) { + if (commands.contains(name)) { commands.remove(name); } else { commands.add(name); @@ -140,8 +141,8 @@ public class CommandListSkillEditorPanel extends SubVariablePanelHandler subCommandSkillElements = commandSkillElement.getCommands(); List newElements = new ArrayList<>(); - for(SubCommandSkillElement subElement : subCommandSkillElements) { - if(subElement.getName().equals(subCommandSkillElement.getName())) { + for (SubCommandSkillElement subElement : subCommandSkillElements) { + if (subElement.getName().equals(subCommandSkillElement.getName())) { newElements.add(subCommandSkillElement); } else { newElements.add(subElement); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/commands/ModifyCommandEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/commands/ModifyCommandEditorPanel.java index 2a4e2bc..a92c0c6 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/commands/ModifyCommandEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/commands/ModifyCommandEditorPanel.java @@ -55,8 +55,8 @@ public class ModifyCommandEditorPanel extends SubVariablePanelHandler(); - if(chance == null) chance = 100.0; + if (commands == null) commands = new ArrayList<>(); + if (chance == null) chance = 100.0; replaceMap.put("{commands}", StringUtils.get().appendList(commands)); replaceMap.put("{chance}", NumberUtils.get().formatDouble(chance)); @@ -84,28 +84,28 @@ public class ModifyCommandEditorPanel extends SubVariablePanelHandler 0.0? "increased" : "decreased"; + String modifyValue = amountToModify > 0.0 ? "increased" : "decreased"; Double currentValue = subCommandSkillElement.getChance(); - if(currentValue == null) currentValue = 100.0; + if (currentValue == null) currentValue = 100.0; double newValue = currentValue + amountToModify; - if(newValue < 0.0) { + if (newValue < 0.0) { newValue = 0.0; } - if(newValue > 100.0) { + if (newValue > 100.0) { newValue = 100.0; } @@ -115,8 +115,8 @@ public class ModifyCommandEditorPanel extends SubVariablePanelHandler subCommandSkillElements = commandSkillElement.getCommands(); List newElements = new ArrayList<>(); - for(SubCommandSkillElement subElement : subCommandSkillElements) { - if(subElement.getName().equals(subCommandSkillElement.getName())) { + for (SubCommandSkillElement subElement : subCommandSkillElements) { + if (subElement.getName().equals(subCommandSkillElement.getName())) { newElements.add(subCommandSkillElement); } else { newElements.add(subElement); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/CustomSkillTypeEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/CustomSkillTypeEditorPanel.java index 5185a4a..907d1f5 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/CustomSkillTypeEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/CustomSkillTypeEditorPanel.java @@ -65,7 +65,7 @@ public class CustomSkillTypeEditorPanel extends SubVariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, skill, customSkillElement, customSkillHandlers); return true; @@ -83,21 +83,22 @@ public class CustomSkillTypeEditorPanel extends SubVariablePanelHandler { - if(slot >= customSkillHandlers.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= customSkillHandlers.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { CustomSkillHandler customSkillHandler = customSkillHandlers.get(slot); String name = customSkillHandler.getSkillName(); Map replaceMap = new HashMap<>(); - String hasCustomData = customSkillHandler.getOtherSkillData() == null? "false" : "true"; + String hasCustomData = customSkillHandler.getOtherSkillData() == null ? "false" : "true"; replaceMap.put("{name}", name); - replaceMap.put("{multiplier}", ""+customSkillHandler.doesUseMultiplier()); + replaceMap.put("{multiplier}", "" + customSkillHandler.doesUseMultiplier()); replaceMap.put("{customData}", hasCustomData); ItemStack itemStack; - if(name.equalsIgnoreCase(current)) { + if (name.equalsIgnoreCase(current)) { itemStack = this.itemStackConverter.from(this.plugin.getItemStackManager().getItemStackHolder("DefaultSelectedCustomSkillTypeItem")); ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Skills.CustomType.selectedName"), replaceMap); @@ -111,7 +112,7 @@ public class CustomSkillTypeEditorPanel extends SubVariablePanelHandler { IOtherSkillDataElement otherSkillDataElement = customSkillHandler.getOtherSkillData(); - JsonObject otherData = otherSkillDataElement == null? null : BossAPI.convertObjectToJsonObject(otherSkillDataElement); + JsonObject otherData = otherSkillDataElement == null ? null : BossAPI.convertObjectToJsonObject(otherSkillDataElement); customSkillElement.getCustom().setType(name); customSkillElement.getCustom().setOtherSkillData(otherData); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MaterialTypeEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MaterialTypeEditorPanel.java index b61ddb6..20da7f9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MaterialTypeEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MaterialTypeEditorPanel.java @@ -45,7 +45,7 @@ public abstract class MaterialTypeEditorPanel extends SubVariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, filteredList, skill, customSkillElement); return true; @@ -72,24 +72,25 @@ public abstract class MaterialTypeEditorPanel extends SubVariablePanelHandler { - if(slot >= filteredList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{}); + if (slot >= filteredList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { Material material = filteredList.get(slot); ItemStack itemStack; - if(material == Material.AIR) itemStack = new ItemStack(Material.GLASS); + if (material == Material.AIR) itemStack = new ItemStack(Material.GLASS); else itemStack = new ItemStack(material); Map replaceMap = new HashMap<>(); - if(itemStack.getType() == Material.AIR) return; + if (itemStack.getType() == Material.AIR) return; String name = material.name(); replaceMap.put("{type}", StringUtils.get().formatString(name)); - if(current.equalsIgnoreCase(name)) { + if (current.equalsIgnoreCase(name)) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Skills.Material.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Skills.Material.name"), replaceMap); @@ -107,7 +108,7 @@ public abstract class MaterialTypeEditorPanel extends SubVariablePanelHandler materials = new ArrayList<>(); masterList.forEach(material -> { - if((material.isBlock() && material.isSolid() && material.isItem()) || (material == Material.AIR)) { + if ((material.isBlock() && material.isSolid() && material.isItem()) || (material == Material.AIR)) { materials.add(material); } }); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MinionSelectEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MinionSelectEditorPanel.java index 565229b..11d128f 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MinionSelectEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/MinionSelectEditorPanel.java @@ -54,7 +54,7 @@ public class MinionSelectEditorPanel extends SubVariablePanelHandler { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, currentEntities, entryList, skill, customSkillElement); return true; @@ -82,8 +82,9 @@ public class MinionSelectEditorPanel extends SubVariablePanelHandler { - if(slot >= entryList.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e->{}); + if (slot >= entryList.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { String name = entryList.get(slot); MinionEntity minionEntity = currentEntities.get(name); @@ -92,10 +93,10 @@ public class MinionSelectEditorPanel extends SubVariablePanelHandler replaceMap = new HashMap<>(); replaceMap.put("{name}", name); - replaceMap.put("{editing}", ""+minionEntity.isEditing()); + replaceMap.put("{editing}", "" + minionEntity.isEditing()); replaceMap.put("{targeting}", minionEntity.getTargeting()); - if(current.equalsIgnoreCase(name)) { + if (current.equalsIgnoreCase(name)) { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Skills.MinionList.selectedName"), replaceMap); } else { ItemStackUtils.applyDisplayName(itemStack, this.plugin.getDisplay().getString("Display.Skills.MinionList.name"), replaceMap); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/SpecialSettingsEditorPanel.java b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/SpecialSettingsEditorPanel.java index 5ca5fb4..c3413c4 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/SpecialSettingsEditorPanel.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/panel/skills/custom/custom/SpecialSettingsEditorPanel.java @@ -62,19 +62,19 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler cSH.getSkillName().equalsIgnoreCase(currentSkillName)).findFirst().orElse(null); - if(customSkillHandler == null) { + if (customSkillHandler == null) { Debug.FAILED_TO_FIND_ASSIGNED_CUSTOMSKILLHANDLER.debug(currentSkillName); return; } List customButtons = customSkillHandler.getOtherSkillDataActions(skill, customSkillElement); - if(customButtons == null || customButtons.isEmpty()) return; + if (customButtons == null || customButtons.isEmpty()) return; int maxPage = panel.getMaxPage(customButtons); panel.setOnPageChange(((player, currentPage, requestedPage) -> { - if(requestedPage < 0 || requestedPage > maxPage) return false; + if (requestedPage < 0 || requestedPage > maxPage) return false; loadPage(panel, requestedPage, customButtons); return true; @@ -91,8 +91,9 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler clickActions) { panel.loadPage(page, ((slot, realisticSlot) -> { - if(slot >= clickActions.size()) { - panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> {}); + if (slot >= clickActions.size()) { + panel.setItem(realisticSlot, new ItemStack(Material.AIR), e -> { + }); } else { ICustomSettingAction customSkillAction = clickActions.get(slot); ClickAction clickAction = customSkillAction.getAction(); @@ -105,7 +106,7 @@ public class SpecialSettingsEditorPanel extends SubVariablePanelHandler 255) { + if (totalAmount > 255) { totalAmount = 255; } @@ -144,11 +144,11 @@ public class CreatePotionEffectEditorPanel extends SubVariablePanelHandler currentList = potionSkillElement.getPotions(); currentList.add(potionEffectHolder); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/Skill.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/Skill.java index 4f8aa04..594405d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/Skill.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/Skill.java @@ -29,46 +29,46 @@ public class Skill { return this.mode; } - public String getType() { - return this.type; - } - - public String getDisplayName() { - return this.displayName; - } - - public String getCustomMessage() { - return this.customMessage; - } - - public Double getRadius() { - return this.radius; - } - - public JsonObject getCustomData() { - return this.customData; - } - public void setMode(String mode) { this.mode = mode; } + public String getType() { + return this.type; + } + public void setType(String type) { this.type = type; } + public String getDisplayName() { + return this.displayName; + } + public void setDisplayName(String displayName) { this.displayName = displayName; } + public String getCustomMessage() { + return this.customMessage; + } + public void setCustomMessage(String customMessage) { this.customMessage = customMessage; } + public Double getRadius() { + return this.radius; + } + public void setRadius(Double radius) { this.radius = radius; } + public JsonObject getCustomData() { + return this.customData; + } + public void setCustomData(JsonObject customData) { this.customData = customData; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/SkillMode.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/SkillMode.java index 01857fb..760d655 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/SkillMode.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/SkillMode.java @@ -22,15 +22,11 @@ public enum SkillMode { this.rank = rank; } - public SkillMode getNext() { - return get(this.rank+1); - } - public static SkillMode getCurrent(String input) { - if(input == null || input.isEmpty()) return BLANK; + if (input == null || input.isEmpty()) return BLANK; - for(SkillMode skillMode : values()) { - if(skillMode.name().equalsIgnoreCase(input)) return skillMode; + for (SkillMode skillMode : values()) { + if (skillMode.name().equalsIgnoreCase(input)) return skillMode; } return BLANK; @@ -39,16 +35,16 @@ public enum SkillMode { public static List getSkillModes() { List list = new ArrayList<>(); - for(SkillMode skillMode : values()) { - if(skillMode.rank > 0) list.add(skillMode); + for (SkillMode skillMode : values()) { + if (skillMode.rank > 0) list.add(skillMode); } return list; } private static SkillMode get(int rank) { - for(SkillMode skillMode : values()) { - if(skillMode.rank == rank) { + for (SkillMode skillMode : values()) { + if (skillMode.rank == rank) { return skillMode; } } @@ -56,4 +52,8 @@ public enum SkillMode { return ALL; } + public SkillMode getNext() { + return get(this.rank + 1); + } + } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Cage.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Cage.java index 7db4245..89da042 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Cage.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Cage.java @@ -17,7 +17,10 @@ import com.songoda.epicbosses.skills.elements.SubCustomSkillElement; import com.songoda.epicbosses.skills.interfaces.ICustomSettingAction; import com.songoda.epicbosses.skills.interfaces.IOtherSkillDataElement; import com.songoda.epicbosses.skills.types.CustomSkillElement; -import com.songoda.epicbosses.utils.*; +import com.songoda.epicbosses.utils.Debug; +import com.songoda.epicbosses.utils.NumberUtils; +import com.songoda.epicbosses.utils.ObjectUtils; +import com.songoda.epicbosses.utils.ServerUtils; import com.songoda.epicbosses.utils.itemstack.converters.MaterialConverter; import com.songoda.epicbosses.utils.panel.base.ClickAction; import com.songoda.epicbosses.utils.panel.base.ISubVariablePanelHandler; @@ -104,7 +107,7 @@ public class Cage extends CustomSkillHandler { nearbyEntities.forEach(livingEntity -> { UUID uuid = livingEntity.getUniqueId(); - if(getPlayersInCage().contains(uuid)) return; + if (getPlayersInCage().contains(uuid)) return; getPlayersInCage().add(uuid); @@ -132,16 +135,16 @@ public class Cage extends CustomSkillHandler { private void restoreBlocks(Queue queue) { queue.forEach(blockState -> { - if(blockState == null) return; + if (blockState == null) return; Location location = blockState.getLocation(); CageLocationData cageLocationData = getCageLocationDataMap().getOrDefault(location, new CageLocationData(location, 1)); int amountOfCages = cageLocationData.getAmountOfCages(); - if(amountOfCages == 1) { + if (amountOfCages == 1) { BlockState oldState = cageLocationData.getOldBlockState(); - if(oldState != null) { + if (oldState != null) { if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) { location.getBlock().setBlockData(oldState.getBlockData()); } else { @@ -164,7 +167,7 @@ public class Cage extends CustomSkillHandler { getCageLocationDataMap().remove(location); } else { - cageLocationData.setAmountOfCages(amountOfCages-1); + cageLocationData.setAmountOfCages(amountOfCages - 1); getCageLocationDataMap().put(location, cageLocationData); } }); @@ -181,22 +184,23 @@ public class Cage extends CustomSkillHandler { private void setBlocks(Queue queue, String materialType, Skill skill) { Material material = MATERIAL_CONVERTER.from(materialType); - if(material == null) { + if (material == null) { Debug.SKILL_CAGE_INVALID_MATERIAL.debug(materialType, skill.getDisplayName()); return; } queue.forEach(blockState -> { - if(blockState == null) return; + if (blockState == null) return; Location location = blockState.getLocation(); CageLocationData cageLocationData = getCageLocationDataMap().getOrDefault(location, new CageLocationData(location, 0)); int currentAmount = cageLocationData.getAmountOfCages(); - if(currentAmount == 0 || cageLocationData.getOldBlockState() == null) cageLocationData.setOldBlockState(blockState); + if (currentAmount == 0 || cageLocationData.getOldBlockState() == null) + cageLocationData.setOldBlockState(blockState); blockState.getBlock().setType(material); - cageLocationData.setAmountOfCages(currentAmount+1); + cageLocationData.setAmountOfCages(currentAmount + 1); getCageLocationDataMap().put(location, cageLocationData); }); } @@ -218,7 +222,7 @@ public class Cage extends CustomSkillHandler { ClickType clickType = event.getClick(); int amountToModifyBy; - if(clickType.name().contains("RIGHT")) { + if (clickType.name().contains("RIGHT")) { amountToModifyBy = -1; } else { amountToModifyBy = +1; @@ -229,7 +233,7 @@ public class Cage extends CustomSkillHandler { int currentAmount = ObjectUtils.getValue(customCageSkillElement.getDuration(), 5); int newAmount = currentAmount + amountToModifyBy; - if(newAmount <= 1) newAmount = 1; + if (newAmount <= 1) newAmount = 1; customCageSkillElement.setDuration(newAmount); subCustomSkillElement.setOtherSkillData(BossAPI.convertObjectToJsonObject(customCageSkillElement)); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Disarm.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Disarm.java index 91ab0fe..88e723d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Disarm.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Disarm.java @@ -49,7 +49,7 @@ public class Disarm extends CustomSkillHandler { switch (itemSlot) { case 0: - if(livingEntity instanceof HumanEntity) { + if (livingEntity instanceof HumanEntity) { HumanEntity humanEntity = (HumanEntity) livingEntity; itemStack = EpicBosses.getInstance().getVersionHandler().getItemInHand(humanEntity); @@ -75,7 +75,7 @@ public class Disarm extends CustomSkillHandler { break; } - if(itemStack == null || itemStack.getType() == Material.AIR) return; + if (itemStack == null || itemStack.getType() == Material.AIR) return; livingEntity.getWorld().dropItemNaturally(livingEntity.getLocation(), itemStack); Message.General_Disarmed.msg(livingEntity); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Fireball.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Fireball.java index d79baf7..d56711b 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Fireball.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Fireball.java @@ -37,11 +37,11 @@ public class Fireball extends CustomSkillHandler { public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List nearbyEntities) { LivingEntity boss = activeBossHolder.getLivingEntity(); - if(boss == null) return; + if (boss == null) return; Double multiplier = customSkillElement.getCustom().getMultiplier(); - if(multiplier == null) multiplier = 1.0; + if (multiplier == null) multiplier = 1.0; double finalMultiplier = multiplier; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Grapple.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Grapple.java index 42682d0..0929e5e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Grapple.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Grapple.java @@ -39,7 +39,7 @@ public class Grapple extends CustomSkillHandler { Location bossLocation = activeBossHolder.getLocation(); Double multiplier = customSkillElement.getCustom().getMultiplier(); - if(multiplier == null) multiplier = 1.0; + if (multiplier == null) multiplier = 1.0; double finalMultiplier = multiplier; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Insidious.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Insidious.java index cec1024..f5afe14 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Insidious.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Insidious.java @@ -36,7 +36,7 @@ public class Insidious extends CustomSkillHandler { public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List nearbyEntities) { Double multiplier = customSkillElement.getCustom().getMultiplier(); - if(multiplier == null) multiplier = 2.5; + if (multiplier == null) multiplier = 2.5; double finalMultiplier = multiplier; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Knockback.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Knockback.java index c418736..7d11ee2 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Knockback.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/Knockback.java @@ -38,7 +38,7 @@ public class Knockback extends CustomSkillHandler { public void castSkill(Skill skill, CustomSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List nearbyEntities) { Double multiplier = customSkillElement.getCustom().getMultiplier(); - if(multiplier == null) multiplier = 2.5; + if (multiplier == null) multiplier = 2.5; double finalMultiplier = multiplier; Location bossLocation = activeBossHolder.getLocation(); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/cage/CageLocationData.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/cage/CageLocationData.java index 1f24e86..4e58363 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/cage/CageLocationData.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/cage/CageLocationData.java @@ -10,11 +10,10 @@ import org.bukkit.block.BlockState; */ public class CageLocationData { + private final Location location; private BlockState oldBlockState; private int amountOfCages = 0; - private final Location location; - public CageLocationData(Location location, int amountOfCages) { this(location); @@ -29,19 +28,19 @@ public class CageLocationData { return this.oldBlockState; } - public int getAmountOfCages() { - return this.amountOfCages; - } - - public Location getLocation() { - return this.location; - } - public void setOldBlockState(BlockState oldBlockState) { this.oldBlockState = oldBlockState; } + public int getAmountOfCages() { + return this.amountOfCages; + } + public void setAmountOfCages(int amountOfCages) { this.amountOfCages = amountOfCages; } + + public Location getLocation() { + return this.location; + } } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/cage/CagePlayerData.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/cage/CagePlayerData.java index d81031d..b4c6989 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/cage/CagePlayerData.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/custom/cage/CagePlayerData.java @@ -33,8 +33,8 @@ public class CagePlayerData { World world = playerLocation.getWorld(); Queue locationQueue = new LinkedList<>(); - for(int x = 1; x >= -1; x--) { - for(int z = 1; z >= -1; z--) { + for (int x = 1; x >= -1; x--) { + for (int z = 1; z >= -1; z--) { Location location1 = new Location(world, x, +2, z); Location location2 = new Location(world, x, -1, z); @@ -53,7 +53,7 @@ public class CagePlayerData { World world = playerLocation.getWorld(); Queue locationQueue = new LinkedList<>(); - for(int y = 1; y >= 0; y--) { + for (int y = 1; y >= 0; y--) { Location innerLocation = new Location(world, 0, y, 0); locationQueue.add(innerLocation); @@ -66,8 +66,8 @@ public class CagePlayerData { World world = playerLocation.getWorld(); Queue locationQueue = new LinkedList<>(); - for(int x = 1; x >= -1; x--) { - for(int z = 1; z >= -1; z--) { + for (int x = 1; x >= -1; x--) { + for (int z = 1; z >= -1; z--) { Location location1 = new Location(world, x, 1, z); Location location2 = new Location(world, x, 0, z); @@ -83,10 +83,10 @@ public class CagePlayerData { Queue blockStateQueue = new LinkedList<>(); World world = playerLocation.getWorld(); - while(!queue.isEmpty()) { + while (!queue.isEmpty()) { Location temp = queue.poll(); - if(temp == null) continue; + if (temp == null) continue; Block block = world.getBlockAt(temp.add(playerLocation).clone()); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/CustomCageSkillElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/CustomCageSkillElement.java index 42a4244..83e4ff4 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/CustomCageSkillElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/CustomCageSkillElement.java @@ -26,30 +26,30 @@ public class CustomCageSkillElement implements IOtherSkillDataElement { return this.flatType; } - public String getWallType() { - return this.wallType; - } - - public String getInsideType() { - return this.insideType; - } - - public int getDuration() { - return this.duration; - } - public void setFlatType(String flatType) { this.flatType = flatType; } + public String getWallType() { + return this.wallType; + } + public void setWallType(String wallType) { this.wallType = wallType; } + public String getInsideType() { + return this.insideType; + } + public void setInsideType(String insideType) { this.insideType = insideType; } + public int getDuration() { + return this.duration; + } + public void setDuration(int duration) { this.duration = duration; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/CustomMinionSkillElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/CustomMinionSkillElement.java index b99d251..d4a4c36 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/CustomMinionSkillElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/CustomMinionSkillElement.java @@ -24,14 +24,14 @@ public class CustomMinionSkillElement implements IOtherSkillDataElement { return this.minionToSpawn; } - public Integer getAmount() { - return this.amount; - } - public void setMinionToSpawn(String minionToSpawn) { this.minionToSpawn = minionToSpawn; } + public Integer getAmount() { + return this.amount; + } + public void setAmount(Integer amount) { this.amount = amount; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/SubCommandSkillElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/SubCommandSkillElement.java index 660bc17..6b63d11 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/SubCommandSkillElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/SubCommandSkillElement.java @@ -33,14 +33,14 @@ public class SubCommandSkillElement { return this.chance; } - public List getCommands() { - return this.commands; - } - public void setChance(Double chance) { this.chance = chance; } + public List getCommands() { + return this.commands; + } + public void setCommands(List commands) { this.commands = commands; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/SubCustomSkillElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/SubCustomSkillElement.java index 6f3a4c1..80d0c2d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/SubCustomSkillElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/elements/SubCustomSkillElement.java @@ -25,7 +25,7 @@ public class SubCustomSkillElement { } public CustomCageSkillElement getCustomCageSkillData() { - if(getType().equalsIgnoreCase("CAGE")) { + if (getType().equalsIgnoreCase("CAGE")) { return BossesGson.get().fromJson(this.otherSkillData, CustomCageSkillElement.class); } @@ -33,7 +33,7 @@ public class SubCustomSkillElement { } public CustomMinionSkillElement getCustomMinionSkillData() { - if(getType().equalsIgnoreCase("MINIONS")) { + if (getType().equalsIgnoreCase("MINIONS")) { return BossesGson.get().fromJson(this.otherSkillData, CustomMinionSkillElement.class); } @@ -44,14 +44,14 @@ public class SubCustomSkillElement { return this.type; } - public Double getMultiplier() { - return this.multiplier; - } - public void setType(String type) { this.type = type; } + public Double getMultiplier() { + return this.multiplier; + } + public void setMultiplier(Double multiplier) { this.multiplier = multiplier; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/CommandSkillElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/CommandSkillElement.java index 088adbe..9eaef5b 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/CommandSkillElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/CommandSkillElement.java @@ -31,7 +31,7 @@ public class CommandSkillElement implements ISkillHandler { List commandSkillElements = getCommands(); ServerUtils serverUtils = ServerUtils.get(); - if(commandSkillElements.isEmpty()) { + if (commandSkillElements.isEmpty()) { Debug.SKILL_COMMANDS_ARE_EMPTY.debug(); return; } @@ -41,9 +41,9 @@ public class CommandSkillElement implements ISkillHandler { Double chance = commandSkillEle.getChance(); List commands = commandSkillEle.getCommands(); - if(commands == null || commands.isEmpty()) return; - if(chance == null) chance = 100.0; - if(!RandomUtils.get().canPreformAction(chance)) return; + if (commands == null || commands.isEmpty()) return; + if (chance == null) chance = 100.0; + if (!RandomUtils.get().canPreformAction(chance)) return; commands.replaceAll(s -> s.replace("%player%", livingEntity.getName())); commands.forEach(serverUtils::sendConsoleCommand); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/GroupSkillElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/GroupSkillElement.java index 297b7f6..83673c2 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/GroupSkillElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/GroupSkillElement.java @@ -36,7 +36,7 @@ public class GroupSkillElement implements ISkillHandler { currentGroupedSkills.forEach(string -> { Skill innerSkill = skillsFileManager.getSkill(string); - if(innerSkill == null) { + if (innerSkill == null) { Debug.SKILL_NOT_FOUND.debug(); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/PotionSkillElement.java b/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/PotionSkillElement.java index 4b6e6d4..fefc8ad 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/PotionSkillElement.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/skills/types/PotionSkillElement.java @@ -34,11 +34,11 @@ public class PotionSkillElement implements ISkillHandler { public void castSkill(Skill skill, PotionSkillElement customSkillElement, ActiveBossHolder activeBossHolder, List nearbyEntities) { List potionElements = getPotions(); - if(this.potionEffectConverter == null) this.potionEffectConverter = new PotionEffectConverter(); + if (this.potionEffectConverter == null) this.potionEffectConverter = new PotionEffectConverter(); - if(nearbyEntities == null || nearbyEntities.isEmpty()) return; - if(potionElements == null) return; - if(potionElements.isEmpty()) { + if (nearbyEntities == null || nearbyEntities.isEmpty()) return; + if (potionElements == null) return; + if (potionElements.isEmpty()) { Debug.SKILL_POTIONS_ARE_EMPTY.debug(); return; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/Debug.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/Debug.java index daf2cd9..65a917d 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/Debug.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/Debug.java @@ -72,12 +72,20 @@ public enum Debug { this.message = message; } + public static void debugMessage(String message) { + PLAIN.debug(message); + } + + public static void setPlugin(EpicBosses plugin) { + PLUGIN = plugin; + } + public void debug(Object... objects) { int current = 0; String message = this.message; - for(Object object : objects) { - if(object == null) continue; + for (Object object : objects) { + if (object == null) continue; String placeholder = "{" + current + "}"; @@ -92,18 +100,10 @@ public enum Debug { PLUGIN.getDebugManager().getToggledPlayers().forEach(uuid -> { Player player = Bukkit.getPlayer(uuid); - if(player == null) return; + if (player == null) return; player.sendMessage(finalMsg); }); } - public static void debugMessage(String message) { - PLAIN.debug(message); - } - - public static void setPlugin(EpicBosses plugin) { - PLUGIN = plugin; - } - } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/EnchantFinder.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/EnchantFinder.java index 3943fef..464a794 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/EnchantFinder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/EnchantFinder.java @@ -57,11 +57,11 @@ public enum EnchantFinder { } public static EnchantFinder getByName(String name) { - for(EnchantFinder enchantFinder : values()) { + for (EnchantFinder enchantFinder : values()) { List names = enchantFinder.getNames(); - for(String s : names) { - if(s.equalsIgnoreCase(name)) return enchantFinder; + for (String s : names) { + if (s.equalsIgnoreCase(name)) return enchantFinder; } } @@ -69,14 +69,14 @@ public enum EnchantFinder { } public static EnchantFinder getByEnchant(Enchantment enchantment) { - if(enchantment == null) return null; + if (enchantment == null) return null; - for(EnchantFinder enchantFinder : values()) { + for (EnchantFinder enchantFinder : values()) { Enchantment enchantFinderEnchant = enchantFinder.getEnchantment(); - if(enchantFinderEnchant == null) continue; + if (enchantFinderEnchant == null) continue; - if(enchantFinderEnchant.equals(enchantment)) return enchantFinder; + if (enchantFinderEnchant.equals(enchantment)) return enchantFinder; } return null; 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 4e05852..72600df 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/EntityFinder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/EntityFinder.java @@ -106,13 +106,23 @@ public enum EntityFinder { this.customEntityHandler = null; } + public static EntityFinder get(String name) { + for (EntityFinder entityFinder : values()) { + for (String s : entityFinder.getNames()) { + if (name.equalsIgnoreCase(s)) return entityFinder; + } + } + + return null; + } + @Override public String toString() { return this.fancyName; } public LivingEntity spawnNewLivingEntity(String input, Location location) { - if(this.customEntityHandler != null) { + if (this.customEntityHandler != null) { LivingEntity livingEntity; try { @@ -128,16 +138,6 @@ public enum EntityFinder { } } - public static EntityFinder get(String name) { - for(EntityFinder entityFinder : values()) { - for (String s : entityFinder.getNames()) { - if(name.equalsIgnoreCase(s)) return entityFinder; - } - } - - return null; - } - public ICustomEntityHandler getCustomEntityHandler() { return this.customEntityHandler; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/MapUtils.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/MapUtils.java index 80d17ce..a7e0f66 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/MapUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/MapUtils.java @@ -14,6 +14,10 @@ public class MapUtils { private static MapUtils INSTANCE = new MapUtils(); + public static MapUtils get() { + return INSTANCE; + } + public > Map sortByValue(Map map) { List> list = new ArrayList<>(map.entrySet()); Map resultMap = new LinkedHashMap<>(); @@ -24,8 +28,4 @@ public class MapUtils { return resultMap; } - public static MapUtils get() { - return INSTANCE; - } - } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/Message.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/Message.java index 2730db4..f42a018 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/Message.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/Message.java @@ -79,59 +79,59 @@ public enum Message { Boss_Help_NoPermission("&c&l(!) &cYou do not have access to this command."), Boss_Help_Page1( "&8&m----*--------&3&l[ &b&lBoss Help &7(Page 1/4) &3&l]&8&m--------*----\n" + - "&b/boss help (page) &8» &7Displays boss commands.\n" + - "&b/boss create [name] [entity] &8» &7Start the creation of a boss.\n" + - "&b/boss edit (name) &8» &7Edit the specified boss.\n" + - "&b/boss info [name] &8» &7Shows information on the specified boss.\n" + - "&b/boss nearby (radius) &8» &7Shows the nearby bosses.\n" + - "&b/boss reload &8» &7Reloads the boss plugin.\n" + - "&7\n" + - "&7Use /boss help 2 to view the next page.\n" + - "&8&m----*-----------------------------------*----"), + "&b/boss help (page) &8» &7Displays boss commands.\n" + + "&b/boss create [name] [entity] &8» &7Start the creation of a boss.\n" + + "&b/boss edit (name) &8» &7Edit the specified boss.\n" + + "&b/boss info [name] &8» &7Shows information on the specified boss.\n" + + "&b/boss nearby (radius) &8» &7Shows the nearby bosses.\n" + + "&b/boss reload &8» &7Reloads the boss plugin.\n" + + "&7\n" + + "&7Use /boss help 2 to view the next page.\n" + + "&8&m----*-----------------------------------*----"), Boss_Help_Page2( "&8&m----*--------&3&l[ &b&lBoss Help &7(Page 2/4) &3&l]&8&m--------*----\n" + - "&b/boss spawn [name] (location) &8» &7Spawns a boss at your" + - " location or the specified location.\n" + - "&7&o(Separate location with commas, an example is: world,0,100,0)\n" + - "&b/boss droptable &8» &7Shows all current drop tables.\n" + - "&b/boss items &8» &7Shows all current custom items.\n" + + "&b/boss spawn [name] (location) &8» &7Spawns a boss at your" + + " location or the specified location.\n" + + "&7&o(Separate location with commas, an example is: world,0,100,0)\n" + + "&b/boss droptable &8» &7Shows all current drop tables.\n" + + "&b/boss items &8» &7Shows all current custom items.\n" + "&b/boss skills &8» &7Shows all current set skills.\n" + - "&b/boss killall (world) &8» &7Kills all bosses/minions.\n" + - "&7\n" + - "&7Use /boss help 3 to view the next page.\n" + - "&8&m----*-----------------------------------*----"), + "&b/boss killall (world) &8» &7Kills all bosses/minions.\n" + + "&7\n" + + "&7Use /boss help 3 to view the next page.\n" + + "&8&m----*-----------------------------------*----"), Boss_Help_Page3( "&8&m----*--------&3&l[ &b&lBoss Help &7(Page 3/4) &3&l]&8&m--------*----\n" + - "&b/boss time [section] &8» &7Shows the time left till next auto spawn.\n" + - "&b/boss giveegg [name] [player] (amount) &8» &7Used to be given a " + - "spawn item of the boss.\n" + - "&b/boss list &8» &7Shows all the list of current boss entities.\n" + - "&b/boss new skill [name] [type] [mode] &8» &7Create a new skill section.\n" + - "&b/boss new droptable [name] [type] &8» &7Create a new drop table section.\n" + - "&7\n" + - "&7Use /boss help 4 to view the next page.\n" + - "&8&m----*-----------------------------------*----"), + "&b/boss time [section] &8» &7Shows the time left till next auto spawn.\n" + + "&b/boss giveegg [name] [player] (amount) &8» &7Used to be given a " + + "spawn item of the boss.\n" + + "&b/boss list &8» &7Shows all the list of current boss entities.\n" + + "&b/boss new skill [name] [type] [mode] &8» &7Create a new skill section.\n" + + "&b/boss new droptable [name] [type] &8» &7Create a new drop table section.\n" + + "&7\n" + + "&7Use /boss help 4 to view the next page.\n" + + "&8&m----*-----------------------------------*----"), Boss_Help_Page4( "&8&m----*--------&3&l[ &b&lBoss Help &7(Page 4/4) &3&l]&8&m--------*----\n" + - "&b/boss new command [name] [commands] &8» &7Used to create a new command section.\n" + - "&7&o(To add a new line use &7||&7&o in-between the messages.)\n" + - "&b/boss new message [name] [messages] &8» &7Used to create a new message section.\n" + - "&7&o(To add a new line use &7||&7&o in-between the messages.)\n" + - "&7/boss new autospawn [name] &8» &7Used to create a new auto spawn section.\n" + - "&b/boss debug &8» &7Used to toggle the debug aspect of the plugin.\n" + - "&7\n" + - "&7\n" + - "&7Use /boss help [page] to view the next page.\n" + - "&8&m----*-----------------------------------*----"), + "&b/boss new command [name] [commands] &8» &7Used to create a new command section.\n" + + "&7&o(To add a new line use &7||&7&o in-between the messages.)\n" + + "&b/boss new message [name] [messages] &8» &7Used to create a new message section.\n" + + "&7&o(To add a new line use &7||&7&o in-between the messages.)\n" + + "&7/boss new autospawn [name] &8» &7Used to create a new auto spawn section.\n" + + "&b/boss debug &8» &7Used to toggle the debug aspect of the plugin.\n" + + "&7\n" + + "&7\n" + + "&7Use /boss help [page] to view the next page.\n" + + "&8&m----*-----------------------------------*----"), Boss_Info_NoPermission("&c&l(!) &cYou do not have access to this command."), Boss_Info_InvalidArgs("&c&l(!) &cYou must use &n/boss info [name]&c to view info on a boss."), Boss_Info_CouldntFindBoss("&c&l(!) &cThe specified boss was not able to be retrieved, please try again."), Boss_Info_Display( "&8&m----*--------&3&l[ &b&l{0} Info &3&l]&8&m--------*----\n" + - "&bEditing: &f{1}\n" + - "&bCurrently Active: &f{2}\n" + - "&bComplete enough to spawn: &f{3}"), + "&bEditing: &f{1}\n" + + "&bCurrently Active: &f{2}\n" + + "&bComplete enough to spawn: &f{3}"), Boss_Items_NoPermission("&c&l(!) &cYou do not have access to this command."), Boss_Items_CannotBeRemoved("&c&l(!) &cThe selected item cannot be removed because it is still used in {0} different positions on the bosses."), @@ -247,10 +247,10 @@ public enum Message { public void msg(CommandSender p, Object... order) { String s = toString(order); - if(s.contains("\n")) { + if (s.contains("\n")) { String[] split = s.split("\n"); - for(String inner : split) { + for (String inner : split) { sendMessage(p, inner, order); } } else { @@ -261,16 +261,16 @@ public enum Message { public void broadcast(Object... order) { String s = toString(); - if(s.contains("\n")) { + if (s.contains("\n")) { String[] split = s.split("\n"); - for(String inner : split) { - for(Player player : Bukkit.getOnlinePlayers()) { + for (String inner : split) { + for (Player player : Bukkit.getOnlinePlayers()) { sendMessage(player, inner, order); } } } else { - for(Player player : Bukkit.getOnlinePlayers()) { + for (Player player : Bukkit.getOnlinePlayers()) { sendMessage(player, s, order); } } @@ -279,38 +279,31 @@ public enum Message { private String getFinalized(String string, Object... order) { int current = 0; - for(Object object : order) { + for (Object object : order) { String placeholder = "{" + current + "}"; - if(string.contains(placeholder)) { - if(object instanceof CommandSender) { + if (string.contains(placeholder)) { + if (object instanceof CommandSender) { string = string.replace(placeholder, ((CommandSender) object).getName()); - } - else if(object instanceof OfflinePlayer) { + } else if (object instanceof OfflinePlayer) { string = string.replace(placeholder, ((OfflinePlayer) object).getName()); - } - else if(object instanceof Location) { + } else if (object instanceof Location) { Location location = (Location) object; String repl = location.getWorld().getName() + ", " + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ(); string = string.replace(placeholder, repl); - } - else if(object instanceof String) { + } else if (object instanceof String) { string = string.replace(placeholder, StringUtils.get().translateColor((String) object)); - } - else if(object instanceof Long) { - string = string.replace(placeholder, ""+object); - } - else if(object instanceof Double) { - string = string.replace(placeholder, ""+object); - } - else if(object instanceof Integer) { - string = string.replace(placeholder, ""+object); - } - else if(object instanceof ItemStack) { + } else if (object instanceof Long) { + string = string.replace(placeholder, "" + object); + } else if (object instanceof Double) { + string = string.replace(placeholder, "" + object); + } else if (object instanceof Integer) { + string = string.replace(placeholder, "" + object); + } else if (object instanceof ItemStack) { string = string.replace(placeholder, getItemStackName((ItemStack) object)); - } else if(object instanceof Boolean) { - string = string.replace(placeholder, ""+object); + } else if (object instanceof Boolean) { + string = string.replace(placeholder, "" + object); } } @@ -327,7 +320,7 @@ public enum Message { private String getItemStackName(ItemStack itemStack) { String name = itemStack.getType().toString().replace("_", " "); - if(itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName()) { + if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName()) { return itemStack.getItemMeta().getDisplayName(); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/MessageUtils.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/MessageUtils.java index e952ea9..36b5b06 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/MessageUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/MessageUtils.java @@ -16,12 +16,16 @@ public class MessageUtils { private static MessageUtils INSTANCE = new MessageUtils(); + public static MessageUtils get() { + return INSTANCE; + } + public void sendMessage(LivingEntity player, String... messages) { sendMessage(player, Arrays.asList(messages)); } public void sendMessage(LivingEntity player, List messages) { - for(String s : messages) { + for (String s : messages) { player.sendMessage(StringUtils.get().translateColor(s)); } } @@ -33,19 +37,15 @@ public class MessageUtils { public void sendMessage(Location center, int radius, List messages) { messages.replaceAll(s -> s.replace('&', '§')); - if(radius == -1) { + if (radius == -1) { Bukkit.getOnlinePlayers().forEach(player -> messages.forEach(string -> player.sendMessage(string))); } else { Bukkit.getOnlinePlayers().forEach(player -> { - if((player.getWorld().equals(center.getWorld())) && (player.getLocation().distanceSquared(center) <= radius)) { + if ((player.getWorld().equals(center.getWorld())) && (player.getLocation().distanceSquared(center) <= radius)) { messages.forEach(string -> player.sendMessage(string)); } }); } } - public static MessageUtils get() { - return INSTANCE; - } - } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/NumberUtils.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/NumberUtils.java index f7d5998..18324a1 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/NumberUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/NumberUtils.java @@ -14,6 +14,10 @@ public class NumberUtils { private static NumberUtils INSTANCE = new NumberUtils(); + public static NumberUtils get() { + return INSTANCE; + } + public boolean isInt(String string) { try { Integer.valueOf(string); @@ -25,13 +29,13 @@ public class NumberUtils { } public Integer getInteger(String input) { - if(!isInt(input)) return null; + if (!isInt(input)) return null; return Integer.valueOf(input); } public int getSquared(int original) { - if(original == -1) return -1; + if (original == -1) return -1; return original * original; } @@ -47,7 +51,7 @@ public class NumberUtils { } public Double getDouble(String input) { - if(!isDouble(input)) return null; + if (!isDouble(input)) return null; return Double.valueOf(input); } @@ -75,8 +79,4 @@ public class NumberUtils { return currentIds.size() + 1; } - public static NumberUtils get() { - return INSTANCE; - } - } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/ObjectUtils.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/ObjectUtils.java index c7f4e52..5b4aeb9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/ObjectUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/ObjectUtils.java @@ -8,7 +8,7 @@ package com.songoda.epicbosses.utils; public class ObjectUtils { public static T getValue(T input, T defaultValue) { - if(input == null) return defaultValue; + if (input == null) return defaultValue; return input; } 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 e4d5afb..c4c0b79 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/PotionEffectFinder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/PotionEffectFinder.java @@ -57,11 +57,11 @@ public enum PotionEffectFinder { } public static PotionEffectFinder getByName(String name) { - for(PotionEffectFinder potionEffectFinder : values()) { + for (PotionEffectFinder potionEffectFinder : values()) { List names = potionEffectFinder.getNames(); - for(String s : names) { - if(s.equalsIgnoreCase(name)) return potionEffectFinder; + for (String s : names) { + if (s.equalsIgnoreCase(name)) return potionEffectFinder; } } @@ -69,11 +69,11 @@ public enum PotionEffectFinder { } public static PotionEffectFinder getByEffect(PotionEffectType potionEffectType) { - for(PotionEffectFinder potionEffectFinder : values()) { + for (PotionEffectFinder potionEffectFinder : values()) { PotionEffectType effectType = potionEffectFinder.getPotionEffectType(); - if(effectType == null) continue; - if(potionEffectType.equals(effectType)) return potionEffectFinder; + if (effectType == null) continue; + if (potionEffectType.equals(effectType)) return potionEffectFinder; } return null; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/RandomUtils.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/RandomUtils.java index 0050999..6294fbb 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/RandomUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/RandomUtils.java @@ -13,6 +13,10 @@ public class RandomUtils { private Random random = new Random(); + public static RandomUtils get() { + return INSTANCE; + } + public boolean preformRandomAction() { int rand = getRandomNumber(2); @@ -41,8 +45,4 @@ public class RandomUtils { return (randomChance <= chanceOfSuccess); } - public static RandomUtils get() { - return INSTANCE; - } - } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/ReflectionUtil.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/ReflectionUtil.java index 194ac5a..f0998e9 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/ReflectionUtil.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/ReflectionUtil.java @@ -18,6 +18,10 @@ public class ReflectionUtil { this.nmsVersion = this.nmsVersion.substring(this.nmsVersion.lastIndexOf(".") + 1); } + public static ReflectionUtil get() { + return instance; + } + public String getVersion() { return this.nmsVersion; } @@ -25,7 +29,7 @@ public class ReflectionUtil { public Class getNMSClass(String name) { try { return Class.forName("net.minecraft.server." + this.nmsVersion + "." + name); - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { e.printStackTrace(); return null; } @@ -34,14 +38,10 @@ public class ReflectionUtil { public Class getOBCClass(String name) { try { return Class.forName("org.bukkit.craftbukkit." + this.nmsVersion + "." + name); - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { e.printStackTrace(); return null; } } - public static ReflectionUtil get() { - return instance; - } - } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/ServerUtils.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/ServerUtils.java index 0052217..3a23c6e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/ServerUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/ServerUtils.java @@ -29,6 +29,10 @@ public class ServerUtils { serverUtils = this; } + public static ServerUtils get() { + return serverUtils; + } + public void log(String log) { Bukkit.getConsoleSender().sendMessage(StringUtils.get().translateColor(log)); } @@ -72,7 +76,7 @@ public class ServerUtils { } public void cancelTask(BukkitTask bukkitTask) { - if(bukkitTask == null) return; + if (bukkitTask == null) return; bukkitTask.cancel(); } @@ -96,8 +100,4 @@ public class ServerUtils { return entity; return null; } - - public static ServerUtils get() { - return serverUtils; - } } 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 3efef29..ef13281 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/StringUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/StringUtils.java @@ -19,6 +19,10 @@ public class StringUtils { private static StringUtils INSTANCE = new StringUtils(); + public static StringUtils get() { + return INSTANCE; + } + public List splitString(String input, int splitSize) { List messages = new ArrayList<>(); int index = 0; @@ -47,13 +51,13 @@ public class StringUtils { return Message.General_LocationFormat.toString() .replace("{world}", world) - .replace("{x}", ""+x) - .replace("{y}", ""+y) - .replace("{z}", ""+z); + .replace("{x}", "" + x) + .replace("{y}", "" + y) + .replace("{z}", "" + z); } public Location fromStringToLocation(String input) { - if(input == null) return null; + if (input == null) return null; String[] split = input.split(","); @@ -64,7 +68,7 @@ public class StringUtils { String zInput = split[3].trim(); World world = Bukkit.getWorld(worldInput); - if(NumberUtils.get().isInt(xInput) && NumberUtils.get().isInt(yInput) && NumberUtils.get().isInt(zInput)) { + if (NumberUtils.get().isInt(xInput) && NumberUtils.get().isInt(yInput) && NumberUtils.get().isInt(zInput)) { return new Location(world, Integer.valueOf(xInput), Integer.valueOf(yInput), Integer.valueOf(zInput)); } } catch (Exception ex) { @@ -80,14 +84,14 @@ public class StringUtils { Queue queue = new LinkedList<>(list); StringBuilder stringBuilder = new StringBuilder(); - while(!queue.isEmpty()) { + while (!queue.isEmpty()) { T object = queue.poll(); - if(object == null) continue; + if (object == null) continue; stringBuilder.append(object.toString()); - if(queue.isEmpty()) { + if (queue.isEmpty()) { stringBuilder.append("."); } else { stringBuilder.append(", "); @@ -98,25 +102,25 @@ public class StringUtils { } public String formatString(String string) { - if(string == null) return "null"; + if (string == null) return "null"; string = string.toLowerCase(); StringBuilder stringBuilder = new StringBuilder(); - if(string.contains(" ")) { - for(String z : string.split(" ")) { + if (string.contains(" ")) { + for (String z : string.split(" ")) { stringBuilder.append(Character.toUpperCase(z.charAt(0))).append(z.substring(1).toLowerCase()); } - } else if(string.contains("_")) { + } else if (string.contains("_")) { String[] split = string.split("_"); - for(int i = 0; i < split.length; i++) { + for (int i = 0; i < split.length; i++) { String z = split[i]; stringBuilder.append(Character.toUpperCase(z.charAt(0))).append(z.substring(1).toLowerCase()); - if(i != (split.length - 1)) { + if (i != (split.length - 1)) { stringBuilder.append(" "); } } @@ -127,8 +131,4 @@ public class StringUtils { return stringBuilder.toString(); } - public static StringUtils get() { - return INSTANCE; - } - } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/adapters/PotionEffectTypeAdapter.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/adapters/PotionEffectTypeAdapter.java index 59feefd..d1e4d0a 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/adapters/PotionEffectTypeAdapter.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/adapters/PotionEffectTypeAdapter.java @@ -18,7 +18,7 @@ public class PotionEffectTypeAdapter implements BaseAdapter { String effectType = jsonElement.getAsString(); PotionEffectType potionEffectType = PotionEffectType.getByName(effectType.toUpperCase()); - if(potionEffectType == null) return null; + if (potionEffectType == null) return null; return potionEffectType; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/CommandService.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/CommandService.java index 50f093e..c426eba 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/CommandService.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/CommandService.java @@ -33,13 +33,13 @@ public abstract class CommandService extends BukkitComm this.description = cmd.getAnnotation(Description.class).value(); this.aliases = new String[]{}; - if(cmd.isAnnotationPresent(Alias.class)) + if (cmd.isAnnotationPresent(Alias.class)) this.aliases = cmd.getAnnotation(Alias.class).value(); - if(cmd.isAnnotationPresent(Permission.class)) + if (cmd.isAnnotationPresent(Permission.class)) this.permission = cmd.getAnnotation(Permission.class).value(); - if(cmd.isAnnotationPresent(NoPermission.class)) + if (cmd.isAnnotationPresent(NoPermission.class)) this.noPermissionMsg = cmd.getAnnotation(NoPermission.class).value(); getGenericClass(); @@ -48,10 +48,10 @@ public abstract class CommandService extends BukkitComm @Override public final boolean execute(CommandSender commandSender, String s, String[] args) { - if(this.permission != null && !testPermission(commandSender)) return false; + if (this.permission != null && !testPermission(commandSender)) return false; - if(!parameterClass.isInstance(commandSender)) { + if (!parameterClass.isInstance(commandSender)) { commandSender.sendMessage(StringUtils.get().translateColor("&4You cannot use that command.")); return false; } @@ -90,21 +90,20 @@ public abstract class CommandService extends BukkitComm setFields(); _commandMap.register(command, this); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } private void setFields() { - if(this.aliases != null) setAliases(Arrays.asList(this.aliases)); - if(this.description != null) setDescription(this.description); - if(this.permission != null) setPermission(this.permission); - if(this.noPermissionMsg != null) setPermissionMessage(this.noPermissionMsg); + if (this.aliases != null) setAliases(Arrays.asList(this.aliases)); + if (this.description != null) setDescription(this.description); + if (this.permission != null) setPermission(this.permission); + if (this.noPermissionMsg != null) setPermissionMessage(this.noPermissionMsg); } private void getGenericClass() { - if(this.parameterClass == null) { + if (this.parameterClass == null) { Type superClass = getClass().getGenericSuperclass(); Type tType = ((ParameterizedType) superClass).getActualTypeArguments()[0]; String className = tType.toString().split(" ")[1]; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/SubCommandService.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/SubCommandService.java index 192eff8..a6b56fc 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/SubCommandService.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/SubCommandService.java @@ -25,8 +25,8 @@ public abstract class SubCommandService extends Command @Override public boolean handleSubCommand(CommandSender commandSender, String[] args) { - for(SubCommand subCommand : this.subCommands) { - if(subCommand.isSubCommand(args[0])) { + for (SubCommand subCommand : this.subCommands) { + if (subCommand.isSubCommand(args[0])) { subCommand.execute(commandSender, args); return true; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Alias.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Alias.java index 7761ae8..7439d71 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Alias.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Alias.java @@ -6,7 +6,7 @@ import java.lang.annotation.*; * Created by charl on 03-May-17. */ @Documented -@Target({ ElementType.TYPE }) +@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Alias { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Description.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Description.java index a30a93b..50624d7 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Description.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Description.java @@ -6,7 +6,7 @@ import java.lang.annotation.*; * Created by charl on 03-May-17. */ @Documented -@Target({ ElementType.TYPE }) +@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Description { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Name.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Name.java index cf568ef..8e3d160 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Name.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Name.java @@ -6,7 +6,7 @@ import java.lang.annotation.*; * Created by LukeBingham on 03/04/2017. */ @Documented -@Target({ ElementType.TYPE }) +@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Name { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/NoPermission.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/NoPermission.java index 78085ad..b172470 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/NoPermission.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/NoPermission.java @@ -8,7 +8,7 @@ import java.lang.annotation.*; * @since 08-Jun-17 */ @Documented -@Target({ ElementType.TYPE }) +@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface NoPermission { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Permission.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Permission.java index cd66ef3..636f120 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Permission.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Permission.java @@ -6,7 +6,7 @@ import java.lang.annotation.*; * Created by charl on 11-May-17. */ @Documented -@Target({ ElementType.TYPE }) +@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Permission { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Suggest.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Suggest.java index 889755f..ec41fed 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Suggest.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/command/attributes/Suggest.java @@ -6,7 +6,7 @@ import java.lang.annotation.*; * Created by LukeBingham on 03/04/2017. */ @Documented -@Target({ ElementType.TYPE }) +@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Suggest { diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/dependencies/ASkyblockHelper.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/dependencies/ASkyblockHelper.java index 41177a1..b72bd0c 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/dependencies/ASkyblockHelper.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/dependencies/ASkyblockHelper.java @@ -16,7 +16,7 @@ public class ASkyblockHelper implements IASkyblockHelper { public boolean isOnOwnIsland(Player player) { Island island = ASkyBlock.getPlugin().getGrid().getProtectedIslandAt(player.getLocation()); - if(island == null) return false; + if (island == null) return false; return island.getMembers().contains(player.getUniqueId()); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/CatHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/CatHandler.java index 454e160..f640959 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/CatHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/CatHandler.java @@ -10,7 +10,7 @@ public class CatHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_14)) { + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_14)) { throw new NullPointerException("This feature is only implemented in version 1.14 and above of Minecraft."); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/DrownedHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/DrownedHandler.java index 17454ed..78b0220 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/DrownedHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/DrownedHandler.java @@ -13,7 +13,7 @@ public class DrownedHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) { throw new NullPointerException("This feature is only implemented in version 1.13 and above of Minecraft."); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ElderGuardianHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ElderGuardianHandler.java index f9657fd..f1b6044 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ElderGuardianHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ElderGuardianHandler.java @@ -18,7 +18,7 @@ public class ElderGuardianHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) throw new NullPointerException("This feature is only implemented in version 1.8 and above of Minecraft."); return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.ELDER_GUARDIAN); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/EndermiteHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/EndermiteHandler.java index 712424d..28ce5d1 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/EndermiteHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/EndermiteHandler.java @@ -18,7 +18,7 @@ public class EndermiteHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) throw new NullPointerException("This feature is only implemented in version 1.8 and above of Minecraft."); return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.ENDERMITE); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/EvokerHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/EvokerHandler.java index 8f3c4f4..b97a2a5 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/EvokerHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/EvokerHandler.java @@ -15,7 +15,7 @@ public class EvokerHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_11)) { + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_11)) { throw new NullPointerException("This feature is only implemented in version 1.11 and above of Minecraft."); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FishHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FishHandler.java index ec97d9f..52d47fa 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FishHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FishHandler.java @@ -13,7 +13,7 @@ public class FishHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) throw new NullPointerException("This feature is only implemented in version 1.13 and above of Minecraft."); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FoxHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FoxHandler.java index 7aa1117..c6af784 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FoxHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FoxHandler.java @@ -13,7 +13,7 @@ public class FoxHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_14)) + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_14)) throw new NullPointerException("This feature is only implemented in version 1.14 and above of Minecraft."); return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.FOX); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/KillerBunnyHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/KillerBunnyHandler.java index 785cf26..37dc562 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/KillerBunnyHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/KillerBunnyHandler.java @@ -16,7 +16,7 @@ public class KillerBunnyHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_8)) throw new NullPointerException("This feature is only implemented in version 1.8 and above of Minecraft."); Rabbit rabbit = (Rabbit) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.RABBIT); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PandaHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PandaHandler.java index 0b5e94c..f2ba492 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PandaHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PandaHandler.java @@ -13,7 +13,7 @@ public class PandaHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_14)) + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_14)) throw new NullPointerException("This feature is only implemented in version 1.14 and above of Minecraft."); return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.PANDA); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ParrotHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ParrotHandler.java index 8070e52..45cf3a4 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ParrotHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ParrotHandler.java @@ -16,7 +16,7 @@ public class ParrotHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { if (ServerVersion.isServerVersionBelow(ServerVersion.V1_12)) - throw new NullPointerException("This feature is only implemented in version 1.12 and above of Minecraft."); + throw new NullPointerException("This feature is only implemented in version 1.12 and above of Minecraft."); return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.PARROT); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PolarBearHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PolarBearHandler.java index dbac2b4..ef1ac57 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PolarBearHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PolarBearHandler.java @@ -2,7 +2,6 @@ package com.songoda.epicbosses.utils.entity.handlers; import com.songoda.core.compatibility.ServerVersion; 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; @@ -16,7 +15,7 @@ public class PolarBearHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_10)) + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_10)) throw new NullPointerException("This feature is only implemented in version 1.10 and above of Minecraft."); return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.POLAR_BEAR); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/RavagerHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/RavagerHandler.java index b723742..fde782e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/RavagerHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/RavagerHandler.java @@ -2,7 +2,6 @@ package com.songoda.epicbosses.utils.entity.handlers; import com.songoda.core.compatibility.ServerVersion; 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; @@ -12,7 +11,7 @@ public class RavagerHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_14)) { + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_14)) { throw new NullPointerException("This feature is only implemented in version 1.14 and above of Minecraft."); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ShulkerHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ShulkerHandler.java index 585deb9..a19e170 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ShulkerHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/ShulkerHandler.java @@ -18,7 +18,7 @@ public class ShulkerHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_9)) { + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_9)) { throw new NullPointerException("This feature is only implemented in version 1.9 and above of Minecraft."); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/StraySkeletonHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/StraySkeletonHandler.java index 5c28486..18beda0 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/StraySkeletonHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/StraySkeletonHandler.java @@ -2,7 +2,6 @@ package com.songoda.epicbosses.utils.entity.handlers; import com.songoda.core.compatibility.ServerVersion; 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; @@ -17,10 +16,10 @@ public class StraySkeletonHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_10)) + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_10)) throw new NullPointerException("This feature is only implemented in version 1.10 and above of Minecraft."); - if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) + if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_10)) return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.STRAY); Skeleton skeleton = (Skeleton) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.SKELETON); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/TurtleHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/TurtleHandler.java index ab4435d..24ec2c7 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/TurtleHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/TurtleHandler.java @@ -10,7 +10,7 @@ public class TurtleHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) + if (ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) throw new NullPointerException("This feature is only implemented in version 1.13 and above of Minecraft."); return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.TURTLE); diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/VexHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/VexHandler.java index 5ac92a1..3a58f70 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/VexHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/VexHandler.java @@ -2,7 +2,6 @@ package com.songoda.epicbosses.utils.entity.handlers; import com.songoda.core.compatibility.ServerVersion; 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; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/VillagerHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/VillagerHandler.java index 5332267..f960366 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/VillagerHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/VillagerHandler.java @@ -18,7 +18,7 @@ public class VillagerHandler implements ICustomEntityHandler { Villager villager = (Villager) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.VILLAGER); String[] split = entityType.split(":"); - if(split.length == 2) { + if (split.length == 2) { String type = split[1]; Villager.Profession profession; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/WitherSkeletonHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/WitherSkeletonHandler.java index ada2add..52b94af 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/WitherSkeletonHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/WitherSkeletonHandler.java @@ -19,7 +19,7 @@ public class WitherSkeletonHandler implements ICustomEntityHandler { @Override public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { - if(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { + if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_11)) { return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.WITHER_SKELETON); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/file/FileUtils.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/file/FileUtils.java index c8a3b1e..aa87130 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/file/FileUtils.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/file/FileUtils.java @@ -15,6 +15,10 @@ public class FileUtils { private static FileUtils INSTANCE = new FileUtils(); + public static FileUtils get() { + return INSTANCE; + } + public void saveFile(File file, FileConfiguration fileConfiguration) { try { fileConfiguration.save(file); @@ -35,8 +39,4 @@ public class FileUtils { return YamlConfiguration.loadConfiguration(file); } - public static FileUtils get() { - return INSTANCE; - } - } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/file/reader/SpigotYmlReader.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/file/reader/SpigotYmlReader.java index 3459ad2..55f438e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/file/reader/SpigotYmlReader.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/file/reader/SpigotYmlReader.java @@ -25,13 +25,13 @@ public class SpigotYmlReader implements IYmlReader { this.spigotConfig = FileUtils.get().loadFile(spigotFile); } + public static SpigotYmlReader get() { + return instance; + } + @Override public Object getObject(String path) { return this.spigotConfig.get(path); } - public static SpigotYmlReader get() { - return instance; - } - } 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 5c89d81..b81d41b 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 @@ -41,44 +41,44 @@ public class ItemStackConverter implements IReplaceableConverter lore = null, enchants = null; - if(durability == 0) { + if (durability == 0) { durability = null; } type = this.materialConverter.to(material); - if(itemStack.hasItemMeta()) { + if (itemStack.hasItemMeta()) { ItemMeta itemMeta = itemStack.getItemMeta(); - if(itemMeta.hasDisplayName()) { + if (itemMeta.hasDisplayName()) { name = itemMeta.getDisplayName().replace('§', '&'); } - if(itemMeta.hasLore()) { + if (itemMeta.hasLore()) { lore = new ArrayList<>(); - for(String string : itemMeta.getLore()) { + for (String string : itemMeta.getLore()) { lore.add(string.replace('§', '&')); } } - if(itemMeta.hasEnchants()) { + if (itemMeta.hasEnchants()) { enchants = this.enchantConverter.to(itemMeta.getEnchants()); } - if(itemMeta instanceof SkullMeta) { + if (itemMeta instanceof SkullMeta) { SkullMeta skullMeta = (SkullMeta) itemMeta; - if(skullMeta.hasOwner()) { + if (skullMeta.hasOwner()) { skullOwner = skullMeta.getOwner(); } } - if(itemMeta instanceof BlockStateMeta) { + if (itemMeta instanceof BlockStateMeta) { BlockStateMeta blockStateMeta = (BlockStateMeta) itemMeta; BlockState blockState = blockStateMeta.getBlockState(); - if(blockState instanceof CreatureSpawner) { + if (blockState instanceof CreatureSpawner) { CreatureSpawner creatureSpawner = (CreatureSpawner) blockState; spawnerId = creatureSpawner.getSpawnedType().getTypeId(); @@ -98,13 +98,13 @@ public class ItemStackConverter implements IReplaceableConverter replaceMap) { ItemStack itemStack = new ItemStack(Material.AIR); - if(itemStackHolder == null) return itemStack; - if(itemStackHolder.getType() == null) return itemStack; + if (itemStackHolder == null) return itemStack; + if (itemStackHolder.getType() == null) return itemStack; String type = itemStackHolder.getType(); Material material = this.materialConverter.from(type); - if(material == null) return itemStack; + if (material == null) return itemStack; itemStack.setType(material); @@ -113,20 +113,20 @@ public class ItemStackConverter implements IReplaceableConverter lore = itemStackHolder.getLore(), enchants = itemStackHolder.getEnchants(); - if(type.contains(":")) { + if (type.contains(":")) { durability = Short.valueOf(type.split(":")[1]); } - if(durability != null) itemStack.setDurability(durability); - if(enchants != null) itemStack.addUnsafeEnchantments(this.enchantConverter.from(enchants)); + if (durability != null) itemStack.setDurability(durability); + if (enchants != null) itemStack.addUnsafeEnchantments(this.enchantConverter.from(enchants)); - if(name != null || skullOwner != null || lore != null || spawnerId != null) { + if (name != null || skullOwner != null || lore != null || spawnerId != null) { ItemMeta itemMeta = itemStack.getItemMeta(); //----------- // SET NAME //----------- - if(name != null) { + if (name != null) { name = StringUtils.get().translateColor(name); itemMeta.setDisplayName(replaceString(name, replaceMap)); @@ -135,7 +135,7 @@ public class ItemStackConverter implements IReplaceableConverter replacedLore = new ArrayList<>(lore); replacedLore.replaceAll(s -> s.replace('&', '§')); @@ -147,12 +147,12 @@ public class ItemStackConverter implements IReplaceableConverter 1) { + if (amount != null && amount > 1) { itemStack.setAmount(amount); } @@ -173,10 +173,10 @@ public class ItemStackConverter implements IReplaceableConverter replaceMap) { - if(replaceMap == null) return input; + if (replaceMap == null) return input; - for(String replaceKey : replaceMap.keySet()) { - if(input.contains(replaceKey)) { + for (String replaceKey : replaceMap.keySet()) { + if (input.contains(replaceKey)) { input = input.replace(replaceKey, replaceMap.get(replaceKey)); } } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackHolderConverter.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackHolderConverter.java index 97cdb63..6e8b0d8 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackHolderConverter.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/ItemStackHolderConverter.java @@ -18,7 +18,7 @@ public class ItemStackHolderConverter implements IConverter, Map to(Map enchantmentIntegerMap) { List enchants = new ArrayList<>(); - for(Map.Entry entry : enchantmentIntegerMap.entrySet()) { + for (Map.Entry entry : enchantmentIntegerMap.entrySet()) { int level = entry.getValue(); Enchantment enchantment = entry.getKey(); EnchantFinder enchantFinder = EnchantFinder.getByEnchant(enchantment); - if(enchantFinder == null) continue; + if (enchantFinder == null) continue; enchants.add(enchantFinder.getFancyName() + ":" + level); } @@ -37,13 +37,13 @@ public class EnchantConverter implements IConverter, Map from(List strings) { Map enchantments = new HashMap<>(); - for(String s : strings) { + for (String s : strings) { String[] split = s.split(":"); String fancyName = split[0]; Integer level = Integer.parseInt(split[1]); EnchantFinder enchantFinder = EnchantFinder.getByName(fancyName); - if(enchantFinder == null) continue; + if (enchantFinder == null) continue; enchantments.put(enchantFinder.getEnchantment(), level); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/converters/MaterialConverter.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/converters/MaterialConverter.java index 14b217f..41fbd32 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/converters/MaterialConverter.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/itemstack/converters/MaterialConverter.java @@ -19,13 +19,13 @@ public class MaterialConverter implements IConverter { @Override public Material from(String input) { - if(input.contains(":")) { + if (input.contains(":")) { String[] split = input.split(":"); input = split[0]; } - if(NumberUtils.get().isInt(input)) { + if (NumberUtils.get().isInt(input)) { return MaterialUtils.fromId(NumberUtils.get().getInteger(input)); } 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 57ed006..a3a1029 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 @@ -63,7 +63,8 @@ public class Panel implements Listener, ICloneable { private int viewers = 0; private PageAction onPageChange = (player, currentPage, requestedPage) -> false; - private PanelCloseAction panelClose = (p) -> {}; + private PanelCloseAction panelClose = (p) -> { + }; //-------------------------------------------------- // @@ -75,12 +76,12 @@ public class Panel implements Listener, ICloneable { * Creates a Panel with the specified arguments * * @param title - Panel title - * @param size - Panel size + * @param size - Panel size */ public Panel(String title, int size) { Bukkit.getPluginManager().registerEvents(this, PLUGIN); - if(size % 9 != 0 && size != 5) { + if (size % 9 != 0 && size != 5) { throw new UnsupportedOperationException("Inventory size must be a multiple of 9 or 5"); } @@ -94,7 +95,7 @@ public class Panel implements Listener, ICloneable { * Creates a Panel with the specified arguments * * @param inventory - Panel inventory - * @param title - Panel title + * @param title - Panel title */ public Panel(Inventory inventory, String title) { this(inventory, title, null, null); @@ -103,10 +104,10 @@ public class Panel implements Listener, ICloneable { /** * Creates a Panel with the specified arguments * - * @param inventory - Panel inventory - * @param title - Panel title + * @param inventory - Panel inventory + * @param title - Panel title * @param panelBuilderSettings - Panel builder settings - * @param panelBuilderCounter - Panel builder counter + * @param panelBuilderCounter - Panel builder counter */ public Panel(Inventory inventory, String title, PanelBuilderSettings panelBuilderSettings, PanelBuilderCounter panelBuilderCounter) { Bukkit.getPluginManager().registerEvents(this, PLUGIN); @@ -136,35 +137,25 @@ public class Panel implements Listener, ICloneable { // //-------------------------------------------------- + public static void setPlugin(JavaPlugin javaPlugin) { + PLUGIN = javaPlugin; + } + @EventHandler protected void onClick(InventoryClickEvent event) { - if(event.getInventory() == null || event.getCursor() == null || getInventory() == null) return; - if(!getInventory().equals(event.getInventory())) return; + if (event.getInventory() == null || event.getCursor() == null || getInventory() == null) return; + if (!getInventory().equals(event.getInventory())) return; Player player = (Player) event.getWhoClicked(); - if(isCancelLowerClick() && isLowerClick(event.getRawSlot())) { + if (isCancelLowerClick() && isLowerClick(event.getRawSlot())) { event.setCancelled(true); return; } - if(getClickSound() != null) player.playSound(player.getLocation(), getClickSound(), 3F, 1F); - if(isCancelClick()) event.setCancelled(true); - if(getInventory().equals(inventory)) executeAction(event.getSlot(), event); - } - - @EventHandler - protected void onClose(InventoryCloseEvent event) { - if(event.getInventory() == null || getInventory() == null) return; - if(!getInventory().equals(event.getInventory())) return; - - Player player = (Player) event.getPlayer(); - - this.panelClose.onClose(player); - this.openedUsers.remove(player.getUniqueId()); - this.viewers--; - - if(getViewers() <= 0 && isDestroyWhenDone()) destroy(); + if (getClickSound() != null) player.playSound(player.getLocation(), getClickSound(), 3F, 1F); + if (isCancelClick()) event.setCancelled(true); + if (getInventory().equals(inventory)) executeAction(event.getSlot(), event); } //-------------------------------------------------- @@ -173,11 +164,25 @@ public class Panel implements Listener, ICloneable { // //-------------------------------------------------- + @EventHandler + protected void onClose(InventoryCloseEvent event) { + if (event.getInventory() == null || getInventory() == null) return; + if (!getInventory().equals(event.getInventory())) return; + + Player player = (Player) event.getPlayer(); + + this.panelClose.onClose(player); + this.openedUsers.remove(player.getUniqueId()); + this.viewers--; + + if (getViewers() <= 0 && isDestroyWhenDone()) destroy(); + } + /** * Used to set an action for when a player clicks * the panel. * - * @param slot - the slot for the action to happen + * @param slot - the slot for the action to happen * @param clickAction - the action to happen * @return an instance of the Panel. */ @@ -218,7 +223,7 @@ public class Panel implements Listener, ICloneable { * @param item - the item to be set. * @return an instance of the Panel. */ - public Panel setItem(int slot, ItemStack item){ + public Panel setItem(int slot, ItemStack item) { this.inventory.setItem(slot, item); return this; } @@ -228,8 +233,8 @@ public class Panel implements Listener, ICloneable { * panel and for an action to also be set to that * specified slot. * - * @param slot - the slot for the action and item to be set to - * @param item - the item to be set + * @param slot - the slot for the action and item to be set to + * @param item - the item to be set * @param action - the action to be applied * @return an instance of the Panel. */ @@ -239,18 +244,6 @@ public class Panel implements Listener, ICloneable { return setOnClick(slot, action); } - /** - * Used to set the click sound for when a player - * clicks the panel. - * - * @param clickSound - the sound to be played. - * @return an instance of the Panel. - */ - public Panel setClickSound(Sound clickSound) { - this.clickSound = clickSound; - return this; - } - /** * Used to open the panel for the specified player. * @@ -288,41 +281,6 @@ public class Panel implements Listener, ICloneable { return this; } - /** - * Used to set if clicks are cancelled in the panel. - * - * @param cancelClick - boolean if clicks are cancelled. - * @return an instance of the Panel. - */ - public Panel setCancelClick(boolean cancelClick) { - this.cancelClick = cancelClick; - return this; - } - - /** - * Used to specify if the panel is destroyed when the - * last person closes it. - * - * @param destroyWhenDone - the boolean to set if the panel destroys on close. - * @return an instance of the Panel. - */ - public Panel setDestroyWhenDone(boolean destroyWhenDone) { - this.destroyWhenDone = destroyWhenDone; - return this; - } - - /** - * Used to set if the click is cancelled on the bottom - * GUI. - * - * @param cancelClick - if the click is cancelled. - * @return an instance of the Panel. - */ - public Panel setCancelLowerClick(boolean cancelClick) { - this.cancelLowerClick = cancelClick; - return this; - } - public boolean isLowerClick(int rawSlot) { return rawSlot >= inventory.getSize(); } @@ -336,7 +294,7 @@ public class Panel implements Listener, ICloneable { * @return the current Panel */ public Panel setParentPanel(Panel parentPanel) { - if(!this.panelBuilderSettings.isBackButton()) return this; + if (!this.panelBuilderSettings.isBackButton()) return this; int slot = this.panelBuilderSettings.getBackButtonSlot() - 1; @@ -349,14 +307,14 @@ public class Panel implements Listener, ICloneable { * will be used if the Back Button is also set up for this * panel. * - * @param panelBuilder - the parent panelBuilder - * @param cancelClick - cancelClick on the parent panel + * @param panelBuilder - the parent panelBuilder + * @param cancelClick - cancelClick on the parent panel * @param cancelLowerClick - cancelLowerClick on the parent panel - * @param destroyWhenDone - destroy parent panel when done + * @param destroyWhenDone - destroy parent panel when done * @return the current Panel */ public Panel setParentPanel(PanelBuilder panelBuilder, boolean cancelClick, boolean destroyWhenDone, boolean cancelLowerClick) { - if(!this.panelBuilderSettings.isBackButton()) return this; + if (!this.panelBuilderSettings.isBackButton()) return this; int slot = this.panelBuilderSettings.getBackButtonSlot() - 1; @@ -380,7 +338,7 @@ public class Panel implements Listener, ICloneable { * @return the current Panel */ public Panel setParentPanelHandler(IPanelHandler panelHandler) { - if(!this.panelBuilderSettings.isBackButton()) return this; + if (!this.panelBuilderSettings.isBackButton()) return this; int slot = this.panelBuilderSettings.getBackButtonSlot() - 1; @@ -394,11 +352,11 @@ public class Panel implements Listener, ICloneable { * panel. * * @param variablePanelHandler - the parent variable panel handler - * @param variable - the variable to handle when opening the parent panel + * @param variable - the variable to handle when opening the parent panel * @return the current Panel */ public Panel setParentPanelHandler(IVariablePanelHandler variablePanelHandler, T variable) { - if(!this.panelBuilderSettings.isBackButton()) return this; + if (!this.panelBuilderSettings.isBackButton()) return this; int slot = this.panelBuilderSettings.getBackButtonSlot() - 1; @@ -412,12 +370,12 @@ public class Panel implements Listener, ICloneable { * panel. * * @param variablePanelHandler - the parent variable panel handler - * @param variable - the main variable to handle when opening the parent panel - * @param subVariable - the sub variable to handle when opening the parent panel + * @param variable - the main variable to handle when opening the parent panel + * @param subVariable - the sub variable to handle when opening the parent panel * @return the current Panel */ public Panel setParentPanelHandler(ISubVariablePanelHandler variablePanelHandler, T variable, Y subVariable) { - if(!this.panelBuilderSettings.isBackButton()) return this; + if (!this.panelBuilderSettings.isBackButton()) return this; int slot = this.panelBuilderSettings.getBackButtonSlot() - 1; @@ -425,8 +383,8 @@ public class Panel implements Listener, ICloneable { return this; } - public Panel setParentPanelHandler(ISubSubVariablePanelHandler panelHandler, T variable, Y subVariable, Z subSubVariable) { - if(!this.panelBuilderSettings.isBackButton()) return this; + public Panel setParentPanelHandler(ISubSubVariablePanelHandler panelHandler, T variable, Y subVariable, Z subSubVariable) { + if (!this.panelBuilderSettings.isBackButton()) return this; int slot = this.panelBuilderSettings.getBackButtonSlot() - 1; @@ -441,7 +399,7 @@ public class Panel implements Listener, ICloneable { * @return the current panel */ public Panel setExitButton() { - if(!this.panelBuilderSettings.isExitButton()) return this; + if (!this.panelBuilderSettings.isExitButton()) return this; int slot = this.panelBuilderSettings.getExitButtonSlot(); @@ -449,17 +407,10 @@ public class Panel implements Listener, ICloneable { return this; } - - //-------------------------------------------------- - // - // O T H E R P A N E L M E T H O D S - // - //-------------------------------------------------- - /** * Used to destroy a panel, no matter how many people * are in it or what's happening in it. - * + *

* ** ONLY USE THIS IF YOU KNOW WHAT YOU'RE DOING ** */ public void destroy() { @@ -471,7 +422,7 @@ public class Panel implements Listener, ICloneable { this.openedUsers.forEach(uuid -> { Player player = Bukkit.getPlayer(uuid); - if(player == null) return; + if (player == null) return; player.closeInventory(); }); @@ -491,10 +442,10 @@ public class Panel implements Listener, ICloneable { public Inventory cloneInventory() { Inventory newInventory = Bukkit.createInventory(this.inventory.getHolder(), this.inventory.getSize(), this.title); - for(int i = 0; i < this.inventory.getSize(); i++) { + for (int i = 0; i < this.inventory.getSize(); i++) { ItemStack itemStack = this.inventory.getItem(i); - if(itemStack == null) continue; + if (itemStack == null) continue; newInventory.setItem(i, itemStack); } @@ -521,10 +472,10 @@ public class Panel implements Listener, ICloneable { panel.onPageChange = this.onPageChange; panel.panelClose = this.panelClose; - for(int i = 0; i < this.inventory.getSize(); i++) { + for (int i = 0; i < this.inventory.getSize(); i++) { ItemStack itemStack = this.inventory.getItem(i); - if(itemStack != null) { + if (itemStack != null) { panel.inventory.setItem(i, itemStack); } } @@ -532,9 +483,10 @@ public class Panel implements Listener, ICloneable { return panel; } + //-------------------------------------------------- // - // P A N E L P A G E M E T H O D S + // O T H E R P A N E L M E T H O D S // //-------------------------------------------------- @@ -542,15 +494,15 @@ public class Panel implements Listener, ICloneable { * Load the specified page of the list panel * with the new page data. * - * @param page - page number to load + * @param page - page number to load * @param pageHandler - page handler that is used when loading the page */ public void loadPage(int page, IPageHandler pageHandler) { int fillTo = getPanelBuilderSettings().getFillTo(); int startIndex = page * fillTo; - for(int i = startIndex; i < startIndex + fillTo; i++) { - pageHandler.handleSlot(i, i-startIndex); + for (int i = startIndex; i < startIndex + fillTo; i++) { + pageHandler.handleSlot(i, i - startIndex); } } @@ -572,52 +524,46 @@ public class Panel implements Listener, ICloneable { * @param map - the map to gain size from * @return integer amount of pages */ - public int getMaxPage(Map map) { + public int getMaxPage(Map map) { return (int) Math.ceil((double) map.size() / (double) getPanelBuilderSettings().getFillTo()) - 1; } //-------------------------------------------------- // - // P A N E L E X E C U T E A C T I O N + // P A N E L P A G E M E T H O D S // //-------------------------------------------------- private void executeAction(int slot, InventoryClickEvent e) { Player clicker = (Player) e.getWhoClicked(); - if(getPanelBuilderCounter().getPageData().containsKey(slot)) { + if (getPanelBuilderCounter().getPageData().containsKey(slot)) { int currentPage = this.currentPageContainer.getOrDefault(clicker.getUniqueId(), 0); - if(getPanelBuilderCounter().getPageData().get(slot) > 0) { - if(this.onPageChange.onPageAction(clicker, currentPage, currentPage+1)) { - this.currentPageContainer.put(clicker.getUniqueId(), currentPage+1); + if (getPanelBuilderCounter().getPageData().get(slot) > 0) { + if (this.onPageChange.onPageAction(clicker, currentPage, currentPage + 1)) { + this.currentPageContainer.put(clicker.getUniqueId(), currentPage + 1); } } else { - if(currentPage != 0) { - if (this.onPageChange.onPageAction(clicker, currentPage, currentPage-1)) { + if (currentPage != 0) { + if (this.onPageChange.onPageAction(clicker, currentPage, currentPage - 1)) { this.currentPageContainer.put(clicker.getUniqueId(), currentPage - 1); } } } } - if(this.targettedSlotActions.containsKey(slot)) { + if (this.targettedSlotActions.containsKey(slot)) { this.targettedSlotActions.get(slot).onClick(e); } - if(!this.allSlotActions.isEmpty()) { - for(ClickAction clickAction : this.allSlotActions) { + if (!this.allSlotActions.isEmpty()) { + for (ClickAction clickAction : this.allSlotActions) { clickAction.onClick(e); } } } - //-------------------------------------------------- - // - // P A N E L P R I V A T E M E T H O D - // - //-------------------------------------------------- - /** * Used to fill the empty spaces in the panel with the specified * EmptySpaceFiller item if it's set up in the config. @@ -625,45 +571,88 @@ public class Panel implements Listener, ICloneable { private void fillEmptySpace() { ItemStackHolder itemStackHolder = this.panelBuilderSettings.getEmptySpaceFillerItem(); - if(itemStackHolder == null) return; + if (itemStackHolder == null) return; ItemStack itemStack = ITEM_STACK_CONVERTER.from(itemStackHolder); - if(itemStack == null) return; + if (itemStack == null) return; - for(int i = 0; i < getInventory().getSize(); i++) { + for (int i = 0; i < getInventory().getSize(); i++) { ItemStack itemAtSlot = getInventory().getItem(i); - if(getPanelBuilderCounter().isButtonAtSlot(i)) continue; + if (getPanelBuilderCounter().isButtonAtSlot(i)) continue; - if(itemAtSlot == null || itemAtSlot.getType() == Material.AIR) { + if (itemAtSlot == null || itemAtSlot.getType() == Material.AIR) { getInventory().setItem(i, itemStack); } } } + public boolean isCancelClick() { + return this.cancelClick; + } + + //-------------------------------------------------- + // + // P A N E L E X E C U T E A C T I O N + // + //-------------------------------------------------- + + /** + * Used to set if clicks are cancelled in the panel. + * + * @param cancelClick - boolean if clicks are cancelled. + * @return an instance of the Panel. + */ + public Panel setCancelClick(boolean cancelClick) { + this.cancelClick = cancelClick; + return this; + } + + //-------------------------------------------------- + // + // P A N E L P R I V A T E M E T H O D + // + //-------------------------------------------------- + + public boolean isDestroyWhenDone() { + return this.destroyWhenDone; + } + //-------------------------------------------------- // // P A N E L S T A T I C M E T H O D // //-------------------------------------------------- - public static void setPlugin(JavaPlugin javaPlugin) { - PLUGIN = javaPlugin; - } - - public boolean isCancelClick() { - return this.cancelClick; - } - - public boolean isDestroyWhenDone() { - return this.destroyWhenDone; + /** + * Used to specify if the panel is destroyed when the + * last person closes it. + * + * @param destroyWhenDone - the boolean to set if the panel destroys on close. + * @return an instance of the Panel. + */ + public Panel setDestroyWhenDone(boolean destroyWhenDone) { + this.destroyWhenDone = destroyWhenDone; + return this; } public boolean isCancelLowerClick() { return this.cancelLowerClick; } + /** + * Used to set if the click is cancelled on the bottom + * GUI. + * + * @param cancelClick - if the click is cancelled. + * @return an instance of the Panel. + */ + public Panel setCancelLowerClick(boolean cancelClick) { + this.cancelLowerClick = cancelClick; + return this; + } + public PanelBuilderSettings getPanelBuilderSettings() { return this.panelBuilderSettings; } @@ -676,6 +665,18 @@ public class Panel implements Listener, ICloneable { return this.clickSound; } + /** + * Used to set the click sound for when a player + * clicks the panel. + * + * @param clickSound - the sound to be played. + * @return an instance of the Panel. + */ + public Panel setClickSound(Sound clickSound) { + this.clickSound = clickSound; + return this; + } + public String getTitle() { return this.title; } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/base/handlers/BasePanelHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/base/handlers/BasePanelHandler.java index 8fbe983..033320e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/base/handlers/BasePanelHandler.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/base/handlers/BasePanelHandler.java @@ -14,9 +14,8 @@ import org.bukkit.configuration.ConfigurationSection; public abstract class BasePanelHandler implements IBasicPanelHandler { protected final BossPanelManager bossPanelManager; - - private PanelBuilder panelBuilder; protected Panel panel = null; + private PanelBuilder panelBuilder; public BasePanelHandler(BossPanelManager bossPanelManager, ConfigurationSection configurationSection) { this(bossPanelManager, new PanelBuilder(configurationSection)); 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 ee182f0..4bde6aa 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 @@ -42,7 +42,7 @@ public class PanelBuilder { this.panelBuilderCounter = new PanelBuilderCounter(); this.configurationSection = configurationSection; - if(replaceMap != null) this.replaceMap.putAll(replaceMap); + if (replaceMap != null) this.replaceMap.putAll(replaceMap); } public PanelBuilder setSize(int size) { @@ -51,7 +51,7 @@ public class PanelBuilder { } public PanelBuilder addReplaceData(Map replaceMap) { - if(replaceMap != null) this.replaceMap.putAll(replaceMap); + if (replaceMap != null) this.replaceMap.putAll(replaceMap); return this; } @@ -80,10 +80,10 @@ public class PanelBuilder { Map clickActionMap = this.panelBuilderCounter.getClickActions(); this.panelBuilderCounter.getSlotsWithCounter().forEach((identifier, slotsWith) -> { - if(itemStackMap.containsKey(identifier)) { + if (itemStackMap.containsKey(identifier)) { slotsWith.forEach(slot -> panel.setItem(slot, itemStackMap.get(identifier))); } - if(clickActionMap.containsKey(identifier)) { + if (clickActionMap.containsKey(identifier)) { slotsWith.forEach(slot -> panel.setOnClick(slot, clickActionMap.get(identifier))); } }); @@ -92,26 +92,28 @@ public class PanelBuilder { } private void build() { - String name = configurationSection.contains("name")? StringUtils.get().translateColor(configurationSection.getString("name")) : "?!? naming convention error ?!?"; - int slots = this.size != 0? this.size : configurationSection.contains("slots")? configurationSection.getInt("slots") : 9; - ConfigurationSection itemSection = configurationSection.contains("Items")? configurationSection.getConfigurationSection("Items") : null; + String name = configurationSection.contains("name") ? StringUtils.get().translateColor(configurationSection.getString("name")) : "?!? naming convention error ?!?"; + int slots = this.size != 0 ? this.size : configurationSection.contains("slots") ? configurationSection.getInt("slots") : 9; + 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) { + if (itemSection != null) { Map> slotsWith = this.panelBuilderCounter.getSlotsWithCounter(); Map> specialSlotsWith = this.panelBuilderCounter.getSpecialValuesCounter(); - for(String s : itemSection.getKeys(false)) { - int slot = NumberUtils.get().isInt(s)? Integer.valueOf(s) - 1 : 0; + for (String s : itemSection.getKeys(false)) { + int slot = NumberUtils.get().isInt(s) ? Integer.valueOf(s) - 1 : 0; ConfigurationSection innerSection = itemSection.getConfigurationSection(s); - if(innerSection.contains("NextPage") && innerSection.getBoolean("NextPage")) this.panelBuilderCounter.addPageData(slot, 1); - if(innerSection.contains("PreviousPage") && innerSection.getBoolean("PreviousPage")) this.panelBuilderCounter.addPageData(slot, -1); + if (innerSection.contains("NextPage") && innerSection.getBoolean("NextPage")) + this.panelBuilderCounter.addPageData(slot, 1); + if (innerSection.contains("PreviousPage") && innerSection.getBoolean("PreviousPage")) + this.panelBuilderCounter.addPageData(slot, -1); - if(innerSection.contains("Button")) { + if (innerSection.contains("Button")) { String identifier = innerSection.getString("Button"); Set current = slotsWith.getOrDefault(identifier, new HashSet<>()); @@ -119,8 +121,8 @@ public class PanelBuilder { this.panelBuilderCounter.getSlotsWithCounter().put(identifier, current); } - for(String identifier : specialSlotsWith.keySet()) { - if(innerSection.contains(identifier)) { + for (String identifier : specialSlotsWith.keySet()) { + if (innerSection.contains(identifier)) { Map current = specialSlotsWith.get(identifier); current.put(slot, innerSection.get(identifier)); @@ -128,12 +130,12 @@ public class PanelBuilder { } } - if(slot > inventory.getSize() - 1) continue; + if (slot > inventory.getSize() - 1) continue; this.defaultSlots.add(slot); - if(innerSection.contains("Item")) innerSection = innerSection.getConfigurationSection("Item"); - if(!innerSection.contains("type")) continue; + if (innerSection.contains("Item")) innerSection = innerSection.getConfigurationSection("Item"); + if (!innerSection.contains("type")) continue; this.inventory.setItem(slot, ItemStackUtils.createItemStack(innerSection, 1, replaceMap)); } @@ -141,8 +143,8 @@ public class PanelBuilder { } private String replace(String input) { - for(Map.Entry entry : replaceMap.entrySet()) { - if(input.contains(entry.getKey())) { + for (Map.Entry entry : replaceMap.entrySet()) { + if (input.contains(entry.getKey())) { input = input.replace(entry.getKey(), entry.getValue()); } } @@ -150,7 +152,7 @@ public class PanelBuilder { String nameKey = "{name}"; //Apply replace twice, to go over any missed replaced values, or new values that had been set in the replacement - if(replaceMap.containsKey(nameKey) && input.contains(nameKey)) { + if (replaceMap.containsKey(nameKey) && input.contains(nameKey)) { input = input.replace(nameKey, replaceMap.get(nameKey)); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilderCounter.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilderCounter.java index 8e92f1f..cd3bcfd 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilderCounter.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilderCounter.java @@ -24,11 +24,11 @@ public class PanelBuilderCounter { public boolean isButtonAtSlot(int slot) { for (Set integers : this.slotsWithCounter.values()) { - if(integers.contains(slot)) return true; + if (integers.contains(slot)) return true; } - for(Map map : this.specialValuesCounter.values()) { - if(map.containsKey(slot)) return true; + for (Map map : this.specialValuesCounter.values()) { + if (map.containsKey(slot)) return true; } return false; diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilderSettings.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilderSettings.java index 64aa7b8..8dd1329 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilderSettings.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/panel/builder/PanelBuilderSettings.java @@ -21,11 +21,11 @@ public class PanelBuilderSettings { ConfigurationSection buttonsSection = configurationSection.getConfigurationSection("Buttons"); this.emptySpaceFiller = settingsSection != null && settingsSection.getBoolean("emptySpaceFiller", false); - this.backButton = settingsSection != null && settingsSection.getBoolean("backButton", false); - this.exitButton = settingsSection != null && settingsSection.getBoolean("exitButton", false); - this.fillTo = settingsSection == null? 0 : settingsSection.getInt("fillTo", 0); - this.backButtonSlot = buttonsSection == null? -1 : buttonsSection.getInt("backButton", -1); - this.exitButtonSlot = buttonsSection == null? -1 : buttonsSection.getInt("exitButton", -1); + this.backButton = settingsSection != null && settingsSection.getBoolean("backButton", false); + this.exitButton = settingsSection != null && settingsSection.getBoolean("exitButton", false); + this.fillTo = settingsSection == null ? 0 : settingsSection.getInt("fillTo", 0); + this.backButtonSlot = buttonsSection == null ? -1 : buttonsSection.getInt("backButton", -1); + this.exitButtonSlot = buttonsSection == null ? -1 : buttonsSection.getInt("exitButton", -1); this.emptySpaceFillerItem = itemStackHolderConverter.to(configurationSection.getConfigurationSection("EmptySpaceFiller")); } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/potion/PotionEffectConverter.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/potion/PotionEffectConverter.java index 31b9ac5..85c7748 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/potion/PotionEffectConverter.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/potion/PotionEffectConverter.java @@ -25,7 +25,7 @@ public class PotionEffectConverter implements IConverter { updateTarget(); - if(this.currentTarget == null || this.currentTarget.isDead()) return; + if (this.currentTarget == null || this.currentTarget.isDead()) return; createAutoTarget(); }); } - } diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/time/TimeUnit.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/time/TimeUnit.java index a7b33af..1492384 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/time/TimeUnit.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/time/TimeUnit.java @@ -4,7 +4,7 @@ package com.songoda.epicbosses.utils.time; * @author AMinecraftDev * @version 1.0.0 * @since 23-May-17 - * + *

* Makes it easy to convert * time */ @@ -26,29 +26,6 @@ public enum TimeUnit { this.seconds = seconds; } - /** - * Returns a double, representing - * the amount of time in the requested - * TimeUnit - * - * @param timeUnit TimeUnit - * @param input double - * @return double - */ - public double to(TimeUnit timeUnit, double input) { - return (input*seconds) / timeUnit.getSeconds(); - } - - /** - * Returns the amound of seconds - * that fit into this TimeUnit - * - * @return double - */ - public double getSeconds() { - return seconds; - } - /** * Returns the TimeUnit that belongs * to the specified String @@ -100,4 +77,27 @@ public enum TimeUnit { } } + /** + * Returns a double, representing + * the amount of time in the requested + * TimeUnit + * + * @param timeUnit TimeUnit + * @param input double + * @return double + */ + public double to(TimeUnit timeUnit, double input) { + return (input * seconds) / timeUnit.getSeconds(); + } + + /** + * Returns the amound of seconds + * that fit into this TimeUnit + * + * @return double + */ + public double getSeconds() { + return seconds; + } + } \ No newline at end of file diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/time/TimeUtil.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/time/TimeUtil.java index c20b132..97f4356 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/time/TimeUtil.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/time/TimeUtil.java @@ -6,7 +6,7 @@ public class TimeUtil { * Returns the amount of time in the * requested TimeUnit from a formatted string * - * @param string String + * @param string String * @param timeUnit TimeUnit * @return double * @throws IllegalArgumentException when the string is formatted wrongly @@ -16,41 +16,41 @@ public class TimeUtil { String timeString = string.trim().toLowerCase(); - if(timeString.contains(" ")) { + if (timeString.contains(" ")) { String[] split = timeString.split(" "); - for(String line : split) { + for (String line : split) { int index = 0; - while(isInteger(String.valueOf(line.charAt(index)))) { + while (isInteger(String.valueOf(line.charAt(index)))) { index++; } int time = Integer.parseInt(line.substring(0, index)); - String unit = line.substring(index+1, line.length()); + String unit = line.substring(index + 1, line.length()); TimeUnit tempUnit = TimeUnit.fromString(unit); - if(tempUnit == null) throw new IllegalArgumentException("Invalid time format: " + unit); + if (tempUnit == null) throw new IllegalArgumentException("Invalid time format: " + unit); seconds += tempUnit.to(TimeUnit.SECONDS, time); } } else { int index = 0; int prevIndex = 0; - while(index < timeString.length()-1) { + while (index < timeString.length() - 1) { double time; - while(isInteger(String.valueOf(timeString.charAt(index)))) { + while (isInteger(String.valueOf(timeString.charAt(index)))) { index++; } time = Integer.parseInt(timeString.substring(prevIndex, index)); prevIndex = index; - while(!isInteger(String.valueOf(timeString.charAt(index)))) { + while (!isInteger(String.valueOf(timeString.charAt(index)))) { index++; - if(index >= timeString.length()) break; + if (index >= timeString.length()) break; } String unit = timeString.substring(prevIndex, index); TimeUnit tempUnit = TimeUnit.fromString(unit); - if(tempUnit == null) throw new IllegalArgumentException("Invalid time format: " + unit); + if (tempUnit == null) throw new IllegalArgumentException("Invalid time format: " + unit); seconds += tempUnit.to(TimeUnit.SECONDS, time); @@ -66,7 +66,7 @@ public class TimeUtil { * belonging to this amount of time * * @param unit TimeUnit - * @param a int amount of time + * @param a int amount of time * @return String */ public static String getFormattedTime(TimeUnit unit, int a) { @@ -77,8 +77,8 @@ public class TimeUtil { * Returns the formatted time string * belonging to this amount of time * - * @param unit TimeUnit - * @param a int amount of time + * @param unit TimeUnit + * @param a int amount of time * @param splitter String * @return String */ @@ -100,7 +100,7 @@ public class TimeUtil { StringBuilder sb = new StringBuilder(); - if(splitter == null) { + if (splitter == null) { if (years > 0) { sb.append(years).append(" year").append(years != 1 ? "s" : "").append(", "); } @@ -123,25 +123,25 @@ public class TimeUtil { sb.append(minutes > 0 ? "and " : "").append(seconds).append(" second").append(seconds != 1 ? "s" : ""); } } else { - if(years > 0) { + if (years > 0) { sb.append(years).append(splitter); } - if(months > 0 || sb.length() > 0) { + if (months > 0 || sb.length() > 0) { sb.append(months).append(splitter); } - if(weeks > 0 || sb.length() > 0) { + if (weeks > 0 || sb.length() > 0) { sb.append(weeks).append(splitter); } - if(days > 0 || sb.length() > 0) { + if (days > 0 || sb.length() > 0) { sb.append(days).append(splitter); } - if(hours > 0 || sb.length() > 0) { + if (hours > 0 || sb.length() > 0) { sb.append(hours).append(splitter); } - if(minutes > 0 || sb.length() > 0) { + if (minutes > 0 || sb.length() > 0) { sb.append(minutes).append(splitter); } - if(seconds > 0 || sb.length() > 0) { + if (seconds > 0 || sb.length() > 0) { sb.append(seconds); } } diff --git a/plugin-modules/FactionHelper/pom.xml b/plugin-modules/FactionHelper/pom.xml index 08a26a4..d6415cb 100644 --- a/plugin-modules/FactionHelper/pom.xml +++ b/plugin-modules/FactionHelper/pom.xml @@ -1,6 +1,6 @@ - EpicBosses diff --git a/pom.xml b/pom.xml index 9f7a835..c4c506e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@ - 4.0.0