Java 类net.minecraft.command.ICommandSender 实例源码

项目:World-Border    文件:CmdBypasslist.java   
@Override
public void execute(final ICommandSender sender, EntityPlayerMP player, List<String> params, String worldName)
{
    final UUID[] uuids = Config.getPlayerBypassList();
    if (uuids.length == 0)
    {
        Util.chat(sender, "Players with border bypass enabled: <none>");
        return;
    }

    try
    {
        String[] names = Profiles.fetchNames(uuids);
        String   list  = Arrays.toString(names);

        Util.chat(sender, "Players with border bypass enabled: " + list);
    }
    catch (Exception ex)
    {
        sendErrorAndHelp(sender, "Failed to look up names for the UUIDs in the border bypass list: " + ex.getMessage());
    }
}
项目:BaseClient    文件:CommandWhitelist.java   
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
    if (args.length == 1)
    {
        return getListOfStringsMatchingLastWord(args, new String[] {"on", "off", "list", "add", "remove", "reload"});
    }
    else
    {
        if (args.length == 2)
        {
            if (args[0].equals("remove"))
            {
                return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getConfigurationManager().getWhitelistedPlayerNames());
            }

            if (args[0].equals("add"))
            {
                return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getPlayerProfileCache().getUsernames());
            }
        }

        return null;
    }
}
项目:CustomWorldGen    文件:CommandScoreboard.java   
protected void resetPlayerScore(ICommandSender sender, String[] p_184912_2_, int p_184912_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    String s = getEntityName(server, sender, p_184912_2_[p_184912_3_++]);

    if (p_184912_2_.length > p_184912_3_)
    {
        ScoreObjective scoreobjective = this.convertToObjective(p_184912_2_[p_184912_3_++], false, server);
        scoreboard.removeObjectiveFromEntity(s, scoreobjective);
        notifyCommandListener(sender, this, "commands.scoreboard.players.resetscore.success", new Object[] {scoreobjective.getName(), s});
    }
    else
    {
        scoreboard.removeObjectiveFromEntity(s, (ScoreObjective)null);
        notifyCommandListener(sender, this, "commands.scoreboard.players.reset.success", new Object[] {s});
    }
}
项目:Backmemed    文件:CommandPardonIp.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.IP_PATTERN.matcher(args[0]);

        if (matcher.matches())
        {
            server.getPlayerList().getBannedIPs().removeEntry(args[0]);
            notifyCommandListener(sender, this, "commands.unbanip.success", new Object[] {args[0]});
        }
        else
        {
            throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException("commands.unbanip.usage", new Object[0]);
    }
}
项目:Backmemed    文件:CommandScoreboard.java   
protected void listObjectives(ICommandSender sender, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    Collection<ScoreObjective> collection = scoreboard.getScoreObjectives();

    if (collection.isEmpty())
    {
        throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]);
    }
    else
    {
        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.scoreboard.objectives.list.count", new Object[] {Integer.valueOf(collection.size())});
        textcomponenttranslation.getStyle().setColor(TextFormatting.DARK_GREEN);
        sender.addChatMessage(textcomponenttranslation);

        for (ScoreObjective scoreobjective : collection)
        {
            sender.addChatMessage(new TextComponentTranslation("commands.scoreboard.objectives.list.entry", new Object[] {scoreobjective.getName(), scoreobjective.getDisplayName(), scoreobjective.getCriteria().getName()}));
        }
    }
}
项目:DecompiledMinecraft    文件:CommandSetDefaultSpawnpoint.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    BlockPos blockpos;

    if (args.length == 0)
    {
        blockpos = getCommandSenderAsPlayer(sender).getPosition();
    }
    else
    {
        if (args.length != 3 || sender.getEntityWorld() == null)
        {
            throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
        }

        blockpos = parseBlockPos(sender, args, 0, true);
    }

    sender.getEntityWorld().setSpawnPoint(blockpos);
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new S05PacketSpawnPosition(blockpos));
    notifyOperators(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
项目:World-Border    文件:CmdDynmapmsg.java   
@Override
public void execute(ICommandSender sender, EntityPlayerMP player, List<String> params, String worldName)
{
    StringBuilder message = new StringBuilder();
    boolean first = true;
    for (String param : params)
    {
        if (!first)
            message.append(" ");
        message.append(param);
        first = false;
    }

    Config.setDynmapMessage(message.toString());

    if (player != null)
        cmdStatus(sender);
}
项目:CustomWorldGen    文件:CommandAchievement.java   
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    if (args.length == 1)
    {
        /**
         * Returns a List of strings (chosen from the given strings) which the last word in the given string array
         * is a beginning-match for. (Tab completion).
         */
        return getListOfStringsMatchingLastWord(args, new String[] {"give", "take"});
    }
    else if (args.length != 2)
    {
        return args.length == 3 ? getListOfStringsMatchingLastWord(args, server.getAllUsernames()) : Collections.<String>emptyList();
    }
    else
    {
        List<String> list = Lists.<String>newArrayList();

        for (StatBase statbase : AchievementList.ACHIEVEMENTS)
        {
            list.add(statbase.statId);
        }

        return getListOfStringsMatchingLastWord(args, list);
    }
}
项目:BaseClient    文件:CommandScoreboard.java   
protected void func_175779_n(ICommandSender p_175779_1_, String[] p_175779_2_, int p_175779_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getPlayerName(p_175779_1_, p_175779_2_[p_175779_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175779_2_[p_175779_3_], false);

        if (scoreobjective.getCriteria() != IScoreObjectiveCriteria.TRIGGER)
        {
            throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()});
        }
        else
        {
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);
            score.setLocked(false);
            notifyOperators(p_175779_1_, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s});
        }
    }
}
项目:Backmemed    文件:CommandDeOp.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 0)
    {
        GameProfile gameprofile = server.getPlayerList().getOppedPlayers().getGameProfileFromName(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.deop.failed", new Object[] {args[0]});
        }
        else
        {
            server.getPlayerList().removeOp(gameprofile);
            notifyCommandListener(sender, this, "commands.deop.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.deop.usage", new Object[0]);
    }
}
项目:NemesisSystem    文件:NemesisSystemCommand.java   
private void spawn(ICommandSender sender, String[] args) throws CommandException {
    if (!(sender instanceof EntityPlayer)) {
        return;
    }

    if (args.length != 2) {
        throw new WrongUsageException("commands.nemesis_system.usage");
    }

    EntityPlayer player = getCommandSenderAsPlayer(sender);
    World world = player.world;

    INemesisRegistry registry = NemesisRegistryProvider.get(world);
    NemesisEntry nemesis = registry.getByName(args[1]);

    SpawnHandler.spawnNemesis(world, player.getPosition(), nemesis);
}
项目:DecompiledMinecraft    文件:CommandSetDefaultSpawnpoint.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    BlockPos blockpos;

    if (args.length == 0)
    {
        blockpos = getCommandSenderAsPlayer(sender).getPosition();
    }
    else
    {
        if (args.length != 3 || sender.getEntityWorld() == null)
        {
            throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
        }

        blockpos = parseBlockPos(sender, args, 0, true);
    }

    sender.getEntityWorld().setSpawnPoint(blockpos);
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new S05PacketSpawnPosition(blockpos));
    notifyOperators(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
项目:DecompiledMinecraft    文件:CommandWhitelist.java   
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
    if (args.length == 1)
    {
        return getListOfStringsMatchingLastWord(args, new String[] {"on", "off", "list", "add", "remove", "reload"});
    }
    else
    {
        if (args.length == 2)
        {
            if (args[0].equals("remove"))
            {
                return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getConfigurationManager().getWhitelistedPlayerNames());
            }

            if (args[0].equals("add"))
            {
                return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getPlayerProfileCache().getUsernames());
            }
        }

        return null;
    }
}
项目:StructPro    文件:Evaluator.java   
/** Generate world region. Very high-weight for cpu-calculation resources command
 * @param vars Variables to parse arguments
 * @param sender Who sends the command
 */
