Package com.forgeessentials.api.permissions

Examples of com.forgeessentials.api.permissions.Zone$PermissionList


    private static AreaZone getAreaZone(WorldZone worldZone, String arg)
    {
        try
        {
            Zone z = APIRegistry.perms.getZoneById(arg);
            if (z != null && z instanceof AreaZone)
                return (AreaZone) z;
        }
        catch (NumberFormatException e)
        {
View Full Code Here


  @SubscribeEvent
  public void serverStarted(FEModuleServerPostInitEvent e)
  {
    loadAll();

    Zone zone = APIRegistry.perms.getServerZone();
    if (!borderMap.containsKey(zone.getName()))
    {
      borderMap.put(zone.getName(), new WorldBorder(zone));
    }
  }
View Full Code Here

   */

  @SubscribeEvent
  public void playerMove(PlayerMoveEvent e)
  {
    Zone zone = APIRegistry.perms.getWorldZone(e.entityPlayer.worldObj);
    WorldBorder border = borderMap.get(zone.getName());
    border.check((EntityPlayerMP) e.entityPlayer);
    borderMap.get(APIRegistry.perms.getServerZone().getName()).check((EntityPlayerMP) e.entityPlayer);
  }
View Full Code Here

    if (FMLCommonHandler.instance().getEffectiveSide().isClient())
    {
      return;
    }

    Zone zone = APIRegistry.perms.getWorldZone(e.world);
    if (!borderMap.containsKey(zone.getName()))
    {
      WorldBorder wb = (WorldBorder) DataStorageManager.getReccomendedDriver().loadObject(con, zone.getName());
      if (wb != null)
      {
        borderMap.put(zone.getName(), wb);
      }
      else
      {
        borderMap.put(zone.getName(), new WorldBorder(zone));
      }
    }
  }
View Full Code Here

    if (FMLCommonHandler.instance().getEffectiveSide().isClient())
    {
      return;
    }

    Zone zone = APIRegistry.perms.getWorldZone(e.world);
    borderMap.remove(zone.getName());
  }
