mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 20:29:20 +00:00
![snowleo](/assets/img/avatar_default.png)
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@969 e251c2fe-e539-e718-e476-b85c1f46cddb
41 lines
969 B
Java
41 lines
969 B
Java
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)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|