Package com.forgeessentials.util.selections

Examples of com.forgeessentials.util.selections.WorldPoint


   *
   * @param player
   */
  public boolean isPlayerInZone(EntityPlayer player)
  {
    return isInZone(new WorldPoint(player));
  }
View Full Code Here


        if (senderPlayer == null)
        {
            error(FEPermissions.MSG_NO_CONSOLE_COMMAND);
            return;
        }
        WorldPoint wp = new WorldPoint(senderPlayer);
        info("Zones at position " + wp.toString());
        for (Zone zone : APIRegistry.perms.getZonesAt(wp))
        {
            info("  #" + zone.getId() + " " + zone.toString());
        }
    }
View Full Code Here

            tabComplete = CommandBase.getListOfStringsMatchingLastWord(new String[] { args.peek() }, parseSpawnArgs);
            return;
        }

        String loc = args.remove().toLowerCase();
        WorldPoint point = null;
        boolean isBed = false;
        switch (loc)
        {
        case "here":
            point = new WorldPoint(senderPlayer);
            break;
        case "bed":
            isBed = true;
            break;
        case "clear":
            break;
        default:
            if (args.size() < 3)
                throw new CommandException("Too few arguments!");
            try
            {
                int x = CommandBase.parseInt(sender, loc);
                int y = CommandBase.parseInt(sender, args.remove());
                int z = CommandBase.parseInt(sender, args.remove());
                int dimension = CommandBase.parseInt(sender, args.remove());
                point = new WorldPoint(dimension, x, y, z);
            }
            catch (NumberFormatException e)
            {
                error("Invalid location argument");
                return;
            }
            break;
        }

        if (isBed)
        {
            zone.setPlayerPermissionProperty(ident, FEPermissions.SPAWN, "bed");
            info(String.format("Set spawn for user %s to be bed-location in zone %s", ident.getUsernameOrUUID(), zone.getName()));
        }
        else if (point == null)
        {
            zone.clearPlayerPermission(ident, FEPermissions.SPAWN);
            info(String.format("Cleared spawn-rule for user %s in zone %s", ident.getUsernameOrUUID(), zone.getName()));
        }
        else
        {
            zone.setPlayerPermissionProperty(ident, FEPermissions.SPAWN, point.toString());
            info(String.format("Set spawn for user %s to %s in zone %s", ident.getUsernameOrUUID(), point.toString(), zone.getName()));
        }
    }