View Full Code Here

  public void execute(ICommandSender sender, String[] args)
  {
    /*
     * We need the zone...
     */
    Zone zone;
    if (args.length == 0)
    {
      OutputHandler.chatError(sender, "You must specify a zone you want to work in. '/wb global' or '/wb <id>'");
      if (sender instanceof EntityPlayer)
      {
        OutputHandler.chatError(sender, "As a player, '/wb world' works too");
      }
      return;
    }
    else if (args[0].equalsIgnoreCase("global"))
    {
      zone = APIRegistry.perms.getServerZone();
    }
    else if (FunctionHelper.isNumeric(args[0]))
    {
      World world = DimensionManager.getWorld(parseInt(sender, args[0]));
      if (world == null)
      {
        OutputHandler.chatError(sender, args[0] + " is not an ID of a loaded world.");
        return;
      }
      zone = APIRegistry.perms.getWorldZone(world);
    }
    else if (args[0].equalsIgnoreCase("world") && sender instanceof EntityPlayer)
    {
      zone = APIRegistry.perms.getWorldZone(((EntityPlayer) sender).worldObj);
    }
    else
    {
      OutputHandler.chatError(sender, "You must specify a zone you want to work in. '/wb global' or '/wb <id>'");
      return;
    }

    /*
     * Now we have the zone...
     */
    WorldBorder border = ModuleWorldBorder.borderMap.get(zone.getName());

    /*
     * Want info?
     */
    if (args.length == 1 || args[1].equalsIgnoreCase("info"))
    {
      // Header
      String header = "--- WorldBorder for " + zone.getName() + " ---";
      OutputHandler.chatNotification(sender, header);
      // Actual info
      OutputHandler.chatNotification(sender, "Enabled: " + (border.enabled ? EnumChatFormatting.GREEN : EnumChatFormatting.RED) + border.enabled);
      OutputHandler.chatNotification(sender, "Center: " + border.center.toString());
      OutputHandler.chatNotification(sender, "Radius: " + border.rad);
View Full Code Here

  // ZONE STUFF
  @SubscribeEvent
  public void playerMove(PlayerMoveEvent e)
  {
    Zone before = APIRegistry.perms.getZonesAt(e.before).get(0);
    Zone after = APIRegistry.perms.getZonesAt(e.after).get(0);
    if (!before.equals(after))
    {
      PlayerChangedZone event = new PlayerChangedZone(e.entityPlayer, before, after, e.before, e.after);
      MinecraftForge.EVENT_BUS.post(event);
      e.setCanceled(event.isCanceled());
View Full Code Here

                }

            // Apply group permissions
            for (Map<String, Object> permData : groupPermissions)
            {
                Zone zone = zones.get(permData.get("zone_id"));
                if (zone != null)
                {
                    zone.setGroupPermissionProperty((String) permData.get("group"), (String) permData.get("permission"), (String) permData.get("value"));
                }
            }

            // Apply user permissions
            for (Map<String, Object> permData : userPermissions)
            {
                Zone zone = zones.get(permData.get("zone_id"));
                if (zone != null)
                {
                    zone.setPlayerPermissionProperty(new UserIdent((String) permData.get("user")), (String) permData.get("permission"),
                            (String) permData.get("value"));
                }
            }

            // Load maxZoneId
            try
            {
                serverZone.setMaxZoneId(Integer.parseInt(infoData.get(INFO_MAX_ZONE_ID)));
            }
            catch (NumberFormatException e)
            {
            }

            // Make sure maxZoneId is valid
            for (Zone zone : zones.values())
                if (zone.getId() > serverZone.getMaxZoneID())
                    serverZone.setMaxZoneId(zone.getId());

            // Add user to groups by fe.internal.player.groups permission
            for (UserIdent ident : serverZone.getPlayerPermissions().keySet())
            {
                String groupList = serverZone.getPlayerPermission(ident, FEPermissions.PLAYER_GROUPS);
View Full Code Here

  {
    for (String username : MinecraftServer.getServer().getAllUsernames())
    {
      EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(username);
      List<AreaZone> zones = APIRegistry.perms.getAreaZonesAt(new WorldPoint(player));
      Zone zone = zones.isEmpty() ? null : zones.get(0);
      while (zone != null)
      {
        if (map.containsKey(zone.toString()))
        {
          map.get(zone.toString()).tick(player);
        }
        zone = zone.getParent();
      }
    }
  }
View Full Code Here

  public void processCommandPlayer(EntityPlayer sender, String[] args)
  {
    /*
     * Get the right zone. If nothing valid is given, defaults to the senders position.
     */
    Zone zone = APIRegistry.perms.getZoneAt(new WorldPoint(sender));
    if (args.length > 0)
    {
      if (args[0].equalsIgnoreCase("world"))
      {
        zone = APIRegistry.perms.getWorldZone(sender.worldObj);
      }
      if (args[0].equalsIgnoreCase("global"))
      {
        zone = APIRegistry.perms.getServerZone();
      }
      // TODO: Identify zones by unique names
      // if (APIRegistry.perms.doesZoneExist(args[0]))
      // {
      // zone = APIRegistry.perms.getZone(args[0]);
      // }
    }

    /*
     * Need to make a new one?
     */
    AutoPromote ap = AutoPromoteManager.instance().map.get(zone.toString());
    if (ap == null)
    {
      AutoPromoteManager.instance().map.put(zone.getId(), new AutoPromote(zone.getId(), false));
      ap = AutoPromoteManager.instance().map.get(zone.toString());
    }

    /*
     * Nope, View the existing one?
     */
    if (args.length == 0 || args.length == 1 || args[1].equalsIgnoreCase("get"))
    {
      String header = "--- AutoPromote for: " + ap.getZone() + " ---";
      OutputHandler.chatNotification(sender, header);
      OutputHandler.chatNotification(sender, "Enabled: " + (ap.isEnabled() ? EnumChatFormatting.GREEN : EnumChatFormatting.RED) + ap.isEnabled());
      OutputHandler.chatNotification(sender, "Promotion times: ");
      for (String i : ap.getPromoteList().keySet())
      {
        OutputHandler.chatNotification(sender, " " + i + " > " + ap.getPromoteList().get(i));
      }
      StringBuilder footer = new StringBuilder();
      for (int i = 3; i < header.length(); i++)
      {
        footer.append("-");
      }
      OutputHandler.chatNotification(sender, footer.toString());
      return;
    }

    /*
     * Nope, Enable?
     */
    if (args[1].equalsIgnoreCase("enable"))
    {
      if (ap.isEnabled())
      {
        OutputHandler.chatWarning(sender, "AutoPromote for " + ap.getZone() + " was already enabled.");
      }
      else
      {
        ap.setEnabled(true);
        OutputHandler.chatConfirmation(sender, "AutoPromote for " + ap.getZone() + " enabled.");
      }
    }

    /*
     * Nope, Disable?
     */
    if (args[1].equalsIgnoreCase("disable"))
    {
      if (!ap.isEnabled())
      {
        OutputHandler.chatWarning(sender, "AutoPromote for " + ap.getZone() + " was already disabled.");
      }
      else
      {
        ap.setEnabled(false);
        OutputHandler.chatConfirmation(sender, "AutoPromote for " + ap.getZone() + " disabled.");
      }
    }

    /*
     * Nope, Edit?
     */
    if (args[1].equalsIgnoreCase("edit"))
    {
      if (args.length == 2)
      {
        OutputHandler.chatError(sender, "Available options: 'del', 'add'");
      }
      else if (args[2].equalsIgnoreCase("del") || args[2].equalsIgnoreCase("delete"))
      {
        if (args.length == 4)
        {
          int i = parseInt(sender, args[3]);
          if (ap.getPromoteList().containsKey(i))
          {
            String group = ap.getPromoteList().remove(i);
            OutputHandler.chatConfirmation(sender, "You have removed " + i + ":" + group + " from the list.");
          }
          else
          {
            OutputHandler.chatError(sender, args[3] + " is not a number in the list.");
          }
        }
        else
        {
          OutputHandler.chatError(sender, "You have to specify a number to remvove from the list.");
        }
      }
      else if (args[2].equalsIgnoreCase("add"))
      {
        if (args.length == 5)
        {
          int i = parseInt(sender, args[3]);
          if (!ap.getPromoteList().containsKey(i))
          {
            String group = args[4];
            if (!APIRegistry.perms.groupExists(group))
            {
              ap.getPromoteList().put(i + "", group);
              OutputHandler.chatConfirmation(sender, "You have added " + i + ":" + group + " to the list.");
            }
            else
            {
              OutputHandler.chatError(sender, args[4] + " is not a valid group in " + zone.toString() + ".");
            }
          }
          else
          {
            OutputHandler.chatError(sender, args[3] + " is already on the list.");
View Full Code Here

TOP

Related Classes of com.forgeessentials.api.permissions.Zone$PermissionList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.