Package com.forgeessentials.util

Examples of com.forgeessentials.util.PlayerInfo


  }

  @Override
  public void processCommandPlayer(EntityPlayer player, String[] args)
  {
    PlayerInfo info = PlayerInfo.getPlayerInfo(player.getPersistentID());
    if (info.getPoint1() == null || info.getPoint2() == null)
    {
      OutputHandler.chatError(player, "Invalid selection.");
      return;
    }
    info.getPoint1().setY(0);
    info.getPoint2().setY(255);
    OutputHandler.chatConfirmation(player, "Selection expanded to world height.");
  }
View Full Code Here


        if (args.length == 1)
        {
            int x = Math.round((float) player.getLookVec().xCoord);
            int y = Math.round((float) player.getLookVec().yCoord);
            int z = Math.round((float) player.getLookVec().zCoord);
            PlayerInfo info = PlayerInfo.getPlayerInfo(player.getPersistentID());
            int expandby = Integer.decode(args[0]);

            // Check to see if selection is valid for expand.
            if (info.getPoint1() == null || info.getPoint2() == null)
            {

                OutputHandler.chatError(player, "Invalid previous selection.");
                return;
            }

            if (x == -1)
            {
                if (info.getPoint1().getX() < info.getPoint2().getX())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX() - expandby, info.getPoint1().getY(), info.getPoint1().getZ()));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX() - expandby, info.getPoint2().getY(), info.getPoint2().getZ()));
                }
            }
            else if (z == 1)
            {
                if (info.getPoint1().getZ() < info.getPoint2().getZ())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX(), info.getPoint1().getY(), info.getPoint1().getZ() + expandby));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX(), info.getPoint2().getY(), info.getPoint2().getZ() + expandby));
                }
            }
            else if (x == 1)
            {
                if (info.getPoint1().getX() < info.getPoint2().getX())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX() + expandby, info.getPoint1().getY(), info.getPoint1().getZ()));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX() + expandby, info.getPoint2().getY(), info.getPoint2().getZ()));
                }
            }
            else if (z == -1)
            {
                if (info.getPoint1().getZ() < info.getPoint2().getZ())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX(), info.getPoint1().getY(), info.getPoint1().getZ() - expandby));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX(), info.getPoint2().getY(), info.getPoint2().getZ() - expandby));
                }
            }
            else if (y == 1)
            {
                if (info.getPoint1().getY() > info.getPoint2().getY())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX(), info.getPoint1().getY() + expandby, info.getPoint1().getZ()));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX(), info.getPoint2().getY() + expandby, info.getPoint2().getZ()));
                }
            }
            else if (y == -1)
            {
                if (info.getPoint1().getY() < info.getPoint2().getY())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX(), info.getPoint1().getY() - expandby, info.getPoint1().getZ()));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX(), info.getPoint2().getY() - expandby, info.getPoint2().getZ()));
                }
            }
            OutputHandler.chatConfirmation(player, "Region expanded by: " + expandby);
            return;
        }
        else if (args.length == 2)
        {
            PlayerInfo info = PlayerInfo.getPlayerInfo(player.getPersistentID());
            int expandby = 0;
            try
            {
                expandby = Integer.decode(args[0]);
            }
            catch (Exception e)
            {
                try
                {
                    expandby = Integer.decode(args[1]);
                }
                catch (Exception ex)
                {
                    OutputHandler.chatError(player, "Neither " + args[0] + " or " + args[1] + " is a number.");
                    return;
                }
            }
            if (args[0].equalsIgnoreCase("north") || args[1].equalsIgnoreCase("north"))
            {
                if (info.getPoint1().getZ() < info.getPoint2().getZ())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX(), info.getPoint1().getY(), info.getPoint1().getZ() - expandby));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX(), info.getPoint2().getY(), info.getPoint2().getZ() - expandby));
                }
            }
            else if (args[0].equalsIgnoreCase("east") || args[1].equalsIgnoreCase("east"))
            {
                if (info.getPoint1().getX() > info.getPoint2().getX())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX() + expandby, info.getPoint1().getY(), info.getPoint1().getZ()));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX() + expandby, info.getPoint2().getY(), info.getPoint2().getZ()));
                }
            }
            else if (args[0].equalsIgnoreCase("south") || args[1].equalsIgnoreCase("south"))
            {
                if (info.getPoint1().getZ() > info.getPoint2().getZ())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX(), info.getPoint1().getY(), info.getPoint1().getZ() + expandby));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX(), info.getPoint2().getY(), info.getPoint2().getZ() + expandby));
                }
            }
            else if (args[0].equalsIgnoreCase("west") || args[1].equalsIgnoreCase("west"))
            {
                if (info.getPoint1().getX() < info.getPoint2().getX())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX() - expandby, info.getPoint1().getY(), info.getPoint1().getZ()));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX() - expandby, info.getPoint2().getY(), info.getPoint2().getZ()));
                }
            }
            else if (args[0].equalsIgnoreCase("up") || args[1].equalsIgnoreCase("up"))
            {
                if (info.getPoint1().getZ() > info.getPoint2().getZ())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX(), info.getPoint1().getY() + expandby, info.getPoint1().getZ()));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX(), info.getPoint2().getY() + expandby, info.getPoint2().getZ()));
                }
            }
            else if (args[0].equalsIgnoreCase("down") || args[1].equalsIgnoreCase("down"))
            {
                if (info.getPoint1().getY() < info.getPoint2().getY())
                {
                    PlayerInfo.selectionProvider.setPoint1((EntityPlayerMP)player,new Point(info.getPoint1().getX(), info.getPoint1().getY() - expandby, info.getPoint1().getZ()));
                }
                else
                {
                    PlayerInfo.selectionProvider.setPoint2((EntityPlayerMP)player,new Point(info.getPoint2().getX(), info.getPoint2().getY() - expandby, info.getPoint2().getZ()));
                }
            }
            else
            {
                OutputHandler.chatError(player, "Invalid Direction");
View Full Code Here

            if (lastGm != gm)
            {
                player.setGameType(gm);
                // OutputHandler.chatNotification(player, "You gamemode has been changed to " + gm.getName());
            }
            PlayerInfo pi = PlayerInfo.getPlayerInfo(player);
            if (gm != pi.getGamemodeInventoryType() && (gm == GameType.CREATIVE || pi.getGamemodeInventoryType() == GameType.CREATIVE))
            {
                pi.setGamemodeInventory(FunctionHelper.swapInventory(player, pi.getGamemodeInventory()));
                pi.setGamemodeInventoryType(gm);
            }
        }
    }
