mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-27 19:47:42 +01:00
Success message on /spawner
Switch to use mob class.
This commit is contained in:
parent
2b48045a8f
commit
a2f727bebc
@ -86,6 +86,9 @@ public enum Mob
|
||||
final protected String type;
|
||||
}
|
||||
|
||||
public CreatureType getType () {
|
||||
return bukkitType;
|
||||
}
|
||||
|
||||
public static class MobException extends Exception
|
||||
{
|
||||
|
@ -483,4 +483,9 @@ public class Util
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static String capitalCase(String s)
|
||||
{
|
||||
return s.toUpperCase().charAt(0) + s.toLowerCase().substring(1);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Mob;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Material;
|
||||
@ -22,6 +23,7 @@ public class Commandspawner extends EssentialsCommand
|
||||
if (args.length < 1 || args[0].length() < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
//TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf");
|
||||
}
|
||||
|
||||
final Block target = user.getTarget().getTargetBlock();
|
||||
@ -33,11 +35,18 @@ public class Commandspawner extends EssentialsCommand
|
||||
charge(user);
|
||||
try
|
||||
{
|
||||
String name = args[0].substring(0, 1).toUpperCase() + args[0].substring(1).toLowerCase();
|
||||
if (name.equalsIgnoreCase("Pigzombie")) {
|
||||
name = "PigZombie";
|
||||
String name = args[0];
|
||||
name = name.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(name);
|
||||
|
||||
Mob mob = null;
|
||||
mob = Mob.fromName(name);
|
||||
if (mob == null)
|
||||
{
|
||||
user.sendMessage(Util.i18n("invalidMob"));
|
||||
return;
|
||||
}
|
||||
new CraftCreatureSpawner(target).setCreatureType(CreatureType.fromName(name));
|
||||
new CraftCreatureSpawner(target).setCreatureType(mob.getType());
|
||||
user.sendMessage(Util.format("setSpawner", mob.name));
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
String[] mountparts = args[0].split(",");
|
||||
String[] parts = mountparts[0].split(":");
|
||||
String mobType = parts[0];
|
||||
mobType = mobType.equalsIgnoreCase("PigZombie") ? "PigZombie" : capitalCase(mobType);
|
||||
mobType = mobType.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(mobType);
|
||||
String mobData = null;
|
||||
if (parts.length == 2)
|
||||
{
|
||||
@ -52,7 +52,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
{
|
||||
parts = mountparts[1].split(":");
|
||||
mountType = parts[0];
|
||||
mountType = mountType.equalsIgnoreCase("PigZombie") ? "PigZombie" : capitalCase(mountType);
|
||||
mountType = mountType.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(mountType);
|
||||
if (parts.length == 2)
|
||||
{
|
||||
mountData = parts[1];
|
||||
@ -186,11 +186,6 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
|
||||
private String capitalCase(String s)
|
||||
{
|
||||
return s.toUpperCase().charAt(0) + s.toLowerCase().substring(1);
|
||||
}
|
||||
|
||||
private void changeMobData(String type, Entity spawned, String data, User user) throws Exception
|
||||
{
|
||||
if ("Slime".equalsIgnoreCase(type))
|
||||
@ -210,8 +205,8 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
{
|
||||
if (data.equalsIgnoreCase("random"))
|
||||
{
|
||||
Random rand = new Random();
|
||||
((CraftSheep)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]);
|
||||
Random rand = new Random();
|
||||
((CraftSheep)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -240,6 +240,7 @@ seconds = seconds
|
||||
seenOffline = Player {0} is offline since {1}
|
||||
seenOnline = Player {0} is online since {1}
|
||||
serverFull = Server is full
|
||||
setSpawner = Changed spawner type to {0}
|
||||
sheepMalformedColor = Malformed color.
|
||||
shoutFormat = \u00a77[Shout]\u00a7f {0}
|
||||
similarWarpExist = A warp with a similar name already exists.
|
||||
|
@ -240,6 +240,7 @@ seconds = sekunder
|
||||
seenOffline = Spiller {0} er offline siden {1}
|
||||
seenOnline = Spiller {0} er online siden {1}
|
||||
serverFull = Server er fuld
|
||||
setSpawner = Changed spawner type to {0}
|
||||
sheepMalformedColor = Misdannet farve.
|
||||
shoutFormat = \u00a77[R\u00e5b]\u00a7f {0}
|
||||
similarWarpExist = En warp med lignende tekst eksisterer allerede.
|
||||
|
@ -238,6 +238,7 @@ seconds = Sekunden
|
||||
seenOffline = Spieler {0} ist offline seit {1}
|
||||
seenOnline = Spieler {0} ist online seit {1}
|
||||
serverFull = Server ist voll
|
||||
setSpawner = Changed spawner type to {0}
|
||||
sheepMalformedColor = Ung\u00fcltige Farbe.
|
||||
shoutFormat = \u00a77[Schrei]\u00a7f {0}
|
||||
similarWarpExist = Ein Warp-Punkt mit einem \u00e4hnlichen Namen existiert bereits.
|
||||
|
@ -240,6 +240,7 @@ seconds = seconds
|
||||
seenOffline = Player {0} is offline since {1}
|
||||
seenOnline = Player {0} is online since {1}
|
||||
serverFull = Server is full
|
||||
setSpawner = Changed spawner type to {0}
|
||||
sheepMalformedColor = Malformed color.
|
||||
shoutFormat = \u00a77[Shout]\u00a7f {0}
|
||||
similarWarpExist = A warp with a similar name already exists.
|
||||
|
@ -238,6 +238,7 @@ seconds = secondes
|
||||
seenOffline = Le joueur {0} est hors ligne depuis {1}
|
||||
seenOnline = Le joueur {0} est en ligne depuis {1}
|
||||
serverFull = Le serveur est plein.
|
||||
setSpawner = Changed spawner type to {0}
|
||||
sheepMalformedColor = Couleur mal form\u00e9e.
|
||||
shoutFormat = \u00a77[Crie]\u00a7f {0}
|
||||
similarWarpExist = Un warp avec un nom similaire existe d\u00e9j\u00e0.
|
||||
|
@ -239,6 +239,7 @@ seconds = seconde
|
||||
seenOffline = Speler {0} is offline vanaf {1}
|
||||
seenOnline = Speler {0} is online vanaf {1}
|
||||
serverFull = Server is vol
|
||||
setSpawner = Changed spawner type to {0}
|
||||
sheepMalformedColor = Misvoormde kleur.
|
||||
shoutFormat = \u00a77[Shout]\u00a7f {0}
|
||||
similarWarpExist = Er bestaat al een warp met dezelfde naam.
|
||||
|
Loading…
Reference in New Issue
Block a user