diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandspawner.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandspawner.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java new file mode 100644 index 000000000..d73c0b843 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -0,0 +1,41 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.Essentials; +import com.earth2me.essentials.User; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Server; +import org.bukkit.block.Block; +import org.bukkit.block.CreatureSpawner; +import org.bukkit.entity.CreatureType; + +public class Commandspawner extends EssentialsCommand +{ + public Commandspawner() + { + super("spawner"); + } + + @Override + protected void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception + { + if (args.length < 1) + { + user.sendMessage(ChatColor.RED + "Usage: /" + commandLabel + " [mob]"); + return; + } + + Block target = user.getTarget().getTargetBlock(); + if (target.getType() != Material.MOB_SPAWNER) + throw new Exception("Target block must be a mob spawner."); + + try + { + ((CreatureSpawner)target).setCreatureType(CreatureType.fromName(args[0])); + } + catch (Throwable ex) + { + + } + } +} |