Package com.forgeessentials.util

Examples of com.forgeessentials.util.PlayerInfo


    @Override
    public void processCommandPlayer(EntityPlayer player, String[] args)
    {
        if (args.length == 1 || args.length == 3)
        {
            PlayerInfo info = PlayerInfo.getPlayerInfo(player.username);
            if (info.getSelection() == null)
            {
                OutputHandler.chatError(player, "Invalid selection detected. Please check your selection.");
                return;
            }
            int radius = -1;
View Full Code Here


            {
                error(player, String.format("%d is not a valid block ID!", ID));
            }
            else
            {
                PlayerInfo info = PlayerInfo.getPlayerInfo(player.username);
                if (info.getSelection() == null)
                {
                    OutputHandler.chatError(player, "Invalid selection detected. Please check your selection.");
                    return;
                }
                Selection sel = info.getSelection();
                BackupArea back = new BackupArea();

                PermQueryPlayerArea query = new PermQueryPlayerArea(player, getCommandPerm(), sel, false);
                PermResult result = APIRegistry.perms.checkPermResult(query);
View Full Code Here

    @Override
    public void processCommandPlayer(EntityPlayer player, String[] args)
    {
        if (args.length == 2)
        {
            PlayerInfo info = PlayerInfo.getPlayerInfo(player.username);
            if (info.getSelection() == null)
            {
                OutputHandler.chatError(player, "Invalid selection detected. Please check your selection.");
                return;
            }
            int[] temp;
            int firstID = -1;
            int firstMeta = -1;
            int secondID = -1;
            int secondMeta = -1;

            // Begin parsing 1st argument pair

            try
            {
                temp = FunctionHelper.parseIdAndMetaFromString(args[0], true);
                firstID = temp[0];
                firstMeta = temp[1];
            }
            catch (Exception e)
            {
                OutputHandler.chatError(player, e.getMessage());
                return;
            }

            // Begin parsing 2nd argument pair if 1st was good.
            try
            {
                temp = FunctionHelper.parseIdAndMetaFromString(args[1], true);
                secondID = temp[0];
                secondMeta = temp[1];
            }
            catch (Exception e)
            {
                OutputHandler.chatError(player, e.getMessage());
                return;
            }

            if (firstID >= Block.blocksList.length || secondID >= Block.blocksList.length)
            {
                error(player, String.format("Block IDs cannot exceed %d!", Block.blocksList.length));
            }
            else if (firstID != 0 && Block.blocksList[firstID] == null)
            {
                error(player, String.format("message.wc.invalidBlockId", firstID));
            }
            else if (secondID != 0 && Block.blocksList[secondID] == null)
            {
                error(player, String.format("%d is not a valid block ID!", secondID));
            }
            else
            {
                Selection sel = info.getSelection();
                BackupArea back = new BackupArea();

                PermQueryPlayerArea query = new PermQueryPlayerArea(player, getCommandPerm(), sel, false);
                PermResult result = APIRegistry.perms.checkPermResult(query);
View Full Code Here

            return;
        }
        else
        {
          EntityPlayerMP player = (EntityPlayerMP) sender;
      PlayerInfo playerInfo = PlayerInfo.getPlayerInfo(player.getPersistentID());
      playerInfo.setLastTeleportOrigin(new WarpPoint(player));
      CommandBack.justDied.remove(player.getPersistentID());
          TeleportCenter.teleport(new WarpPoint(sender.getEntityWorld().provider.dimensionId, mo.blockX, mo.blockY, mo.blockZ, sender.rotationPitch, sender.rotationYaw), player);
        }
    }
View Full Code Here

public class CommandSetPlot extends ForgeEssentialsCommandBase{

    @Override
    public void processCommandPlayer(EntityPlayer player, String[] args)
    {
        PlayerInfo info = PlayerInfo.getPlayerInfo(player);
        Plot plot = new Plot(player.getEntityWorld(), info.getPoint1(), info.getPoint2(), Integer.parseInt(args[1]), args[0], player.getUniqueID());
        PlotManager.addPlot(plot);
    }
View Full Code Here

            if (!(sender instanceof EntityPlayerMP))
            {
                throw new CommandException("Command not usable from console. Try /zone set <name> <coords> instead");
            }
           
            PlayerInfo info = PlayerInfo.getPlayerInfo((EntityPlayerMP) sender);
            AreaBase area = info.getSelection();
            if (area == null)
                throw new CommandException("No selection available. Please select a region first.");

            PermissionContext context = new PermissionContext();
            context.setCommandSender(sender);
View Full Code Here

    }
  }

  public void teleport()
  {
    PlayerInfo pi = PlayerInfo.getPlayerInfo(player.getPersistentID());
    pi.setLastTeleportOrigin(new WarpPoint(player));
    pi.setLastTeleportTime(System.currentTimeMillis());

    if (player.dimension != point.getDimension())
    {
      FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager()
          .transferPlayerToDimension(player, point.getDimension());
View Full Code Here

    FMLCommonHandler.instance().bus().register(this);
  }

  public static void teleport(WarpPoint point, EntityPlayerMP player)
  {
    PlayerInfo pi = PlayerInfo.getPlayerInfo(player.getPersistentID());
    long timeSinceLastTeleport = (System.currentTimeMillis() - pi.getLastTeleportTime()) / 1000L;
    if (timeSinceLastTeleport < teleportCooldown && timeSinceLastTeleport >= 0 && !PermissionsManager.checkPermission(player, BYPASS_COOLDOWN))
    {
      OutputHandler.chatNotification(player, String.format("Cooldown still active. %s seconds to go.", teleportCooldown - timeSinceLastTeleport));
    }
    else
View Full Code Here

            return out;
        }
       
        Data data = new Data();

        PlayerInfo pi = PlayerInfo.getPlayerInfo(player.getPersistentID());
        if (sendHome)
        {
            data.home = pi.getHome();
            data.back = pi.getLastTeleportOrigin();
        }

        if (sendArmorAndHealth)
        {
            data.armor = player.inventory.getTotalArmorValue();
            data.health = player.getHealth();
        }
       
        if (sendMoney)
        {
            data.money = APIRegistry.wallet.getWallet(player.getPersistentID());
        }
           
        if (sendPosition)
        {
            data.position = new WarpPoint(player);
        }
       
        data.ping = player.ping;
        data.gameMode = player.theItemInWorldManager.getGameType().getName();

        if (!player.getActivePotionEffects().isEmpty() && sendPotions)
        {
            @SuppressWarnings("unchecked")
            Collection<PotionEffect> effects = player.getActivePotionEffects();
            data.potions = new ArrayList<String>(effects.size());
            for (PotionEffect effect : effects)
            {
                String name = StatCollector.translateToLocal(Potion.potionTypes[effect.getPotionID()].getName());
                switch(effect.getAmplifier())
                {
                    case 1:
                        name += " II";
                        break;
                    case 2:
                        name += " III";
                        break;
                    case 3:
                        name += " IV";
                        break;
                }
                data.potions.add(name);
            }
        }

        if (sendXP)
        {
            data.xp = new XP();
            data.xp.lvl = player.experienceLevel;
            data.xp.bar = player.experience;
        }

        if (sendFood)
        {
            data.foodStats = new FoodStats();
            data.foodStats.food = player.getFoodStats().getFoodLevel();
            data.foodStats.saturation = player.getFoodStats().getSaturationLevel();
        }

        if (sendCapabilities)
        {
            data.capabilities = new Capabilities();
            data.capabilities.allowEdit = player.capabilities.allowEdit;
            data.capabilities.allowFlying = player.capabilities.allowFlying;
            data.capabilities.isFlying = player.capabilities.isFlying;
            data.capabilities.disableDamage = player.capabilities.disableDamage;
        }

        data.group = APIRegistry.perms.getPrimaryGroup(new UserIdent(player));
        data.firstJoin = pi.getFirstJoin();
        data.timePlayed = pi.getTimePlayed();

        return GSON.toJsonTree(data);

    }
View Full Code Here

    } else {
      wandName = "your hands";
      wandId = "hands";
    }

        PlayerInfo info = PlayerInfo.getPlayerInfo(sender.getPersistentID());

        // Check for rebind
        boolean rebind = args.length > 0 && args[0].equalsIgnoreCase("rebind");
       
    // Check for unbind
    if (!rebind && ((info.isWandEnabled() && info.getWandID().equals(wandId)) | (args.length > 0 && args[0].equalsIgnoreCase("unbind")))) {
      OutputHandler.sendMessage(sender, EnumChatFormatting.LIGHT_PURPLE + "Wand unbound from " + wandName);
      info.setWandEnabled(false);
      return;
    }

    // Check for permissions
    if (!checkCommandPermission(sender))
        throw new CommandException(FEPermissions.MSG_NO_COMMAND_PERM);

    if (args.length > 0 && !rebind) {
      Pair<String, Integer> data = FunctionHelper.parseIdAndMetaFromString(args[0], false);
      wandItem = GameData.getItemRegistry().getObject(data.getLeft());
      wandId = wandItem.getUnlocalizedName();
      wandDmg = data.getRight();
      if (wandDmg == -1) {
        wandDmg = 0;
      }
    }
   
    // Bind wand
    info.setWandEnabled(true);
    info.setWandID(wandId);
    info.setWandDmg(wandDmg);
    OutputHandler.chatConfirmation(sender, "Wand bound to " + wandName);
    }
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.