use of org.bukkit.entity.EntityType in project MagicPlugin by elBukkit.
the class MagicMobCommandExecutor method onTabComplete.
@Override
public Collection<String> onTabComplete(CommandSender sender, String commandName, String[] args) {
List<String> options = new ArrayList<>();
if (!sender.hasPermission("Magic.commands.mmob"))
return options;
if (args.length == 1) {
options.add("spawn");
options.add("list");
options.add("clear");
} else if (args.length == 2 && (args[0].equalsIgnoreCase("spawn") || args[0].equalsIgnoreCase("clear"))) {
options.addAll(api.getController().getMobKeys());
for (EntityType entityType : EntityType.values()) {
if (entityType.isAlive() && entityType.isSpawnable()) {
options.add(entityType.name().toLowerCase());
}
}
} else if (args.length == 3 && args[0].equalsIgnoreCase("clear")) {
List<World> worlds = api.getPlugin().getServer().getWorlds();
for (World world : worlds) {
options.add(world.getName());
}
}
return options;
}
use of org.bukkit.entity.EntityType in project CommandHelper by EngineHub.
the class BukkitMCEntityType method build.
// This way we don't take up extra memory on non-bukkit implementations
public static void build() {
vanilla = new HashMap<>();
mappings = new HashMap<>();
NULL = new BukkitMCEntityType(EntityType.UNKNOWN, MCVanillaEntityType.UNKNOWN);
ArrayList<EntityType> counted = new ArrayList<>();
for (MCVanillaEntityType v : MCVanillaEntityType.values()) {
if (v.existsInCurrent()) {
EntityType type = getBukkitType(v);
if (type == null) {
CHLog.GetLogger().e(CHLog.Tags.RUNTIME, "Could not find a matching entity type for " + v.name() + ". This is an error, please report this to the bug tracker.", Target.UNKNOWN);
continue;
}
BukkitMCEntityType wrapper = new BukkitMCEntityType(type, v);
wrapper.setWrapperClass();
vanilla.put(v, wrapper);
mappings.put(v.name(), wrapper);
counted.add(type);
}
}
for (EntityType b : EntityType.values()) {
if (!counted.contains(b)) {
mappings.put(b.name(), new BukkitMCEntityType(b, MCVanillaEntityType.UNKNOWN));
}
}
}
use of org.bukkit.entity.EntityType in project CommandHelper by EngineHub.
the class BukkitMCBlockProjectileSource method launchProjectile.
@Override
public MCProjectile launchProjectile(MCProjectileType projectile, Vector3D init) {
EntityType et = EntityType.valueOf(projectile.name());
Class<? extends Entity> c = et.getEntityClass();
Vector vector = new Vector(init.X(), init.Y(), init.Z());
Projectile proj = bps.launchProjectile(c.asSubclass(Projectile.class), vector);
MCEntity e = BukkitConvertor.BukkitGetCorrectEntity(proj);
if (e instanceof MCProjectile) {
return (MCProjectile) e;
} else {
return null;
}
}
use of org.bukkit.entity.EntityType in project CommandHelper by EngineHub.
the class BukkitMCEntityProjectileSource method launchProjectile.
@Override
public MCProjectile launchProjectile(MCProjectileType projectile, Vector3D init) {
EntityType et = EntityType.valueOf(projectile.name());
Class<? extends Entity> c = et.getEntityClass();
Vector vector = new Vector(init.X(), init.Y(), init.Z());
Projectile proj = eps.launchProjectile(c.asSubclass(Projectile.class), vector);
MCEntity mcproj = BukkitConvertor.BukkitGetCorrectEntity(proj);
if (mcproj instanceof MCProjectile) {
return (MCProjectile) mcproj;
} else {
return null;
}
}
use of org.bukkit.entity.EntityType in project CommandHelper by EngineHub.
the class BukkitMCEntityProjectileSource method launchProjectile.
@Override
public MCProjectile launchProjectile(MCProjectileType projectile) {
EntityType et = EntityType.valueOf(projectile.name());
Class<? extends Entity> c = et.getEntityClass();
Projectile proj = eps.launchProjectile(c.asSubclass(Projectile.class));
MCEntity mcproj = BukkitConvertor.BukkitGetCorrectEntity(proj);
if (mcproj instanceof MCProjectile) {
return (MCProjectile) mcproj;
} else {
return null;
}
}
Aggregations