mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Added new mobs
This commit is contained in:
parent
1f6b1f4a2c
commit
293f2f7cd2
3 changed files with 21 additions and 19 deletions
|
@ -29,8 +29,12 @@ public enum Mob
|
||||||
WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF),
|
WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF),
|
||||||
CAVESPIDER("CaveSpider", Enemies.ENEMY, CreatureType.CAVE_SPIDER),
|
CAVESPIDER("CaveSpider", Enemies.ENEMY, CreatureType.CAVE_SPIDER),
|
||||||
ENDERMAN("Enderman", Enemies.ENEMY, "", CreatureType.ENDERMAN),
|
ENDERMAN("Enderman", Enemies.ENEMY, "", CreatureType.ENDERMAN),
|
||||||
SILVERFISH("Silverfish", Enemies.ENEMY, "", CreatureType.SILVERFISH);
|
SILVERFISH("Silverfish", Enemies.ENEMY, "", CreatureType.SILVERFISH),
|
||||||
|
ENDERDRAGON("EnderDragon", Enemies.ENEMY, CreatureType.ENDER_DRAGON),
|
||||||
|
VILLAGER("Villager", Enemies.FRIENDLY, CreatureType.VILLAGER),
|
||||||
|
BLAZE("Blaze", Enemies.ENEMY, CreatureType.BLAZE),
|
||||||
|
MUSHROOMCOW("MushroomCow", Enemies.FRIENDLY, CreatureType.MUSHROOM_COW);
|
||||||
|
//TODO: Snowman
|
||||||
public static final Logger logger = Logger.getLogger("Minecraft");
|
public static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
private Mob(String n, Enemies en, String s, CreatureType type)
|
private Mob(String n, Enemies en, String s, CreatureType type)
|
||||||
|
@ -47,7 +51,6 @@ public enum Mob
|
||||||
this.type = en;
|
this.type = en;
|
||||||
this.bukkitType = type;
|
this.bukkitType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String suffix = "s";
|
public String suffix = "s";
|
||||||
final public String name;
|
final public String name;
|
||||||
final public Enemies type;
|
final public Enemies type;
|
||||||
|
@ -58,7 +61,7 @@ public enum Mob
|
||||||
{
|
{
|
||||||
for (Mob mob : Mob.values())
|
for (Mob mob : Mob.values())
|
||||||
{
|
{
|
||||||
hashMap.put(mob.name, mob);
|
hashMap.put(mob.name.toLowerCase(), mob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,24 +84,26 @@ public enum Mob
|
||||||
NEUTRAL("neutral"),
|
NEUTRAL("neutral"),
|
||||||
ENEMY("enemy");
|
ENEMY("enemy");
|
||||||
|
|
||||||
private Enemies(final String t)
|
private Enemies(final String type)
|
||||||
{
|
{
|
||||||
this.type = t;
|
this.type = type;
|
||||||
}
|
}
|
||||||
final protected String type;
|
final protected String type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreatureType getType () {
|
public CreatureType getType()
|
||||||
|
{
|
||||||
return bukkitType;
|
return bukkitType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Mob fromName(final String name)
|
||||||
|
{
|
||||||
|
return hashMap.get(name.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class MobException extends Exception
|
public static class MobException extends Exception
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Mob fromName(String n)
|
|
||||||
{
|
|
||||||
return hashMap.get(n);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ public class Commandspawner extends EssentialsCommand
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String name = args[0];
|
String name = args[0];
|
||||||
name = name.equalsIgnoreCase("CaveSpider") ? "CaveSpider" : name.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(name);
|
|
||||||
|
|
||||||
Mob mob = null;
|
Mob mob = null;
|
||||||
mob = Mob.fromName(name);
|
mob = Mob.fromName(name);
|
||||||
|
|
|
@ -32,7 +32,6 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
String[] mountparts = args[0].split(",");
|
String[] mountparts = args[0].split(",");
|
||||||
String[] parts = mountparts[0].split(":");
|
String[] parts = mountparts[0].split(":");
|
||||||
String mobType = parts[0];
|
String mobType = parts[0];
|
||||||
mobType = mobType.equalsIgnoreCase("CaveSpider") ? "CaveSpider" : mobType.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(mobType);
|
|
||||||
String mobData = null;
|
String mobData = null;
|
||||||
if (parts.length == 2)
|
if (parts.length == 2)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +43,6 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
{
|
{
|
||||||
parts = mountparts[1].split(":");
|
parts = mountparts[1].split(":");
|
||||||
mountType = parts[0];
|
mountType = parts[0];
|
||||||
mountType = mountType.equalsIgnoreCase("CaveSpider") ? "CaveSpider" : mountType.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(mountType);
|
|
||||||
if (parts.length == 2)
|
if (parts.length == 2)
|
||||||
{
|
{
|
||||||
mountData = parts[1];
|
mountData = parts[1];
|
||||||
|
@ -62,14 +60,14 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("invalidMob"));
|
throw new Exception(Util.i18n("invalidMob"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase()))
|
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase()))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Block block = Util.getTarget(user).getBlock();
|
final Block block = Util.getTarget(user).getBlock();
|
||||||
if (block == null)
|
if (block == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
|
@ -92,7 +90,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
user.sendMessage(Util.i18n("invalidMob"));
|
user.sendMessage(Util.i18n("invalidMob"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase()))
|
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase()))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(Util.i18n("unableToSpawnMob"));
|
||||||
|
|
Loading…
Reference in a new issue