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


Java WrongUsageException类代码示例

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


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

示例1: execute

import net.minecraft.command.WrongUsageException; //导入依赖的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:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:CommandDeOp.java

示例2: processCommand

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 0)
    {
        MinecraftServer minecraftserver = MinecraftServer.getServer();
        GameProfile gameprofile = minecraftserver.getConfigurationManager().getOppedPlayers().getGameProfileFromName(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.deop.failed", new Object[] {args[0]});
        }
        else
        {
            minecraftserver.getConfigurationManager().removeOp(gameprofile);
            notifyOperators(sender, this, "commands.deop.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.deop.usage", new Object[0]);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:CommandDeOp.java

示例3: processCommand

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception);
            throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()});
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:CommandMessageRaw.java

示例4: processCommand

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 0)
    {
        MinecraftServer minecraftserver = MinecraftServer.getServer();
        GameProfile gameprofile = minecraftserver.getPlayerProfileCache().getGameProfileForUsername(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.op.failed", new Object[] {args[0]});
        }
        else
        {
            minecraftserver.getConfigurationManager().addOp(gameprofile);
            notifyOperators(sender, this, "commands.op.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.op.usage", new Object[0]);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:CommandOp.java

示例5: handleTracking

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
private void handleTracking(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length != 3)
    {
        throw new WrongUsageException("commands.forge.usage.tracking");
    }
    String type = args[1];
    int duration = parseInt(args[2], 1, 60);

    if ("te".equals(type))
    {
        doTurnOnTileEntityTracking(server, sender, duration);
    }
    else
    {
        throw new WrongUsageException("commands.forge.usage.tracking");
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:ForgeCommand.java

示例6: processCommand

import net.minecraft.command.WrongUsageException; //导入依赖的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: processCommand

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 1)
    {
        Matcher matcher = CommandBanIp.field_147211_a.matcher(args[0]);

        if (matcher.matches())
        {
            MinecraftServer.getServer().getConfigurationManager().getBannedIPs().removeEntry(args[0]);
            notifyOperators(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:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:CommandPardonIp.java

示例8: processCommand

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length == 1 && args[0].length() > 0)
    {
        MinecraftServer minecraftserver = MinecraftServer.getServer();
        GameProfile gameprofile = minecraftserver.getConfigurationManager().getBannedPlayers().isUsernameBanned(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.unban.failed", new Object[] {args[0]});
        }
        else
        {
            minecraftserver.getConfigurationManager().getBannedPlayers().removeEntry(gameprofile);
            notifyOperators(sender, this, "commands.unban.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.unban.usage", new Object[0]);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:CommandPardonPlayer.java

示例9: execute

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.tellraw.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(server, sender, args[0]);
        String s = buildString(args, 1);

        try
        {
            ITextComponent itextcomponent = ITextComponent.Serializer.jsonToComponent(s);
            entityplayer.addChatMessage(TextComponentUtils.processComponent(sender, itextcomponent, entityplayer));
        }
        catch (JsonParseException jsonparseexception)
        {
            /**
             * Convert a JsonParseException into a user-friendly exception
             */
            throw toSyntaxException(jsonparseexception);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:CommandMessageRaw.java

示例10: execute

import net.minecraft.command.WrongUsageException; //导入依赖的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:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:CommandPardonIp.java

示例11: setSteps

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
private void setSteps(IIfEntryStore store, ICommandSender sender, String act, String res) throws CommandException
{
    int steps;
    switch (act)
    {
        case "unlock":
            steps = PurMag.INSTANCE.getIfRegistry().getEntry(res).getSteps().size();
            break;
        case "lock":
            steps = 0;
            break;
        default:
            throw new WrongUsageException(getUsage(sender));
    }
    store.setSteps(res, steps);
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:17,代码来源:CommandIf.java

示例12: spawn

import net.minecraft.command.WrongUsageException; //导入依赖的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

示例13: execute

import net.minecraft.command.WrongUsageException; //导入依赖的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.getPlayerProfileCache().getGameProfileForUsername(args[0]);

        if (gameprofile == null)
        {
            throw new CommandException("commands.op.failed", new Object[] {args[0]});
        }
        else
        {
            server.getPlayerList().addOp(gameprofile);
            notifyCommandListener(sender, this, "commands.op.success", new Object[] {args[0]});
        }
    }
    else
    {
        throw new WrongUsageException("commands.op.usage", new Object[0]);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:CommandOp.java

示例14: gui

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
private void gui(ICommandSender sender, String[] args) throws CommandException {

		if (!(sender instanceof EntityPlayer)) {
			return;
		}

		EntityPlayerMP player = getCommandSenderAsPlayer(sender);

		if (args.length == 1) {
			NemesisSystem.NETWORK.sendTo(new MessageOpenNemesisGui(player), player);
			return;
		}

		if (args.length == 2) {
			NemesisEntry nemesis = NemesisRegistryProvider.get(player.world).getByName(args[1]);
			NemesisKnowledge knowledge = DiscoveryUtil.getGetPlayerKnowledgeOfNemesis(player, nemesis.getId());
			if (knowledge == null) {
				knowledge = new NemesisKnowledge();
			}
			NemesisSystem.NETWORK.sendTo(new MessageOpenNemesisDetailsGui(nemesis, knowledge), player);
			return;
		}

		throw new WrongUsageException("commands.nemesis_system.usage");
	}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:26,代码来源:NemesisSystemCommand.java

示例15: execute

import net.minecraft.command.WrongUsageException; //导入依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, 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);
    server.getPlayerList().sendPacketToAllPlayers(new SPacketSpawnPosition(blockpos));
    notifyCommandListener(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:CommandSetDefaultSpawnpoint.java


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