mirror of
https://github.com/songoda/EpicBosses.git
synced 2025-01-21 22:31:21 +01:00
Added support for 1.13 entities
This commit is contained in:
parent
e9d0dbeb62
commit
8aa867c615
@ -69,6 +69,11 @@ public enum EntityFinder {
|
||||
LLAMA("Llama", new LlamaHandler(), "llama"),
|
||||
PARROT("Parrot", new ParrotHandler(), "parrot"),
|
||||
VILLAGER("Villager", new VillagerHandler(), "villager"),
|
||||
DOLPHIN("Dolphin", new DolphinHandler(), "dolphin"),
|
||||
DROWNED("Drowned", new DrownedHandler(), "drowned"),
|
||||
FISH("Fish", new FishHandler(), "fish", "tropicalfish", "tropical fish", "tropical_fish", "clownfish", "cod", "salmon", "pufferfish"),
|
||||
TURTLE("Turtle", new TurtleHandler(), "turtle"),
|
||||
PHANTOM("Phantom", new PhantomHandler(), "phantom"),
|
||||
CAT("Cat", new CatHandler(), "cat"),
|
||||
FOX("Fox", new FoxHandler(), "fox"),
|
||||
PANDA("Panda", new PandaHandler(), "panda"),
|
||||
|
@ -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 DolphinHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if(this.versionHandler.getVersion().isLessThan(Versions.v1_13_R1)) {
|
||||
throw new NullPointerException("This feature is only implemented in version 1.13 and above of Minecraft.");
|
||||
}
|
||||
|
||||
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.DOLPHIN);
|
||||
}
|
||||
}
|
@ -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 DrownedHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if(this.versionHandler.getVersion().isLessThan(Versions.v1_13_R1)) {
|
||||
throw new NullPointerException("This feature is only implemented in version 1.13 and above of Minecraft.");
|
||||
}
|
||||
|
||||
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.DROWNED);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
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.Fish;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class FishHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if(this.versionHandler.getVersion().isLessThan(Versions.v1_13_R1)) {
|
||||
throw new NullPointerException("This feature is only implemented in version 1.13 and above of Minecraft.");
|
||||
}
|
||||
|
||||
|
||||
EntityType fishEntityType;
|
||||
String type = entityType.toUpperCase().replace("_", "");
|
||||
switch (type) {
|
||||
case "COD":
|
||||
fishEntityType = EntityType.COD;
|
||||
break;
|
||||
case "PUFFERFISH":
|
||||
fishEntityType = EntityType.PUFFERFISH;
|
||||
break;
|
||||
case "SALMON":
|
||||
fishEntityType = EntityType.SALMON;
|
||||
break;
|
||||
case "FISH":
|
||||
case "TROPICALFISH":
|
||||
case "CLOWNFISH":
|
||||
default:
|
||||
fishEntityType = EntityType.TROPICAL_FISH;
|
||||
break;
|
||||
}
|
||||
|
||||
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, fishEntityType);
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ public class MagmaCubeHandler implements ICustomEntityHandler {
|
||||
int size = 4;
|
||||
if (entityType.contains(":")) {
|
||||
String[] split = entityType.split(":");
|
||||
size = Integer.valueOf(split[1]);
|
||||
size = Integer.parseInt(split[1]);
|
||||
}
|
||||
|
||||
MagmaCube magmaCube = (MagmaCube) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.MAGMA_CUBE);
|
||||
|
@ -0,0 +1,32 @@
|
||||
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;
|
||||
import org.bukkit.entity.Phantom;
|
||||
|
||||
public class PhantomHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if(this.versionHandler.getVersion().isLessThan(Versions.v1_13_R1)) {
|
||||
throw new NullPointerException("This feature is only implemented in version 1.13 and above of Minecraft.");
|
||||
}
|
||||
|
||||
int size = 4;
|
||||
if (entityType.contains(":")) {
|
||||
String[] split = entityType.split(":");
|
||||
size = Integer.parseInt(split[1]);
|
||||
}
|
||||
|
||||
Phantom phantom = (Phantom) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.PHANTOM);
|
||||
phantom.setSize(size);
|
||||
|
||||
return phantom;
|
||||
}
|
||||
}
|
@ -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 TurtleHandler implements ICustomEntityHandler {
|
||||
|
||||
private VersionHandler versionHandler = new VersionHandler();
|
||||
|
||||
@Override
|
||||
public LivingEntity getBaseEntity(String entityType, Location spawnLocation) {
|
||||
if(this.versionHandler.getVersion().isLessThan(Versions.v1_13_R1)) {
|
||||
throw new NullPointerException("This feature is only implemented in version 1.13 and above of Minecraft.");
|
||||
}
|
||||
|
||||
return (LivingEntity) spawnLocation.getWorld().spawnEntity(spawnLocation, EntityType.TURTLE);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user