Beispiel #1
0
 public void run() {
   for (String name : lastLoc.keySet()) {
     Player player = plugin.getServer().getPlayer(name);
     if (player == null) {
       removePlayer(name);
     } else {
       // workaround for bukkit issue
       String prevWorld = lastLoc.get(name).getWorld().getName();
       String curWorld = player.getLocation().getWorld().getName();
       if (prevWorld.equals(curWorld)) {
         if (player.getLocation().distance(lastLoc.get(name)) < 1) {
           continue;
         }
       }
       // if distance between player's current location and stored
       // location is less than 1, this move is not active; if active
       // and ignore vehicle movement is set and player in vehicle,
       // then update location, but don't count this move as active
       addPlayer(player);
       if (!isIgnoreVehicleMovement || !player.isInsideVehicle()) {
         afkBooter.getPlayerActivity().recordActivity(name);
       }
     }
   }
 }
Beispiel #2
0
  public MovementTracker(AfkBooter afkBooter) {
    this.afkBooter = afkBooter;
    this.plugin = afkBooter.getPlugin();

    // load configuration
    loadConfig();

    // initialize with current online players
    Player[] players = plugin.getServer().getOnlinePlayers();
    for (Player player : players) {
      addPlayer(player);
    }

    afkBooter.writeDebugMsg("created MovementTracker object.");
  }