Skip to content

Commit

Permalink
Better compatibility with older server 1.7.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Jan 18, 2015
1 parent 1abf8ee commit fff8235
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ASkyBlock
main: com.wasteofplastic.askyblock.ASkyBlock
version: 2.7.8
version: 2.7.9pre
description: A SkyBlock Plugin
author: Tastybento
depend: [Vault]
Expand Down
17 changes: 14 additions & 3 deletions src/com/wasteofplastic/askyblock/PlayerCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@

import java.io.File;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;

import com.google.common.collect.Lists;

/**
* @author ben
* Provides a memory cache of online player information
Expand All @@ -38,8 +42,8 @@ public class PlayerCache {

protected PlayerCache(ASkyBlock plugin) {
this.plugin = plugin;
final Collection<? extends Player> serverPlayers = Bukkit.getServer().getOnlinePlayers();
for (Player p : serverPlayers) {
//final Collection<? extends Player> serverPlayers = Bukkit.getServer().getOnlinePlayers();
for (Player p : getOnlinePlayers()) {
if (p.isOnline()) {
final Players playerInf = new Players(plugin, p.getUniqueId());
// Make sure parties are working correctly
Expand All @@ -53,7 +57,14 @@ protected PlayerCache(ASkyBlock plugin) {
}
}
}

public static List<Player> getOnlinePlayers() {
List<Player> list = Lists.newArrayList();
for (World world : Bukkit.getWorlds()) {
list.addAll(world.getPlayers());
}
return Collections.unmodifiableList(list);
}

/*
* Cache control methods
*/
Expand Down

0 comments on commit fff8235

Please sign in to comment.