View Full Code Here

            if (TeleportDataManager.warps.containsKey(args[0].toLowerCase()))
            {
                if (PermissionsManager.checkPermission(sender, getPermissionNode() + "." + args[0].toLowerCase()))
                {
                    Warp warp = TeleportDataManager.warps.get(args[0].toLowerCase());
                    PlayerInfo playerInfo = PlayerInfo.getPlayerInfo(sender.getPersistentID());
                    playerInfo.setLastTeleportOrigin(new WarpPoint(sender));
                    CommandBack.justDied.remove(sender.getPersistentID());
                    TeleportCenter.teleport(warp.getPoint(), (EntityPlayerMP) sender);
                }
                else
                {
View Full Code Here

    {
        if (justDied.contains(sender.getPersistentID()))
        {
            if (PermissionsManager.checkPermission(sender, TeleportModule.PERM_BACK_ONDEATH))
            {
                PlayerInfo info = PlayerInfo.getPlayerInfo(sender.getPersistentID());
                if (info.getLastTeleportOrigin() != null)
                {
                    WarpPoint death = info.getLastTeleportOrigin();
                    info.setLastTeleportOrigin(new WarpPoint(sender));
                    EntityPlayerMP player = (EntityPlayerMP) sender;
                    TeleportCenter.teleport(death, player);
                }
                else
                {
                    OutputHandler.chatError(sender, "You have nowhere to get back to");
                }
                justDied.remove(sender.getPersistentID());
                return;
            }
            else
            {
                OutputHandler.chatError(sender, "You have nowhere to get back to");
            }
        }
        else if (PermissionsManager.checkPermission(sender, TeleportModule.PERM_BACK_ONTP))
        {
            PlayerInfo info = PlayerInfo.getPlayerInfo(sender.getPersistentID());
            if (info.getLastTeleportOrigin() != null)
            {
                WarpPoint back = info.getLastTeleportOrigin();
                info.setLastTeleportOrigin(new WarpPoint(sender));
                EntityPlayerMP player = (EntityPlayerMP) sender;
                TeleportCenter.teleport(back, player);
            }
            else
            {
View Full Code Here

TOP

Related Classes of com.forgeessentials.util.PlayerInfo

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.