summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandspawner.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawner.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
index dba77b5b4..e92b29a93 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
@@ -3,6 +3,8 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Mob;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
+import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.Block;
@@ -25,8 +27,8 @@ public class Commandspawner extends EssentialsCommand
//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();
- if (target.getType() != Material.MOB_SPAWNER)
+ final Location target = Util.getTarget(user);
+ if (target == null || target.getBlock().getType() != Material.MOB_SPAWNER)
{
throw new Exception(_("mobSpawnTarget"));
}
@@ -42,7 +44,7 @@ public class Commandspawner extends EssentialsCommand
user.sendMessage(_("invalidMob"));
return;
}
- ((CreatureSpawner)target.getState()).setCreatureType(mob.getType());
+ ((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType());
user.sendMessage(_("setSpawner", mob.name));
}
catch (Throwable ex)