Fix missed cases from previous user iteration optimizations.

This commit is contained in:
md_5 2014-08-16 19:04:13 +10:00
parent 3f1c996959
commit 037456c99d
6 changed files with 11 additions and 14 deletions

View File

@ -325,9 +325,8 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
@Override
public void onDisable()
{
for (Player p : getServer().getOnlinePlayers())
for (User user : getOnlineUsers())
{
User user = getUser(p);
if (user.isVanished())
{
user.setVanished(false);
@ -562,9 +561,8 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
public void cleanupOpenInventories()
{
for (Player player : getServer().getOnlinePlayers())
for (User user : getOnlineUsers())
{
User user = getUser(player);
if (user.isRecipeSee())
{
user.getBase().getOpenInventory().getTopInventory().clear();
@ -742,7 +740,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
event.getPlayer().sendMessage("Essentials failed to load, read the log file.");
}
}, this);
for (Player player : getServer().getOnlinePlayers())
for (Player player : getOnlinePlayers())
{
player.sendMessage("Essentials failed to load, read the log file.");
}

View File

@ -780,7 +780,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es
}
else
{
for (Player p : ess.getServer().getOnlinePlayers())
for (Player p : ess.getOnlinePlayers())
{
p.showPlayer(getBase());
}

View File

@ -103,10 +103,9 @@ public class Commandnear extends EssentialsCommand
final long radiusSquared = radius * radius;
boolean showHidden = user.canInteractVanished();
for (Player onlinePlayer : server.getOnlinePlayers())
for (User player: ess.getOnlineUsers())
{
final User player = ess.getUser(onlinePlayer);
if (!player.equals(user) && (!player.isHidden(user.getBase()) || showHidden || user.getBase().canSee(onlinePlayer)))
if (!player.equals(user) && (!player.isHidden(user.getBase()) || showHidden || user.getBase().canSee(player.getBase())))
{
final Location playerLoc = player.getLocation();
if (playerLoc.getWorld() != world)

View File

@ -220,9 +220,9 @@ public class Commandptime extends EssentialsCommand
// If that fails, Is the argument something like "*" or "all"?
else if (selector.equalsIgnoreCase("*") || selector.equalsIgnoreCase("all"))
{
for (Player player : server.getOnlinePlayers())
for (User u : ess.getOnlineUsers())
{
users.add(ess.getUser(player));
users.add(u);
}
}
// We failed to understand the world target...

View File

@ -170,9 +170,9 @@ public class Commandpweather extends EssentialsCommand
// If that fails, Is the argument something like "*" or "all"?
else if (selector.equalsIgnoreCase("*") || selector.equalsIgnoreCase("all"))
{
for (Player player : server.getOnlinePlayers())
for (User u : ess.getOnlineUsers())
{
users.add(ess.getUser(player));
users.add(u);
}
}
// We failed to understand the world target...

View File

@ -222,7 +222,7 @@ public class KeywordReplacer implements IText
//Now lets build the all user playerlist
final StringBuilder playerlistBuilder = new StringBuilder();
for (Player p : ess.getServer().getOnlinePlayers())
for (Player p : ess.getOnlinePlayers())
{
if (ess.getUser(p).isHidden())
{