Package org.bukkit

Examples of org.bukkit.OfflinePlayer


      // load old player groups from database and delete the ones that did not play for a configured amount of time
      ResultSet res = SQLManager.query_res("SELECT * FROM "+ SQLManager.prefix +"old_groups");
      List<String> remPlayers = new ArrayList<String>();
      try {
        while (res.next()) {
          OfflinePlayer op = Bukkit.getOfflinePlayer(res.getString("player_name"));
          if ((CommandsEX.getConf().getInt("deathGroupsCleanupTime", 14) > 0) && ((Utils.getUnixTimestamp(0L) - (int) (op.getLastPlayed() / 1000)) > (CommandsEX.getConf().getInt("deathGroupsCleanupTime", 14) * 60 * 60 * 24))) {
            // if a player did not play for given number of days, remove his previous group from database
            remPlayers.add(res.getString("player_name"));
          } else {
            oldPlayerGroups.put(res.getString("player_name"), res.getString("group_name"));
          }
View Full Code Here


  public void setRemainingLives(int remainingLives) {
    this.remainingLives = remainingLives;
    if (this.warzone.getScoreboard() != null && this.warzone.getScoreboardType() == ScoreboardType.LIFEPOOL) {
      String teamName = kind.getColor() + name + ChatColor.RESET;
      OfflinePlayer teamPlayer = Bukkit.getOfflinePlayer(teamName);
      Objective obj = this.warzone.getScoreboard().getObjective("Lifepool");
      obj.getScore(teamPlayer).setScore(remainingLives);
    }
  }
View Full Code Here

        World bukkitWorld = null;
        if (world != null)
            bukkitWorld = world.getWorld();

        OfflinePlayer player = ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getOfflinePlayer();
        boolean inGroup = Depends.permissions.playerInGroup((bukkitWorld == null ? null: bukkitWorld.getName()), player, group.asString());

        switch (Action.valueOf(action.asString().toUpperCase())) {
            case ADD:
                if (inGroup)
                    dB.echoDebug(scriptEntry, "Player " + player.getName() + " is already in group " + group);
                else
                    Depends.permissions.playerAddGroup((bukkitWorld == null ? null: bukkitWorld.getName()), player, group.asString());
                return;
            case REMOVE:
                if (!inGroup)
                    dB.echoDebug(scriptEntry, "Player " + player.getName() + " is not in group " + group);
                else
                    Depends.permissions.playerRemoveGroup((bukkitWorld == null ? null: bukkitWorld.getName()), player, group.asString());
                return;
        }
View Full Code Here

        World bukkitWorld = null;
        if (world != null)
            bukkitWorld = world.getWorld();

        OfflinePlayer player = ((BukkitScriptEntryData)scriptEntry.entryData).hasPlayer() ? ((BukkitScriptEntryData)scriptEntry.entryData).getPlayer().getOfflinePlayer() : null;

        switch (Action.valueOf(action.asString().toUpperCase())) {
            case ADD:
                if (group != null) {
                    if (Depends.permissions.groupHas(bukkitWorld, group.asString(), permission.asString()))
                        dB.echoDebug(scriptEntry, "Group " + group + " already has permission " + permission);
                    else
                        Depends.permissions.groupAdd(bukkitWorld, group.asString(), permission.asString());
                } else {
                    if(Depends.permissions.playerHas(bukkitWorld == null ? null: bukkitWorld.getName(), player, permission.asString()))
                        dB.echoDebug(scriptEntry, "Player " + player.getName() + " already has permission " + permission);
                    else
                        Depends.permissions.playerAdd(bukkitWorld == null ? null: bukkitWorld.getName(), player, permission.asString());
                }
                return;
            case REMOVE:
                if (group != null) {
                    if(!Depends.permissions.groupHas(bukkitWorld, group.asString(), permission.asString()))
                        dB.echoDebug(scriptEntry, "Group " + group + " does not have access to permission " + permission);
                    else
                        Depends.permissions.groupRemove(bukkitWorld, group.asString(), permission.asString());
                } else {
                    if(!Depends.permissions.playerHas(bukkitWorld == null ? null: bukkitWorld.getName(), player, permission.asString()))
                        dB.echoDebug(scriptEntry, "Player " + player.getName() + " does not have access to permission " + permission);
                    else
                        Depends.permissions.playerRemove(bukkitWorld == null ? null: bukkitWorld.getName(), player, permission.asString());
                }
                return;
        }
View Full Code Here

      sender.sendMessage("   " + group.getIdentifier() + " (" + rank + ")");
    }
  }

  private String nameToUUID(String name) {
    OfflinePlayer player = Bukkit.getServer().getOfflinePlayer(name);
    if (player != null) {
      UUID uid = player.getUniqueId();
      if (uid != null) {
        return uid.toString();
      }
    }
    return name;
View Full Code Here

    return regexPerms;
  }

  @Override
  public String UUIDToName(UUID uid) {
    OfflinePlayer ply = null;
    try {
      ply = getServer().getPlayer(uid); // to make things cheaper, we're just checking online players (can be improved later on)
      // Also, only online players are really necessary to convert to proper names
    } catch (NoSuchMethodError e) {
      // Old craftbukkit, guess we won't have a fallback name. Much shame.
    }
    return ply != null ? ply.getName() : null;
  }
