Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more replacing. fix getUser();

  • Loading branch information...
commit ab9545624c351f3518e6d1863ff24020b6bed605 1 parent 90ba0c9
@Iaccidentally Iaccidentally authored
Showing with 61 additions and 58 deletions.
  1. +1 −1  Essentials/src/net/ess3/commands/Commandafk.java
  2. +1 −0  Essentials/src/net/ess3/commands/Commandban.java
  3. +2 −1  Essentials/src/net/ess3/commands/Commandbanip.java
  4. +1 −1  Essentials/src/net/ess3/commands/Commanddelhome.java
  5. +2 −2 Essentials/src/net/ess3/commands/Commandeco.java
  6. +2 −2 Essentials/src/net/ess3/commands/Commandexp.java
  7. +1 −1  Essentials/src/net/ess3/commands/Commandfeed.java
  8. +2 −2 Essentials/src/net/ess3/commands/Commandfly.java
  9. +1 −1  Essentials/src/net/ess3/commands/Commandgamemode.java
  10. +1 −1  Essentials/src/net/ess3/commands/Commandgive.java
  11. +1 −1  Essentials/src/net/ess3/commands/Commandgod.java
  12. +1 −1  Essentials/src/net/ess3/commands/Commandheal.java
  13. +1 −1  Essentials/src/net/ess3/commands/Commandignore.java
  14. +2 −2 Essentials/src/net/ess3/commands/Commandlightning.java
  15. +6 −6 Essentials/src/net/ess3/commands/Commandmail.java
  16. +7 −7 Essentials/src/net/ess3/commands/Commandmsg.java
  17. +1 −1  Essentials/src/net/ess3/commands/Commandnear.java
  18. +2 −2 Essentials/src/net/ess3/commands/Commandnick.java
  19. +1 −1  Essentials/src/net/ess3/commands/Commandpay.java
  20. +5 −5 Essentials/src/net/ess3/commands/Commandptime.java
  21. +4 −4 Essentials/src/net/ess3/commands/Commandr.java
  22. +1 −1  Essentials/src/net/ess3/commands/Commandrealname.java
  23. +1 −1  Essentials/src/net/ess3/commands/Commandseen.java
  24. +1 −1  Essentials/src/net/ess3/commands/Commandsethome.java
  25. +1 −1  Essentials/src/net/ess3/commands/Commandtempban.java
  26. +1 −1  Essentials/src/net/ess3/commands/Commandtime.java
  27. +2 −2 Essentials/src/net/ess3/commands/Commandtpaall.java
  28. +2 −2 Essentials/src/net/ess3/commands/Commandtpall.java
  29. +2 −2 Essentials/src/net/ess3/commands/Commandtppos.java
  30. +3 −2 Essentials/src/net/ess3/commands/Commandwarp.java
  31. +1 −1  Essentials/src/net/ess3/commands/EssentialsCommand.java
  32. +1 −1  Essentials/src/net/ess3/commands/EssentialsCommandHandler.java
