当前位置: 首页>>代码示例>>Java>>正文


Java ICommandSender类代码示例

本文整理汇总了Java中net.minecraft.command.ICommandSender的典型用法代码示例。如果您正苦于以下问题:Java ICommandSender类的具体用法?Java ICommandSender怎么用?Java ICommandSender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ICommandSender类属于net.minecraft.command包,在下文中一共展示了ICommandSender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:abused,项目名称:World-Border,代码行数:23,代码来源:CmdBypasslist.java

示例2: addTabCompletionOptions

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
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;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:CommandWhitelist.java

示例3: resetPlayerScore

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
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});
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:CommandScoreboard.java

示例4: execute

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
/**
 * 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]);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:CommandPardonIp.java

示例5: listObjectives

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
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()}));
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:CommandScoreboard.java

示例6: processCommand

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
/**
 * 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())});
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:CommandSetDefaultSpawnpoint.java

示例7: execute

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
@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);
}
 
开发者ID:abused,项目名称:World-Border,代码行数:19,代码来源:CmdDynmapmsg.java

示例8: getTabCompletionOptions

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:CommandAchievement.java

示例9: func_175779_n

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
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});
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:26,代码来源:CommandScoreboard.java

示例10: execute

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
/**
 * 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]);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:CommandDeOp.java

示例11: spawn

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
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);
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:18,代码来源:NemesisSystemCommand.java

示例12: execGen

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
/** 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));
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:21,代码来源:Evaluator.java

示例13: resetPlayers

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
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});
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:CommandScoreboard.java

示例14: execute

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
/**
 * 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]);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:CommandPardonPlayer.java

示例15: getTabCompletions

import net.minecraft.command.ICommandSender; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:26,代码来源:CommandInvite.java


注:本文中的net.minecraft.command.ICommandSender类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。