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

项目:TFC2    文件:DebugCommand.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] params)
{
    EntityPlayerMP player;
    try {
        player = getCommandSenderAsPlayer(sender);
    } catch (PlayerNotFoundException e) {
        return;
    }
    WorldServer world = server.worldServerForDimension(player.getEntityWorld().provider.getDimension());

    if(params.length == 1 && params[0].equalsIgnoreCase("report"))
    {
        int xM =player.getPosition().getX() >> 12;
        int zM =player.getPosition().getZ() >> 12;
        String out = "World Seed: [" + world.getSeed() + "] | IslandMap: [" +xM + "," + zM + "] | PlayerPos: [" + player.getPosition().toString() + "]";
        StringSelection selection = new StringSelection(out);
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        if(clipboard != null)
            clipboard.setContents(selection, selection);

    }
}
项目:TFC2    文件:DebugCommand.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] params)
{
    EntityPlayerMP player;
    try {
        player = getCommandSenderAsPlayer(sender);
    } catch (PlayerNotFoundException e) {
        return;
    }
    WorldServer world = server.worldServerForDimension(player.getEntityWorld().provider.getDimension());

    if(params.length == 1 && params[0].equalsIgnoreCase("report"))
    {
        int xM =player.getPosition().getX() >> 12;
        int zM =player.getPosition().getZ() >> 12;
        String out = "World Seed: [" + world.getSeed() + "] | IslandMap: [" +xM + "," + zM + "] | PlayerPos: [" + player.getPosition().toString() + "]";
        StringSelection selection = new StringSelection(out);
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        if(clipboard != null)
            clipboard.setContents(selection, selection);

    }
}
项目:ServerTools-PERMISSION    文件:CommandRemoveUUID.java   
@Override
public void processCommand(ICommandSender sender, String[] args) {

    if (args.length != 2)
        throw new WrongUsageException(getCommandUsage(sender));

    try {
        UUID uuid = UUID.fromString(args[0]);

        Group group = PermissionManager.getGroup(args[1]);

        if (group == null)
            throw new PlayerNotFoundException("That group doesn't exist");

        if (group.removePlayer(uuid)) {
            ServerToolsPermission.log.info("Removed UUID {} from the {} group", args[0], group.getName());
            notifyOperators(sender, this, String.format("Removed %s from the %s group", args[0], group.getName()));
        } else {
            throw new PlayerNotFoundException("That player wasn't a member of that group");
        }

    } catch (IllegalArgumentException e) {
        throw new CommandException(e.getMessage());
    }
}
项目:ServerTools-PERMISSION    文件:CommandRemovePerm.java   
@Override
public void processCommand(ICommandSender sender, String[] args) {

    if (args.length < 2) {
        throw new WrongUsageException(getCommandUsage(sender));
    }

    String perm = ""; // *Sigh*
    for (int i = 0; i < args.length - 1; i++) {
        perm += args[i] + " ";
    }
    perm = perm.trim();

    String groupName = args[args.length - 1];
    Group group = PermissionManager.getGroup(groupName);

    if (group == null) {
        throw new PlayerNotFoundException("Group: " + groupName + " doesn't exist");
    }

    if (group.removePerm(perm)) {
        notifyOperators(sender, this, String.format("Removed perm: %s From group: %s", perm, groupName));
    } else {
        throw new CommandException(String.format("Group: %s didn't have perm: %s", groupName, perm));
    }
}
项目:ServerTools-PERMISSION    文件:CommandAddUUID.java   
@Override
public void processCommand(ICommandSender sender, String[] args) {

    if (args.length != 2)
        throw new WrongUsageException(getCommandUsage(sender));

    try {
        UUID uuid = UUID.fromString(args[0]);

        Group group = PermissionManager.getGroup(args[1]);

        if (group == null)
            throw new PlayerNotFoundException("That group doesn't exist");

        group.addPlayer(uuid);

        ServerToolsPermission.log.info("Added UUID {} to the {} group", args[0], group.getName());
        notifyOperators(sender, this, String.format("Added %s to the %s group", args[0], group.getName()));

    } catch (IllegalArgumentException e) {
        throw new CommandException(e.getMessage());
    }
}
项目:ServerTools-PERMISSION    文件:CommandAddPerm.java   
@Override
public void processCommand(ICommandSender sender, String[] args) {

    if (args.length < 2) {
        throw new WrongUsageException(getCommandUsage(sender));
    }

    String perm = ""; // *Sigh*
    for (int i = 0; i < args.length - 1; i++) {
        perm += args[i] + " ";
    }
    perm = perm.trim();

    String groupName = args[args.length - 1];
    Group group = PermissionManager.getGroup(groupName);

    if (group == null) {
        throw new PlayerNotFoundException("Group: " + groupName + " doesn't exist");
    }

    group.addPerm(perm);

    notifyOperators(sender, this, String.format("Added perm: %s To group: %s", perm, groupName));
}
项目:RuneCraftery    文件:CommandServerMessage.java   
public void func_71515_b(ICommandSender p_71515_1_, String[] p_71515_2_) {
   if(p_71515_2_.length < 2) {
      throw new WrongUsageException("commands.message.usage", new Object[0]);
   } else {
      EntityPlayerMP var3 = func_82359_c(p_71515_1_, p_71515_2_[0]);
      if(var3 == null) {
         throw new PlayerNotFoundException();
      } else if(var3 == p_71515_1_) {
         throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
      } else {
         String var4 = func_82361_a(p_71515_1_, p_71515_2_, 1, !(p_71515_1_ instanceof EntityPlayer));
         var3.func_70006_a(ChatMessageComponent.func_111082_b("commands.message.display.incoming", new Object[]{p_71515_1_.func_70005_c_(), var4}).func_111059_a(EnumChatFormatting.GRAY).func_111063_b(Boolean.valueOf(true)));
         p_71515_1_.func_70006_a(ChatMessageComponent.func_111082_b("commands.message.display.outgoing", new Object[]{var3.func_70005_c_(), var4}).func_111059_a(EnumChatFormatting.GRAY).func_111063_b(Boolean.valueOf(true)));
      }
   }
}
项目:RuneCraftery    文件:CommandBase.java   
public static String func_82361_a(ICommandSender p_82361_0_, String[] p_82361_1_, int p_82361_2_, boolean p_82361_3_) {
   StringBuilder var4 = new StringBuilder();

   for(int var5 = p_82361_2_; var5 < p_82361_1_.length; ++var5) {
      if(var5 > p_82361_2_) {
         var4.append(" ");
      }

      String var6 = p_82361_1_[var5];
      if(p_82361_3_) {
         String var7 = PlayerSelector.func_82385_b(p_82361_0_, var6);
         if(var7 != null) {
            var6 = var7;
         } else if(PlayerSelector.func_82378_b(var6)) {
            throw new PlayerNotFoundException();
         }
      }

      var4.append(var6);
   }

   return var4.toString();
}
项目:RuneCraftery    文件:CommandServerKick.java   
public void func_71515_b(ICommandSender p_71515_1_, String[] p_71515_2_) {
   if(p_71515_2_.length > 0 && p_71515_2_[0].length() > 1) {
      EntityPlayerMP var3 = MinecraftServer.func_71276_C().func_71203_ab().func_72361_f(p_71515_2_[0]);
      String var4 = "Kicked by an operator.";
      boolean var5 = false;
      if(var3 == null) {
         throw new PlayerNotFoundException();
      } else {
         if(p_71515_2_.length >= 2) {
            var4 = func_82360_a(p_71515_1_, p_71515_2_, 1);
            var5 = true;
         }

         var3.field_71135_a.func_72565_c(var4);
         if(var5) {
            func_71522_a(p_71515_1_, "commands.kick.success.reason", new Object[]{var3.func_70023_ak(), var4});
         } else {
            func_71522_a(p_71515_1_, "commands.kick.success", new Object[]{var3.func_70023_ak()});
         }

      }
   } else {
      throw new WrongUsageException("commands.kick.usage", new Object[0]);
   }
}
项目:RuneCraftery    文件:CommandServerBanIp.java   
public void func_71515_b(ICommandSender p_71515_1_, String[] p_71515_2_) {
   if(p_71515_2_.length >= 1 && p_71515_2_[0].length() > 1) {
      Matcher var3 = field_71545_a.matcher(p_71515_2_[0]);
      String var4 = null;
      if(p_71515_2_.length >= 2) {
         var4 = func_82360_a(p_71515_1_, p_71515_2_, 1);
      }

      if(var3.matches()) {
         this.func_71544_a(p_71515_1_, p_71515_2_[0], var4);
      } else {
         EntityPlayerMP var5 = MinecraftServer.func_71276_C().func_71203_ab().func_72361_f(p_71515_2_[0]);
         if(var5 == null) {
            throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
         }

         this.func_71544_a(p_71515_1_, var5.func_71114_r(), var4);
      }

   } else {
      throw new WrongUsageException("commands.banip.usage", new Object[0]);
   }
}
项目:HxCSkills    文件:CommandSetSkills.java   
@Override
public void handleCommand(ICommandSender sender, String[] args) throws PlayerNotFoundException {
    EntityPlayerMP Sender = (EntityPlayerMP)sender;
    if (args.length >= 2) SkillToLevel = args[1].toLowerCase();
    if (args.length >= 3) HowManyLevels = args[2];
    if (args.length >= 4) target = CommandBase.getPlayer(sender, args[3]);
    else target = Sender;
    Skills.update(target);
    NBTTagCompound data = Skills.SkillData(target);

    if (!HowManyLevels.equals(""))HML = Integer.parseInt(HowManyLevels);

    if (!SkillToLevel.equals("")){
        for (int i = 0; i <= SkillNames.length; i++) {
            if (SkillToLevel.toLowerCase().contains(SkillNames[i].toLowerCase())) TargetSkill = i;
            else Sender.addChatMessage(new ChatComponentText("Current compatible arguments are: Stealth, Immunity, Fly, LegStrength, TorsoStrength, HeadStrength, FeetStrength, Health, Stamina."));
        }
        SL = data.getInteger(SkillNamesFull[TargetSkill]);
        TargetSkillName = SkillNamesFull[TargetSkill];

        if (PermissionsHandler.canUseCommand(Configurations.SetSkillsPL, Sender)) data.setInteger(TargetSkillName, (SL + HML));
        else Sender.addChatMessage(new ChatComponentText("\u00A74You're unable to use this command."));
        Skills.saveSkillData(target, data);

    } else Sender.addChatMessage(new ChatComponentText("\u00A74You must specify a skill name!"));
}
项目:ServerTools-CORE    文件:CommandSilence.java   
@Override
public void processCommand(final ICommandSender sender, final String[] args) throws CommandException {
    if (args.length != 2) throw new WrongUsageException(getCommandUsage(sender));
    GameProfile gameProfile = ServerUtils.getGameProfile(args[1]).orElseThrow(PlayerNotFoundException::new);
    final UUID uuid = gameProfile.getId();
    if ("add".equals(args[0])) {
        if (silenceHandler.addSilence(uuid)) {
            notifyOperators(sender, this, "Silenced %s", args[1]);
        } else {
            throw new CommandException("That player is already silenced");
        }
    } else if ("remove".equals(args[0])) {
        if (silenceHandler.removeSilence(uuid)) {
            notifyOperators(sender, this, "Removed silence on %s", args[1]);
        } else {
            throw new CommandException("That player was not silenced");
        }
    } else {
        throw new WrongUsageException(getCommandUsage(sender));
    }
}
项目:ServerTools-CORE    文件:CommandUUID.java   
@Override
public void processCommand(final ICommandSender sender, final String[] args) throws CommandException {
    GameProfile gameProfile;
    if (args.length == 1) {
        gameProfile = ServerUtils.getGameProfile(args[0]).orElseThrow(PlayerNotFoundException::new);
    } else if (args.length == 0) {
        gameProfile = getCommandSenderAsPlayer(sender).getGameProfile();
    } else {
        throw new WrongUsageException(getCommandUsage(sender));
    }

    ChatComponentText text = new ChatComponentText(gameProfile.getName() + "'s UUID is: ");
    ChatComponentText uuidText = new ChatComponentText(gameProfile.getId().toString());
    uuidText.getChatStyle().setColor(EnumChatFormatting.AQUA);
    text.appendSibling(uuidText);
    sender.addChatMessage(text);
}
项目:GriefGuardian    文件:AdminMode.java   
@Override
public void processCommand(ICommandSender commandSender, String[] args) {
    EntityPlayerMP player;
    try {
        player = getCommandSenderAsPlayer(commandSender);
    } catch (PlayerNotFoundException e) {
        e.printStackTrace();
        return;
    }
    if (PlayerDataUtils.hasMasterACL(player)){
        PlayerDataUtils.setMasterACL(player, false);
        commandSender.addChatMessage(new ChatComponentText("griefguardian.commands.adminmodeoff"));
    }else{
        PlayerDataUtils.setMasterACL(player, true);
        commandSender.addChatMessage(new ChatComponentText("griefguardian.commands.adminmodeon"));
    }
}
项目:GriefGuardian    文件:AdminInvisibility.java   
@Override
public void processCommand(ICommandSender commandSender, String[] args) {
    EntityPlayerMP player;
    try {
        player = getCommandSenderAsPlayer(commandSender);
    } catch (PlayerNotFoundException e) {
        e.printStackTrace();
        return;
    }
    if (PlayerDataUtils.isAdminInvisible(player)){
        PlayerDataUtils.setAdminInvisiblity(player, false);
        commandSender.addChatMessage(new ChatComponentText("griefguardian.commands.admininvisoff"));
    }else{
        PlayerDataUtils.setAdminInvisiblity(player, true);
        commandSender.addChatMessage(new ChatComponentText("griefguardian.commands.admininvison"));
    }
}
项目:GriefGuardian    文件:ActionLogEventHandler.java   
@SubscribeEvent
public void onServerCommand(CommandEvent event){
    EntityPlayerMP player;
    try {
        player = CommandBase.getCommandSenderAsPlayer(event.sender);
    } catch (PlayerNotFoundException e) {
        e.printStackTrace();
        return;
    }
    String cmd = event.command.getCommandName();
    for (String s : event.parameters)
        cmd += " " + s;
    GriefGuardian._dal.logAction(
            player, 
            Actions.COMMAND, 
            (int)Math.floor(player.posX), 
            (int)Math.floor(player.posY), 
            (int)Math.floor(player.posZ), 
            null, 
            cmd
            );
}
项目:MCManager    文件:CommandHeal.java   
@Override
public void processCommand(ICommandSender sender, String[] args)
{
    String username = args.length < 1 ? null : args[0];
    EntityPlayer player = username == null ? getCommandSenderAsPlayer(sender) :
                                             MCManager.instance.getServer().getConfigurationManager().getPlayerForUsername(username);

    if(player == null)
        throw new PlayerNotFoundException();

    float healthAmount = player.getMaxHealth() - player.getHealth();
    int foodAmount = (int)player.getMaxHealth() - player.getFoodStats().getFoodLevel();

    player.heal(healthAmount);
    player.getFoodStats().addStats(foodAmount, 20.0F);
    notifyAdmins(sender, "Healing " + player.username);
}
项目:minecraft-roguelike    文件:CommandRouteDungeon.java   
public static Coord getLocation(ICommandContext context, List<String> args) throws NumberInvalidException, PlayerNotFoundException{
    ArgumentParser ap = new ArgumentParser(args);

    Coord pos = context.getPos();

    if(ap.match(0, "here") || ap.match(0, "nearby")){
        return new Coord((int) pos.getX(), 0, (int) pos.getZ());
    } else {
        try {
            int x = CommandBase.parseInt(ap.get(0));
            int z = CommandBase.parseInt(ap.get(1));
            return new Coord(x, 0, z);
        } catch (NumberInvalidException e) {
            context.sendMessage("Failure: Invalid Coords: X Z", MessageType.ERROR);
            throw(e);
        }
    }
}
项目:DecompiledMinecraft    文件:CommandBanIp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && args[0].length() > 1)
    {
        IChatComponent ichatcomponent = args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null;
        Matcher matcher = field_147211_a.matcher(args[0]);

        if (matcher.matches())
        {
            this.func_147210_a(sender, args[0], ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
        }
        else
        {
            EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(args[0]);

            if (entityplayermp == null)
            {
                throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
            }

            this.func_147210_a(sender, entityplayermp.getPlayerIP(), ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
        }
    }
    else
    {
        throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
}
项目:DecompiledMinecraft    文件:CommandMessage.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), ichatcomponent.createCopy()});
            ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), ichatcomponent.createCopy()});
            chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(chatcomponenttranslation);
            sender.addChatMessage(chatcomponenttranslation1);
        }
    }
}
项目:DecompiledMinecraft    文件:CommandBanIp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && args[0].length() > 1)
    {
        IChatComponent ichatcomponent = args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null;
        Matcher matcher = field_147211_a.matcher(args[0]);

        if (matcher.matches())
        {
            this.func_147210_a(sender, args[0], ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
        }
        else
        {
            EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(args[0]);

            if (entityplayermp == null)
            {
                throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
            }

            this.func_147210_a(sender, entityplayermp.getPlayerIP(), ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
        }
    }
    else
    {
        throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
}
项目:DecompiledMinecraft    文件:CommandMessage.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), ichatcomponent.createCopy()});
            ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), ichatcomponent.createCopy()});
            chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(chatcomponenttranslation);
            sender.addChatMessage(chatcomponenttranslation1);
        }
    }
}
项目:BaseClient    文件:CommandBanIp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && args[0].length() > 1)
    {
        IChatComponent ichatcomponent = args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null;
        Matcher matcher = field_147211_a.matcher(args[0]);

        if (matcher.matches())
        {
            this.func_147210_a(sender, args[0], ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
        }
        else
        {
            EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(args[0]);

            if (entityplayermp == null)
            {
                throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
            }

            this.func_147210_a(sender, entityplayermp.getPlayerIP(), ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
        }
    }
    else
    {
        throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
}
项目:BaseClient    文件:CommandMessage.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), ichatcomponent.createCopy()});
            ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), ichatcomponent.createCopy()});
            chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(chatcomponenttranslation);
            sender.addChatMessage(chatcomponenttranslation1);
        }
    }
}
项目:BaseClient    文件:CommandBanIp.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length >= 1 && args[0].length() > 1)
    {
        IChatComponent ichatcomponent = args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null;
        Matcher matcher = field_147211_a.matcher(args[0]);

        if (matcher.matches())
        {
            this.func_147210_a(sender, args[0], ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
        }
        else
        {
            EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(args[0]);

            if (entityplayermp == null)
            {
                throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
            }

            this.func_147210_a(sender, entityplayermp.getPlayerIP(), ichatcomponent == null ? null : ichatcomponent.getUnformattedText());
        }
    }
    else
    {
        throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
}
项目:BaseClient    文件:CommandMessage.java   
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), ichatcomponent.createCopy()});
            ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), ichatcomponent.createCopy()});
            chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(chatcomponenttranslation);
            sender.addChatMessage(chatcomponenttranslation1);
        }
    }
}
项目:Backmemed    文件:CommandBanIp.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)
    {
        ITextComponent itextcomponent = args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null;
        Matcher matcher = IP_PATTERN.matcher(args[0]);

        if (matcher.matches())
        {
            this.banIp(server, sender, args[0], itextcomponent == null ? null : itextcomponent.getUnformattedText());
        }
        else
        {
            EntityPlayerMP entityplayermp = server.getPlayerList().getPlayerByUsername(args[0]);

            if (entityplayermp == null)
            {
                throw new PlayerNotFoundException("commands.banip.invalid");
            }

            this.banIp(server, sender, entityplayermp.getPlayerIP(), itextcomponent == null ? null : itextcomponent.getUnformattedText());
        }
    }
    else
    {
        throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
}
项目:Backmemed    文件:CommandMessage.java   
/**
 * 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.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(server, sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget");
        }
        else
        {
            ITextComponent itextcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), itextcomponent.createCopy()});
            TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), itextcomponent.createCopy()});
            textcomponenttranslation.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            textcomponenttranslation1.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(textcomponenttranslation);
            sender.addChatMessage(textcomponenttranslation1);
        }
    }
}
项目:CustomWorldGen    文件:CommandBanIp.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)
    {
        ITextComponent itextcomponent = args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null;
        Matcher matcher = IP_PATTERN.matcher(args[0]);

        if (matcher.matches())
        {
            this.banIp(server, sender, args[0], itextcomponent == null ? null : itextcomponent.getUnformattedText());
        }
        else
        {
            EntityPlayerMP entityplayermp = server.getPlayerList().getPlayerByUsername(args[0]);

            if (entityplayermp == null)
            {
                throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
            }

            this.banIp(server, sender, entityplayermp.getPlayerIP(), itextcomponent == null ? null : itextcomponent.getUnformattedText());
        }
    }
    else
    {
        throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
}
项目:CustomWorldGen    文件:CommandMessage.java   
/**
 * 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.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(server, sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            ITextComponent itextcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), itextcomponent.createCopy()});
            TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), itextcomponent.createCopy()});
            textcomponenttranslation.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            textcomponenttranslation1.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(textcomponenttranslation);
            sender.addChatMessage(textcomponenttranslation1);
        }
    }
}
项目:mobycraft    文件:BuildContainerCommands.java   
@Override
public void teleport() throws PlayerNotFoundException {
    if (!(sender instanceof EntityPlayer)) {
        return;
    }

    if (boxContainers.size() < 1) {
        refreshAndBuildContainers();
        if (boxContainers.size() < 1) {
            sendErrorMessage("No containers currently existing!");
        }
    }

    if (Utils.checkIfArgIsNull(args, 0)) {
        sendErrorMessage("Container name not specified! Command is used as /docker rm <name> .");
        return;
    }

    Container container = listCommands.getFromAllWithName("/" + arg1);

    if (container == null) {
        sendErrorMessage("No container exists with the name \"" + arg1
                + "\"");
    }

    BoxContainer boxContainer = listCommands
            .getBoxContainerWithID(container.getId());

    BlockPos pos = boxContainer.getPosition();

    getCommandSenderAsPlayer(sender).playerNetServerHandler
            .setPlayerLocation(pos.getX() + 0.5, pos.getY() + 0.5,
                    pos.getZ() - 0.5, 0, 0);
}
项目:mobycraft    文件:BuildContainerCommands.java   
@Override
public EntityPlayerMP getCommandSenderAsPlayer(ICommandSender sender)
        throws PlayerNotFoundException {
    if (sender instanceof EntityPlayerMP) {
        return (EntityPlayerMP) sender;
    } else {
        throw new PlayerNotFoundException(
                "You must specify which player you wish to perform this action on.",
                new Object[0]);
    }
}
项目:LookingGlass    文件:CommandBaseAdv.java   
public static EntityPlayerMP getTargetPlayer(ICommandSender sender, String target) {
    EntityPlayerMP entityplayermp = PlayerSelector.matchOnePlayer(sender, target);

    if (entityplayermp == null) {
        entityplayermp = MinecraftServer.getServer().getConfigurationManager().func_152612_a(target);
    }
    if (entityplayermp == null) { throw new PlayerNotFoundException(); }
    return entityplayermp;
}
项目:Hemomancy    文件:CommandSummonControlTest.java   
@Override
public void execute(ICommandSender icommandsender, String[] astring) throws PlayerNotFoundException 
{
    EntityPlayerMP targetPlayer = getCommandSenderAsPlayer(icommandsender);

    targetPlayer.openGui(Hemomancy.instance, GuiHandler.SUMMON_GUI, targetPlayer.worldObj, (int)targetPlayer.posX, (int)targetPlayer.posY, (int)targetPlayer.posZ);
}
项目:Hemomancy    文件:CommandHUD.java   
@Override
public void execute(ICommandSender icommandsender, String[] astring) throws PlayerNotFoundException 
{
    EntityPlayerMP targetPlayer = getCommandSenderAsPlayer(icommandsender);

    targetPlayer.openGui(Hemomancy.instance, GuiHandler.HUD_GUI, targetPlayer.worldObj, (int)targetPlayer.posX, (int)targetPlayer.posY, (int)targetPlayer.posZ);
}
项目:Resilience-Client-Source    文件:CommandBanIp.java   
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
    if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].length() > 1)
    {
        Matcher var3 = field_147211_a.matcher(par2ArrayOfStr[0]);
        IChatComponent var4 = null;

        if (par2ArrayOfStr.length >= 2)
        {
            var4 = func_147178_a(par1ICommandSender, par2ArrayOfStr, 1);
        }

        if (var3.matches())
        {
            this.func_147210_a(par1ICommandSender, par2ArrayOfStr[0], var4 == null ? null : var4.getUnformattedText());
        }
        else
        {
            EntityPlayerMP var5 = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par2ArrayOfStr[0]);

            if (var5 == null)
            {
                throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
            }

            this.func_147210_a(par1ICommandSender, var5.getPlayerIP(), var4 == null ? null : var4.getUnformattedText());
        }
    }
    else
    {
        throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
}
项目:Resilience-Client-Source    文件:CommandMessage.java   
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr)
{
    if (par2ArrayOfStr.length < 2)
    {
        throw new WrongUsageException("commands.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayerMP var3 = getPlayer(par1ICommandSender, par2ArrayOfStr[0]);

        if (var3 == null)
        {
            throw new PlayerNotFoundException();
        }
        else if (var3 == par1ICommandSender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            IChatComponent var4 = func_147176_a(par1ICommandSender, par2ArrayOfStr, 1, !(par1ICommandSender instanceof EntityPlayer));
            ChatComponentTranslation var5 = new ChatComponentTranslation("commands.message.display.incoming", new Object[] {par1ICommandSender.func_145748_c_(), var4.createCopy()});
            ChatComponentTranslation var6 = new ChatComponentTranslation("commands.message.display.outgoing", new Object[] {var3.func_145748_c_(), var4.createCopy()});
            var5.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            var6.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true));
            var3.addChatMessage(var5);
            par1ICommandSender.addChatMessage(var6);
        }
    }
}
项目:D3Log    文件:D3LogCommand.java   
private void lookupTask(ICommandSender sender, String[] args, boolean rollback)
{
    if (args.length != 2) throw new WrongUsageException("You must specify which player you wish to perform this action on.");
    UUID uuid;
    try
    {
        uuid = getPlayer(sender, args[1]).getUniqueID();
    }
    catch (PlayerNotFoundException ignored)
    {
        uuid = UUID.fromString(args[1]);
    }
    new LookupTask(getCommandSenderAsPlayer(sender)).setUUID(uuid).setRollback(rollback).go();
}
项目:ExpandedRailsMod    文件:CommandBanIp.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)
    {
        ITextComponent itextcomponent = args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null;
        Matcher matcher = IP_PATTERN.matcher(args[0]);

        if (matcher.matches())
        {
            this.banIp(server, sender, args[0], itextcomponent == null ? null : itextcomponent.getUnformattedText());
        }
        else
        {
            EntityPlayerMP entityplayermp = server.getPlayerList().getPlayerByUsername(args[0]);

            if (entityplayermp == null)
            {
                throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]);
            }

            this.banIp(server, sender, entityplayermp.getPlayerIP(), itextcomponent == null ? null : itextcomponent.getUnformattedText());
        }
    }
    else
    {
        throw new WrongUsageException("commands.banip.usage", new Object[0]);
    }
}
项目:ExpandedRailsMod    文件:CommandMessage.java   
/**
 * 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.message.usage", new Object[0]);
    }
    else
    {
        EntityPlayer entityplayer = getPlayer(server, sender, args[0]);

        if (entityplayer == sender)
        {
            throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]);
        }
        else
        {
            ITextComponent itextcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer));
            TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), itextcomponent.createCopy()});
            TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), itextcomponent.createCopy()});
            textcomponenttranslation.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            textcomponenttranslation1.getStyle().setColor(TextFormatting.GRAY).setItalic(Boolean.valueOf(true));
            entityplayer.addChatMessage(textcomponenttranslation);
            sender.addChatMessage(textcomponenttranslation1);
        }
    }
}