TF-EssentialsX/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java

46 lines
912 B
Java
Raw Normal View History

package com.earth2me.essentials.commands;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandsethome extends EssentialsCommand
{
public Commandsethome()
{
super("sethome");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length > 0)
{
if (args.length < 2)
{
user.setHome(args[0].equalsIgnoreCase("default"));
}
else
{
if (user.isAuthorized("essentials.sethome.others"))
{
User usersHome = ess.getUser(ess.getServer().getPlayer(args[0]));
if(usersHome == null)
{
usersHome = ess.getOfflineUser(args[0]);
}
usersHome.setHome(user.getLocation(), args[1].equalsIgnoreCase("default"));
}
}
}
2011-06-28 09:13:18 +00:00
else
{
user.setHome(false);
}
charge(user);
user.sendMessage(Util.i18n("homeSet"));
}
}