summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandessentials.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkickall.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandnick.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandnuke.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandptime.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandpweather.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandrealname.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpall.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java15
12 files changed, 26 insertions, 36 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java
index 1633fd685..311cb3e13 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java
@@ -5,8 +5,7 @@ import static com.earth2me.essentials.I18n.tl;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.NumberUtil;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.Collection;
import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.entity.Player;
@@ -36,7 +35,7 @@ public class Commandclearinventory extends EssentialsCommand
private void parseCommand(Server server, CommandSource sender, String[] args, boolean allowOthers, boolean allowAll) throws Exception
{
- List<Player> players = new ArrayList<Player>();
+ Collection<Player> players = new ArrayList<Player>();
int offset = 0;
if (sender.isPlayer())
@@ -48,7 +47,7 @@ public class Commandclearinventory extends EssentialsCommand
{
sender.sendMessage(tl("inventoryClearingFromAll"));
offset = 1;
- players = Arrays.asList(server.getOnlinePlayers());
+ players = ess.getOnlinePlayers();
}
else if (allowOthers && args.length > 0 && args[0].trim().length() > 2)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
index 23173661e..54f409b8e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
@@ -165,7 +165,7 @@ public class Commandessentials extends EssentialsCommand
{
return;
}
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (Player onlinePlayer : ess.getOnlinePlayers())
{
onlinePlayer.playSound(onlinePlayer.getLocation(), Sound.NOTE_PIANO, 1, noteMap.get(note));
}
@@ -214,7 +214,7 @@ public class Commandessentials extends EssentialsCommand
{
logger.info(s);
}
- for (Player player : ess.getServer().getOnlinePlayers())
+ for (Player player : ess.getOnlinePlayers())
{
player.sendMessage(playerMoo);
player.playSound(player.getLocation(), Sound.COW_IDLE, 1, 1.0f);
@@ -348,7 +348,7 @@ public class Commandessentials extends EssentialsCommand
UUID onlineUUID = null;
- for (Player player : server.getOnlinePlayers())
+ for (Player player : ess.getOnlinePlayers())
{
if (player.getName().equalsIgnoreCase(name))
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java
index ba885731a..745da13e3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java
@@ -20,7 +20,7 @@ public class Commandkickall extends EssentialsCommand
String kickReason = args.length > 0 ? getFinalArg(args, 0) : tl("kickDefault");
kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n"));
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (Player onlinePlayer : ess.getOnlinePlayers())
{
if (!sender.isPlayer() || !onlinePlayer.getName().equalsIgnoreCase(sender.getPlayer().getName()))
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java
index 366b525e0..fb8914fe4 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java
@@ -109,7 +109,7 @@ public class Commandnick extends EssentialsLoopCommand
private boolean nickInUse(final Server server, final User target, String nick)
{
final String lowerNick = FormatUtil.stripFormat(nick.toLowerCase(Locale.ENGLISH));
- for (final Player onlinePlayer : server.getOnlinePlayers())
+ for (final Player onlinePlayer : ess.getOnlinePlayers())
{
if (target.getBase().getName().equals(onlinePlayer.getName()))
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java
index 7e6e347c3..e82c46c8d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandnuke.java
@@ -3,8 +3,7 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n.tl;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.Collection;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
@@ -22,7 +21,7 @@ public class Commandnuke extends EssentialsCommand
@Override
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException
{
- List<Player> targets;
+ Collection<Player> targets;
if (args.length > 0)
{
targets = new ArrayList<Player>();
@@ -35,7 +34,7 @@ public class Commandnuke extends EssentialsCommand
}
else
{
- targets = Arrays.asList(server.getOnlinePlayers());
+ targets = ess.getOnlinePlayers();
}
ess.getTNTListener().enable();
for (Player player : targets)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java
index c14f31cbb..6bd748bff 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java
@@ -197,9 +197,9 @@ public class Commandptime extends EssentialsCommand
}
else
{
- for (Player player : server.getOnlinePlayers())
+ for (User user : ess.getOnlineUsers())
{
- users.add(ess.getUser(player));
+ users.add(user);
}
}
return users;
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java
index cf47e8b17..9aec1ff6b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java
@@ -147,9 +147,9 @@ public class Commandpweather extends EssentialsCommand
}
else
{
- for (Player player : server.getOnlinePlayers())
+ for (User user : ess.getOnlineUsers())
{
- users.add(ess.getUser(player));
+ users.add(user);
}
}
return users;
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java
index a292316bd..55cdadbfb 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java
@@ -26,10 +26,9 @@ public class Commandrealname extends EssentialsCommand
final String whois = args[0].toLowerCase(Locale.ENGLISH);
boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).canInteractVanished();
boolean foundUser = false;
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (User u: ess.getOnlineUsers())
{
- final User u = ess.getUser(onlinePlayer);
- if (skipHidden && u.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(onlinePlayer))
+ if (skipHidden && u.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(u.getBase()))
{
continue;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java
index 572083540..4cbd9603b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java
@@ -34,9 +34,8 @@ public class Commandtpaall extends EssentialsCommand
private void teleportAAllPlayers(final Server server, final CommandSource sender, final User target)
{
sender.sendMessage(tl("teleportAAll"));
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (User player : ess.getOnlineUsers())
{
- final User player = ess.getUser(onlinePlayer);
if (target == player)
{
continue;
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
index 503d29e98..c850fad2e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java
@@ -37,9 +37,8 @@ public class Commandtpall extends EssentialsCommand
{
sender.sendMessage(tl("teleportAll"));
final Location loc = target.getLocation();
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (User player : ess.getOnlineUsers())
{
- final User player = ess.getUser(onlinePlayer);
if (target == player)
{
continue;
diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
index 71d45a288..ee605ffb3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
+++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java
@@ -137,10 +137,8 @@ public abstract class EssentialsCommand implements IEssentialsCommand
if (matches.isEmpty())
{
final String matchText = searchTerm.toLowerCase(Locale.ENGLISH);
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (User userMatch : ess.getOnlineUsers())
{
- final User userMatch = ess.getUser(onlinePlayer);
-
if (getHidden || canInteractWith(sourceUser, userMatch))
{
final String displayName = FormatUtil.stripFormat(userMatch.getDisplayName()).toLowerCase(Locale.ENGLISH);
diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java
index 7dfa594fc..ccb297f14 100644
--- a/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java
+++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsLoopCommand.java
@@ -38,10 +38,9 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand
else if (matchWildcards && searchTerm.contentEquals("*"))
{
boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).canInteractVanished();
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (User onlineUser : ess.getOnlineUsers())
{
- final User onlineUser = ess.getUser(onlinePlayer);
- if (skipHidden && onlineUser.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(onlinePlayer))
+ if (skipHidden && onlineUser.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(onlineUser.getBase()))
{
continue;
}
@@ -85,10 +84,9 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand
if (matchWildcards && (searchTerm.contentEquals("**") || searchTerm.contentEquals("*")))
{
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (User onlineUser : ess.getOnlineUsers())
{
- final User onlineUser = ess.getUser(onlinePlayer);
- if (skipHidden && onlineUser.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(onlinePlayer))
+ if (skipHidden && onlineUser.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(onlineUser.getBase()))
{
continue;
}
@@ -107,10 +105,9 @@ public abstract class EssentialsLoopCommand extends EssentialsCommand
if (matchedPlayers.isEmpty())
{
final String matchText = searchTerm.toLowerCase(Locale.ENGLISH);
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (User player : ess.getOnlineUsers())
{
- final User player = ess.getUser(onlinePlayer);
- if (skipHidden && player.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(onlinePlayer))
+ if (skipHidden && player.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(player.getBase()))
{
continue;
}