Package net.canarymod.commandsys.commands.playermod

Source Code of net.canarymod.commandsys.commands.playermod.PlayerRemove

package net.canarymod.commandsys.commands.playermod;

import net.canarymod.Canary;
import net.canarymod.Translator;
import net.canarymod.api.entity.living.humanoid.Player;
import net.canarymod.chat.MessageReceiver;
import net.canarymod.commandsys.NativeCommand;

/**
* Command to remove player data from the database  
*
* @author Chris (damagefilter)
*/
public class PlayerRemove implements NativeCommand {
    // player) remove <playername>
    public void execute(MessageReceiver caller, String[] args) {
        if (args[args.length - 1].equals("--help")) {
            Canary.help().getHelp(caller, "playermod remove");
            return;
        }
        Player target = Canary.getServer().matchPlayer(args[1]);
        if (target == null) {
            Canary.usersAndGroups().removeUserData(args[1]);
            caller.notice(Translator.translate("modify player removed"));
            return;
        }
        target.setGroup(Canary.usersAndGroups().getDefaultGroup());
        Canary.usersAndGroups().removeUserData(target.getName());
        caller.notice(Translator.translate("modify player removed"));
    }
}
TOP

Related Classes of net.canarymod.commandsys.commands.playermod.PlayerRemove

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.