Package org.bukkit

Examples of org.bukkit.OfflinePlayer


            team.addPlayer((Player) sender);
            addedPlayers.add(sender.getName());
          } else {
            for (int i = 3; i < args.length; i++) {
              String playerName = args[i];
              OfflinePlayer offlinePlayer;
              Player player = Bukkit.getPlayerExact(playerName);
              if (player != null) {
                offlinePlayer = player;
              } else {
                offlinePlayer = Bukkit.getOfflinePlayer(playerName);
              }
              team.addPlayer(offlinePlayer);
              addedPlayers.add(offlinePlayer.getName());

              // AUTOREFEREE START - check for AutoRefTeam
              if (match != null)
              {
                AutoRefTeam autorefteam = match.getScoreboardTeam(teamName);
                if (autorefteam != null && player != null)
                {
                  PlayerTeamJoinEvent.Reason reason = PlayerTeamJoinEvent.Reason.AUTOMATIC;
                  match.joinTeam(player, autorefteam, reason, false);
                }
              }
              // AUTOREFEREE END
            }
          }
          sender.sendMessage("Added " + addedPlayers.size() + " player(s) to team " + team.getName() + ": " + stringCollectionToString(addedPlayers));
        }
      } else if (args[1].equalsIgnoreCase("leave")) {
        if (!(sender instanceof Player) && args.length < 3) {
          sender.sendMessage(ChatColor.RED + "/scoreboard teams leave [player...]");
          return false;
        }
        Set<String> left = new HashSet<String>();
        Set<String> noTeam = new HashSet<String>();
        if ((sender instanceof Player) && args.length == 2) {
          Team team = scoreboard.getPlayerTeam((Player) sender);
          if (team != null) {
            team.removePlayer((Player) sender);
            left.add(sender.getName());
          } else {
            noTeam.add(sender.getName());
          }
        } else {
          for (int i = 2; i < args.length; i++) {
            String playerName = args[i];
            OfflinePlayer offlinePlayer;
            Player player = Bukkit.getPlayerExact(playerName);
            if (player != null) {
              offlinePlayer = player;
            } else {
              offlinePlayer = Bukkit.getOfflinePlayer(playerName);
            }
            Team team = scoreboard.getPlayerTeam(offlinePlayer);
            if (team != null) {
              team.removePlayer(offlinePlayer);
              left.add(offlinePlayer.getName());
            } else {
              noTeam.add(offlinePlayer.getName());
            }
          }
        }
        if (!left.isEmpty()) {
          sender.sendMessage("Removed " + left.size() + " player(s) from their teams: " + stringCollectionToString(left));
View Full Code Here


  public boolean autoInvite(CommandSender sender, AutoRefMatch match, String[] args, CommandLine options)
  {
    if (match != null) for (int i = 0; i < args.length; ++i)
    {
      // first, remove this player from all expected player lists
      OfflinePlayer opl = plugin.getServer().getOfflinePlayer(args[i]);
      for (AutoRefMatch m : plugin.getMatches()) m.removeExpectedPlayer(opl);

      // add them to the expected players list
      match.addExpectedPlayer(opl);
View Full Code Here

  Set<String> playerLimboLogin = Sets.newHashSet();

  @EventHandler(priority=EventPriority.MONITOR)
  public void playerPreLogin(AsyncPlayerPreLoginEvent event)
  {
    OfflinePlayer opl = Bukkit.getOfflinePlayer(event.getName());
    Location oloc = SportBukkitUtil.getOfflinePlayerLocation(opl);

    // either there is no offline player utility, or check the world like normal
    if (opl.hasPlayedBefore() && SportBukkitUtil.hasSportBukkitApi() &&
      (oloc == null || oloc.getWorld() == null))
    {
      if (!opl.isOnline()) playerLimboLogin.add(opl.getName());
      // TODO deferred teleportation back on the sync server thread if online
    }
  }
View Full Code Here

    // check if all the players are here
    boolean ready = true;
    for ( String name : getExpectedPlayers() )
    {
      OfflinePlayer opl = Bukkit.getOfflinePlayer(name);
      ready &= opl.isOnline() && isPlayer(opl.getPlayer()) &&
        getPlayer(opl.getPlayer()).isPresent();
    }

    // set status based on whether the players are online
    setCurrentState(ready ? MatchStatus.READY : MatchStatus.WAITING);
  }
View Full Code Here

        if (uuid == null) {
            return null;
        }

        OfflinePlayer owner = Bukkit.getOfflinePlayer(uuid);

        Action buy = Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
        double price = (action == buy ? PriceUtil.getBuyPrice(prices) : PriceUtil.getSellPrice(prices));

        Chest chest = uBlock.findConnectedChest(sign);
View Full Code Here

        Player p = Bukkit.getPlayerExact(player);
        if (p != null) {
            return p.hasPermission(name + "." + perm);
        }
        else {
            OfflinePlayer op = Bukkit.getOfflinePlayer(player);
            if((op != null) && op.isOp()) {
                return true;
            }
            return false;
        }
    }
View Full Code Here

        public String getServerName() {
            return getServer().getServerName();
        }
        @Override
        public boolean isPlayerBanned(String pid) {
            OfflinePlayer p = getServer().getOfflinePlayer(pid);
            if((p != null) && p.isBanned())
                return true;
            return false;
        }
View Full Code Here

        public DynmapWorld getWorldByName(String wname) {
            return DynmapPlugin.this.getWorldByName(wname);
        }
        @Override
        public DynmapPlayer getOfflinePlayer(String name) {
            OfflinePlayer op = getServer().getOfflinePlayer(name);
            if(op != null) {
                return new BukkitPlayer(op);
            }
            return null;
        }
View Full Code Here

            }
            return null;
        }
        @Override
        public Set<String> checkPlayerPermissions(String player, Set<String> perms) {
            OfflinePlayer p = getServer().getOfflinePlayer(player);
            if(p.isBanned())
                return new HashSet<String>();
            Set<String> rslt = permissions.hasOfflinePermissions(player, perms);
            if (rslt == null) {
                rslt = new HashSet<String>();
                if(p.isOp()) {
                    rslt.addAll(perms);
                }
            }
            return rslt;
        }
View Full Code Here

            }
            return rslt;
        }
        @Override
        public boolean checkPlayerPermission(String player, String perm) {
            OfflinePlayer p = getServer().getOfflinePlayer(player);
            if(p.isBanned())
                return false;
            boolean rslt = permissions.hasOfflinePermission(player, perm);
            return rslt;
        }
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.