3.0.0-SNAPSHOT-U15

Added Donkey, Evoker, Illusioner, Mule, Vex and Vindicator Handlers as well as added ZombieHorse, Donkey, Mule, Evoker, Vex, Vindicator, Illusioner, Creeper, Skeleton, Spider, Giant, Zombie, BabyZombie, Slime, Ghast, PigZombie, BabyPigZombie, Enderman, CaveSpider, Silverfish, Blaze, MagmaCube, EnderDragon, Wither, Bat, Witch to EntityFinder.
This commit is contained in:
AMinecraftDev 2018-07-01 12:58:46 +08:00
parent 3c98256356
commit 2cc9625c0a
9 changed files with 197 additions and 54 deletions

View File

@ -24,7 +24,32 @@ public enum EntityFinder {
HUSK("Husk", new HuskZombieHandler(), "husk"), HUSK("Husk", new HuskZombieHandler(), "husk"),
ZOMBIE_VILLAGER("ZombieVillager", new ZombieVillagerHandler(), "zombievillager", "zombie_villager", "zombie villager", "villagerzombie", "villager_zombie", "villager zombie"), ZOMBIE_VILLAGER("ZombieVillager", new ZombieVillagerHandler(), "zombievillager", "zombie_villager", "zombie villager", "villagerzombie", "villager_zombie", "villager zombie"),
SKELETON_HORSE("SkeletonHorse", new SkeletonHorseHandler(), "skeletonhorse", "skeleton_horse", "skeleton horse"), SKELETON_HORSE("SkeletonHorse", new SkeletonHorseHandler(), "skeletonhorse", "skeleton_horse", "skeleton horse"),
ZOMBIE_HORSE("ZombieHorse", new ZombieHorseHandler(), "zombiehorse", "zombie_horse", "zombie horse"); ZOMBIE_HORSE("ZombieHorse", new ZombieHorseHandler(), "zombiehorse", "zombie_horse", "zombie horse"),
DONKEY("Donkey", new DonkeyHorseHandler(), "donkey"),
MULE("Mule", new MuleHorseHandler(), "mule"),
EVOKER("Evoker", new EvokerHandler(), "evoker"),
VEX("Vex", new VexHandler(), "vex"),
VINDICATOR("Vindicator", new VindicatorHandler(), "vindicator"),
ILLUSIONER("Illusioner", new IllusionerHandler(), "illusioner"),
CREEPER("Creeper", EntityType.CREEPER, "creeper"),
SKELETON("Skeleton", EntityType.SKELETON, "skeleton"),
SPIDER("Spider", EntityType.SPIDER, "spider"),
GIANT("Giant", EntityType.GIANT, "giant", "giant_zombie", "giant zombie", "giantzombie"),
ZOMBIE("Zombie", new ZombieHandler(), "zombie"),
BABY_ZOMBIE("BabyZombie", new ZombieBabyHandler(), "babyzombie", "baby_zombie", "baby zombie"),
SLIME("Slime", new SlimeHandler(), "slime"),
GHAST("Ghast", EntityType.GHAST, "ghast"),
PIG_ZOMBIE("PigZombie", new PigZombieHandler(), "pigzombie", "pig zombie", "pig_zombie", "zombiepigman", "zombie_pigman", "zombie pigman"),
BABY_PIG_ZOMBIE("BabyPigZombie", new PigZombieBabyHandler(), "babypigzombie", "baby pig zombie", "baby_pig_zombie", "babyzombiepigman", "baby_zombie_pigman", "baby zombie pigman"),
ENDERMAN("Enderman", EntityType.ENDERMAN, "enderman"),
CAVE_SPIDER("CaveSpider", EntityType.CAVE_SPIDER, "cavespider", "cave_spider", "cave spider"),
SILVERFISH("Silverfish", EntityType.SILVERFISH, "silverfish"),
BLAZE("Blaze", EntityType.BLAZE, "blaze"),
MAGMA_CUBE("MagmaCube", new MagmaCubeHandler(), "magmacube", "magma_cube", "magma cube"),
ENDER_DRAGON("EnderDragon", EntityType.ENDER_DRAGON, "enderdragon", "ender_dragon", "ender dragon"),
WITHER("Wither", EntityType.WITHER, "wither"),
BAT("Bat", EntityType.BAT, "bat"),
WITCH("Witch", EntityType.WITCH, "witch");
@Getter private ICustomEntityHandler customEntityHandler; @Getter private ICustomEntityHandler customEntityHandler;
@Getter private List<String> names = new ArrayList<>(); @Getter private List<String> names = new ArrayList<>();

View File

@ -1,52 +0,0 @@
package net.aminecraftdev.custombosses.utils;
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
import net.aminecraftdev.custombosses.utils.entity.handlers.*;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 01-Jun-18
*/
public enum EntityTypeUtil {
WITHER_SKELETON(new WitherSkeletonHandler()),
ELDER_GUARDIAN(new ElderGuardianHandler()),
KILLER_BUNNY(new KillerBunnyHandler()),
ZOMBIE(new ZombieBabyHandler()),
BABY_ZOMBIE(new ZombieBabyHandler()),
PIG_ZOMBIE(new PigZombieHandler()),
BABY_PIG_ZOMBIE(new PigZombieBabyHandler()),
SLIME(new SlimeHandler()),
MAGMA_CUBE(new MagmaCubeHandler()),
VILLAGER(new VillagerHandler());
private ICustomEntityHandler entityHandler;
EntityTypeUtil(ICustomEntityHandler customEntityHandler) {
this.entityHandler = customEntityHandler;
}
private ICustomEntityHandler getEntityHandler() {
return entityHandler;
}
public static LivingEntity get(String entityType, Location spawnLocation) {
for(EntityTypeUtil entityTypeUtil : values()) {
if(entityType.toUpperCase().startsWith(entityTypeUtil.name())) return entityTypeUtil.getEntityHandler().getBaseEntity(entityType, spawnLocation);
}
return null;
}
public static EntityTypeUtil get(String entityType) {
for(EntityTypeUtil entityTypeUtil : values()) {
if(entityType.toUpperCase().startsWith(entityTypeUtil.name())) return entityTypeUtil;
}
return null;
}
}

View File

@ -0,0 +1,31 @@
package net.aminecraftdev.custombosses.utils.entity.handlers;
import net.aminecraftdev.custombosses.utils.Versions;
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
import net.aminecraftdev.custombosses.utils.version.VersionHandler;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 01-Jul-18
*/
public class DonkeyHorseHandler implements ICustomEntityHandler {
private VersionHandler versionHandler = new VersionHandler();
@Override
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
if(this.versionHandler.getVersion().isHigherThanOrEqualTo(Versions.v1_11_R1)) {
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.DONKEY);
}
Horse horse = (Horse) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.HORSE);
horse.setVariant(Horse.Variant.DONKEY);
return horse;
}
}