View Full Code Here

    return ply != null ? ply.getName() : null;
  }

  @Override
  public UUID nameToUUID(String name) {
    OfflinePlayer player = getServer().getOfflinePlayer(name);
    UUID userUUID = null;
    try {
      userUUID = player.getUniqueId();
    } catch (Throwable t) {
      // Handle cases where the plugin is not running on a uuid-aware Bukkit by just not converting here
    }
    return userUUID;
  }
View Full Code Here

    ///////

    @Override
    public String getPropertyString() {
        if (((Tameable) entity.getBukkitEntity()).isTamed()) {
            OfflinePlayer owner = (OfflinePlayer) ((Tameable) entity.getBukkitEntity()).getOwner();
            if (owner == null)
                return "true";
            else
                return "true|" + owner.getName();
        }
        else
            return null;
    }
View Full Code Here

        Scoreboard emptyBoard = createScoreboard();

        // Clear every viewer's set scoreboard
        for (Map.Entry<String, String> entry : viewerMap.entrySet()) {
            OfflinePlayer player = ScoreboardCommand.getOfflinePlayer(entry.getKey());
            if (player.isOnline()) {
                player.getPlayer().setScoreboard(emptyBoard);
            }
        }

        // Delete the contents of the scoreboardMap and viewerMap
        scoreboardMap.clear();
        viewerMap.clear();

        ConfigurationSection rootSection = DenizenAPI.getCurrentInstance()
                .getScoreboards().getConfigurationSection("Scoreboards");

        // Go no further if we have no scoreboards saved
        if (rootSection == null) return;

        Scoreboard board = null;

        // Iterate through scoreboards
        for (String id : rootSection.getKeys(false)) {
            // Create a scoreboard with this id
            board = createScoreboard(id);

            // Get the list of viewers
            List<String> viewerList = rootSection.getStringList(id + ".Viewers");

            // Iterate through viewers, store them in the viewerMap,
            // and make them see this scoreboard if they are online
            for (String viewer : viewerList) {
                if (dPlayer.matches(viewer)) {
                    dPlayer player = dPlayer.valueOf(viewer);
                    viewerMap.put(player.getName(), id);

                    if (player.isOnline())
                        player.getPlayerEntity().setScoreboard(board);
                }
            }

            ConfigurationSection objSection = rootSection
                    .getConfigurationSection(id + ".Objectives");
View Full Code Here

    public static Object getForcedPlayer(String playerDisplayName) {
        Player OnlinePlayer = Helper.matchOnePlayer(playerDisplayName);
        if (OnlinePlayer != null) {
            return OnlinePlayer;
        } else {
            OfflinePlayer OfflinePlayer = SimpleClans.getInstance().getServer().getOfflinePlayer(playerDisplayName);
            return OfflinePlayer;
        }
    }
View Full Code Here

TOP

Related Classes of org.bukkit.OfflinePlayer

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.