static void execGen(Variables vars, ICommandSender sender) {
    int size = vars.get(new String[]{"size", "s", "length", "radius", "r"}, 16);
    int startX = vars.get(new String[]{"startx", "sx"}, 0);
    int startZ = vars.get(new String[]{"startz", "sz"}, 0);
    boolean stop = vars.get(new String[]{"stop", "end", "finish"}, false);
    boolean skip = vars.get(new String[]{"skip"}, false);
    int progress = vars.get(new String[]{"progress"}, 0);
    int step = Math.min(Math.max(1, vars.get(new String[]{"step", "delta"}, 32)), 4096);
    String worldName = vars.get(new String[]{"world"});
    UWorld world = worldName == null ? new UWorld(sender.getEntityWorld()) : UWorld.getWorld(worldName);
    if (world == null) {
        feedback(sender, "§4No matching world");
        return;
    }
    feedback(sender, Evaluator.cmdGen(world, startX, startZ, step, size, stop, skip, progress));
}
项目:BaseClient    文件:CommandScoreboard.java   
protected void resetPlayers(ICommandSender p_147187_1_, String[] p_147187_2_, int p_147187_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getEntityName(p_147187_1_, p_147187_2_[p_147187_3_++]);

    if (p_147187_2_.length > p_147187_3_)
    {
        ScoreObjective scoreobjective = this.getObjective(p_147187_2_[p_147187_3_++], false);
        scoreboard.removeObjectiveFromEntity(s, scoreobjective);
        notifyOperators(p_147187_1_, this, "commands.scoreboard.players.resetscore.success", new Object[] {scoreobjective.getName(), s});
    }
    else
    {
        scoreboard.removeObjectiveFromEntity(s, (ScoreObjective)null);
        notifyOperators(p_147187_1_, this, "commands.scoreboard.players.reset.success", new Object[] {s});
    }
}
项目:Backmemed    文件:CommandPardonPlayer.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 0)
    {
        GameProfile gameprofile = server.getPlayerList().getBannedPlayers().getBannedProfile(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.unban.failed", new Object[] {args[0]});
        }
        else
        {
            server.getPlayerList().getBannedPlayers().removeEntry(gameprofile);
            notifyCommandListener(sender, this, "commands.unban.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.unban.usage", new Object[0]);
    }
}
项目:CreeperHostGui    文件:CommandInvite.java   
@Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos)
{
    if (args.length == 1)
    {
        return getListOfStringsMatchingLastWord(args, new String[]{"list", "add", "remove", "reload"});
    }
    else
    {
        if (args.length == 2)
        {
            if ("remove".equals(args[0]))
            {
                return getListOfStringsMatchingLastWord(args, server.getPlayerList().getWhitelistedPlayerNames());
            }

            if ("add".equals(args[0]))
            {
                return getListOfStringsMatchingLastWord(args, server.getPlayerProfileCache().getUsernames());
            }
        }

        return Collections.emptyList();
    }
}
项目:BaseClient    文件:CommandAchievement.java   
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
    if (args.length == 1)
    {
        return getListOfStringsMatchingLastWord(args, new String[] {"give", "take"});
    }
    else if (args.length != 2)
    {
        return args.length == 3 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null;
    }
    else
    {
        List<String> list = Lists.<String>newArrayList();

        for (StatBase statbase : StatList.allStats)
        {
            list.add(statbase.statId);
        }

        return getListOfStringsMatchingLastWord(args, list);
    }
}
项目:BaseClient    文件:CommandPublishLocalServer.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    String s = MinecraftServer.getServer().shareToLAN(WorldSettings.GameType.SURVIVAL, false);

    if (s != null)
    {
        notifyOperators(sender, this, "commands.publish.started", new Object[] {s});
    }
    else
    {
        notifyOperators(sender, this, "commands.publish.failed", new Object[0]);
    }
}
项目:craftsman    文件:Cube.java   
@Override
public void doCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {     
    FstPlayer player = new FstPlayer(sender);
    player.runIfAirOrBlockHeld(() -> {
        doCommandWithoutCheckingBlock(player, args); 
    });
}
项目:BaseClient    文件:CommandScoreboard.java   
protected void func_175781_o(ICommandSender p_175781_1_, String[] p_175781_2_, int p_175781_3_) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard();
    String s = getEntityName(p_175781_1_, p_175781_2_[p_175781_3_++]);

    if (s.length() > 40)
    {
        throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)});
    }
    else
    {
        ScoreObjective scoreobjective = this.getObjective(p_175781_2_[p_175781_3_++], false);

        if (!scoreboard.entityHasObjective(s, scoreobjective))
        {
            throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s});
        }
        else
        {
            int i = p_175781_2_[p_175781_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_175781_2_[p_175781_3_]);
            ++p_175781_3_;
            int j = p_175781_3_ < p_175781_2_.length && !p_175781_2_[p_175781_3_].equals("*") ? parseInt(p_175781_2_[p_175781_3_], i) : Integer.MAX_VALUE;
            Score score = scoreboard.getValueFromObjective(s, scoreobjective);

            if (score.getScorePoints() >= i && score.getScorePoints() <= j)
            {
                notifyOperators(p_175781_1_, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
            else
            {
                throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)});
            }
        }
    }
}
项目:CustomWorldGen    文件:CommandScoreboard.java   
protected void removeObjective(ICommandSender sender, String p_184905_2_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    ScoreObjective scoreobjective = this.convertToObjective(p_184905_2_, false, server);
    scoreboard.removeObjective(scoreobjective);
    notifyCommandListener(sender, this, "commands.scoreboard.objectives.remove.success", new Object[] {p_184905_2_});
}
项目:Backmemed    文件:CommandSaveOff.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    boolean flag = false;

    for (int i = 0; i < server.worldServers.length; ++i)
    {
        if (server.worldServers[i] != null)
        {
            WorldServer worldserver = server.worldServers[i];

            if (!worldserver.disableLevelSaving)
            {
                worldserver.disableLevelSaving = true;
                flag = true;
            }
        }
    }

    if (flag)
    {
        notifyCommandListener(sender, this, "commands.save.disabled", new Object[0]);
    }
    else
    {
        throw new CommandException("commands.save-off.alreadyOff", new Object[0]);
    }
}
项目:CustomWorldGen    文件:CommandStop.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (server.worldServers != null)
    {
        notifyCommandListener(sender, this, "commands.stop.start", new Object[0]);
    }

    server.initiateShutdown();
}
项目:CustomWorldGen    文件:CommandBroadcast.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length > 0 && args[0].length() > 0)
    {
        ITextComponent itextcomponent = getChatComponentFromNthArg(sender, args, 0, true);
        server.getPlayerList().sendChatMsg(new TextComponentTranslation("chat.type.announcement", new Object[] {sender.getDisplayName(), itextcomponent}));
    }
    else
    {
        throw new WrongUsageException("commands.say.usage", new Object[0]);
    }
}
项目:DecompiledMinecraft    文件:CommandSaveOn.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    MinecraftServer minecraftserver = MinecraftServer.getServer();
    boolean flag = false;

    for (int i = 0; i < minecraftserver.worldServers.length; ++i)
    {
        if (minecraftserver.worldServers[i] != null)
        {
            WorldServer worldserver = minecraftserver.worldServers[i];

            if (worldserver.disableLevelSaving)
            {
                worldserver.disableLevelSaving = false;
                flag = true;
            }
        }
    }

    if (flag)
    {
        notifyOperators(sender, this, "commands.save.enabled", new Object[0]);
    }
    else
    {
        throw new CommandException("commands.save-on.alreadyOn", new Object[0]);
    }
}
项目:Bewitchment    文件:CommandIncantation.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (args.length < 1) throw new WrongUsageException("commands.incantation.usage");
    if (sender.getCommandSenderEntity() == null) return;
    final String command = args[0];
    if (ModCommands.commands.containsKey(command)) {
        ModCommands.commands.get(command).cast(server, sender, args);
    } else {
        throw new CommandException("commands.incantation.notFound", sender.getName());
    }
}
项目:World-Border    文件:CmdHelp.java   
@Override
public void cmdStatus(ICommandSender sender)
{
    String commands = WorldBorder.COMMAND.getCommandNames().toString().replace(", ", C_DESC + ", " + C_CMD);
    Util.chat(sender, C_HEAD + "Commands: " + C_CMD + commands.substring(1, commands.length() - 1));
    Util.chat(sender, "Example, for info on \"set\" command: " + cmd(sender) + nameEmphasized() + C_CMD + "set");
    Util.chat(sender, C_HEAD + "For a full command example list, simply run the root " + cmd(sender) + C_HEAD + "command by itself with nothing specified.");
}
项目:BaseClient    文件:CommandSaveOn.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    MinecraftServer minecraftserver = MinecraftServer.getServer();
    boolean flag = false;

    for (int i = 0; i < minecraftserver.worldServers.length; ++i)
    {
        if (minecraftserver.worldServers[i] != null)
        {
            WorldServer worldserver = minecraftserver.worldServers[i];

            if (worldserver.disableLevelSaving)
            {
                worldserver.disableLevelSaving = false;
                flag = true;
            }
        }
    }

    if (flag)
    {
        notifyOperators(sender, this, "commands.save.enabled", new Object[0]);
    }
    else
    {
        throw new CommandException("commands.save-on.alreadyOn", new Object[0]);
    }
}
项目:World-Border    文件:CmdDenypearl.java   
@Override
public void execute(ICommandSender sender, EntityPlayerMP player, List<String> params, String worldName)
{
    Config.setDenyEnderpearl( strAsBool( params.get(0) ) );

    if (player != null)
    {
        Log.info(
            (Config.getDenyEnderpearl() ? "Enabled" : "Disabled")
            + " direct cancellation of ender pearls thrown past the border at the command of player \""
            + player.getDisplayName() + "\"."
        );
        cmdStatus(sender);
    }
}
项目:VillagerTrades    文件:ModCommand.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    World world = sender.getEntityWorld();
    if (!world.isRemote)
    {

        if (args.length == 0)
        {
            for (Map.Entry<Integer, String> kvp : VillagerRegistryHelper.getProfessionIdsAndNamesSortedById())
            {
                sender.sendMessage(new TextComponentString(kvp.getKey() + ": " + kvp.getValue()));
            }
            return;
        }

        if (args.length == 2 && args[0].equals("profession"))
        {
            VillagerProfession profession = VillagerRegistryHelper.getProfession(args[1]);
            if (profession != null)
            {
                for (VillagerCareer career : new VTTVillagerProfession(profession).getCareers())
                {
                    VTTVillagerCareer vttCareer = new VTTVillagerCareer(career);
                    sender.sendMessage(new TextComponentString(vttCareer.getId() + ": " + vttCareer.getName()));
                    sender.sendMessage(new TextComponentString("   " + vttCareer.getCareerLevels() + " levels"));
                }
            }
        }

    }
}
项目:RenderPlayerMod-1.8.9    文件:RenderPlayer.java   
public void processCommand(ICommandSender sender, String[] args) {
    if(args.length > 0) {
        if(args[0].equalsIgnoreCase("right")) {
        }

        if(args[0].equalsIgnoreCase("left")) {
        }
    }
    ChatHandler.send(RenderPlayerMod.getPrefix() + "&cUsage: /renderplayer <right|left>");
    return;
}
项目:connor41-etfuturum2    文件:SetPlayerModelCommand.java   
@Override
public void processCommand(ICommandSender sender, String[] args) {
    if (args.length != 1 || !"alex".equals(args[0].toLowerCase()) && !"steve".equals(args[0].toLowerCase()))
        throw new WrongUsageException(getCommandUsage(sender));

    if (sender instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) sender;
        NBTTagCompound nbt = player.getEntityData();
        boolean isAlex = "alex".equals(args[0].toLowerCase());
        nbt.setBoolean(MODEL_KEY, isAlex);
        EtFuturum.networkWrapper.sendToAll(new SetPlayerModelMessage(player, isAlex));
    }
}
项目:MeeCreeps    文件:CommandTestApi.java   
@Override
public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
    if (sender instanceof EntityPlayerMP) {
        return ((EntityPlayerMP) sender).capabilities.isCreativeMode && sender.canUseCommand(2, "");
    } else {
        return sender.canUseCommand(2, "creep_test");
    }
}
项目:DecompiledMinecraft    文件:CommandEmote.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length <= 0)
    {
        throw new WrongUsageException("commands.me.usage", new Object[0]);
    }
    else
    {
        IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 0, !(sender instanceof EntityPlayer));
        MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.emote", new Object[] {sender.getDisplayName(), ichatcomponent}));
    }
}
项目:StructPro    文件:Evaluator.java   
/** Paste something to the world
 * @param vars Variables to parse arguments
 * @param sender Who sends the command
 */