View File

@ -0,0 +1,27 @@
package net.aminecraftdev.custombosses.utils.entity.handlers;
import net.aminecraftdev.custombosses.utils.Versions;
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
import net.aminecraftdev.custombosses.utils.version.VersionHandler;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 01-Jul-18
*/
public class EvokerHandler implements ICustomEntityHandler {
private VersionHandler versionHandler = new VersionHandler();
@Override
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
if(this.versionHandler.getVersion().isLessThan(Versions.v1_11_R1)) {
throw new NullPointerException("This feature is only implemented in version 1.11 and above of Minecraft.");
}
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.EVOKER);
}
}

View File

@ -0,0 +1,27 @@
package net.aminecraftdev.custombosses.utils.entity.handlers;
import net.aminecraftdev.custombosses.utils.Versions;
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
import net.aminecraftdev.custombosses.utils.version.VersionHandler;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 01-Jul-18
*/
public class IllusionerHandler implements ICustomEntityHandler {
private VersionHandler versionHandler = new VersionHandler();
@Override
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
if(this.versionHandler.getVersion().isLessThan(Versions.v1_11_R1)) {
throw new NullPointerException("This feature is only implemented in version 1.11 and above of Minecraft.");
}
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.ILLUSIONER);
}
}

View File

@ -0,0 +1,31 @@
package net.aminecraftdev.custombosses.utils.entity.handlers;
import net.aminecraftdev.custombosses.utils.Versions;
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
import net.aminecraftdev.custombosses.utils.version.VersionHandler;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 01-Jul-18
*/
public class MuleHorseHandler implements ICustomEntityHandler {
private VersionHandler versionHandler = new VersionHandler();
@Override
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
if(this.versionHandler.getVersion().isHigherThanOrEqualTo(Versions.v1_11_R1)) {
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.MULE);
}
Horse horse = (Horse) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.HORSE);
horse.setVariant(Horse.Variant.MULE);
return horse;
}
}

View File

@ -0,0 +1,27 @@
package net.aminecraftdev.custombosses.utils.entity.handlers;
import net.aminecraftdev.custombosses.utils.Versions;
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
import net.aminecraftdev.custombosses.utils.version.VersionHandler;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 01-Jul-18
*/
public class VexHandler implements ICustomEntityHandler {
private VersionHandler versionHandler = new VersionHandler();
@Override
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
if(this.versionHandler.getVersion().isLessThan(Versions.v1_11_R1)) {
throw new NullPointerException("This feature is only implemented in version 1.11 and above of Minecraft.");
}
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.VEX);
}
}

View File

@ -0,0 +1,27 @@
package net.aminecraftdev.custombosses.utils.entity.handlers;
import net.aminecraftdev.custombosses.utils.Versions;
import net.aminecraftdev.custombosses.utils.entity.ICustomEntityHandler;
import net.aminecraftdev.custombosses.utils.version.VersionHandler;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
/**
* @author Charles Cullen
* @version 1.0.0
* @since 01-Jul-18
*/
public class VindicatorHandler implements ICustomEntityHandler {
private VersionHandler versionHandler = new VersionHandler();
@Override
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
if(this.versionHandler.getVersion().isLessThan(Versions.v1_11_R1)) {
throw new NullPointerException("This feature is only implemented in version 1.11 and above of Minecraft.");
}
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.VINDICATOR);
}
}

View File

@ -19,7 +19,7 @@
</modules> </modules>
<properties> <properties>
<plugin.version>3.0.0-SNAPSHOT-U14</plugin.version> <plugin.version>3.0.0-SNAPSHOT-U15</plugin.version>
<plugin.name>CustomBosses</plugin.name> <plugin.name>CustomBosses</plugin.name>
<plugin.main>net.aminecraftdev.custombosses.CustomBosses</plugin.main> <plugin.main>net.aminecraftdev.custombosses.CustomBosses</plugin.main>
<plugin.author>AMinecraftDev</plugin.author> <plugin.author>AMinecraftDev</plugin.author>