View
2  Essentials/src/net/ess3/commands/Commandafk.java
@@ -14,7 +14,7 @@ public void run(final IUser user, final String commandLabel, final String[] args
{
if (args.length > 0 && Permissions.AFK_OTHERS.isAuthorized(user))
{
- IUser afkUser = ess.getUser((Player)ess.getServer().matchPlayer(args[0]));
+ IUser afkUser = player.getUser((Player)ess.getServer().matchPlayer(args[0]));
if (afkUser != null)
{
toggleAfk(afkUser);
View
1  Essentials/src/net/ess3/commands/Commandban.java
@@ -7,6 +7,7 @@
import net.ess3.user.Ban;
import lombok.Cleanup;
import net.ess3.api.server.CommandSender;
+import net.ess3.api.server.Player;
public class Commandban extends EssentialsCommand
View
3  Essentials/src/net/ess3/commands/Commandbanip.java
@@ -4,6 +4,7 @@
import net.ess3.api.IUser;
import lombok.Cleanup;
import net.ess3.api.server.CommandSender;
+import net.ess3.api.server.Player;
public class Commandbanip extends EssentialsCommand
@@ -17,7 +18,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
}
@Cleanup
- final IUser player = ess.getUser(args[0]);
+ final IUser player = player.getUser(args[0]);
player.acquireReadLock();
if (player == null)
View
2  Essentials/src/net/ess3/commands/Commanddelhome.java
@@ -20,7 +20,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
}
@Cleanup
- IUser user = sender instanceof Player ? ess.getUser((Player)sender) : null;
+ IUser user = sender instanceof Player ? player.getUser((Player)sender) : null;
String name;
String[] expandedArg;
View
4 Essentials/src/net/ess3/commands/Commandeco.java
@@ -33,9 +33,9 @@ protected void run(final CommandSender sender, final String commandLabel, final
if (args[1].contentEquals("**"))
{
- for (String sUser : ess.getUserMap().getAllUniqueUsers())
+ for (String sUser : userMap.matchUser().getAllUniqueUsers())
{
- final IUser player = ess.getUser(sUser);
+ final IUser player = Player.getUser(sUser);
switch (cmd)
{
case GIVE:
View
4 Essentials/src/net/ess3/commands/Commandexp.java
@@ -91,7 +91,7 @@ private void showMatch(final CommandSender sender, final String match) throws No
for (Player matchPlayer : server.matchPlayer(match))
{
foundUser = true;
- final IUser target = ess.getUser(matchPlayer);
+ final IUser target = player.getUser(matchPlayer);
showExp(sender, target);
}
if (!foundUser)
@@ -105,7 +105,7 @@ private void expMatch(final CommandSender sender, final String match, final Stri
boolean foundUser = false;
for (Player matchPlayer : server.matchPlayer(match))
{
- final IUser target = ess.getUser(matchPlayer);
+ final IUser target = player.getUser(matchPlayer);
setExp(sender, target, amount, toggle);
foundUser = true;
}
View
2  Essentials/src/net/ess3/commands/Commandfeed.java
@@ -35,7 +35,7 @@ private void feedOtherPlayers(final ICommandSender sender, final String name)
}
for (Player player : players)
{
- if (ess.getUser(player).isHidden())
+ if (player.getUser(player).isHidden())
{
continue;
}
View
4 Essentials/src/net/ess3/commands/Commandfly.java
@@ -4,7 +4,7 @@
import net.ess3.api.IUser;
import net.ess3.api.server.CommandSender;
import net.ess3.api.server.Player;
-import net.ess3.api.IServer
+import net.ess3.api.server.IServer;
import net.ess3.permissions.Permissions;
@@ -43,7 +43,7 @@ private void flyOtherPlayers(final Server server, final CommandSender sender, fi
{
for (Player matchPlayer : server.matchPlayer(args[0]))
{
- final IUser player = ess.getUser(matchPlayer);
+ final IUser player = player.getUser(matchPlayer);
if (player.isHidden())
{
continue;
View
2  Essentials/src/net/ess3/commands/Commandgamemode.java
@@ -39,7 +39,7 @@ private void gamemodeOtherPlayers(final CommandSender sender, final String args[
{
for (Player matchPlayer : server.matchPlayer(args[0]))
{
- final IUser player = ess.getUser(matchPlayer);
+ final IUser player = player.getUser(matchPlayer);
if (player.isHidden())
{
continue;
View
2  Essentials/src/net/ess3/commands/Commandgive.java
@@ -53,7 +53,7 @@ else if (args.length > 2 && Integer.parseInt(args[2]) > 0)
{
continue;
}
- final Enchantment enchantment = Commandenchant.getEnchantment(split[0], sender instanceof Player ? ess.getUser((Player)sender) : null);
+ final Enchantment enchantment = Commandenchant.getEnchantment(split[0], sender instanceof Player ? player.getUser((Player)sender) : null);
int level;
if (split.length > 1)
{
View
2  Essentials/src/net/ess3/commands/Commandgod.java
@@ -38,7 +38,7 @@ private void godOtherPlayers(final CommandSender sender, final String[] args)
{
for (Player matchPlayer : server.matchPlayer(args[0]))
{
- final IUser player = ess.getUser(matchPlayer);
+ final IUser player = player.getUser(matchPlayer);
if (player.isHidden())
{
continue;
View
2  Essentials/src/net/ess3/commands/Commandheal.java
@@ -53,7 +53,7 @@ private void healOtherPlayers(final CommandSender sender, final String name)
}
for (Player p : players)
{
- if (ess.getUser(p).isHidden())
+ if (player.getUser(p).isHidden())
{
continue;
}
View
2  Essentials/src/net/ess3/commands/Commandignore.java
@@ -20,7 +20,7 @@ protected void run(final IUser user, final String commandLabel, final String[] a
}
catch (NoSuchFieldException ex)
{
- player = ess.getUser(args[0]);
+ player = player.getUser(args[0]);
}
if (player == null)
{
View
4 Essentials/src/net/ess3/commands/Commandlightning.java
@@ -20,7 +20,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
IUser user = null;
if (sender instanceof Player)
{
- user = ess.getUser(((Player)sender));
+ user = player.getUser(((Player)sender));
}
if ((args.length < 1 || !Permissions.LIGHTNING_OTHERS.isAuthorized(user)) && user != null)
{
@@ -49,7 +49,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
{
sender.sendMessage(_("lightningUse", matchPlayer.getDisplayName()));
final LightningStrike strike = matchPlayer.getWorld().strikeLightningEffect(matchPlayer.getLocation());
- if (!ess.getUser(matchPlayer).isGodModeEnabled())
+ if (!player.getUser(matchPlayer).isGodModeEnabled())
{
matchPlayer.damage(power, strike);
}
View
12 Essentials/src/net/ess3/commands/Commandmail.java
@@ -42,11 +42,11 @@ public void run(final IUser user, final String commandLabel, final String[] args
IUser u;
if (player != null)
{
- u = ess.getUser(player);
+ u = player.getUser(player);
}
else
{
- u = ess.getUser(args[1]);
+ u = player.getUser(args[1]);
}
if (u == null)
{
@@ -97,11 +97,11 @@ else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
IUser u;
if (player != null)
{
- u = ess.getUser(player);
+ u = player.getUser(player);
}
else
{
- u = ess.getUser(args[1]);
+ u = player.getUser(args[1]);
}
if (u == null)
{
@@ -122,11 +122,11 @@ else if (args.length >= 2)
IUser u;
if (player != null)
{
- u = ess.getUser(player);
+ u = player.getUser(player);
}
else
{
- u = ess.getUser(args[0]);
+ u = player.getUser(args[0]);
}
if (u == null)
{
View
14 Essentials/src/net/ess3/commands/Commandmsg.java
@@ -27,7 +27,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
if (sender instanceof Player)
{
@Cleanup
- IUser user = ess.getUser((Player)sender);
+ IUser user = player.getUser((Player)sender);
user.acquireReadLock();
if (user.getData().isMuted())
{
@@ -49,7 +49,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
final String translatedMe = _("me");
- final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
+ final IReplyTo replyTo = sender instanceof Player ? player.getUser((Player)sender) : Console.getConsoleReplyTo();
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
if (args[0].equalsIgnoreCase(Console.NAME))
@@ -72,7 +72,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
int i = 0;
for (Player matchedPlayer : matchedPlayers)
{
- final IUser u = ess.getUser(matchedPlayer);
+ final IUser u = player.getUser(matchedPlayer);
if (u.isHidden())
{
i++;
@@ -86,14 +86,14 @@ protected void run(final CommandSender sender, final String commandLabel, final
for (Player matchedPlayer : matchedPlayers)
{
sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message));
- final IUser matchedUser = ess.getUser(matchedPlayer);
- if (sender instanceof Player && (matchedUser.isIgnoringPlayer(ess.getUser((Player)sender)) || matchedUser.isHidden()))
+ final IUser matchedUser = player.getUser(matchedPlayer);
+ if (sender instanceof Player && (matchedUser.isIgnoringPlayer(player.getUser((Player)sender)) || matchedUser.isHidden()))
{
continue;
}
matchedPlayer.sendMessage(_("msgFormat", senderName, translatedMe, message));
- replyTo.setReplyTo(ess.getUser(matchedPlayer));
- ess.getUser(matchedPlayer).setReplyTo(sender);
+ replyTo.setReplyTo(player.getUser(matchedPlayer));
+ player.getUser(matchedPlayer).setReplyTo(sender);
}
}
}
View
2  Essentials/src/net/ess3/commands/Commandnear.java
@@ -86,7 +86,7 @@ private String getLocal(final IUser user, final long radius)
for (Player onlinePlayer : server.getOnlinePlayers())
{
- final IUser player = ess.getUser(onlinePlayer);
+ final IUser player = player.getUser(onlinePlayer);
if (!player.equals(user) && !player.isHidden())
{
final Location playerLoc = player.getLocation();
View
4 Essentials/src/net/ess3/commands/Commandnick.java
@@ -7,7 +7,7 @@
import net.ess3.api.IUser;
import net.ess3.api.server.CommandSender;
import net.ess3.api.server.Player;
-import net.ess3.api.IServer
+import net.ess3.api.server.IServer;
import net.ess3.permissions.Permissions;
import net.ess3.utils.Util;
@@ -84,7 +84,7 @@ private void resetAllNicknames(final Server server)
{
try
{
- setNickname(ess.getUser(player), "off");
+ setNickname(player.getUser(player), "off");
}
catch (Exception ex)
{
View
2  Essentials/src/net/ess3/commands/Commandpay.java
@@ -27,7 +27,7 @@ public void run(final IUser user, final String commandLabel, final String[] args
boolean foundUser = false;
for (Player p : server.matchPlayer(args[0]))
{
- IUser u = ess.getUser(p);
+ IUser u = player.getUser(p);
if (u.isHidden())
{
continue;
View
10 Essentials/src/net/ess3/commands/Commandptime.java
@@ -41,7 +41,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
return;
}
- IUser user = sender instanceof Player ? ess.getUser((Player)sender) : null;
+ IUser user = sender instanceof Player ? Player.getUser((Player)sender) : null;
if ((!users.contains(user) || users.size() > 1) && user != null && !Permissions.PTIME_OTHERS.isAuthorized(user))
{
user.sendMessage(_("pTimeOthersPermission"));
@@ -183,12 +183,12 @@ private void setUsersTime(final CommandSender sender, final Collection<IUser> us
// If there is no selector we want the sender itself. Or all users if sender isn't a user.
if (selector == null)
{
- final IUser user = sender instanceof Player ? ess.getUser((Player)sender) : null;
+ final IUser user = sender instanceof Player ? Player.getUser((Player)sender) : null;
if (user == null)
{
for (Player player : server.getOnlinePlayers())
{
- users.add(ess.getUser(player));
+ users.add(Player.getUser(player));
}
}
else
@@ -203,7 +203,7 @@ private void setUsersTime(final CommandSender sender, final Collection<IUser> us
final List<Player> matchedPlayers = server.matchPlayer(selector);
if (!matchedPlayers.isEmpty())
{
- user = ess.getUser(matchedPlayers.get(0));
+ user = Player.getUser(matchedPlayers.get(0));
}
if (user != null)
@@ -215,7 +215,7 @@ else if (selector.equalsIgnoreCase("*") || selector.equalsIgnoreCase("all"))
{
for (Player player : server.getOnlinePlayers())
{
- users.add(ess.getUser(player));
+ users.add(player.getUser(player));
}
}
// We failed to understand the world target...
View
8 Essentials/src/net/ess3/commands/Commandr.java
@@ -26,7 +26,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
if (sender instanceof Player)
{
- IUser user = ess.getUser((Player)sender);
+ IUser user = Player.getUser((Player)sender);
if (Permissions.MSG_COLOR.isAuthorized(user))
{
message = Util.replaceFormat(message);
@@ -56,8 +56,8 @@ protected void run(final CommandSender sender, final String commandLabel, final
sender.sendMessage(_("msgFormat", _("me"), targetName, message));
if (target instanceof Player)
{
- IUser player = ess.getUser((Player)target);
- if (sender instanceof Player && player.isIgnoringPlayer(ess.getUser((Player)sender)))
+ IUser player = player.getUser((Player)target);
+ if (sender instanceof Player && player.isIgnoringPlayer(player.getUser((Player)sender)))
{
return;
}
@@ -68,7 +68,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
{
if (target instanceof Player)
{
- ess.getUser((Player)target).setReplyTo(sender);
+ player.getUser((Player)target).setReplyTo(sender);
}
else
{
View
2  Essentials/src/net/ess3/commands/Commandrealname.java
@@ -24,7 +24,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
final String whois = args[0].toLowerCase(Locale.ENGLISH);
for (Player onlinePlayer : server.getOnlinePlayers())
{
- final IUser u = ess.getUser(onlinePlayer);
+ final IUser u = player.getUser(onlinePlayer);
if (u.isHidden())
{
continue;
View
2  Essentials/src/net/ess3/commands/Commandseen.java
@@ -37,7 +37,7 @@ protected void seen (final CommandSender sender, final String[] args, final bool
catch (NoSuchFieldException e)
{
@Cleanup
- IUser u = ess.getUser(args[0]);
+ IUser u = player.getUser(args[0]);
u.acquireReadLock();
if (u == null)
{
View
2  Essentials/src/net/ess3/commands/Commandsethome.java
@@ -56,7 +56,7 @@ public void run(final IUser user, final String commandLabel, String[] args) thro
if (Permissions.SETHOME_OTHERS.isAuthorized(user))
{
@Cleanup
- IUser usersHome = ess.getUser(ess.getServer().getPlayer(args[0]));
+ IUser usersHome = player.getUser(ess.getServer().getPlayer(args[0]));
if (usersHome == null)
{
throw new Exception(_("playerNotFound"));
View
2  Essentials/src/net/ess3/commands/Commandtempban.java
@@ -51,7 +51,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
for (Player onlinePlayer : server.getOnlinePlayers())
{
- final IUser player = ess.getUser(onlinePlayer);
+ final IUser player = player.getUser(onlinePlayer);
if (Permissions.BAN_NOTIFY.isAuthorized(player))
{
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
View
2  Essentials/src/net/ess3/commands/Commandtime.java
@@ -122,7 +122,7 @@ private void setWorldsTime(final CommandSender sender, final Collection<World> w
// If there is no selector we want the world the user is currently in. Or all worlds if it isn't a user.
if (selector == null)
{
- final IUser user = sender instanceof Player ? ess.getUser((Player)sender) : null;
+ final IUser user = sender instanceof Player ? player.getUser((Player)sender) : null;
if (user == null)
{
worlds.addAll(server.getWorlds());
View
4 Essentials/src/net/ess3/commands/Commandtpaall.java
@@ -18,7 +18,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
{
if (sender instanceof Player)
{
- teleportAAllPlayers(sender, ess.getUser((Player)sender));
+ teleportAAllPlayers(sender, player.getUser((Player)sender));
return;
}
throw new NotEnoughArgumentsException();
@@ -34,7 +34,7 @@ private void teleportAAllPlayers(final CommandSender sender, final IUser user)
for (Player onlinePlayer : server.getOnlinePlayers())
{
@Cleanup
- final IUser player = ess.getUser(onlinePlayer);
+ final IUser player = player.getUser(onlinePlayer);
player.acquireReadLock();
if (user == player)
{
View
4 Essentials/src/net/ess3/commands/Commandtpall.java
@@ -20,7 +20,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
{
if (sender instanceof Player)
{
- teleportAllPlayers(sender, ess.getUser((Player)sender));
+ teleportAllPlayers(sender, player.getUser((Player)sender));
return;
}
throw new NotEnoughArgumentsException();
@@ -35,7 +35,7 @@ private void teleportAllPlayers(CommandSender sender, IUser user)
sender.sendMessage(_("teleportAll"));
for (Player onlinePlayer : server.getOnlinePlayers())
{
- final IUser player = ess.getUser(onlinePlayer);
+ final IUser player = player.getUser(onlinePlayer);
if (user == player)
{
continue;
View
4 Essentials/src/net/ess3/commands/Commandtppos.java
@@ -2,9 +2,9 @@
import static net.ess3.I18n._;
import net.ess3.api.IUser;
+import net.ess3.api.server.CommandSender;
import net.ess3.api.server.Location;
import net.ess3.economy.Trade;
-//TODO: remove bukkit
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -45,7 +45,7 @@ public void run(final CommandSender sender, final String commandLabel, final Str
throw new NotEnoughArgumentsException();
}
- IUser user = ess.getUser(server.getPlayer(args[0]));
+ IUser user = player.getUser(server.getPlayer(args[0]));
final int x = Integer.parseInt(args[1]);
final int y = Integer.parseInt(args[2]);
final int z = Integer.parseInt(args[3]);
View
5 Essentials/src/net/ess3/commands/Commandwarp.java
@@ -12,6 +12,7 @@
import java.util.List;
import java.util.Locale;
//TODO: remove bukkit
+import net.ess3.api.server.CommandSender;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -36,7 +37,7 @@ public void run(final IUser user, final String commandLabel, final String[] args
IUser otherUser = null;
if (args.length == 2 && Permissions.WARP_OTHERS.isAuthorized(user))
{
- otherUser = ess.getUser(server.getPlayer(args[1]));
+ otherUser = player.getUser(server.getPlayer(args[1]));
if (otherUser == null)
{
throw new Exception(_("playerNotFound"));
@@ -57,7 +58,7 @@ protected void run(final CommandSender sender, final String commandLabel, final
warpList(sender, args);
throw new NoChargeException();
}
- IUser otherUser = ess.getUser(server.getPlayer(args[1]));
+ IUser otherUser = player.getUser(server.getPlayer(args[1]));
if (otherUser == null)
{
throw new Exception(_("playerNotFound"));
View
2  Essentials/src/net/ess3/commands/EssentialsCommand.java
@@ -53,7 +53,7 @@ protected IUser getPlayer(final String[] args, final int pos, final boolean getO
{
throw new NoSuchFieldException(_("playerNotFound"));
}
- final IUser user = ess.getUser(args[pos]);
+ final IUser user = player.getUser(args[pos]);
if (user != null)
{
if (!getOffline && (!user.isOnline() || user.isHidden()))
View
2  Essentials/src/net/ess3/commands/EssentialsCommandHandler.java
@@ -102,7 +102,7 @@ public boolean handleCommand(final CommandSender sender, final Command command,
IUser user = null;
if (sender instanceof Player)
{
- user = ess.getUser((Player)sender);
+ user = player.getUser((Player)sender);
LOGGER.log(Level.INFO, String.format("[PLAYER_COMMAND] %s: /%s %s ", ((Player)sender).getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)));
}
Please sign in to comment.
Something went wrong with that request. Please try again.