Added world arghandler

This commit is contained in:
Olof Larsson 2012-01-12 19:06:34 +01:00
parent c5b7f07456
commit 3867c24bc7
2 changed files with 29 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import java.util.Map;
import java.util.Set;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -16,6 +17,7 @@ import com.massivecraft.mcore1.cmd.arg.AHFloat;
import com.massivecraft.mcore1.cmd.arg.AHInteger;
import com.massivecraft.mcore1.cmd.arg.AHMaterial;
import com.massivecraft.mcore1.cmd.arg.AHPlayer;
import com.massivecraft.mcore1.cmd.arg.AHWorld;
import com.massivecraft.mcore1.cmd.arg.IArgHandler;
public class Cmd
@ -55,5 +57,6 @@ public class Cmd
this.setArgHandler(Integer.class, new AHInteger());
this.setArgHandler(Material.class, new AHMaterial());
this.setArgHandler(Player.class, new AHPlayer());
this.setArgHandler(World.class, new AHWorld());
}
}

View File

@ -0,0 +1,26 @@
package com.massivecraft.mcore1.cmd.arg;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import com.massivecraft.mcore1.MPlugin;
public class AHWorld extends AHBase<World>
{
@Override
public World parse(String str, String style, CommandSender sender, MPlugin p)
{
this.error.clear();
if (str == null) return null;
World ret = Bukkit.getWorld(str);
if (ret == null)
{
this.error.add("<b>No world matching \"<p>"+str+"<b>\".");
}
return ret;
}
}