static void execPaste(Variables vars, ICommandSender sender) {
    Random random = new Random();
    String name = vars.get(new String[]{"name"}, "");
    UBlockPos where = new UBlockPos(0, 0, 0);
    if (sender instanceof EntityPlayerMP) {
        EntityPlayerMP player = (EntityPlayerMP) sender;
        where = new UBlockPos((int)player.posX, (int)player.posY, (int)player.posZ);
    }
    int posX = vars.get(new String[]{"posx", "px", "x"}, where.getX());
    int posY = vars.get(new String[]{"posy", "py", "y"}, where.getY());
    int posZ = vars.get(new String[]{"posz", "pz", "z"}, where.getZ());
    int rotateX = vars.get(new String[]{"rotatex", "rotx", "rx"}, 0);
    int rotateY = vars.get(new String[]{"rotatey", "roty", "ry"}, random.nextInt() % 4);
    int rotateZ = vars.get(new String[]{"rotatez", "rotz", "rz"}, 0);
    boolean flipX = vars.get(new String[]{"flipx", "fx"},  random.nextBoolean());
    boolean flipY = vars.get(new String[]{"flipy", "fy"}, false);
    boolean flipZ = vars.get(new String[]{"flipz", "fz"}, random.nextBoolean());
    boolean isVillage = vars.get(new String[]{"village", "town", "city"}, false);
    boolean isInsecure = vars.get(new String[]{"insecure"}, false);
    posY = vars.get(new String[]{"auto"}, false) ? 0 : posY;
    if (vars.get(new String[]{"wand"}, false) && sender instanceof EntityPlayer && wand.containsKey(sender)) {
        UBlockPos pos = wand.get(sender).getValue();
        posX = pos.getX(); posY = pos.getY(); posZ = pos.getZ();
    }
    String worldName = vars.get(new String[]{"world"});
    UWorld world = worldName == null ? new UWorld(sender.getEntityWorld()) : UWorld.getWorld(worldName);
    if (world == null) {
        feedback(sender, "No matching world");
        return;
    }
    feedback(sender, Evaluator.cmdPaste(world, name, posX, posY, posZ, rotateX, rotateY, rotateZ, flipX, flipY, flipZ, isVillage, isInsecure));
}
项目:CustomWorldGen    文件:CommandMessage.java   
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    /**
     * Returns a List of strings (chosen from the given strings) which the last word in the given string array is a
     * beginning-match for. (Tab completion).
     */
    return getListOfStringsMatchingLastWord(args, server.getAllUsernames());
}
项目:World-Border    文件:CmdKnockback.java   
@Override
public void cmdStatus(ICommandSender sender)
{
    double kb = Config.getKnockBack();
    if (kb < 1)
        Util.chat(sender, C_HEAD + "Knockback is set to 0, disabling border enforcement.");
    else
        Util.chat(sender, C_HEAD + "Knockback is set to " + kb + " blocks inside the border.");
}
项目:Ye-Olde-Chat    文件:CommandSetRoleplayMode.java   
@Override
public void processCommand(ICommandSender par1ICommandSender,
        String[] par2ArrayOfStr) {
    EntityPlayer player = (EntityPlayer) par1ICommandSender;
    PlayerRoleplayMode props = PlayerRoleplayMode.get(player);
    props.setRoleplayMode(!props.getRoleplayMode(), true);
    player.addChatComponentMessage(new ChatComponentText("Your nickname is now:"
        + "."));
}
项目:BaseClient    文件:CommandPardonIp.java   
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
    return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getKeys()) : null;
}