diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 2a9b34a..35a5a5e 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -34,12 +34,12 @@ - + - - - - + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_massivecraft_FactionsOne_1_2_1.xml b/.idea/libraries/Maven__com_massivecraft_FactionsOne_1_2_1.xml deleted file mode 100644 index 9f0eee9..0000000 --- a/.idea/libraries/Maven__com_massivecraft_FactionsOne_1_2_1.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__com_massivecraft_FactionsUUID_1_6_9_5_U0_1_20.xml b/.idea/libraries/Maven__com_massivecraft_FactionsUUID_1_6_9_5_U0_1_20.xml deleted file mode 100644 index 6cf04dc..0000000 --- a/.idea/libraries/Maven__com_massivecraft_FactionsUUID_1_6_9_5_U0_1_20.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__com_massivecraft_factions_Factions_2_9_1_SNAPSHOT.xml b/.idea/libraries/Maven__com_massivecraft_factions_Factions_2_9_1_SNAPSHOT.xml deleted file mode 100644 index c2dae64..0000000 --- a/.idea/libraries/Maven__com_massivecraft_factions_Factions_2_9_1_SNAPSHOT.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Maven__com_massivecraft_massivecore_MassiveCore_2_9_1_SNAPSHOT.xml b/.idea/libraries/Maven__com_massivecraft_massivecore_MassiveCore_2_9_1_SNAPSHOT.xml deleted file mode 100644 index 78218b6..0000000 --- a/.idea/libraries/Maven__com_massivecraft_massivecore_MassiveCore_2_9_1_SNAPSHOT.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/api-modules/FactionsM/FactionsM.iml b/api-modules/FactionsM/FactionsM.iml index 3488d97..b932985 100644 --- a/api-modules/FactionsM/FactionsM.iml +++ b/api-modules/FactionsM/FactionsM.iml @@ -1,6 +1,6 @@ - + @@ -9,28 +9,5 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/api-modules/FactionsOne/FactionsOne.iml b/api-modules/FactionsOne/FactionsOne.iml index d91e86e..b932985 100644 --- a/api-modules/FactionsOne/FactionsOne.iml +++ b/api-modules/FactionsOne/FactionsOne.iml @@ -1,6 +1,6 @@ - + @@ -9,27 +9,5 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/api-modules/FactionsUUID/FactionsUUID.iml b/api-modules/FactionsUUID/FactionsUUID.iml index 3a4c164..b932985 100644 --- a/api-modules/FactionsUUID/FactionsUUID.iml +++ b/api-modules/FactionsUUID/FactionsUUID.iml @@ -1,6 +1,6 @@ - + @@ -9,27 +9,5 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/api-modules/PluginAPI/PluginAPI.iml b/api-modules/PluginAPI/PluginAPI.iml index d49074e..b932985 100644 --- a/api-modules/PluginAPI/PluginAPI.iml +++ b/api-modules/PluginAPI/PluginAPI.iml @@ -1,6 +1,6 @@ - + @@ -9,25 +9,5 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugin-modules/Core/Core.iml b/plugin-modules/Core/Core.iml index 4f08f88..3126c70 100644 --- a/plugin-modules/Core/Core.iml +++ b/plugin-modules/Core/Core.iml @@ -1,6 +1,6 @@ - + @@ -9,29 +9,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugin-modules/Core/resources/autospawns.yml b/plugin-modules/Core/resources/autospawns.yml deleted file mode 100644 index 043a435..0000000 --- a/plugin-modules/Core/resources/autospawns.yml +++ /dev/null @@ -1,55 +0,0 @@ -AutoSpawns: - '1': - Coords: - world: world - x: 0 - y: 150 - z: 0 - - PossibleSpawns: - - SKELETON - - ZOMBIE - - GIANT - - Settings: - spawnIfChunkNotLoaded: false - maxSpawned: 1 - bossesPerInterval: 1 - spawnRate: 30m - spawnType: INTERVAL - holographicPlaceholder: '{custombosses_1}' - - Messages: - onSpawn: [] - Intervals: - '10': - - '&e&l(!) &bThe boss (#1) is about to spawn in {0} seconds!' - '60': - - '&e&l(!) &bThe boss (#1) is about to spawn in {0} seconds!' - '300': - - '&e&l(!) &bThe boss (#1) is about to spawn in 5 minutes!' - '2': - Coords: - world: world - x: 0 - y: 150 - z: 0 - - PossibleSpawns: - - SKELETON - - Settings: - spawnIfChunkNotLoaded: false - maxSpawned: 1 - bossesPerInterval: 1 - spawnRate: 1m - spawnType: INTERVAL - holographicPlaceholder: '{custombosses_2}' - - Messages: - onSpawn: [] - Intervals: - '10': - - '&e&l(!) &bThe boss (#2) is about to spawn in {0} seconds!' - '30': - - '&e&l(!) &bThe boss (#2) is about to spawn in {0} seconds!' \ No newline at end of file diff --git a/plugin-modules/Core/resources/bosses.yml b/plugin-modules/Core/resources/bosses.yml index 49f2341..e69de29 100644 --- a/plugin-modules/Core/resources/bosses.yml +++ b/plugin-modules/Core/resources/bosses.yml @@ -1,135 +0,0 @@ -Bosses: - - #SKELETON BOSS CONFIGURATION SECTION - SKELETON: - Item: - type: '383:51' - name: '&6&lSkeleton King Boss Spawn Egg' - lore: - - '&7Right click a block to spawn' - - '&7the boss as that location.' - Boss: - targetType: VANILLA - type: SKELETON - name: '&6&l&nSkeleton King Boss' - health: 80 - Armor: - type: GOLD - enchants: - - PROTECTION_ENVIRONMENTAL:4 - - DURABILITY:3 - Weapon: - type: DIAMOND_SWORD - enchants: - - KNOCKBACK:3 - - DURABILITY:3 - Head: - owner: AMinecraftDev - Potions: - '1': - type: DAMAGE_RESISTANCE - level: 3 - duration: -1 - Skills: - overallChance: 30.0 - message: '&6&l{0} &7used &e{1}' - delay: 30s - list: - - 30:KNOCKBACK1 - - 40:CAGE1 - - 70:CAGE2 - Drops: - NaturalDrops: false - DropTable: SkeletonTable1 - Messages: - onSpawn: - - '&4' - - '&a&lA &6&l{boss} &a&lhas been spawned in the warzone!' - - '&4' - onDeath: - message: - - '&4' - - '&8&m---------&8&l[ &a&l{boss}&r &a&lKilled &8&l]&r&8&m---------' - - '&aKillers: &r{format}' - format: ' &6&l{position} &e{player} &7(&b{%}%&7) /n' - Taunts: - delay: 30s - messages: - - '&7Muahahahaha you can never beat me.' - - '&7You think that hurts someone like me?!' - Commands: - onSpawn: - - 'say onSpawn random command: {player} spawned me.' - onDeath: - - 'say onDeath random command: {player}' - - #ZOMBIE BOSS CONFIGURATION SECTION - ZOMBIE: - Item: - type: '383:54' - name: '&2&lZombie King Boss Spawn Egg' - lore: - - '&7Right click a block to spawn' - - '&7the boss as that location.' - Boss: - targetType: DAMAGE - type: ZOMBIE - name: '&2&l&nZombie King Boss' - health: 100 - Weapon: - type: DIAMOND_AXE - enchants: - - KNOCKBACK:3 - - DURABILITY:3 - Drops: - NaturalDrops: false - DropTable: ZombieTable1 - Messages: - onSpawn: - - '&4' - - '&a&lA &6&l{boss} &a&lhas been spawned in the warzone!' - - '&4' - onDeath: - message: - - '&4' - - '&8&m---------&8&l[ &a&l{boss}&r &a&lKilled &8&l]&r&8&m---------' - - '&aKillers: &r{format}' - format: ' &6&l{position} &e{player} &7(&b{%}%&7) /n' - Taunts: - delay: 30s - messages: - - '&7Muahahahaha you can never beat me.' - - '&7You think that hurts someone like me?!' - Commands: - onSpawn: - - 'say onSpawn random command: {player} spawned me.' - onDeath: - - 'say onDeath random command: {player}' - - #GIANT BOSS CONFIGURATION SECTION - GIANT: - Item: - type: '383:54' - name: '&b&lGiant Zombie Boss Spawn Egg' - lore: - - '&7Right click a block to spawn' - - '&7the boss as that location.' - Boss: - targetType: DAMAGE - type: GIANT - name: '&b&l&nGiant King Boss' - health: 100 - Drops: - NaturalDrops: false - DropTable: GiantTable1 - Messages: - onSpawn: - - '&4' - - '&a&lA &6&l{boss} &a&lhas been spawned in the warzone!' - - '&4' - onDeath: - message: - - '&4' - - '&8&m---------&8&l[ &a&l{boss}&r &a&lKilled &8&l]&r&8&m---------' - - '&aKillers: &r{format}' - format: ' &6&l{position} &e{player} &7(&b{%}%&7) /n' \ No newline at end of file diff --git a/plugin-modules/Core/resources/config.yml b/plugin-modules/Core/resources/config.yml deleted file mode 100644 index 11ec1ae..0000000 --- a/plugin-modules/Core/resources/config.yml +++ /dev/null @@ -1,102 +0,0 @@ -Settings: - AutoSpawns: - enabled: true - sectionToTimeInCommand: '1' - BroadcastRange: - onDeath: -1 - onHealth: 150 - onSkill: 150 - onSpawn: -1 - onSpawnCommand: 0 - onTaunt: 150 - CommandsEnabled: - Help: true - KillAll: true - List: true - Reload: true - Spawn: true - Time: true - HealthBar: - ActionBar: - enabled: true - message: '&6{0}&7 has &c{1}/{2} health.' - BossBar: - enabled: false - message: '&6{0}' - useHealthBar: true -onSpawn: - Regions: - enabled: true - spawnRegions: - - 'spawn_region1' - blockedRegions: - - 'blocked_region1' - Worlds: - enabled: false - blockedWorlds: - - 'world_nether' - - 'world_the_end' -onSkill: - minionsPerSpawn: 5 - maxMinionsPerBoss: 10 - disableCageBreak: true -onDeath: - noReward: - onLava: true - onDrown: false - onSuffocate: false -GUI: - EggExtraLore: - - '&8&m-----------------------------------' - - '&7' - - '&6&lGet this egg:' - - '&f/giveegg {0} {1} [amount]' - - '&7' - - '&8&m-----------------------------------' - - Inventory: - name: '&6&lCustom Bosses' - slots: 54 - Items: - '54': - type: PAPER - name: '&e&lNext Page ->' - lore: - - '&7Click this to go to the &enext' - - '&epage&7, if there is one.' - NextPage: true - '53': - type: 102 - name: '&e' - lore: [] - '52': - type: 102 - name: '&e' - lore: [] - '51': - type: 102 - name: '&e' - lore: [] - '50': - type: 102 - name: '&e' - lore: [] - '49': - type: 102 - name: '&e' - lore: [] - '48': - type: 102 - name: '&e' - lore: [] - '47': - type: 102 - name: '&e' - lore: [] - '46': - type: PAPER - name: '&e&l<- Previous Page' - lore: - - '&7Click this to go the &eprevious' - - '&epage&7, if there is one.' - PreviousPage: true \ No newline at end of file diff --git a/plugin-modules/Core/resources/droptable.yml b/plugin-modules/Core/resources/droptable.yml deleted file mode 100644 index 5d3dcfb..0000000 --- a/plugin-modules/Core/resources/droptable.yml +++ /dev/null @@ -1,144 +0,0 @@ -# -# ----------------------------------------------------------------------------------------------------------------------------------------- -# - -SkeletonTable1: # Used in the identifier in bosses.yml - '1': # The position for rewards (1st most damage). - RequiredPercent: 20.0 # The required % to get this reward - RandomCustomDrop: false # Choose Random Custom Drops or go in order? - MaxCustomDrops: 5 # The maximum amount of custom drops. - customDrops: # The custom drops list. - - 'Chance:50 Item:Item1' - - 'Chance:50 Item:Item2' - - RandomCommand: false # Choose Random Commands or go in order? - MaxCommands: 5 # The maximum amount of commands. - commands: # The commands list. - - '50: eco give %player% 500' # The 50: represents the chance of the command occurring, and after the ': ' is the command. - - '50: eco give %player% 2500' # If you are using the chance system you MUST put a space between the : and the commmand. - - '2': # The position for rewards (2nd most damage). - RequiredPercent: 20.0 # The required % to get this reward - RandomCustomDrop: false # Choose Random Custom Drops or go in order? - MaxCustomDrops: 5 # The maximum amount of custom drops. - customDrops: # The custom drops list. - - 'Chance:50 Item:Item1' - - 'Chance:50 Item:Item2' - - RandomCommand: false # Choose Random Commands or go in order? - MaxCommands: 5 # The maximum amount of commands. - commands: # The commands list. - - '50: eco give %player% 500' # The 50: represents the chance of the command occurring, and after the ': ' is the command. - - '50: eco give %player% 2500' # If you are using the chance system you MUST put a space between the : and the commmand. - - '3': # The position for rewards (3rd most damage). - RequiredPercent: 20.0 # The required % to get this reward - RandomCustomDrop: false # Choose Random Custom Drops or go in order? - MaxCustomDrops: 5 # The maximum amount of custom drops. - customDrops: # The custom drops list. - - 'Chance:50 Item:Item1' - - 'Chance:50 Item:Item2' - - RandomCommand: false # Choose Random Commands or go in order? - MaxCommands: 5 # The maximum amount of commands. - commands: # The commands list. - - '50: eco give %player% 500' # The 50: represents the chance of the command occurring, and after the ': ' is the command. - - '50: eco give %player% 2500' # If you are using the chance system you MUST put a space between the : and the commmand. - -# -# ----------------------------------------------------------------------------------------------------------------------------------------- -# - -ZombieTable1: - '1': - RequiredPercent: 10.0 - RandomCustomDrop: false - MaxCustomDrops: 5 - customDrops: - - 'Chance:50 Item:Item1' - - 'Chance:50 Item:Item2' - - RandomCommand: false - MaxCommands: 5 - commands: - - '50: eco give %player% 5000' - - '50: eco give %player% 10000' - - '2': - RequiredPercent: 10.0 - RandomCustomDrop: false - MaxCustomDrops: 5 - customDrops: - - 'Chance:50 Item:Item1' - - 'Chance:50 Item:Item2' - - RandomCommand: false - MaxCommands: 5 - commands: - - '50: eco give %player% 4000' - - '50: eco give %player% 7500' - - '3': - RequiredPercent: 10.0 - RandomCustomDrop: false - MaxCustomDrops: 5 - customDrops: - - 'Chance:50 Item:Item1' - - 'Chance:50 Item:Item2' - - RandomCommand: false - MaxCommands: 5 - commands: - - '50: eco give %player% 300' - - '50: eco give %player% 5000' - -# -# ----------------------------------------------------------------------------------------------------------------------------------------- -# - -GiantTable1: - '1': - RequiredPercent: 10.0 - RandomCustomDrop: false - MaxCustomDrops: 5 - customDrops: - - 'Chance:50 Item:Item1' - - 'Chance:50 Item:Item2' - - RandomCommand: false - MaxCommands: 5 - commands: - - '50: eco give %player% 10000' - - '50: eco give %player% 50000' - - '2': - RequiredPercent: 10.0 - RandomCustomDrop: false - MaxCustomDrops: 5 - customDrops: - - 'Chance:50 Item:Item1' - - 'Chance:50 Item:Item2' - - RandomCommand: false - MaxCommands: 5 - commands: - - '50: eco give %player% 5000' - - '50: eco give %player% 25000' - - '3': - RequiredPercent: 10.0 - RandomCustomDrop: false - MaxCustomDrops: 5 - customDrops: - - 'Chance:50 Item:Item1' - - 'Chance:50 Item:Item2' - - RandomCommand: false - MaxCommands: 5 - commands: - - '50: eco give %player% 5000' - - '50: eco give %player% 25000' - -# -# ----------------------------------------------------------------------------------------------------------------------------------------- -# \ No newline at end of file diff --git a/plugin-modules/Core/resources/items.yml b/plugin-modules/Core/resources/items.yml deleted file mode 100644 index a3b23c1..0000000 --- a/plugin-modules/Core/resources/items.yml +++ /dev/null @@ -1,18 +0,0 @@ -Item1: - amount: 1 - type: STONE - name: '&5Epic Stone' - lore: - - '&7This stone is' - - '&7Lucky.' - enchants: - - DURABILITY:3 - - DAMAGE_ALL:5 - -Item2: - amount: 5 - type: WOOD - name: '&5Epic wood' - lore: - - '&7This wood is' - - '&7hard.' \ No newline at end of file diff --git a/plugin-modules/Core/resources/lang.yml b/plugin-modules/Core/resources/lang.yml deleted file mode 100644 index b86c92d..0000000 --- a/plugin-modules/Core/resources/lang.yml +++ /dev/null @@ -1 +0,0 @@ -# The configuration for all Messages. diff --git a/plugin-modules/Core/resources/plugin.yml b/plugin-modules/Core/resources/plugin.yml deleted file mode 100644 index 75456d0..0000000 --- a/plugin-modules/Core/resources/plugin.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: CustomBosses -main: net.aminecraftdev.custombosses.CustomBosses -version: ${project.version} -author: AMinecraftDev diff --git a/plugin-modules/Core/resources/skills.yml b/plugin-modules/Core/resources/skills.yml deleted file mode 100644 index 56e5ddb..0000000 --- a/plugin-modules/Core/resources/skills.yml +++ /dev/null @@ -1,193 +0,0 @@ -#--------------------------------------------------------------------------------------------------------------------------------- -# Available skill modes: -# -# ALL - The skill will be applied to everyone within the radius. -# RANDOM - The skill will be applied to random people within the radius, with a 50% chance per person for it to happen to them. -# ONE - Will only effect the closest person to the boss. -# BOSS - The skill will only effect the boss. -# -#--------------------------------------------------------------------------------------------------------------------------------- -# Available skill types: -# -# POTION - It's just a potion effect so it'll just apply the specified potions to the player. -# CUSTOM - It's a custom skill which requires a custom .java class, when this is used please add "customType: {type}" on the line -# underneath the type. -# COMMAND - Just runs specified commands in the commands list. -# -#--------------------------------------------------------------------------------------------------------------------------------- - -Skills: - BLIND1: - mode: ALL - type: POTION - radius: 10 - - Potions: - '1': - type: POISON - level: 1 - duration: 5 - '2': - type: BLINDNESS - level: 1 - duration: 5 - - BLIND2: - mode: ALL - type: POTION - radius: 10 - - Potions: - '1': - type: POISON - level: 2 - duration: 5 - '2': - type: BLINDNESS - level: 2 - duration: 5 - - CAGE1: - mode: ALL - type: CUSTOM - customType: CAGE - radius: 10 - - Cage: - Flat: IRON_BLOCK - Wall: IRON_FENCE - Inside: STATIONARY_LAVA - - CAGE2: - mode: ALL - type: CUSTOM - customType: CAGE - radius: 10 - - Cage: - Flat: IRON_BLOCK - Wall: IRON_FENCE - Inside: STATIONARY_WATER - - KNOCKBACK1: - mode: ALL - type: CUSTOM - customType: KNOCKBACK - radius: 10 - - multiplier: 2.5 - - KNOCKBACK2: - mode: ALL - type: CUSTOM - customType: KNOCKBACK - radius: 10 - - multiplier: 5 - - DISARM1: - mode: ONE - type: CUSTOM - customType: DISARM - radius: 10 - - WARP1: - mode: ONE - type: CUSTOM - customType: WARP - radius: 10 - - EXPLOSION1: - mode: ALL - type: POTION - radius: 2 - - Potions: - '1': - type: WITHER - level: 3 - duration: 5 - - MINIONS1: - mode: BOSS - type: CUSTOM - customType: MINIONS - radius: 10 - - Boss: - type: ZOMBIE - name: '&a&lMinion Goblin' - health: 40 - Armor: - type: LEATHER - enchants: - - PROTECTION_ENVIRONMENTAL:4 - - DURABILITY:3 - Weapon: - type: STONE - enchants: - - DAMAGE_ALL:10 - - DURABILITY:3 - Potions: - '1': - type: SPEED - level: 10 - duration: -1 - - MINIONS2: - mode: BOSS - type: CUSTOM - customType: MINIONS - radius: 10 - - Boss: - type: SKELETON - name: '&a&lMinion Goblin' - health: 40 - Armor: - type: LEATHER - enchants: - - PROTECTION_ENVIRONMENTAL:4 - - DURABILITY:3 - Weapon: - type: STONE - enchants: - - DAMAGE_ALL:10 - - DURABILITY:3 - Potions: - '1': - type: SPEED - level: 10 - duration: -1 - - INSIDIOUS1: - mode: ALL - type: CUSTOM - customType: INSIDIOUS - radius: 10 - - burnDuration: 4 - - INSIDIOUS2: - mode: ALL - type: CUSTOM - customType: INSIDIOUS - radius: 10 - - burnDuration: 6 - - LOOT1: - mode: RANDOM - type: COMMAND - radius: 10 - commands: - - '40:eco give {p} 100' - - '60:eco give {p} 1000' - - LOOT2: - mode: RANDOM - type: COMMAND - radius: 10 - commands: - - '40:eco give {p} 200' - - '60:eco give {p} 2000' \ No newline at end of file diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/CustomBosses.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/CustomBosses.java index 6b195a5..239ec40 100644 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/CustomBosses.java +++ b/plugin-modules/Core/src/net/aminecraftdev/custombosses/CustomBosses.java @@ -3,7 +3,7 @@ package net.aminecraftdev.custombosses; /** * @author AMinecraftDev * @version 1.0.0 - * @since 31-May-17 + * @since 06-Sep-17 */ public class CustomBosses { } diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/api/BossAPI.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/api/BossAPI.java new file mode 100644 index 0000000..c647e6e --- /dev/null +++ b/plugin-modules/Core/src/net/aminecraftdev/custombosses/api/BossAPI.java @@ -0,0 +1,52 @@ +package net.aminecraftdev.custombosses.api; + +import net.aminecraftdev.custombosses.handlers.BossEntity; +import net.aminecraftdev.custombosses.managers.BossManager; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +/** + * @author AMinecraftDev + * @version 1.0.0 + * @since 06-Sep-17 + */ +public class BossAPI { + + public boolean createBoss(String entityType, double health, String identifier) { + try { + EntityType.valueOf(entityType); + } catch (IllegalArgumentException ex) { + return false; + } + + if(BossManager.isBossEntitySet(identifier)) return false; + + EntityType eType = EntityType.valueOf(entityType); + BossEntity bossEntity = new BossEntity(eType, health, identifier); + + BossManager.addBossEntity(bossEntity); + return true; + } + + public LivingEntity spawnBoss(String identifier, Location location) { + if(!BossManager.isBossEntitySet(identifier)) return null; + + BossEntity bossEntity = BossManager.getBossEntity(identifier); + + return bossEntity.createNewBossEntity(location); + } + + public LivingEntity spawnMinion(String identifier, Location location) { + if(!BossManager.isBossEntitySet(identifier)) return null; + + BossEntity bossEntity = BossManager.getBossEntity(identifier); + + return bossEntity.createNewMinionEntity(location); + } + + public BossEntity getBoss(String identifier) { + return BossManager.getBossEntity(identifier); + } + +} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossHelpCmd.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossHelpCmd.java deleted file mode 100644 index a3802a6..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossHelpCmd.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.aminecraftdev.custombosses.commands; - -import net.aminecraftdev.custombosses.innerapi.command.SubCommand; -import net.aminecraftdev.custombosses.utils.Message; -import org.bukkit.command.CommandSender; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossHelpCmd extends SubCommand { - - public BossHelpCmd(String subCommand) { - super(subCommand); - } - - @Override - public void execute(CommandSender sender, String[] args) { - Message.BossCommand_Help.msg(sender); - return; - } -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossKillAllCmd.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossKillAllCmd.java deleted file mode 100644 index c55bc5d..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossKillAllCmd.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.commands; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossKillAllCmd { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossListCmd.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossListCmd.java deleted file mode 100644 index a9e388f..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossListCmd.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.commands; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossListCmd { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossReloadCmd.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossReloadCmd.java deleted file mode 100644 index bb15f9d..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossReloadCmd.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.commands; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossReloadCmd { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossSpawnCmd.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossSpawnCmd.java deleted file mode 100644 index 2cd705d..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossSpawnCmd.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.commands; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossSpawnCmd { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossTimeCmd.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossTimeCmd.java deleted file mode 100644 index 73361d3..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/BossTimeCmd.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.commands; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossTimeCmd { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/base/BossCmd.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/base/BossCmd.java deleted file mode 100644 index 4d2faa1..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/commands/base/BossCmd.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.aminecraftdev.custombosses.commands.base; - -import net.aminecraftdev.custombosses.innerapi.command.SubCommand; -import net.aminecraftdev.custombosses.innerapi.command.SubCommandBuilder; -import net.aminecraftdev.custombosses.innerapi.command.builder.CommandService; -import net.aminecraftdev.custombosses.innerapi.command.builder.attributes.*; -import net.aminecraftdev.custombosses.utils.Message; -import org.bukkit.command.CommandSender; - -import java.util.HashSet; -import java.util.Set; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -@Name("boss") -@Alias({"bosses", "custombosses", "customboss"}) -@Permission("bosses.command.use") -@Description("Access all boss related features of CustomBosses.") -@NoPermission("&cI'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.") -public class BossCmd extends CommandService implements SubCommandBuilder { - - private final Set> subCommands = new HashSet<>(); - - public BossCmd() { - super(BossCmd.class); - } - - @Override - public void execute(CommandSender sender, String[] args) { - if(args.length == 0) { - Message.BossCommand_Help.msg(sender); - return; - } - - for(SubCommand subCommand : subCommands) { - if(subCommand.getSubCommand().equalsIgnoreCase(args[0])) { - subCommand.execute(sender, args); - return; - } - } - - Message.BossCommand_Help.msg(sender); - return; - } - - - @Override - public void register(SubCommand subCommand) { - subCommands.add(subCommand); - } -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossDamageEvent.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossDamageEvent.java deleted file mode 100644 index 6565dda..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossDamageEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.events; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossDamageEvent { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossDeathEvent.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossDeathEvent.java deleted file mode 100644 index cf4b52c..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossDeathEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.events; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossDeathEvent { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossSkillEvent.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossSkillEvent.java deleted file mode 100644 index 172e986..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossSkillEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.events; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossSkillEvent { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossSpawnEvent.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossSpawnEvent.java deleted file mode 100644 index 19c495a..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/events/BossSpawnEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.events; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossSpawnEvent { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/AutoSpawnHandler.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/AutoSpawnHandler.java deleted file mode 100644 index 20ed975..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/AutoSpawnHandler.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.handlers; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class AutoSpawnHandler { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/BossEntity.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/BossEntity.java new file mode 100644 index 0000000..87d56fb --- /dev/null +++ b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/BossEntity.java @@ -0,0 +1,26 @@ +package net.aminecraftdev.custombosses.handlers; + +import net.aminecraftdev.custombosses.models.CustomEntityModel; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; + +import java.util.List; +import java.util.Map; + +/** + * @author AMinecraftDev + * @version 1.0.0 + * @since 06-Sep-17 + */ +public class BossEntity extends CustomEntityModel { + + public BossEntity(EntityType entityType, double health, String identifier) { + super(entityType, health, identifier); + } + + public BossEntity(EntityType entityType, Map equipment, List description, List defaultPotionEffects, ItemStack itemStackInMainHand, ItemStack itemStackInOffHand, String identifier, double health, String name) { + super(entityType, equipment, description, defaultPotionEffects, itemStackInMainHand, itemStackInOffHand, identifier, health, name); + } + +} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/MinionHandler.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/MinionHandler.java deleted file mode 100644 index 3b9f2fd..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/MinionHandler.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.handlers; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class MinionHandler { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/TauntHandler.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/TauntHandler.java deleted file mode 100644 index d93e617..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/TauntHandler.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.handlers; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class TauntHandler { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/builders/EntityHandler.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/builders/EntityHandler.java deleted file mode 100644 index ac72469..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/builders/EntityHandler.java +++ /dev/null @@ -1,129 +0,0 @@ -package net.aminecraftdev.custombosses.handlers.builders; - -import net.aminecraftdev.custombosses.innerapi.reflection.ReflectionUtils; -import org.bukkit.Location; -import org.bukkit.entity.*; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class EntityHandler extends ReflectionUtils { - - public final LivingEntity getBaseEntity(String type, Location location) { - LivingEntity livingEntity = null; - EntityType entityType = null; - - if(type.equalsIgnoreCase("WITHER_SKELETON")) livingEntity = getWitherSkeleton(location); - else if(type.equalsIgnoreCase("ELDER_GUARDIAN")) livingEntity = getElderGuardian(location); - else if(type.equalsIgnoreCase("KILLER_BUNNY")) livingEntity = getKillerBunny(location); - else if(type.equalsIgnoreCase("ZOMBIE")) livingEntity = getZombie(location); - else if(type.equalsIgnoreCase("BABY_ZOMBIE")) livingEntity = getBabyZombie(location); - else if(type.equalsIgnoreCase("PIG_ZOMBIE")) livingEntity = getPigZombie(location); - else if(type.equalsIgnoreCase("BABY_PIG_ZOMBIE")) livingEntity = getBabyPigZombie(location); - else if(type.contains(":")) { - String[] split = type.split(":"); - - if(split[0].equalsIgnoreCase("SLIME")) { - livingEntity = getSlime(location, Integer.valueOf(split[1])); - } else if(split[0].equalsIgnoreCase("MAGMA_CUBE")) { - livingEntity = getMagmaCube(location, Integer.valueOf(split[1])); - } else { - if(EntityType.valueOf(type).equals(null)) { - /* ADD A DEBUG MESSAGE HERE */ - return null; - } - } - } else { - if(EntityType.valueOf(type).equals(null)) { - /* ADD A DEBUG MESSAGE HERE */ - return null; - } - - entityType = EntityType.valueOf(type); - } - - if(livingEntity == null) { - if(entityType == EntityType.SLIME) getSlime(location, 10); - else if(entityType == EntityType.MAGMA_CUBE) getSlime(location, 10); - else { - livingEntity = (LivingEntity) location.getWorld().spawn(location, entityType.getEntityClass()); - } - } - - return livingEntity; - } - - private LivingEntity getWitherSkeleton(Location location) { - if(getAPIVersion().startsWith("v1_11_R")) { - return (LivingEntity) location.getWorld().spawn(location, EntityType.WITHER_SKELETON.getEntityClass()); - } else { - Skeleton skeleton = (Skeleton) location.getWorld().spawn(location, EntityType.SKELETON.getEntityClass()); - skeleton.setSkeletonType(Skeleton.SkeletonType.WITHER); - - return skeleton; - } - } - - private LivingEntity getElderGuardian(Location location) { - if(getAPIVersion().startsWith("v1_11_R")) { - return (LivingEntity) location.getWorld().spawn(location, EntityType.ELDER_GUARDIAN.getEntityClass()); - } else { - Guardian guardian = (Guardian) location.getWorld().spawn(location, EntityType.GUARDIAN.getEntityClass()); - guardian.setElder(true); - - return guardian; - } - } - - private LivingEntity getKillerBunny(Location location) { - Rabbit rabbit = (Rabbit) location.getWorld().spawn(location, EntityType.RABBIT.getEntityClass()); - rabbit.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY); - - return rabbit; - } - - private LivingEntity getBabyZombie(Location location) { - Zombie zombie = (Zombie) location.getWorld().spawn(location, EntityType.ZOMBIE.getEntityClass()); - zombie.setBaby(true); - - return zombie; - } - - private LivingEntity getZombie(Location location) { - Zombie zombie = (Zombie) location.getWorld().spawn(location, EntityType.ZOMBIE.getEntityClass()); - zombie.setBaby(false); - - return zombie; - } - - private LivingEntity getBabyPigZombie(Location location) { - PigZombie pigZombie = (PigZombie) location.getWorld().spawn(location, EntityType.PIG_ZOMBIE.getEntityClass()); - pigZombie.setBaby(true); - - return pigZombie; - } - - private LivingEntity getPigZombie(Location location) { - PigZombie pigZombie = (PigZombie) location.getWorld().spawn(location, EntityType.PIG_ZOMBIE.getEntityClass()); - pigZombie.setBaby(false); - - return pigZombie; - } - - private LivingEntity getSlime(Location location, int size) { - Slime slime = (Slime) location.getWorld().spawn(location, EntityType.SLIME.getEntityClass()); - slime.setSize(size); - - return slime; - } - - private LivingEntity getMagmaCube(Location location, int size) { - MagmaCube magmaCube = (MagmaCube) location.getWorld().spawn(location, EntityType.MAGMA_CUBE.getEntityClass()); - magmaCube.setSize(size); - - return magmaCube; - } - -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/builders/EquipmentHandler.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/builders/EquipmentHandler.java deleted file mode 100644 index d4f265a..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/builders/EquipmentHandler.java +++ /dev/null @@ -1,77 +0,0 @@ -package net.aminecraftdev.custombosses.handlers.builders; - -import net.aminecraftdev.custombosses.innerapi.itemstack.ItemStackUtils; -import org.bukkit.Material; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.LivingEntity; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class EquipmentHandler { - - public void applyEquipment(LivingEntity livingEntity, ConfigurationSection configurationSection) { - Map mapOfEnchants = getMapOfEnchants(configurationSection); - String type = configurationSection.getString("type").toUpperCase(); - - if(configurationSection.getName().equalsIgnoreCase("Armor")) { - String innerType = type + "_HELMET"; - - livingEntity.getEquipment().setHelmet(getArmour(innerType, mapOfEnchants)); - innerType = type + "_CHESTPLATE"; - livingEntity.getEquipment().setChestplate(getArmour(innerType, mapOfEnchants)); - innerType = type + "_LEGGINGS"; - livingEntity.getEquipment().setLeggings(getArmour(innerType, mapOfEnchants)); - innerType = type + "_BOOTS"; - livingEntity.getEquipment().setBoots(getArmour(innerType, mapOfEnchants)); - } else { - ItemStack itemStack = new ItemStack(ItemStackUtils.getType(type)); - - itemStack.addUnsafeEnchantments(mapOfEnchants); - livingEntity.getEquipment().setItemInHand(itemStack); - } - } - - public void applySkull(LivingEntity livingEntity, ConfigurationSection configurationSection) { - String owner = configurationSection.getString("owner"); - ItemStack itemStack = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); - SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta(); - - skullMeta.setOwner(owner); - itemStack.setItemMeta(skullMeta); - livingEntity.getEquipment().setHelmet(itemStack); - } - - private Map getMapOfEnchants(ConfigurationSection configurationSection) { - Map enchantmentIntegerMap = new HashMap<>(); - List enchantsList = configurationSection.getStringList("enchants"); - - for(String s : enchantsList) { - String[] spl = s.split(":"); - String ench = spl[0]; - int level = Integer.parseInt(spl[1]); - - enchantmentIntegerMap.put(Enchantment.getByName(ench), level); - } - - return enchantmentIntegerMap; - } - - private ItemStack getArmour(String type, Map enchantments) { - ItemStack itemStack = new ItemStack(ItemStackUtils.getType(type)); - - itemStack.addUnsafeEnchantments(enchantments); - - return itemStack; - } - -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/BossEntity.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/BossEntity.java deleted file mode 100644 index 7f73d34..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/BossEntity.java +++ /dev/null @@ -1,140 +0,0 @@ -package net.aminecraftdev.custombosses.handlers.mobs; - -import net.aminecraftdev.custombosses.handlers.mobs.interfaces.IDamageHandler; -import net.aminecraftdev.custombosses.handlers.mobs.interfaces.IKillHandler; -import net.aminecraftdev.custombosses.handlers.mobs.interfaces.IMobHandler; -import net.aminecraftdev.custombosses.handlers.mobs.interfaces.ISpawnHandler; -import net.aminecraftdev.custombosses.innerapi.message.MessageUtils; -import net.aminecraftdev.custombosses.managers.BossManager; -import org.bukkit.Location; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; - -import java.util.UUID; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class BossEntity implements IMobHandler, ISpawnHandler, IDamageHandler, IKillHandler { - - private boolean hasSkills, hasTaunts, hasCommands, hasMessages, isAutoBoss; - private ConfigurationSection configurationSection; - private LivingEntity livingEntity; - private BossManager bossManager; - private boolean isBossSpawned; - private double maxHealth; - private UUID uuid; - - //private Set skills = new HashSet<>(); - //private List taunts = new ArrayList<>(); - - public BossEntity(ConfigurationSection configurationSection, BossManager bossManager, boolean isAutoBoss) { - this.hasSkills = this.configurationSection.contains("Skills"); - this.hasTaunts = this.configurationSection.contains("Taunts"); - this.hasCommands = this.configurationSection.contains("Commands"); - this.hasMessages = this.configurationSection.contains("Messages"); - this.configurationSection = configurationSection; - this.bossManager = bossManager; - this.isBossSpawned = false; - this.isAutoBoss = isAutoBoss; - } - - @Override - public ConfigurationSection getConfigurationSection() { - return configurationSection; - } - - @Override - public double getMaxHealth() { - return maxHealth; - } - - @Override - public double getCurrentHealth() { - return livingEntity.getHealth(); - } - - @Override - public UUID getUniqueId() { - return uuid; - } - - @Override - public boolean isAutoBoss() { - return isAutoBoss; - } - - @Override - public void spawn(Location location) { - spawnBoss(location); - spawnMessage(location); - } - - @Override - public void spawnBoss(Location location) { - if(this.isBossSpawned) { - /* ADD DEBUG MESSAGE HERE */ - return; - } - - ConfigurationSection bossConfigurationSection = configurationSection.getConfigurationSection("Boss"); - String type = bossConfigurationSection.getString("type"); - String targetType = bossConfigurationSection.getString("targetType"); - String name = bossConfigurationSection.contains("name")? bossConfigurationSection.getString("name") : ""; - double health = bossConfigurationSection.getDouble("health"); - - this.livingEntity = this.bossManager.getEntityHandler().getBaseEntity(type, location); - - this.livingEntity.setCustomName(MessageUtils.translateString(name)); - this.livingEntity.setCustomNameVisible(true); - this.livingEntity.setMaxHealth(health); - this.livingEntity.setHealth(health); - this.livingEntity.setRemoveWhenFarAway(false); - this.livingEntity.setCanPickupItems(false); - - if(bossConfigurationSection.contains("Armor")) this.bossManager.getEquipmentHandler().applyEquipment(this.livingEntity, bossConfigurationSection.getConfigurationSection("Armor")); - if(bossConfigurationSection.contains("Weapon")) this.bossManager.getEquipmentHandler().applyEquipment(this.livingEntity, bossConfigurationSection.getConfigurationSection("Weapon")); - if(bossConfigurationSection.contains("Head")) this.bossManager.getEquipmentHandler().applySkull(this.livingEntity, bossConfigurationSection.getConfigurationSection("Head")); - if(bossConfigurationSection.contains("Potions")) this.bossManager.applyPotionEffects(this.livingEntity, bossConfigurationSection.getConfigurationSection("Potions")); - - this.maxHealth = health; - this.livingEntity.getEquipment().setHelmetDropChance(0.0F); - this.livingEntity.getEquipment().setChestplateDropChance(0.0F); - this.livingEntity.getEquipment().setLeggingsDropChance(0.0F); - this.livingEntity.getEquipment().setBootsDropChance(0.0F); - - /* HANDLE TARGET SYSTEM HERE */ - - this.uuid = this.livingEntity.getUniqueId(); - } - - @Override - public void spawnMessage(Location location) { - if(!hasMessages) return; - if(!configurationSection.contains("Messages.onSpawn")) return; - - } - - @Override - public void onDamage(Player damager, int damage) { - - } - - @Override - public void kill(Location location) { - - } - - @Override - public void killBoss(Location location) { - - } - - @Override - public void killMessage(Location location) { - - } -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/MinionEntity.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/MinionEntity.java deleted file mode 100644 index 989092a..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/MinionEntity.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.handlers.mobs; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class MinionEntity { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/IDamageHandler.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/IDamageHandler.java deleted file mode 100644 index 3ff31a0..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/IDamageHandler.java +++ /dev/null @@ -1,14 +0,0 @@ -package net.aminecraftdev.custombosses.handlers.mobs.interfaces; - -import org.bukkit.entity.Player; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public interface IDamageHandler { - - void onDamage(Player damager, int damage); - -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/IKillHandler.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/IKillHandler.java deleted file mode 100644 index b44c94f..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/IKillHandler.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.aminecraftdev.custombosses.handlers.mobs.interfaces; - -import org.bukkit.Location; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public interface IKillHandler { - - void killBoss(Location location); - - void killMessage(Location location); - -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/IMobHandler.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/IMobHandler.java deleted file mode 100644 index eebecc3..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/IMobHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.aminecraftdev.custombosses.handlers.mobs.interfaces; - -import org.bukkit.Location; -import org.bukkit.configuration.ConfigurationSection; - -import java.util.UUID; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public interface IMobHandler { - - ConfigurationSection getConfigurationSection(); - - double getMaxHealth(); - - double getCurrentHealth(); - - UUID getUniqueId(); - - boolean isAutoBoss(); - - void spawn(Location location); - - void kill(Location location); - -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/ISpawnHandler.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/ISpawnHandler.java deleted file mode 100644 index 4c90fbd..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/handlers/mobs/interfaces/ISpawnHandler.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.aminecraftdev.custombosses.handlers.mobs.interfaces; - -import org.bukkit.Location; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public interface ISpawnHandler { - - void spawnBoss(Location location); - - void spawnMessage(Location location); - -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/AutoSpawnManager.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/AutoSpawnManager.java deleted file mode 100644 index a35458e..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/AutoSpawnManager.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.managers; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class AutoSpawnManager { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/BossManager.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/BossManager.java index 7e14496..252d673 100644 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/BossManager.java +++ b/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/BossManager.java @@ -1,55 +1,29 @@ package net.aminecraftdev.custombosses.managers; -import net.aminecraftdev.custombosses.handlers.builders.EntityHandler; -import net.aminecraftdev.custombosses.handlers.builders.EquipmentHandler; -import net.aminecraftdev.custombosses.handlers.mobs.BossEntity; -import net.aminecraftdev.custombosses.handlers.mobs.MinionEntity; -import net.aminecraftdev.custombosses.innerapi.PotionUtils; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.entity.LivingEntity; -import org.bukkit.potion.PotionEffect; +import net.aminecraftdev.custombosses.handlers.BossEntity; -import java.util.HashSet; -import java.util.Set; +import java.util.HashMap; +import java.util.Map; /** * @author AMinecraftDev * @version 1.0.0 - * @since 31-May-17 + * @since 06-Sep-17 */ public class BossManager { - private static final Set BOSSES = new HashSet<>(); - private static final Set MINIONS = new HashSet<>(); - private EntityHandler entityHandler; - private EquipmentHandler equipmentHandler; + private static final Map MAP_OF_BOSSES = new HashMap<>(); - public BossManager() { - this.entityHandler = new EntityHandler(); - this.equipmentHandler = new EquipmentHandler(); + public static boolean isBossEntitySet(String identifier) { + return MAP_OF_BOSSES.containsKey(identifier); } - - - - public EntityHandler getEntityHandler() { - return entityHandler; + public static void addBossEntity(BossEntity bossEntity) { + MAP_OF_BOSSES.put(bossEntity.getIdentifier(), bossEntity); } - public EquipmentHandler getEquipmentHandler() { - return equipmentHandler; + public static BossEntity getBossEntity(String identifier) { + return MAP_OF_BOSSES.getOrDefault(identifier, null); } - public void applyPotionEffects(LivingEntity livingEntity, ConfigurationSection configurationSection) { - for(String s : configurationSection.getKeys(false)) { - PotionEffect potionEffect = PotionUtils.getPotionEffect(configurationSection.getConfigurationSection(s)); - - if(potionEffect == null) continue; - - livingEntity.addPotionEffect(potionEffect); - } - } - - - } diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/ItemManager.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/ItemManager.java deleted file mode 100644 index 5735e2a..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/ItemManager.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.managers; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class ItemManager { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/MinionManager.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/MinionManager.java deleted file mode 100644 index 47dfb33..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/MinionManager.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.managers; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class MinionManager { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/SkillManager.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/SkillManager.java deleted file mode 100644 index d65c6dc..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/managers/SkillManager.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.managers; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class SkillManager { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/models/CustomEntityModel.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/models/CustomEntityModel.java new file mode 100644 index 0000000..a473c83 --- /dev/null +++ b/plugin-modules/Core/src/net/aminecraftdev/custombosses/models/CustomEntityModel.java @@ -0,0 +1,216 @@ +package net.aminecraftdev.custombosses.models; + +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.inventory.EntityEquipment; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; + +import java.util.*; + +/** + * @author AMinecraftDev + * @version 1.0.0 + * @since 06-Sep-17 + */ +public class CustomEntityModel { + + private List defaultPotionEffects = new ArrayList<>(); + private Map spawnedLocations = new HashMap<>(); + private Map equipment = new HashMap<>(); + private Set minionsSpawned = new HashSet<>(); + private Set bossesSpawned = new HashSet<>(); + private List description = new ArrayList<>(); + + private ItemStack itemStackInMainHand; + private ItemStack itemStackInOffHand; + private boolean canDropEquipment; + private EntityType entityType; + private String identifier; + private double health; + private String name; + + public CustomEntityModel(EntityType entityType, double health, String identifier) { + this(entityType, null, null, null, null, null, identifier, health, null); + } + + public CustomEntityModel(EntityType entityType, Map equipment, List description, List defaultPotionEffects, ItemStack itemStackInMainHand, ItemStack itemStackInOffHand, String identifier, double health, String name) { + this.entityType = entityType; + this.identifier = identifier; + + setItemStackInMainHand(itemStackInMainHand); + setItemStackInOffHand(itemStackInOffHand); + setMaxHealth(health); + setName(name); + + if(equipment != null) equipment.forEach((integer, itemStack) -> setEquipment(integer, itemStack)); + if(description != null) setDescription(description); + if(this.defaultPotionEffects != null) defaultPotionEffects.forEach(potionEffect -> addDefaultPotionEffects(potionEffect)); + } + + public String getIdentifier() { + return identifier; + } + + public List getDefaultPotionEffects() { + return new ArrayList<>(defaultPotionEffects); + } + + public void addDefaultPotionEffects(PotionEffect potionEffect) { + defaultPotionEffects.add(potionEffect); + } + + public Set getBossesSpawned() { + return new HashSet<>(bossesSpawned); + } + + public Set getMinionsSpawned() { + return new HashSet<>(minionsSpawned); + } + + public Map getSpawnedLocations() { + return new HashMap<>(spawnedLocations); + } + + public Map getEquipment() { + return new HashMap<>(equipment); + } + + public void setEquipment(int slot, ItemStack itemStack) { + if(slot > 3) return; + + equipment.put(slot, itemStack); + } + + public List getDescription() { + return new ArrayList<>(description); + } + + public void setDescription(List description) { + this.description = description; + } + + public void addDescription(String line) { + description.add(line); + } + + public ItemStack getItemStackInMainHand() { + return itemStackInMainHand; + } + + public void setItemStackInMainHand(ItemStack itemStack) { + this.itemStackInMainHand = itemStack; + } + + public ItemStack getItemStackInOffHand() { + return itemStackInOffHand; + } + + public void setItemStackInOffHand(ItemStack itemStack) { + this.itemStackInOffHand = itemStack; + } + + public double getMaxHealth() { + return health; + } + + public void setMaxHealth(double health) { + this.health = health; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public EntityType getEntityType() { + return entityType; + } + + public boolean canDropEquipment() { + return canDropEquipment; + } + + public void setCanDropEquipment(boolean bool) { + this.canDropEquipment = bool; + } + + public LivingEntity createNewBossEntity(Location location) { + LivingEntity livingEntity = createNewEntity(location); + + bossesSpawned.add(livingEntity); + spawnedLocations.put(livingEntity.getUniqueId(), location); + + return livingEntity; + } + + public LivingEntity createNewMinionEntity(Location location) { + LivingEntity livingEntity = createNewEntity(location); + + minionsSpawned.add(livingEntity); + + return livingEntity; + } + + private LivingEntity createNewEntity(Location location) { + LivingEntity livingEntity = (LivingEntity) location.getWorld().spawn(location, entityType.getEntityClass()); + EntityEquipment entityEquipment = livingEntity.getEquipment(); + + livingEntity.setMaxHealth(getMaxHealth()); + livingEntity.setHealth(getMaxHealth()); + + if(getName() != null) { + livingEntity.setCustomName(getName()); + livingEntity.setCustomNameVisible(true); + } + + if(getItemStackInMainHand() != null) { + entityEquipment.setItemInMainHand(getItemStackInMainHand()); + + if(!canDropEquipment()) entityEquipment.setItemInMainHandDropChance(0); + } + + if(getItemStackInOffHand() != null) { + entityEquipment.setItemInOffHand(getItemStackInOffHand()); + + if(!canDropEquipment()) entityEquipment.setItemInOffHandDropChance(0); + } + + if(!getEquipment().isEmpty()) { + if(equipment.containsKey(0)) { + entityEquipment.setHelmet(equipment.get(0)); + + if(!canDropEquipment()) entityEquipment.setHelmetDropChance(0); + } + + if(equipment.containsKey(1)) { + entityEquipment.setChestplate(equipment.get(1)); + + if(!canDropEquipment()) entityEquipment.setChestplateDropChance(0); + } + + if(equipment.containsKey(2)) { + entityEquipment.setLeggings(equipment.get(2)); + + if(!canDropEquipment()) entityEquipment.setLeggingsDropChance(0); + } + + if(equipment.containsKey(3)) { + entityEquipment.setBoots(equipment.get(3)); + + if(!canDropEquipment()) entityEquipment.setBootsDropChance(0); + } + } + + if(!getDefaultPotionEffects().isEmpty()) { + livingEntity.addPotionEffects(defaultPotionEffects); + } + + return livingEntity; + } + +} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/ITarget.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/ITarget.java deleted file mode 100644 index 599c207..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/ITarget.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.target; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public interface ITarget { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/TargetTypes.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/TargetTypes.java deleted file mode 100644 index 500a823..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/TargetTypes.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.aminecraftdev.custombosses.target; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public enum TargetTypes { - - VANILLA(), - DAMAGE(), - INTERVAL(); - - TargetTypes() { - - } - -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/types/TargetDamage.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/types/TargetDamage.java deleted file mode 100644 index 1b2b309..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/types/TargetDamage.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.target.types; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class TargetDamage { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/types/TargetInterval.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/types/TargetInterval.java deleted file mode 100644 index e419051..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/target/types/TargetInterval.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.aminecraftdev.custombosses.target.types; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public class TargetInterval { -} diff --git a/plugin-modules/Core/src/net/aminecraftdev/custombosses/utils/Message.java b/plugin-modules/Core/src/net/aminecraftdev/custombosses/utils/Message.java deleted file mode 100644 index fabe500..0000000 --- a/plugin-modules/Core/src/net/aminecraftdev/custombosses/utils/Message.java +++ /dev/null @@ -1,201 +0,0 @@ -package net.aminecraftdev.custombosses.utils; - -import net.aminecraftdev.custombosses.innerapi.message.MessageUtils; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -/** - * @author AMinecraftDev - * @version 1.0.0 - * @since 31-May-17 - */ -public enum Message { - - BossCommand_Help( - " &4\n" + - "&7&m-----------------&b&l[ &a&lCustomBosses&r &b&l]&7&m-----------------&r\n" + - " &4\n" + - "&6/boss spawn (type) (x) (y) (z) (world) &e&m-&f&o Spawn a boss at the coordinates.\n" + - "&7/boss spawn (type) (player) &e&m-&f&o Spawn a boss on a player.\n" + - "&6/boss time &e&m-&f&o View the time until the next boss auto-spawn.\n" + - "&6/boss reload &e&m-&f&o Reloads the YML files for CustomBosses.\n" + - "&6/boss killall &e&m-&f&o Kills all currently spawned bosses/minions.\n" + - "&6/boss list &e&m-&f&o Opens a GUI with all the available boss eggs.\n" + - "&6/giveegg (player) (boss) [amount] &e&m-&f&o Gives the specified player a boss egg.\n" + - " &4\n" + - "&7&m-----------------&b&l[ &a&lCustomBosses&r &b&l]&7&m-----------------&r\n" + - " &4"), - BossCommand_KillAll_Blocked("&c&l[!] &cThe KillAll command is blocked!"), - BossCommand_KillAll_Killed("&a&l[!] &fYou've killed &e{0}&f bosses/minions."), - BossCommand_List("&a&l[!] &fYou are now viewing all custom bosses."), - BossCommand_Reload("&a&l[!] &fYou just reloaded the files for CustomBosses."), - BossCommand_Spawn_InvalidBoss("&c&l[!] &cThe specified boss doesn't exist!"), - BossCommand_Spawn_InvalidLocation("&c&l[!] &cThe specified location is invalid!"), - BossCommand_Spawn_InvalidWorld("&c&l[!] &cThe specified world doesn't exist!"), - BossCommand_Spawn_Spawned("&a&l[!] &fYou have spawned a &e{0}&f boss at &e{1}&f."), - BossCommand_Time_Display("&a&l[!] &fThere is currently &e{0}&f left till next spawn."), - BossCommand_Time_NotEnabled("&c&l[!] &cThe boss time command has been disabled."), - - GiveEggCommand_Given_Receiver("&a&l[!] &fYou have received &e{0}x&f boss egg(s)."), - GiveEggCommand_Given_Sender("&a&l[!] &fYou have given &e{0}x&f boss egg(s) to &e{1}&f."), - GiveEggCommand_Help( - " &4\n" + - "&7&m-----------------&b&l[ &a&lCustomBosses&r &b&l]&7&m-----------------&r\n" + - " &4\n" + - "&6/boss spawn (type) (x) (y) (z) (world) &e&m-&f&o Spawn a boss at the coordinates.\n" + - "&7/boss spawn (type) (player) &e&m-&f&o Spawn a boss on a player.\n" + - "&6/boss time &e&m-&f&o View the time until the next boss auto-spawn.\n" + - "&6/boss reload &e&m-&f&o Reloads the YML files for CustomBosses.\n" + - "&6/boss killall &e&m-&f&o Kills all currently spawned bosses/minions.\n" + - "&6/boss list &e&m-&f&o Opens a GUI with all the available boss eggs.\n" + - "&6/giveegg (player) (boss) [amount] &e&m-&f&o Gives the specified player a boss egg.\n" + - " &4\n" + - "&7&m-----------------&b&l[ &a&lCustomBosses&r &b&l]&7&m-----------------&r\n" + - " &4"), - GiveEggCommand_InvalidBoss("&c&l[!] &cThe specified boss doesn't exist!"), - - Settings_InvalidNumber("&c&l[!] &cYou have specified an invalid number!"), - Settings_InventorySpace("&c&l[!] &cYou do not have enough inventory space for that!"), - Settings_ItemStack_Max("&c&l[!] &cThe maximum ItemStack size is 64!"), - Settings_ItemStack_Min("&c&l[!] &cThe minimum ItemStack size is 1!"), - Settings_ItemStack_Null("&c&l[!] &cThe specified ItemStack cannot be null or air!"), - Settings_MustBePlayer("&c&l[!] &cYou must be a player to use that feature!"), - Settings_NotOnline("&c&l[!] &cThe player you specified is offline or doesn't exist!"); - - private String path; - private String msg; - private static FileConfiguration LANG; - - Message(String string) { - this.path = "Messages." + this.name().replace("_", "."); - this.msg = string; - } - - public static void setFile(FileConfiguration configuration) { - LANG = configuration; - } - - @Override - public String toString() { - String s = ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, msg)); - - return s; - } - - public String toString(Object... args) { - String s = ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, msg)); - - return getMessageReplaced(s, args); - } - - public String getDefault() { - return this.msg; - } - - public String getPath() { - return this.path; - } - - public void msg(CommandSender p, Object... order) { - String s = toString(); - - if(s.contains("\n")) { - String[] split = s.split("\n"); - - for(String inner : split) { - messageString(p, inner, order); - } - } else { - messageString(p, s, order); - } - } - - public void broadcast(Object... order) { - String s = toString(); - - if(s.contains("\n")) { - String[] split = s.split("\n"); - - for(String s1 : split) { - for(Player player : Bukkit.getOnlinePlayers()) { - messageString(player, s1, order); - } - } - } else { - for(Player player : Bukkit.getOnlinePlayers()) { - messageString(player, s, order); - } - } - } - - - - /** - * - * Private Enum methods - * - * - */ - private void messageString(CommandSender player, String s, Object... order) { - if(s.equalsIgnoreCase("")) return; - - if(s.contains("{c}")) { - MessageUtils.sendCenteredMessage(player, getMessageReplaced(s, order).replace("{c}", "")); - } else { - player.sendMessage(getMessageReplaced(s, order)); - } - } - - private String getMessageReplaced(String s, Object... order) { - int current = 0; - - for(Object object : order) { - String placeholder = "{" + current + "}"; - - if(s.contains(placeholder)) { - if(object instanceof CommandSender) { - s = s.replace(placeholder, ((CommandSender) object).getName()); - } - - if(object instanceof Location) { - Location location = (Location) object; - String repl = location.getWorld().getName() + ", " + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ(); - - s = s.replace(placeholder, repl); - } - - if(object instanceof String) { - s = s.replace(placeholder, MessageUtils.translateString((String) object)); - } - - if(object instanceof Integer) { - s = s.replace(placeholder, ""+object); - } - - if(object instanceof ItemStack) { - s = s.replace(placeholder, getItemStackName((ItemStack) object)); - } - } - - current++; - } - - return s; - } - - private String getItemStackName(ItemStack itemStack) { - String name = itemStack.getType().toString().replace("_", " "); - - if(itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName()) { - return itemStack.getItemMeta().getDisplayName(); - } - - return name; - } - -} diff --git a/pom.xml b/pom.xml index 94666dd..41a44f3 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ net.aminecraftdev.custombosses CustomBosses pom - 3.0.0.0 + 3.0.0.1 api-modules/FactionsM api-modules/FactionsOne