From e9d0dbeb62f3a038f1a5246b8503d6e1c4ceb39d Mon Sep 17 00:00:00 2001 From: Esophose Date: Sun, 4 Aug 2019 12:02:01 -0600 Subject: [PATCH] 1.14 mobs --- .../listeners/pre/BossSpawnListener.java | 3 +++ .../epicbosses/utils/EntityFinder.java | 9 +++++++- .../utils/entity/handlers/CatHandler.java | 22 +++++++++++++++++++ .../utils/entity/handlers/FoxHandler.java | 22 +++++++++++++++++++ .../utils/entity/handlers/PandaHandler.java | 22 +++++++++++++++++++ .../entity/handlers/PillagerHandler.java | 22 +++++++++++++++++++ .../utils/entity/handlers/RavagerHandler.java | 22 +++++++++++++++++++ .../entity/handlers/TraderLlamaHandler.java | 22 +++++++++++++++++++ .../handlers/WanderingTraderHandler.java | 22 +++++++++++++++++++ 9 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/CatHandler.java create mode 100644 plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FoxHandler.java create mode 100644 plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PandaHandler.java create mode 100644 plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PillagerHandler.java create mode 100644 plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/RavagerHandler.java create mode 100644 plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/TraderLlamaHandler.java create mode 100644 plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/WanderingTraderHandler.java diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/listeners/pre/BossSpawnListener.java b/plugin-modules/Core/src/com/songoda/epicbosses/listeners/pre/BossSpawnListener.java index 5bb0ccf..2243f5e 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/listeners/pre/BossSpawnListener.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/listeners/pre/BossSpawnListener.java @@ -138,6 +138,9 @@ public class BossSpawnListener implements Listener { if (messages != null && !activeBossHolder.isCustomSpawnMessage()) messages.replaceAll(s -> s.replace("{name}", player.getName())); + } else { + if (messages != null && !activeBossHolder.isCustomSpawnMessage()) + messages.replaceAll(s -> s.replace("{name}", "Console")); } if (commands != 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 17b4b0d..4b19437 100644 --- a/plugin-modules/Core/src/com/songoda/epicbosses/utils/EntityFinder.java +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/EntityFinder.java @@ -68,7 +68,14 @@ public enum EntityFinder { POLAR_BEAR("PolarBear", new PolarBearHandler(), "polarbear", "polar_bear", "polar bear", "snowbear", "snow_bear", "snow bear"), LLAMA("Llama", new LlamaHandler(), "llama"), PARROT("Parrot", new ParrotHandler(), "parrot"), - VILLAGER("Villager", new VillagerHandler(), "villager"); + VILLAGER("Villager", new VillagerHandler(), "villager"), + CAT("Cat", new CatHandler(), "cat"), + FOX("Fox", new FoxHandler(), "fox"), + PANDA("Panda", new PandaHandler(), "panda"), + PILLAGER("Pillager", new PillagerHandler(), "pillager"), + RAVAGER("Ravager", new RavagerHandler(), "ravager"), + TRADER_LLAMA("TraderLlama", new TraderLlamaHandler(), "traderllama", "trader_llama", "trader llama", "llamatrader", "llama_trader", "llama trader"), + WANDERING_TRADER("WanderingTrader", new WanderingTraderHandler(), "wanderingtrader", "wandering_trader", "wandering trader", "tradervillager", "trader_villager", "trader villager"); @Getter private ICustomEntityHandler customEntityHandler; @Getter private List names = new ArrayList<>(); 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 new file mode 100644 index 0000000..ef57fc0 --- /dev/null +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/CatHandler.java @@ -0,0 +1,22 @@ +package com.songoda.epicbosses.utils.entity.handlers; + +import com.songoda.epicbosses.utils.Versions; +import com.songoda.epicbosses.utils.entity.ICustomEntityHandler; +import com.songoda.epicbosses.utils.version.VersionHandler; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +public class CatHandler implements ICustomEntityHandler { + + private VersionHandler versionHandler = new VersionHandler(); + + @Override + public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { + if(this.versionHandler.getVersion().isLessThan(Versions.v1_14_R1)) { + throw new NullPointerException("This feature is only implemented in version 1.14 and above of Minecraft."); + } + + return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.CAT); + } +} 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 new file mode 100644 index 0000000..b55c410 --- /dev/null +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/FoxHandler.java @@ -0,0 +1,22 @@ +package com.songoda.epicbosses.utils.entity.handlers; + +import com.songoda.epicbosses.utils.Versions; +import com.songoda.epicbosses.utils.entity.ICustomEntityHandler; +import com.songoda.epicbosses.utils.version.VersionHandler; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +public class FoxHandler implements ICustomEntityHandler { + + private VersionHandler versionHandler = new VersionHandler(); + + @Override + public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { + if(this.versionHandler.getVersion().isLessThan(Versions.v1_14_R1)) { + 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/PandaHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PandaHandler.java new file mode 100644 index 0000000..1a68f7c --- /dev/null +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PandaHandler.java @@ -0,0 +1,22 @@ +package com.songoda.epicbosses.utils.entity.handlers; + +import com.songoda.epicbosses.utils.Versions; +import com.songoda.epicbosses.utils.entity.ICustomEntityHandler; +import com.songoda.epicbosses.utils.version.VersionHandler; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +public class PandaHandler implements ICustomEntityHandler { + + private VersionHandler versionHandler = new VersionHandler(); + + @Override + public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { + if(this.versionHandler.getVersion().isLessThan(Versions.v1_14_R1)) { + 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/PillagerHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PillagerHandler.java new file mode 100644 index 0000000..4ed62ad --- /dev/null +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/PillagerHandler.java @@ -0,0 +1,22 @@ +package com.songoda.epicbosses.utils.entity.handlers; + +import com.songoda.epicbosses.utils.Versions; +import com.songoda.epicbosses.utils.entity.ICustomEntityHandler; +import com.songoda.epicbosses.utils.version.VersionHandler; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +public class PillagerHandler implements ICustomEntityHandler { + + private VersionHandler versionHandler = new VersionHandler(); + + @Override + public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { + if(this.versionHandler.getVersion().isLessThan(Versions.v1_14_R1)) { + throw new NullPointerException("This feature is only implemented in version 1.14 and above of Minecraft."); + } + + return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.PILLAGER); + } +} 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 new file mode 100644 index 0000000..ec564e6 --- /dev/null +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/RavagerHandler.java @@ -0,0 +1,22 @@ +package com.songoda.epicbosses.utils.entity.handlers; + +import com.songoda.epicbosses.utils.Versions; +import com.songoda.epicbosses.utils.entity.ICustomEntityHandler; +import com.songoda.epicbosses.utils.version.VersionHandler; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +public class RavagerHandler implements ICustomEntityHandler { + + private VersionHandler versionHandler = new VersionHandler(); + + @Override + public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { + if(this.versionHandler.getVersion().isLessThan(Versions.v1_14_R1)) { + throw new NullPointerException("This feature is only implemented in version 1.14 and above of Minecraft."); + } + + return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.RAVAGER); + } +} diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/TraderLlamaHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/TraderLlamaHandler.java new file mode 100644 index 0000000..4c384b4 --- /dev/null +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/TraderLlamaHandler.java @@ -0,0 +1,22 @@ +package com.songoda.epicbosses.utils.entity.handlers; + +import com.songoda.epicbosses.utils.Versions; +import com.songoda.epicbosses.utils.entity.ICustomEntityHandler; +import com.songoda.epicbosses.utils.version.VersionHandler; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +public class TraderLlamaHandler implements ICustomEntityHandler { + + private VersionHandler versionHandler = new VersionHandler(); + + @Override + public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { + if(this.versionHandler.getVersion().isLessThan(Versions.v1_14_R1)) { + throw new NullPointerException("This feature is only implemented in version 1.12 and above of Minecraft."); + } + + return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.TRADER_LLAMA); + } +} diff --git a/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/WanderingTraderHandler.java b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/WanderingTraderHandler.java new file mode 100644 index 0000000..286e7d5 --- /dev/null +++ b/plugin-modules/Core/src/com/songoda/epicbosses/utils/entity/handlers/WanderingTraderHandler.java @@ -0,0 +1,22 @@ +package com.songoda.epicbosses.utils.entity.handlers; + +import com.songoda.epicbosses.utils.Versions; +import com.songoda.epicbosses.utils.entity.ICustomEntityHandler; +import com.songoda.epicbosses.utils.version.VersionHandler; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; + +public class WanderingTraderHandler implements ICustomEntityHandler { + + private VersionHandler versionHandler = new VersionHandler(); + + @Override + public LivingEntity getBaseEntity(String entityType, Location spawnLocation) { + if(this.versionHandler.getVersion().isLessThan(Versions.v1_14_R1)) { + throw new NullPointerException("This feature is only implemented in version 1.14 and above of Minecraft."); + } + + return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.WANDERING_TRADER); + } +}