@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); } }
@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()); } }
@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)); } }
@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()); } }
@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)); }
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))); } } }
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(); }
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]); } }
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]); } }
@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!")); }
@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)); } }
@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); }
@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")); } }
@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")); } }
@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 ); }
@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); }
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); } } }
/** * 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]); } }
/** * 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); } } }
/** * 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]); } }
/** * 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); } } }
/** * 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]); } }
/** * 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); } } }
@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); }
@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]); } }
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; }
@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); }
@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); }
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]); } }
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); } } }
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(); }