Ejemplo n.º 1
0
 public void func_71515_b(ICommandSender p_71515_1_, String[] p_71515_2_) {
   p_71515_1_.func_70006_a(
       p_71515_1_.func_70004_a(
           "commands.players.list",
           new Object[] {
             Integer.valueOf(MinecraftServer.func_71276_C().func_71233_x()),
             Integer.valueOf(MinecraftServer.func_71276_C().func_71275_y())
           }));
   p_71515_1_.func_70006_a(MinecraftServer.func_71276_C().func_71203_ab().func_72398_c());
 }
Ejemplo n.º 2
0
 @Override
 public void processCommand(ICommandSender arg0, String[] arg1) {
   // TODO Auto-generated method stub
   String[] t = new String[CommandJailAdd.jails.keySet().size()];
   t = CommandJailAdd.jails.keySet().toArray(t);
   arg0.sendChatToPlayer(this.joinNiceString(t));
 }
Ejemplo n.º 3
0
  public void processCommand(ICommandSender sender, String[] args) {
    if (args.length != 2) {
      throw new WrongUsageException(getCommandUsage(sender), new Object[0]);
    }

    EntityPlayerMP player = ((EntityPlayerMP) sender);
    ItemStack stack = player.inventory.getCurrentItem();

    if (args[0].equalsIgnoreCase("add")) {
      NBTTagCompound regionSelection = (NBTTagCompound) stack.getTagCompound().copy();

      if (regionSelection.hasKey("pos1") && regionSelection.hasKey("pos2")) {
        if (SimpleRegions.regionData.hasKey(args[1])) {
          throw new WrongUsageException("Region name already used.");
        } else {
          regionSelection.setString("Owner", sender.getCommandSenderName());
          SimpleRegions.regionData.setCompoundTag(args[1], regionSelection);
          SimpleRegions.availableRegions.add(args[1]);
          sender.sendChatToPlayer("Region " + args[1] + " added. You have been set as owner.");
        }
      } else {
        throw new WrongUsageException("Selection has to be square.");
      }
    } else if (args[0].equalsIgnoreCase("remove")) {
      if (SimpleRegions.regionData.hasKey(args[1])) {
        NBTTagCompound newData = new NBTTagCompound();
        Iterator i = SimpleRegions.regionData.getTags().iterator();
        while (i.hasNext()) {
          NBTBase tag = (NBTBase) i.next();
          if (!tag.getName().equals(args[1])) {
            newData.setTag(args[1], tag);
          } else {
            sender.sendChatToPlayer("Region " + args[1] + " removed.");
            SimpleRegions.availableRegions.remove(tag.getName());
            return;
          }
        }
      } else {
        sender.sendChatToPlayer("Region " + args[1] + " not found!");
      }
    } else {
      throw new WrongUsageException(getCommandUsage(sender), new Object[0]);
    }
  }
Ejemplo n.º 4
0
 public String func_71518_a(ICommandSender p_71518_1_) {
   return p_71518_1_.func_70004_a("commands.effect.usage", new Object[0]);
 }
Ejemplo n.º 5
0
 public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) {
   return Permissions.hasPermission(
       par1ICommandSender.getCommandSenderName(), "SM." + getCommandName());
 }
Ejemplo n.º 6
0
 public boolean canCommandSenderUseCommand(ICommandSender arg0) {
   return CommandsMain.isSinglePlayer
       ? true
       : CommandsMain.isPowerUser(arg0.getCommandSenderName());
 }
Ejemplo n.º 7
0
 public boolean canCommandSenderUseCommand(ICommandSender sender) {
   return Permissions.hasPermission(sender.getCommandSenderName(), "SR.all");
 }
  @Override
  public void processCommand(ICommandSender var1, String[] var2) {
    boolean isConsole = !(var1 instanceof EntityPlayer);
    String action;
    String who = "";
    try {
      action = var2[0].toLowerCase();

    } catch (ArrayIndexOutOfBoundsException e) {
      throw new WrongUsageException("/permissions <add|remove|list> player [permission]");
    }
    if (!validActions.contains(action.toLowerCase())) {
      throw new WrongUsageException("/permissions <add|remove|list> player [permission]");
    }

    try {
      who = var2[1].toLowerCase();
    } catch (Exception e) {
      if (action == "list") {
        who = "__GLOBAL__PERMISSION__LISTING";
      } else {
        throw new WrongUsageException("/permissions <add|remove|list> player [permission]");
      }
    }

    String what = "";
    if (action == "add" || action == "remove") {
      try {
        what = var2[2];
      } catch (Exception e) {
        throw new WrongUsageException("/permissions <add|remove|list> player [permission]");
      }
    }

    if (action == "add") {
      Permissions.givePlayerPermission(
          Permissions.getPermissionFromPath(what),
          MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(who));
      var1.sendChatToPlayer(ChatColor.YELLOW + "Success!" + ChatColor.RESET);
    } else if (action == "remove") {
      Permissions.removePlayerPermission(
          Permissions.getPermissionFromPath(what),
          MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(who));
      var1.sendChatToPlayer(ChatColor.YELLOW + "Success!" + ChatColor.RESET);
    } else if (action.equals("list")) {
      if (who == "__GLOBAL__PERMISSION__LISTING") {
        var1.sendChatToPlayer("Available permissions: ");
        for (IPermission j : Permissions.allPermissions) {
          var1.sendChatToPlayer(
              ChatColor.GREEN + j.getName() + ChatColor.RESET + " " + j.getConfigurationPath());
        }
      }
      var1.sendChatToPlayer(
          ChatColor.GREEN + "Permissions for " + ChatColor.YELLOW + var2[1] + ":");
      try {
        for (IPermission j : Permissions.getPermissionsForPlayer(who)) {
          var1.sendChatToPlayer(
              ChatColor.GREEN + j.getName() + ChatColor.RESET + " " + j.getConfigurationPath());
        }
      } catch (Exception e) {
        e.printStackTrace();
        var1.sendChatToPlayer("No permissions!");
      }
    } else {
      throw new WrongUsageException("Something __really__ weird happend. Interesting.");
    }
  }