View Full Code Here

            tabComplete = CommandBase.getListOfStringsMatchingLastWord(new String[] { args.peek() }, parseSpawnArgs);
            return;
        }

        String loc = args.remove().toLowerCase();
        WorldPoint point = null;
        boolean isBed = false;
        switch (loc)
        {
        case "here":
            point = new WorldPoint(senderPlayer);
            break;
        case "bed":
            isBed = true;
            break;
        case "clear":
            break;
        default:
            if (args.size() < 3)
                throw new CommandException("Too few arguments!");
            try
            {
                int x = CommandBase.parseInt(sender, loc);
                int y = CommandBase.parseInt(sender, args.remove());
                int z = CommandBase.parseInt(sender, args.remove());
                int dimension = CommandBase.parseInt(sender, args.remove());
                point = new WorldPoint(dimension, x, y, z);
            }
            catch (NumberFormatException e)
            {
                error("Invalid location argument");
                return;
            }
            break;
        }

        if (isBed)
        {
            zone.setGroupPermissionProperty(group, FEPermissions.SPAWN, "bed");
            info(String.format("Set spawn for group %s to be bed-location in zone %s", group, zone.getName()));
        }
        else if (point == null)
        {
            zone.clearGroupPermission(group, FEPermissions.SPAWN);
            info(String.format("Cleared spawn-rule for group %s in zone %s", group, zone.getName()));
        }
        else
        {
            zone.setGroupPermissionProperty(group, FEPermissions.SPAWN, point.toString());
            info(String.format("Set spawn for group %s to %s in zone %s", group, point.toString(), zone.getName()));
        }
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public void processCommandConsole(ICommandSender sender, String[] args)
    {
        int radius = 0;
        WorldPoint center = new WorldPoint(0, 0, 0, 0);

        if (args.length >= 4)
        {
            radius = parseIntWithMin(sender, args[0], 0);
            center.setX(parseInt(sender, args[1]));
            center.setY(parseInt(sender, args[2]));
            center.setZ(parseInt(sender, args[3]));
            if (args.length >= 5)
            {
                center.setDimension(parseInt(sender, args[3]));
            }
        }
        else
        {
            OutputHandler.chatError(sender, "Improper syntax. Please try this instead: <radius> <x, y, z>");
            return;
        }

        List<EntityItem> entityList = DimensionManager.getWorld(center.getDimension()).getEntitiesWithinAABB(EntityItem.class,
                AxisAlignedBB.getBoundingBox(center.getX() - radius, center.getY() - radius, center.getZ() - radius, center.getX() + radius + 1, center.getY() + radius + 1,
                        center.getZ() + radius + 1));

        int counter = 0;
        for (int i = 0; i < entityList.size(); i++)
        {
            EntityItem entity = entityList.get(i);
View Full Code Here

    public static WarpPoint getPlayerSpawn(EntityPlayer player, WorldPoint location)
    {
        UserIdent ident = new UserIdent(player);
        if (location == null)
            location = new WorldPoint(player);
        String spawnProperty = APIRegistry.perms.getPermission(ident, location, null, APIRegistry.perms.getPlayerGroups(ident), FEPermissions.SPAWN, true);
        WorldPoint point = null;
        if (spawnProperty == null)
            return null;
        if (spawnProperty.equalsIgnoreCase("bed"))
        {
            if (player.getBedLocation() != null)
            {
                ChunkCoordinates spawn = player.getBedLocation();
                EntityPlayer.verifyRespawnCoordinates(player.worldObj, spawn, true);
                point = new WorldPoint(player.dimension, spawn.posX, spawn.posY, spawn.posZ);
            }
        }
        else
        {
            point = WorldPoint.fromString(spawnProperty);
View Full Code Here

    // Player info
    String playerPrefix = FunctionHelper.formatColors(FunctionHelper.getPlayerPrefixSuffix(new UserIdent(event.player), false));
    String playerSuffix = FunctionHelper.formatColors(FunctionHelper.getPlayerPrefixSuffix(new UserIdent(event.player), true));
    String groupPrefix = FunctionHelper.formatColors(FunctionHelper.getPlayerGroupPrefixSuffix(new UserIdent(event.player), false));
    String groupSuffix = FunctionHelper.formatColors(FunctionHelper.getPlayerGroupPrefixSuffix(new UserIdent(event.player), true));
    String zoneID = APIRegistry.perms.getZonesAt(new WorldPoint(event.player)).get(0).getName();
    String rank = "";

        // It may be beneficial to make this a public function. -RlonRyan
        String format = ConfigChat.chatFormat;
        format = ConfigChat.chatFormat == null || ConfigChat.chatFormat.trim().isEmpty() ? "<%username>%message" : ConfigChat.chatFormat;
View Full Code Here

  public void run()
  {
    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()))
        {
View Full Code Here

        if (contextIsConsole(context))
            return true;

        UserIdent ident = null;
        EntityPlayer player = contextGetPlayerOrCommandPlayer(context);
        WorldPoint loc = null;
        WorldArea area = null;
        int dim = 0;

        if (player != null)
        {
            ident = new UserIdent(player);
            // TODO: should be changed to context.getDimension()
            dim = player.dimension;
        }

        if (context.getTargetLocationStart() != null)
        {
            if (context.getTargetLocationEnd() != null)
            {
                area = new WorldArea(dim, new Point(context.getTargetLocationStart()), new Point(context.getTargetLocationEnd()));
            }
            else
            {
                loc = new WorldPoint(dim, context.getTargetLocationStart());
            }
        }
        else if (context.getSourceLocationStart() != null)
        {
            if (context.getSourceLocationEnd() != null)
            {
                area = new WorldArea(dim, new Point(context.getSourceLocationStart()), new Point(context.getSourceLocationEnd()));
            }
            else
            {
                loc = new WorldPoint(dim, context.getSourceLocationStart());
            }
        }
        else
        {
            if (player != null)
            {
                loc = new WorldPoint(player);
            }
        }

        return checkBooleanPermission(getPermission(ident, loc, area, getPlayerGroups(ident), permissionNode, false));
        // return checkPermission(player, node);
View Full Code Here

    @Override
    public boolean checkPermission(EntityPlayer player, String permissionNode)
    {
        UserIdent ident = new UserIdent(player);
        return checkBooleanPermission(getPermission(ident, new WorldPoint(player), null, getPlayerGroups(ident), permissionNode, false));
    }
View Full Code Here

TOP

Related Classes of com.forgeessentials.util.selections.WorldPoint

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.