diff options
60 files changed, 172 insertions, 201 deletions
diff --git a/Essentials/src/net/ess3/Jails.java b/Essentials/src/net/ess3/Jails.java index 2c3f31bca..e2dfec477 100644 --- a/Essentials/src/net/ess3/Jails.java +++ b/Essentials/src/net/ess3/Jails.java @@ -164,7 +164,7 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp public void onBlockBreak(final BlockBreakEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (user.getData().isJailed()) { @@ -176,7 +176,7 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp public void onBlockPlace(final BlockPlaceEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (user.getData().isJailed()) { @@ -188,7 +188,7 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp public void onBlockDamage(final BlockDamageEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (user.getData().isJailed()) { @@ -204,7 +204,7 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp public void onPlayerInteract(final PlayerInteractEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (user.getData().isJailed()) { @@ -216,7 +216,7 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp public void onPlayerRespawn(final PlayerRespawnEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (!user.getData().isJailed() || user.getData().getJail() == null || user.getData().getJail().isEmpty()) { @@ -244,7 +244,7 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp public void onPlayerTeleport(final PlayerTeleportEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (!user.getData().isJailed() || user.getData().getJail() == null || user.getData().getJail().isEmpty()) { @@ -273,7 +273,7 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp public void onPlayerJoin(final PlayerJoinEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (!user.getData().isJailed() || user.getData().getJail() == null || user.getData().getJail().isEmpty()) { diff --git a/Essentials/src/net/ess3/commands/Commandafk.java b/Essentials/src/net/ess3/commands/Commandafk.java index 9bd3662c7..a04fbf8b4 100644 --- a/Essentials/src/net/ess3/commands/Commandafk.java +++ b/Essentials/src/net/ess3/commands/Commandafk.java @@ -2,8 +2,6 @@ package net.ess3.commands; import static net.ess3.I18n._; import net.ess3.api.IUser; -import net.ess3.api.server.Permission; -import net.ess3.api.server.Player; import net.ess3.permissions.Permissions; @@ -14,7 +12,7 @@ public class Commandafk extends EssentialsCommand { if (args.length > 0 && Permissions.AFK_OTHERS.isAuthorized(user)) { - IUser afkUser = ess.getUser((Player)ess.getServer().matchPlayer(args[0])); + IUser afkUser = ess.getUserMap().getUser(args[0]); if (afkUser != null) { toggleAfk(afkUser); @@ -46,11 +44,5 @@ public class Commandafk extends EssentialsCommand ess.broadcastMessage(user, _("userIsAway", user.getDisplayName())); } } - } - - @Override - public Permission.Default getPermissionDefault() - { - return Permission.Default.TRUE; - } + } } diff --git a/Essentials/src/net/ess3/commands/Commandban.java b/Essentials/src/net/ess3/commands/Commandban.java index 959904b4f..c94f30e9e 100644 --- a/Essentials/src/net/ess3/commands/Commandban.java +++ b/Essentials/src/net/ess3/commands/Commandban.java @@ -7,6 +7,7 @@ import net.ess3.permissions.Permissions; 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 @@ -55,7 +56,7 @@ public class Commandban extends EssentialsCommand user.setBanned(true); user.kickPlayer(banReason); - for (IPlayer onlinePlayer : server.getOnlinePlayers()) + for (Player onlinePlayer : server.getOnlinePlayers()) { final IUser player = onlinePlayer.getUser(); if (Permissions.BAN_NOTIFY.isAuthorized(player)) diff --git a/Essentials/src/net/ess3/commands/Commandbanip.java b/Essentials/src/net/ess3/commands/Commandbanip.java index 66ff37eb5..0b74e2c66 100644 --- a/Essentials/src/net/ess3/commands/Commandbanip.java +++ b/Essentials/src/net/ess3/commands/Commandbanip.java @@ -17,7 +17,7 @@ public class Commandbanip extends EssentialsCommand } @Cleanup - final IUser player = ess.getUser(args[0]); + final IUser player = ess.getUserMap().getUser(args[0]); player.acquireReadLock(); if (player == null) diff --git a/Essentials/src/net/ess3/commands/Commandbreak.java b/Essentials/src/net/ess3/commands/Commandbreak.java index 78e58ce0e..2ff282708 100644 --- a/Essentials/src/net/ess3/commands/Commandbreak.java +++ b/Essentials/src/net/ess3/commands/Commandbreak.java @@ -1,10 +1,9 @@ package net.ess3.commands; -import net.ess3.api.IUser; -import net.ess3.permissions.Permissions; import static net.ess3.I18n._; +import net.ess3.api.IUser; import net.ess3.api.server.Material; -//TODO: remove bukkit +import net.ess3.permissions.Permissions; import org.bukkit.block.Block; import org.bukkit.event.block.BlockBreakEvent; diff --git a/Essentials/src/net/ess3/commands/Commandburn.java b/Essentials/src/net/ess3/commands/Commandburn.java index 24f0e5f87..c4ac6d9ca 100644 --- a/Essentials/src/net/ess3/commands/Commandburn.java +++ b/Essentials/src/net/ess3/commands/Commandburn.java @@ -15,7 +15,7 @@ public class Commandburn extends EssentialsCommand throw new NotEnoughArgumentsException(); } - for (Player p : server.matchPlayer(args[0])) + for (Player p : ess.getUserMap().matchUsers(args[0], false, true)) { p.setFireTicks(Integer.parseInt(args[1]) * 20); sender.sendMessage(_("burnMsg", p.getDisplayName(), Integer.parseInt(args[1]))); diff --git a/Essentials/src/net/ess3/commands/Commanddelhome.java b/Essentials/src/net/ess3/commands/Commanddelhome.java index 4856bd824..61f5cdbfc 100644 --- a/Essentials/src/net/ess3/commands/Commanddelhome.java +++ b/Essentials/src/net/ess3/commands/Commanddelhome.java @@ -20,7 +20,7 @@ public class Commanddelhome extends EssentialsCommand } @Cleanup - IUser user = sender instanceof Player ? ess.getUser((Player)sender) : null; + IUser user = sender instanceof Player ? ess.getUserMap().getUser((Player)sender) : null; String name; String[] expandedArg; diff --git a/Essentials/src/net/ess3/commands/Commandeco.java b/Essentials/src/net/ess3/commands/Commandeco.java index 571f695df..e51c31fdb 100644 --- a/Essentials/src/net/ess3/commands/Commandeco.java +++ b/Essentials/src/net/ess3/commands/Commandeco.java @@ -35,7 +35,7 @@ public class Commandeco extends EssentialsCommand { for (String sUser : ess.getUserMap().getAllUniqueUsers()) { - final IUser player = ess.getUser(sUser); + final IUser player = ess.getUserMap().getUser(sUser); switch (cmd) { case GIVE: diff --git a/Essentials/src/net/ess3/commands/Commandexp.java b/Essentials/src/net/ess3/commands/Commandexp.java index 4c0b0054c..7025d142e 100644 --- a/Essentials/src/net/ess3/commands/Commandexp.java +++ b/Essentials/src/net/ess3/commands/Commandexp.java @@ -88,11 +88,10 @@ public class Commandexp extends EssentialsCommand private void showMatch(final CommandSender sender, final String match) throws NotEnoughArgumentsException { boolean foundUser = false; - for (Player matchPlayer : server.matchPlayer(match)) + for (IUser matchPlayer : ess.getUserMap().matchUsers(match, false, true)) { - foundUser = true; - final IUser target = ess.getUser(matchPlayer); - showExp(sender, target); + foundUser = true; + showExp(sender, matchPlayer); } if (!foundUser) { @@ -103,10 +102,9 @@ public class Commandexp extends EssentialsCommand private void expMatch(final CommandSender sender, final String match, final String amount, final boolean toggle) throws NotEnoughArgumentsException { boolean foundUser = false; - for (Player matchPlayer : server.matchPlayer(match)) - { - final IUser target = ess.getUser(matchPlayer); - setExp(sender, target, amount, toggle); + for (IUser matchPlayer : ess.getUserMap().matchUsers(match, false, true)) + { + setExp(sender, matchPlayer, amount, toggle); foundUser = true; } if (!foundUser) diff --git a/Essentials/src/net/ess3/commands/Commandext.java b/Essentials/src/net/ess3/commands/Commandext.java index da2bd29f5..9d614b306 100644 --- a/Essentials/src/net/ess3/commands/Commandext.java +++ b/Essentials/src/net/ess3/commands/Commandext.java @@ -34,7 +34,7 @@ public class Commandext extends EssentialsCommand private void extinguishPlayers(final CommandSender sender, final String name) throws Exception { - for (Player matchPlayer : server.matchPlayer(name)) + for (Player matchPlayer : ess.getUserMap().matchUsers(name, true, false)) { matchPlayer.setFireTicks(0); sender.sendMessage(_("extinguishOthers", matchPlayer.getDisplayName())); diff --git a/Essentials/src/net/ess3/commands/Commandfeed.java b/Essentials/src/net/ess3/commands/Commandfeed.java index b2340ef60..1ca9d7b95 100644 --- a/Essentials/src/net/ess3/commands/Commandfeed.java +++ b/Essentials/src/net/ess3/commands/Commandfeed.java @@ -1,10 +1,12 @@ package net.ess3.commands; +import java.util.List; +import java.util.Set; import static net.ess3.I18n._; import net.ess3.api.IUser; -import net.ess3.permissions.Permissions; -import java.util.List; +import net.ess3.api.server.CommandSender; import net.ess3.api.server.Player; +import net.ess3.permissions.Permissions; public class Commandfeed extends EssentialsCommand @@ -24,21 +26,16 @@ public class Commandfeed extends EssentialsCommand } } - private void feedOtherPlayers(final ICommandSender sender, final String name) - // shouldn't this be CommandSender? ^ + private void feedOtherPlayers(final CommandSender sender, final String name) { - final List<Player> players = server.matchPlayer(name); - if (players.isEmpty()) + final Set<IUser> users = ess.getUserMap().matchUsers(name, false, true); + if (users.isEmpty()) { sender.sendMessage(_("playerNotFound")); return; } - for (Player player : players) - { - if (ess.getUser(player).isHidden()) - { - continue; - } + for (Player player : users) + { player.setFoodLevel(20); player.setSaturation(10); sender.sendMessage(_("feedOther", player.getDisplayName())); diff --git a/Essentials/src/net/ess3/commands/Commandfly.java b/Essentials/src/net/ess3/commands/Commandfly.java index 54e6dec42..9d587bdb2 100644 --- a/Essentials/src/net/ess3/commands/Commandfly.java +++ b/Essentials/src/net/ess3/commands/Commandfly.java @@ -4,7 +4,7 @@ import static net.ess3.I18n._; 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; @@ -39,36 +39,31 @@ public class Commandfly extends EssentialsCommand user.sendMessage(_("flyMode", _(user.getAllowFlight() ? "enabled" : "disabled"), user.getDisplayName())); } - private void flyOtherPlayers(final Server server, final CommandSender sender, final String[] args) + private void flyOtherPlayers(final IServer server, final CommandSender sender, final String[] args) { - for (Player matchPlayer : server.matchPlayer(args[0])) - { - final IUser player = ess.getUser(matchPlayer); - if (player.isHidden()) - { - continue; - } + for (Player matchPlayer : ess.getUserMap().matchUsers(args[0],true,true)) + { if (args.length > 1) { if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1")) { - player.setAllowFlight(true); + matchPlayer.setAllowFlight(true); } else { - player.setAllowFlight(false); + matchPlayer.setAllowFlight(false); } } else { - player.setAllowFlight(!player.getAllowFlight()); + matchPlayer.setAllowFlight(!matchPlayer.getAllowFlight()); } - if (!player.getAllowFlight()) + if (!matchPlayer.getAllowFlight()) { - player.setFlying(false); + matchPlayer.setFlying(false); } - sender.sendMessage(_("flyMode", _(player.getAllowFlight() ? "enabled" : "disabled"), player.getDisplayName())); + sender.sendMessage(_("flyMode", _(matchPlayer.getAllowFlight() ? "enabled" : "disabled"), matchPlayer.getDisplayName())); } } } diff --git a/Essentials/src/net/ess3/commands/Commandgamemode.java b/Essentials/src/net/ess3/commands/Commandgamemode.java index 4a4cac437..6cdf6f6f4 100644 --- a/Essentials/src/net/ess3/commands/Commandgamemode.java +++ b/Essentials/src/net/ess3/commands/Commandgamemode.java @@ -37,14 +37,8 @@ public class Commandgamemode extends EssentialsCommand private void gamemodeOtherPlayers(final CommandSender sender, final String args[]) { - for (Player matchPlayer : server.matchPlayer(args[0])) - { - final IUser player = ess.getUser(matchPlayer); - if (player.isHidden()) - { - continue; - } - + for (Player player : ess.getUserMap().matchUsers(args[0], false, true)) + { if (args.length > 1) { if (args[1].contains("creat") || args[1].equalsIgnoreCase("1")) diff --git a/Essentials/src/net/ess3/commands/Commandgive.java b/Essentials/src/net/ess3/commands/Commandgive.java index eb326748e..6cbc178f3 100644 --- a/Essentials/src/net/ess3/commands/Commandgive.java +++ b/Essentials/src/net/ess3/commands/Commandgive.java @@ -53,7 +53,7 @@ public class Commandgive extends EssentialsCommand { 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 ? ess.getUserMap().getUser((Player)sender) : null); int level; if (split.length > 1) { diff --git a/Essentials/src/net/ess3/commands/Commandgod.java b/Essentials/src/net/ess3/commands/Commandgod.java index 97c04ca23..0f74689d3 100644 --- a/Essentials/src/net/ess3/commands/Commandgod.java +++ b/Essentials/src/net/ess3/commands/Commandgod.java @@ -38,7 +38,7 @@ public class Commandgod extends EssentialsCommand { for (Player matchPlayer : server.matchPlayer(args[0])) { - final IUser player = ess.getUser(matchPlayer); + final IUser player = ess.getUserMap().getUser(matchPlayer); if (player.isHidden()) { continue; diff --git a/Essentials/src/net/ess3/commands/Commandheal.java b/Essentials/src/net/ess3/commands/Commandheal.java index d5c18149c..cdbca69a4 100644 --- a/Essentials/src/net/ess3/commands/Commandheal.java +++ b/Essentials/src/net/ess3/commands/Commandheal.java @@ -1,6 +1,7 @@ package net.ess3.commands; import java.util.List; +import java.util.Set; import static net.ess3.I18n._; import net.ess3.api.IUser; import net.ess3.api.server.CommandSender; @@ -9,7 +10,6 @@ import net.ess3.permissions.Permissions; import net.ess3.user.UserData.TimestampType; - public class Commandheal extends EssentialsCommand { @Override @@ -45,18 +45,14 @@ public class Commandheal extends EssentialsCommand private void healOtherPlayers(final CommandSender sender, final String name) { - final List<Player> players = server.matchPlayer(name); - if (players.isEmpty()) + final Set<IUser> users = ess.getUserMap().matchUsers(name, false, true); + if (users.isEmpty()) { sender.sendMessage(_("playerNotFound")); return; } - for (Player p : players) - { - if (ess.getUser(p).isHidden()) - { - continue; - } + for (Player p : users) + { p.setHealth(20); p.setFoodLevel(20); p.sendMessage(_("heal")); diff --git a/Essentials/src/net/ess3/commands/Commandhelpop.java b/Essentials/src/net/ess3/commands/Commandhelpop.java index 542d89b10..5ca9a5386 100644 --- a/Essentials/src/net/ess3/commands/Commandhelpop.java +++ b/Essentials/src/net/ess3/commands/Commandhelpop.java @@ -1,9 +1,11 @@ package net.ess3.commands; import java.util.logging.Level; +import static net.ess3.I18n._; import net.ess3.api.IUser; import net.ess3.api.server.Player; import net.ess3.permissions.Permissions; +import net.ess3.utils.Util; public class Commandhelpop extends EssentialsCommand diff --git a/Essentials/src/net/ess3/commands/Commandignore.java b/Essentials/src/net/ess3/commands/Commandignore.java index af9f2b710..82261dbfa 100644 --- a/Essentials/src/net/ess3/commands/Commandignore.java +++ b/Essentials/src/net/ess3/commands/Commandignore.java @@ -20,7 +20,7 @@ public class Commandignore extends EssentialsCommand } catch (NoSuchFieldException ex) { - player = ess.getUser(args[0]); + player = ess.getUserMap().getUser(args[0]); } if (player == null) { diff --git a/Essentials/src/net/ess3/commands/Commandkill.java b/Essentials/src/net/ess3/commands/Commandkill.java index 7611ef7e3..2797ba0fe 100644 --- a/Essentials/src/net/ess3/commands/Commandkill.java +++ b/Essentials/src/net/ess3/commands/Commandkill.java @@ -18,7 +18,7 @@ public class Commandkill extends EssentialsCommand throw new NotEnoughArgumentsException(); } - for (Player matchPlayer : server.matchPlayer(args[0])) + for (Player matchPlayer : ess.getUserMap().matchUsers(args[0], false, true)) { final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE); server.getPluginManager().callEvent(ede); diff --git a/Essentials/src/net/ess3/commands/Commandlightning.java b/Essentials/src/net/ess3/commands/Commandlightning.java index 646adadcd..5f7735d82 100644 --- a/Essentials/src/net/ess3/commands/Commandlightning.java +++ b/Essentials/src/net/ess3/commands/Commandlightning.java @@ -20,7 +20,7 @@ public class Commandlightning extends EssentialsCommand IUser user = null; if (sender instanceof Player) { - user = ess.getUser(((Player)sender)); + user = ess.getUserMap().getUser(((Player)sender)); } if ((args.length < 1 || !Permissions.LIGHTNING_OTHERS.isAuthorized(user)) && user != null) { @@ -28,7 +28,7 @@ public class Commandlightning extends EssentialsCommand return; } - if (server.matchPlayer(args[0]).isEmpty()) + if (ess.getUserMap().matchUsers(args[0], false, true).isEmpty()) { throw new Exception(_("playerNotFound")); } @@ -45,11 +45,11 @@ public class Commandlightning extends EssentialsCommand } } - for (Player matchPlayer : server.matchPlayer(args[0])) + for (Player matchPlayer : ess.getUserMap().matchUsers(args[0], false, true)) { sender.sendMessage(_("lightningUse", matchPlayer.getDisplayName())); final LightningStrike strike = matchPlayer.getWorld().strikeLightningEffect(matchPlayer.getLocation()); - if (!ess.getUser(matchPlayer).isGodModeEnabled()) + if (!ess.getUserMap().getUser(matchPlayer).isGodModeEnabled()) { matchPlayer.damage(power, strike); } diff --git a/Essentials/src/net/ess3/commands/Commandmail.java b/Essentials/src/net/ess3/commands/Commandmail.java index 25893cb4c..75896c658 100644 --- a/Essentials/src/net/ess3/commands/Commandmail.java +++ b/Essentials/src/net/ess3/commands/Commandmail.java @@ -9,7 +9,6 @@ import java.util.List; import net.ess3.api.server.Player; - public class Commandmail extends EssentialsCommand { //TODO: Tidy this up @@ -38,15 +37,15 @@ public class Commandmail extends EssentialsCommand throw new Exception(_("noPerm", "essentials.mail.send")); } - Player player = server.getPlayer(args[1]); + Player player = ess.getUserMap().matchUser(args[1], true, false); IUser u; if (player != null) { - u = ess.getUser(player); + u = ess.getUserMap().getUser(player); } else { - u = ess.getUser(args[1]); + u = ess.getUserMap().getUser(args[1]); } if (u == null) { @@ -93,15 +92,15 @@ public class Commandmail extends EssentialsCommand } else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { - Player player = server.getPlayer(args[1]); + Player player = ess.getUserMap().matchUser(args[1], true, false); IUser u; if (player != null) { - u = ess.getUser(player); + u = ess.getUserMap().getUser(player); } else { - u = ess.getUser(args[1]); + u = ess.getUserMap().getUser(args[1]); } if (u == null) { @@ -118,15 +117,15 @@ public class Commandmail extends EssentialsCommand else if (args.length >= 2) { //allow sending from console without "send" argument, since it's the only thing the console can do - Player player = server.getPlayer(args[0]); + Player player = ess.getUserMap().matchUser(args[0], true, false); IUser u; if (player != null) { - u = ess.getUser(player); + u = ess.getUserMap().getUser(player); } else { - u = ess.getUser(args[0]); + u = ess.getUserMap().getUser(args[0]); } if (u == null) { diff --git a/Essentials/src/net/ess3/commands/Commandmsg.java b/Essentials/src/net/ess3/commands/Commandmsg.java index 3a2e8b297..91f38f38b 100644 --- a/Essentials/src/net/ess3/commands/Commandmsg.java +++ b/Essentials/src/net/ess3/commands/Commandmsg.java @@ -27,7 +27,7 @@ public class Commandmsg extends EssentialsCommand if (sender instanceof Player) { @Cleanup - IUser user = ess.getUser((Player)sender); + IUser user = ess.getUserMap().getUser((Player)sender); user.acquireReadLock(); if (user.getData().isMuted()) { @@ -49,7 +49,7 @@ public class Commandmsg extends EssentialsCommand final String translatedMe = _("me"); - final IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo(); + final IReplyTo replyTo = sender instanceof Player ? ess.getUserMap().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 @@ public class Commandmsg extends EssentialsCommand int i = 0; for (Player matchedPlayer : matchedPlayers) { - final IUser u = ess.getUser(matchedPlayer); + final IUser u = ess.getUserMap().getUser(matchedPlayer); if (u.isHidden()) { i++; @@ -86,14 +86,14 @@ public class Commandmsg extends EssentialsCommand 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 = ess.getUserMap().getUser(matchedPlayer); + if (sender instanceof Player && (matchedUser.isIgnoringPlayer(ess.getUserMap().getUser((Player)sender)) || matchedUser.isHidden())) { continue; } matchedPlayer.sendMessage(_("msgFormat", senderName, translatedMe, message)); - replyTo.setReplyTo(ess.getUser(matchedPlayer)); - ess.getUser(matchedPlayer).setReplyTo(sender); + replyTo.setReplyTo(ess.getUserMap().getUser(matchedPlayer)); + ess.getUserMap().getUser(matchedPlayer).setReplyTo(sender); } } } diff --git a/Essentials/src/net/ess3/commands/Commandnear.java b/Essentials/src/net/ess3/commands/Commandnear.java index fd3db71f9..2d52825c4 100644 --- a/Essentials/src/net/ess3/commands/Commandnear.java +++ b/Essentials/src/net/ess3/commands/Commandnear.java @@ -86,7 +86,7 @@ public class Commandnear extends EssentialsCommand for (Player onlinePlayer : server.getOnlinePlayers()) { - final IUser player = ess.getUser(onlinePlayer); + final IUser player = ess.getUserMap().getUser(onlinePlayer); if (!player.equals(user) && !player.isHidden()) { final Location playerLoc = player.getLocation(); diff --git a/Essentials/src/net/ess3/commands/Commandnick.java b/Essentials/src/net/ess3/commands/Commandnick.java index 07a251f14..1d844e54d 100644 --- a/Essentials/src/net/ess3/commands/Commandnick.java +++ b/Essentials/src/net/ess3/commands/Commandnick.java @@ -7,7 +7,7 @@ import net.ess3.api.ISettings; 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; @@ -78,13 +78,13 @@ public class Commandnick extends EssentialsCommand } } - private void resetAllNicknames(final Server server) + private void resetAllNicknames(final IServer server) { for (Player player : server.getOnlinePlayers()) { try { - setNickname(ess.getUser(player), "off"); + setNickname(ess.getUserMap().getUser(player), "off"); } catch (Exception ex) { diff --git a/Essentials/src/net/ess3/commands/Commandnuke.java b/Essentials/src/net/ess3/commands/Commandnuke.java index 94b60cd77..aed0bf822 100644 --- a/Essentials/src/net/ess3/commands/Commandnuke.java +++ b/Essentials/src/net/ess3/commands/Commandnuke.java @@ -45,7 +45,7 @@ public class Commandnuke extends EssentialsCommand { for (int z = -10; z <= 10; z += 5) { - final Location tntloc = new Location(world, loc.getBlockX() + x, world.getMaxHeight(), loc.getBlockZ() + z); + final Location tntloc = Location(world, loc.getBlockX() + x, world.getMaxHeight(), loc.getBlockZ() + z); final TNTPrimed tnt = world.spawn(tntloc, TNTPrimed.class); } } diff --git a/Essentials/src/net/ess3/commands/Commandpay.java b/Essentials/src/net/ess3/commands/Commandpay.java index c1f331fca..fa09c9a30 100644 --- a/Essentials/src/net/ess3/commands/Commandpay.java +++ b/Essentials/src/net/ess3/commands/Commandpay.java @@ -25,15 +25,10 @@ public class Commandpay extends EssentialsCommand double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", "")); boolean foundUser = false; - for (Player p : server.matchPlayer(args[0])) + for (Player p : ess.getUserMap().matchUsers(args[0], false, false)) { - IUser u = ess.getUser(p); - if (u.isHidden()) - { - continue; - } - user.payUser(u, amount); - Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), u.getName(), new Trade(amount, ess), user.getLocation(), ess); + user.payUser(p.getUser(), amount); + Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), p.getName(), new Trade(amount, ess), user.getLocation(), ess); foundUser = true; } diff --git a/Essentials/src/net/ess3/commands/Commandptime.java b/Essentials/src/net/ess3/commands/Commandptime.java index 7a0f27b1f..396497618 100644 --- a/Essentials/src/net/ess3/commands/Commandptime.java +++ b/Essentials/src/net/ess3/commands/Commandptime.java @@ -41,7 +41,7 @@ public class Commandptime extends EssentialsCommand return; } - IUser user = sender instanceof Player ? ess.getUser((Player)sender) : null; + IUser user = sender instanceof Player ? ess.getUserMap().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 @@ public class Commandptime extends EssentialsCommand // 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 ? ess.getUserMap().getUser((Player)sender) : null; if (user == null) { for (Player player : server.getOnlinePlayers()) { - users.add(ess.getUser(player)); + users.add(ess.getUserMap().getUser(player)); } } else @@ -203,7 +203,7 @@ public class Commandptime extends EssentialsCommand final List<Player> matchedPlayers = server.matchPlayer(selector); if (!matchedPlayers.isEmpty()) { - user = ess.getUser(matchedPlayers.get(0)); + user = ess.getUserMap().getUser(matchedPlayers.get(0)); } if (user != null) @@ -215,7 +215,7 @@ public class Commandptime extends EssentialsCommand { for (Player player : server.getOnlinePlayers()) { - users.add(ess.getUser(player)); + users.add(ess.getUserMap().getUser(player)); } } // We failed to understand the world target... diff --git a/Essentials/src/net/ess3/commands/Commandr.java b/Essentials/src/net/ess3/commands/Commandr.java index 1b2e42dcb..1e0b5750e 100644 --- a/Essentials/src/net/ess3/commands/Commandr.java +++ b/Essentials/src/net/ess3/commands/Commandr.java @@ -26,7 +26,7 @@ public class Commandr extends EssentialsCommand if (sender instanceof Player) { - IUser user = ess.getUser((Player)sender); + IUser user = ess.getUserMap().getUser((Player)sender); if (Permissions.MSG_COLOR.isAuthorized(user)) { message = Util.replaceFormat(message); @@ -56,8 +56,8 @@ public class Commandr extends EssentialsCommand 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 = ess.getUserMap().getUser((Player)target); + if (sender instanceof Player && player.isIgnoringPlayer(ess.getUserMap().getUser((Player)sender))) { return; } @@ -68,7 +68,7 @@ public class Commandr extends EssentialsCommand { if (target instanceof Player) { - ess.getUser((Player)target).setReplyTo(sender); + ess.getUserMap().getUser((Player)target).setReplyTo(sender); } else { diff --git a/Essentials/src/net/ess3/commands/Commandrealname.java b/Essentials/src/net/ess3/commands/Commandrealname.java index 85430b90d..f21c7e2c5 100644 --- a/Essentials/src/net/ess3/commands/Commandrealname.java +++ b/Essentials/src/net/ess3/commands/Commandrealname.java @@ -24,7 +24,7 @@ public class Commandrealname extends EssentialsCommand final String whois = args[0].toLowerCase(Locale.ENGLISH); for (Player onlinePlayer : server.getOnlinePlayers()) { - final IUser u = ess.getUser(onlinePlayer); + final IUser u = ess.getUserMap().getUser(onlinePlayer); if (u.isHidden()) { continue; diff --git a/Essentials/src/net/ess3/commands/Commandseen.java b/Essentials/src/net/ess3/commands/Commandseen.java index a508b16e3..7a47cb52c 100644 --- a/Essentials/src/net/ess3/commands/Commandseen.java +++ b/Essentials/src/net/ess3/commands/Commandseen.java @@ -37,7 +37,7 @@ public class Commandseen extends EssentialsCommand catch (NoSuchFieldException e) { @Cleanup - IUser u = ess.getUser(args[0]); + IUser u = ess.getUserMap().getUser(args[0]); u.acquireReadLock(); if (u == null) { diff --git a/Essentials/src/net/ess3/commands/Commandsethome.java b/Essentials/src/net/ess3/commands/Commandsethome.java index 00e3a0170..511d05487 100644 --- a/Essentials/src/net/ess3/commands/Commandsethome.java +++ b/Essentials/src/net/ess3/commands/Commandsethome.java @@ -56,7 +56,7 @@ public class Commandsethome extends EssentialsCommand if (Permissions.SETHOME_OTHERS.isAuthorized(user)) { @Cleanup - IUser usersHome = ess.getUser(ess.getServer().getPlayer(args[0])); + IUser usersHome = ess.getUserMap().getUser(ess.getServer().getPlayer(args[0])); if (usersHome == null) { throw new Exception(_("playerNotFound")); diff --git a/Essentials/src/net/ess3/commands/Commandtempban.java b/Essentials/src/net/ess3/commands/Commandtempban.java index d41dbac37..4b2c0d041 100644 --- a/Essentials/src/net/ess3/commands/Commandtempban.java +++ b/Essentials/src/net/ess3/commands/Commandtempban.java @@ -51,7 +51,7 @@ public class Commandtempban extends EssentialsCommand for (Player onlinePlayer : server.getOnlinePlayers()) { - final IUser player = ess.getUser(onlinePlayer); + final IUser player = ess.getUserMap().getUser(onlinePlayer); if (Permissions.BAN_NOTIFY.isAuthorized(player)) { onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason)); diff --git a/Essentials/src/net/ess3/commands/Commandtime.java b/Essentials/src/net/ess3/commands/Commandtime.java index f48b31cd7..c0ea66898 100644 --- a/Essentials/src/net/ess3/commands/Commandtime.java +++ b/Essentials/src/net/ess3/commands/Commandtime.java @@ -122,7 +122,7 @@ public class Commandtime extends EssentialsCommand // 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 ? ess.getUserMap().getUser((Player)sender) : null; if (user == null) { worlds.addAll(server.getWorlds()); diff --git a/Essentials/src/net/ess3/commands/Commandtpaall.java b/Essentials/src/net/ess3/commands/Commandtpaall.java index 717a55cc1..c4f2696b2 100644 --- a/Essentials/src/net/ess3/commands/Commandtpaall.java +++ b/Essentials/src/net/ess3/commands/Commandtpaall.java @@ -18,7 +18,7 @@ public class Commandtpaall extends EssentialsCommand { if (sender instanceof Player) { - teleportAAllPlayers(sender, ess.getUser((Player)sender)); + teleportAAllPlayers(sender, ess.getUserMap().getUser((Player)sender)); return; } throw new NotEnoughArgumentsException(); @@ -34,7 +34,7 @@ public class Commandtpaall extends EssentialsCommand for (Player onlinePlayer : server.getOnlinePlayers()) { @Cleanup - final IUser player = ess.getUser(onlinePlayer); + final IUser player = ess.getUserMap().getUser(onlinePlayer); player.acquireReadLock(); if (user == player) { diff --git a/Essentials/src/net/ess3/commands/Commandtpall.java b/Essentials/src/net/ess3/commands/Commandtpall.java index 0a08f88b7..373c51a4d 100644 --- a/Essentials/src/net/ess3/commands/Commandtpall.java +++ b/Essentials/src/net/ess3/commands/Commandtpall.java @@ -20,7 +20,7 @@ public class Commandtpall extends EssentialsCommand { if (sender instanceof Player) { - teleportAllPlayers(sender, ess.getUser((Player)sender)); + teleportAllPlayers(sender, ess.getUserMap().getUser((Player)sender)); return; } throw new NotEnoughArgumentsException(); @@ -35,7 +35,7 @@ public class Commandtpall extends EssentialsCommand sender.sendMessage(_("teleportAll")); for (Player onlinePlayer : server.getOnlinePlayers()) { - final IUser player = ess.getUser(onlinePlayer); + final IUser player = ess.getUserMap().getUser(onlinePlayer); if (user == player) { continue; diff --git a/Essentials/src/net/ess3/commands/Commandtppos.java b/Essentials/src/net/ess3/commands/Commandtppos.java index 29350cc60..e7f5859b8 100644 --- a/Essentials/src/net/ess3/commands/Commandtppos.java +++ b/Essentials/src/net/ess3/commands/Commandtppos.java @@ -45,7 +45,7 @@ public class Commandtppos extends EssentialsCommand throw new NotEnoughArgumentsException(); } - IUser user = ess.getUser(server.getPlayer(args[0])); + IUser user = ess.getUserMap().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]); diff --git a/Essentials/src/net/ess3/commands/Commandwarp.java b/Essentials/src/net/ess3/commands/Commandwarp.java index 2d56a0cb9..c470a3a77 100644 --- a/Essentials/src/net/ess3/commands/Commandwarp.java +++ b/Essentials/src/net/ess3/commands/Commandwarp.java @@ -36,7 +36,7 @@ public class Commandwarp extends EssentialsCommand IUser otherUser = null; if (args.length == 2 && Permissions.WARP_OTHERS.isAuthorized(user)) { - otherUser = ess.getUser(server.getPlayer(args[1])); + otherUser = ess.getUserMap().getUser(server.getPlayer(args[1])); if (otherUser == null) { throw new Exception(_("playerNotFound")); @@ -57,7 +57,7 @@ public class Commandwarp extends EssentialsCommand warpList(sender, args); throw new NoChargeException(); } - IUser otherUser = ess.getUser(server.getPlayer(args[1])); + IUser otherUser = ess.getUserMap().getUser(server.getPlayer(args[1])); if (otherUser == null) { throw new Exception(_("playerNotFound")); diff --git a/Essentials/src/net/ess3/commands/EssentialsCommand.java b/Essentials/src/net/ess3/commands/EssentialsCommand.java index d54e3d309..8425bebd5 100644 --- a/Essentials/src/net/ess3/commands/EssentialsCommand.java +++ b/Essentials/src/net/ess3/commands/EssentialsCommand.java @@ -53,7 +53,7 @@ public abstract class EssentialsCommand extends AbstractSuperpermsPermission imp { throw new NoSuchFieldException(_("playerNotFound")); } - final IUser user = ess.getUser(args[pos]); + final IUser user = ess.getUserMap().getUser(args[pos]); if (user != null) { if (!getOffline && (!user.isOnline() || user.isHidden())) diff --git a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java index db2b63c3e..dd2e1cddb 100644 --- a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java +++ b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java @@ -102,7 +102,7 @@ public class EssentialsCommandHandler implements ICommandHandler IUser user = null; if (sender instanceof Player) { - user = ess.getUser((Player)sender); + user = ess.getUserMap().getUser((Player)sender); LOGGER.log(Level.INFO, String.format("[PLAYER_COMMAND] %s: /%s %s ", ((Player)sender).getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0))); } diff --git a/Essentials/src/net/ess3/economy/Economy.java b/Essentials/src/net/ess3/economy/Economy.java index c818dbf75..cfd1f899e 100644 --- a/Essentials/src/net/ess3/economy/Economy.java +++ b/Essentials/src/net/ess3/economy/Economy.java @@ -90,7 +90,7 @@ public class Economy implements IEconomy @Override public double getMoney(String name) throws UserDoesNotExistException { - IUser user = ess.getUser(name); + IUser user = ess.getUserMap().getUser(name); if (user == null) { return getNPCBalance(name); @@ -101,7 +101,7 @@ public class Economy implements IEconomy @Override public void setMoney(String name, double balance) throws NoLoanPermittedException, UserDoesNotExistException { - IUser user = ess.getUser(name); + IUser user = ess.getUserMap().getUser(name); if (user == null) { setNPCBalance(name, balance, true); @@ -143,7 +143,7 @@ public class Economy implements IEconomy @Override public boolean isNPC(String name) throws UserDoesNotExistException { - boolean result = ess.getUser(name) == null; + boolean result = ess.getUserMap().getUser(name) == null; if (result) { getNPCBalance(name); diff --git a/Essentials/src/net/ess3/listener/EssentialsBlockListener.java b/Essentials/src/net/ess3/listener/EssentialsBlockListener.java index 5faaeeb3b..a843202c0 100644 --- a/Essentials/src/net/ess3/listener/EssentialsBlockListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsBlockListener.java @@ -31,7 +31,7 @@ public class EssentialsBlockListener implements Listener { return; } - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); final boolean unlimitedForUser = user.getData().hasUnlimited(itemstack.getType()); if (unlimitedForUser && user.getGameMode() == GameMode.SURVIVAL) { diff --git a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java index 6677005bd..f25376f62 100644 --- a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java @@ -44,9 +44,9 @@ public class EssentialsEntityListener implements Listener if (eDefend instanceof Player && eAttack instanceof Player) { @Cleanup - final IUser attacker = ess.getUser((Player)eAttack); + final IUser attacker = ess.getUserMap().getUser((Player)eAttack); @Cleanup - final IUser defender = ess.getUser((Player)eDefend); + final IUser defender = ess.getUserMap().getUser((Player)eDefend); @Cleanup ISettings settings = ess.getSettings(); settings.acquireReadLock(); @@ -104,7 +104,7 @@ public class EssentialsEntityListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onEntityDamage(final EntityDamageEvent event) { - if (event.getEntity() instanceof Player && ess.getUser((Player)event.getEntity()).isGodModeEnabled()) + if (event.getEntity() instanceof Player && ess.getUserMap().getUser((Player)event.getEntity()).isGodModeEnabled()) { final Player player = (Player)event.getEntity(); player.setFireTicks(0); @@ -116,7 +116,7 @@ public class EssentialsEntityListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onEntityCombust(final EntityCombustEvent event) { - if (event.getEntity() instanceof Player && ess.getUser((Player)event.getEntity()).isGodModeEnabled()) + if (event.getEntity() instanceof Player && ess.getUserMap().getUser((Player)event.getEntity()).isGodModeEnabled()) { event.setCancelled(true); } @@ -125,7 +125,7 @@ public class EssentialsEntityListener implements Listener @EventHandler(priority = EventPriority.LOWEST) public void onPlayerDeathEvent(final PlayerDeathEvent event) { - final IUser user = ess.getUser((Player)event.getEntity()); + final IUser user = ess.getUserMap().getUser((Player)event.getEntity()); @Cleanup final ISettings settings = ess.getSettings(); settings.acquireReadLock(); @@ -143,7 +143,7 @@ public class EssentialsEntityListener implements Listener @EventHandler(priority = EventPriority.LOW) public void onPlayerDeathExpEvent(final PlayerDeathEvent event) { - final IUser user = ess.getUser(event.getEntity()); + final IUser user = ess.getUserMap().getUser(event.getEntity()); if (Permissions.KEEPXP.isAuthorized(user)) { event.setKeepLevel(true); @@ -154,7 +154,7 @@ public class EssentialsEntityListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onFoodLevelChange(final FoodLevelChangeEvent event) { - if (event.getEntity() instanceof Player && ess.getUser((Player)event.getEntity()).isGodModeEnabled()) + if (event.getEntity() instanceof Player && ess.getUserMap().getUser((Player)event.getEntity()).isGodModeEnabled()) { event.setCancelled(true); } @@ -170,7 +170,7 @@ public class EssentialsEntityListener implements Listener final ISettings settings = ess.getSettings(); settings.acquireReadLock(); @Cleanup - final IUser user = ess.getUser((Player)event.getEntity()); + final IUser user = ess.getUserMap().getUser((Player)event.getEntity()); user.acquireReadLock(); if (user.getData().isAfk() && settings.getData().getCommands().getAfk().isFreezeAFKPlayers()) { diff --git a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java index 564a75f34..04a12aada 100644 --- a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java @@ -52,7 +52,7 @@ public class EssentialsPlayerListener implements Listener @EventHandler(priority = EventPriority.NORMAL) public void onPlayerRespawn(final PlayerRespawnEvent event) { - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.updateCompass(); user.updateDisplayName(); } @@ -61,7 +61,7 @@ public class EssentialsPlayerListener implements Listener public void onPlayerChat(final PlayerChatEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (user.getData().isMuted()) { @@ -72,7 +72,7 @@ public class EssentialsPlayerListener implements Listener final Iterator<Player> it = event.getRecipients().iterator(); while (it.hasNext()) { - final IUser player = ess.getUser(it.next()); + final IUser player = ess.getUserMap().getUser(it.next()); if (player.isIgnoringPlayer(user)) { it.remove(); @@ -86,7 +86,7 @@ public class EssentialsPlayerListener implements Listener public void onPlayerMove(final PlayerMoveEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); @Cleanup final ISettings settings = ess.getSettings(); @@ -121,7 +121,7 @@ public class EssentialsPlayerListener implements Listener public void onPlayerQuit(final PlayerQuitEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); @Cleanup final ISettings settings = ess.getSettings(); @@ -152,7 +152,7 @@ public class EssentialsPlayerListener implements Listener } ess.getBackup().startTask(); @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireWriteLock(); user.updateDisplayName(); @@ -163,7 +163,7 @@ public class EssentialsPlayerListener implements Listener { if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(user)) { - user.hidePlayer(ess.getUser(p).getBase()); + user.hidePlayer(ess.getUserMap().getUser(p).getBase()); } } @@ -225,7 +225,7 @@ public class EssentialsPlayerListener implements Listener return; } @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireWriteLock(); user.getData().setNpc(false); @@ -261,7 +261,7 @@ public class EssentialsPlayerListener implements Listener //There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports. if ((event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND) && settings.getData().getCommands().getBack().isRegisterBackInListener()) { - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.setLastLocation(); } @@ -271,7 +271,7 @@ public class EssentialsPlayerListener implements Listener public void onPlayerEggThrow(final PlayerEggThrowEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); final ItemStack hand = new ItemStack(Material.EGG, 1); if (user.getData().hasUnlimited(hand.getType())) @@ -285,7 +285,7 @@ public class EssentialsPlayerListener implements Listener public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (user.getData().hasUnlimited(event.getBucket())) { @@ -304,7 +304,7 @@ public class EssentialsPlayerListener implements Listener @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event) { - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); final String cmd = event.getMessage().toLowerCase(Locale.ENGLISH).split(" ")[0].replace("/", "").toLowerCase(Locale.ENGLISH); final List<String> commands = Arrays.asList("msg", "r", "mail", "m", "t", "emsg", "tell", "er", "reply", "ereply", "email"); if (commands.contains(cmd)) @@ -312,7 +312,7 @@ public class EssentialsPlayerListener implements Listener for (Player player : ess.getServer().getOnlinePlayers()) { @Cleanup - IUser spyer = ess.getUser(player); + IUser spyer = ess.getUserMap().getUser(player); spyer.acquireReadLock(); if (spyer.getData().isSocialspy() && !user.equals(spyer)) { @@ -333,7 +333,7 @@ public class EssentialsPlayerListener implements Listener final ISettings settings = ess.getSettings(); settings.acquireReadLock(); @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (settings.getData().getChat().getChangeDisplayname()) { @@ -360,7 +360,7 @@ public class EssentialsPlayerListener implements Listener public void onPlayerInteract(final PlayerInteractEvent event) { @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); user.updateActivity(true); switch (event.getAction()) @@ -449,7 +449,7 @@ public class EssentialsPlayerListener implements Listener return; } @Cleanup - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); user.acquireReadLock(); if (user.getData().isAfk()) { @@ -462,11 +462,11 @@ public class EssentialsPlayerListener implements Listener { if (event.getView().getTopInventory().getType() == InventoryType.PLAYER) { - final IUser user = ess.getUser((Player)event.getWhoClicked()); + final IUser user = ess.getUserMap().getUser((Player)event.getWhoClicked()); final InventoryHolder invHolder = event.getView().getTopInventory().getHolder(); if (invHolder != null && invHolder instanceof Player) { - final IUser invOwner = ess.getUser((Player)invHolder); + final IUser invOwner = ess.getUserMap().getUser((Player)invHolder); if (user.isInvSee() && (!Permissions.INVSEE_MODIFY.isAuthorized(user) || Permissions.INVSEE_PREVENT_MODIFY.isAuthorized(invOwner) || !invOwner.isOnline())) @@ -482,7 +482,7 @@ public class EssentialsPlayerListener implements Listener { if (event.getView().getTopInventory().getType() == InventoryType.PLAYER) { - final IUser user = ess.getUser((Player)event.getPlayer()); + final IUser user = ess.getUserMap().getUser((Player)event.getPlayer()); user.setInvSee(false); } } diff --git a/Essentials/src/net/ess3/metrics/MetricsListener.java b/Essentials/src/net/ess3/metrics/MetricsListener.java index 1db463a46..0a6ff6628 100644 --- a/Essentials/src/net/ess3/metrics/MetricsListener.java +++ b/Essentials/src/net/ess3/metrics/MetricsListener.java @@ -24,7 +24,7 @@ public class MetricsListener implements Listener @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(final PlayerJoinEvent event) { - /*final IUser player = ess.getUser(event.getPlayer()); + /*final IUser player = ess.getUserMap().getUser(event.getPlayer()); if (ess.getSettings().isMetricsEnabled() == false && (player.isAuthorized("essentials.essentials") || player.isAuthorized("bukkit.broadcast.admin"))) { player.sendMessage("PluginMetrics collects minimal statistic data, starting in about 5 minutes."); diff --git a/Essentials/src/net/ess3/settings/SpawnsHolder.java b/Essentials/src/net/ess3/settings/SpawnsHolder.java index 4f43e5ab9..bca2e8815 100644 --- a/Essentials/src/net/ess3/settings/SpawnsHolder.java +++ b/Essentials/src/net/ess3/settings/SpawnsHolder.java @@ -224,7 +224,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE public void onPlayerRespawn(final PlayerRespawnEvent event) { - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); boolean respawnAtHome = false; final ISettings settings = ess.getSettings(); @@ -264,7 +264,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE public void onPlayerJoin(final PlayerJoinEvent event) { - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); if (user.hasPlayedBefore()) { diff --git a/Essentials/src/net/ess3/user/User.java b/Essentials/src/net/ess3/user/User.java index 061f006db..47224adfc 100644 --- a/Essentials/src/net/ess3/user/User.java +++ b/Essentials/src/net/ess3/user/User.java @@ -718,7 +718,7 @@ public class User extends UserBase implements IUser { for (Player p : ess.getServer().getOnlinePlayers()) { - if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(ess.getUser(p))) + if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(ess.getUserMap().getUser(p))) { p.hidePlayer(getBase()); } diff --git a/Essentials/src/net/ess3/utils/textreader/TextPager.java b/Essentials/src/net/ess3/utils/textreader/TextPager.java index c1ca8e939..099d9bbb7 100644 --- a/Essentials/src/net/ess3/utils/textreader/TextPager.java +++ b/Essentials/src/net/ess3/utils/textreader/TextPager.java @@ -3,6 +3,9 @@ package net.ess3.utils.textreader; import java.util.List; import java.util.Locale; import java.util.Map; +import net.ess3.I18n; +import static net.ess3.I18n._; +import net.ess3.api.server.CommandSender; public class TextPager diff --git a/Essentials/test/net/ess3/EconomyTest.java b/Essentials/test/net/ess3/EconomyTest.java index 21669d7e6..74554a698 100644 --- a/Essentials/test/net/ess3/EconomyTest.java +++ b/Essentials/test/net/ess3/EconomyTest.java @@ -24,7 +24,7 @@ public class EconomyTest extends EssentialsTest assertFalse("NPC does not exists", ess.getEconomy().playerExists(NPCNAME)); assertTrue("Create NPC", ess.getEconomy().createNPC(NPCNAME)); assertTrue("NPC exists", ess.getEconomy().playerExists(NPCNAME)); - assertNull("NPC can not be accessed", ess.getUser(NPCNAME)); + assertNull("NPC can not be accessed", ess.getUserMap().getUser(NPCNAME)); try { ess.getEconomy().removeNPC(NPCNAME); diff --git a/Essentials/test/net/ess3/StorageTest.java b/Essentials/test/net/ess3/StorageTest.java index aac394bf6..3ed119d37 100644 --- a/Essentials/test/net/ess3/StorageTest.java +++ b/Essentials/test/net/ess3/StorageTest.java @@ -123,7 +123,7 @@ public class StorageTest extends EssentialsTest OfflinePlayer base1 = server.createPlayer("testPlayer1", ess); server.addPlayer(base1); ext.mark("fake user created"); - UserData user = (UserData)ess.getUser(base1); + UserData user = (UserData)ess.getUserMap().getUser(base1); ext.mark("load empty user"); for (int j = 0; j < 1; j++) { diff --git a/Essentials/test/net/ess3/UserTest.java b/Essentials/test/net/ess3/UserTest.java index 3baa420df..220f56f3c 100644 --- a/Essentials/test/net/ess3/UserTest.java +++ b/Essentials/test/net/ess3/UserTest.java @@ -17,7 +17,7 @@ public class UserTest extends EssentialsTest super(testName); server.addPlayer("testPlayer1"); - base1 = ess.getUser("testPlayer1"); + base1 = ess.getUserMap().getUser("testPlayer1"); } private void should(String what) @@ -28,16 +28,16 @@ public class UserTest extends EssentialsTest /*public void testUpdate() { OfflinePlayer base1alt = server.createPlayer(base1.getName(), ess); - assertEquals(base1alt, ess.getUser(base1alt).getBase()); + assertEquals(base1alt, ess.getUserMap().getUser(base1alt).getBase()); } public void testHome() { - IUser user = ess.getUser(base1); + IUser user = ess.getUserMap().getUser(base1); Location loc = base1.getLocation(); user.setHome(); OfflinePlayer base2 = server.createPlayer(base1.getName(), ess); - IUser user2 = ess.getUser(base2); + IUser user2 = ess.getUserMap().getUser(base2); Location home = user2.getHome(loc); assertNotNull(home); @@ -52,7 +52,7 @@ public class UserTest extends EssentialsTest /*public void testMoney() { should("properly set, take, give, and get money"); - IUser user = ess.getUser(base1); + IUser user = ess.getUserMap().getUser(base1); double i; user.setMoney(i = 100.5); user.takeMoney(50); @@ -65,7 +65,7 @@ public class UserTest extends EssentialsTest /*public void testGetGroup() { should("return the default group"); - IUser user = ess.getUser(base1); + IUser user = ess.getUserMap().getUser(base1); //assertEquals(user.getGroup(), "default"); }*/ diff --git a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java index ae8fce4a1..f3ce3abaf 100644 --- a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java @@ -71,7 +71,7 @@ public abstract class EssentialsChatPlayer implements Listener { if (sender instanceof Player) { - charge.charge(ess.getUser((Player)sender)); + charge.charge(ess.getUserMap().getUser((Player)sender)); } } diff --git a/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java index be7b20ba6..f248a21a4 100644 --- a/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java @@ -35,8 +35,8 @@ public class EssentialsLocalChatEventListener implements Listener for (Player onlinePlayer : server.getOnlinePlayers()) { String type = _("chatTypeLocal"); - final IUser user = ess.getUser(onlinePlayer); - if (user.isIgnoringPlayer(ess.getUser(sender))) + final IUser user = ess.getUserMap().getUser(onlinePlayer); + if (user.isIgnoringPlayer(ess.getUserMap().getUser(sender))) { continue; } diff --git a/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerLowest.java index dfe96df35..5c2fa1d7e 100644 --- a/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerLowest.java +++ b/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerLowest.java @@ -28,7 +28,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer { return; } - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); final ChatStore chatStore = new ChatStore(ess, user, getChatType(event.getMessage())); setChatStore(event, chatStore); formatChat(event, chatStore); diff --git a/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java index 14554e3a9..5c12f09c6 100644 --- a/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java +++ b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java @@ -45,7 +45,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(final PlayerJoinEvent event) { - final IUser u = ess.getUser(event.getPlayer()); + final IUser u = ess.getUserMap().getUser(event.getPlayer()); if (Permissions.GEOIP_HIDE.isAuthorized(u)) { return; @@ -97,7 +97,7 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload { for (Player player : event.getPlayer().getServer().getOnlinePlayers()) { - final IUser user = ess.getUser(player); + final IUser user = ess.getUserMap().getUser(player); if (Permissions.GEOIP_SHOW.isAuthorized(user)) { user.sendMessage(_("geoipJoinFormat", user.getDisplayName(), builder.toString())); diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java index c3fcfe441..b500c3ea3 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java @@ -48,7 +48,7 @@ public class EssentialsConnect LOGGER.log(Level.WARNING, warnMessage); for (Player p : ess.getServer().getOnlinePlayers()) { - final IUser alertUser = ess.getUser(p); + final IUser alertUser = ess.getUserMap().getUser(p); if (Permissions.ALERTS.isAuthorized(alertUser)) { alertUser.sendMessage(warnMessage); diff --git a/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java index 59c733981..1c0505821 100644 --- a/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java +++ b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java @@ -35,7 +35,7 @@ public class EssentialsSign public final boolean onSignCreate(final SignChangeEvent event, final IEssentials ess) { final ISign sign = new EventSign(event); - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); if (!SignsPermissions.getCreatePermission(signName).isAuthorized(user)) { // Return true, so other plugins can use the same sign title, just hope @@ -82,7 +82,7 @@ public class EssentialsSign public final boolean onSignInteract(final Block block, final Player player, final IEssentials ess) { final ISign sign = new BlockSign(block); - final IUser user = ess.getUser(player); + final IUser user = ess.getUserMap().getUser(player); try { return SignsPermissions.getUsePermission(signName).isAuthorized(user) @@ -103,7 +103,7 @@ public class EssentialsSign public final boolean onSignBreak(final Block block, final Player player, final IEssentials ess) { final ISign sign = new BlockSign(block); - final IUser user = ess.getUser(player); + final IUser user = ess.getUserMap().getUser(player); try { return SignsPermissions.getBreakPermission(signName).isAuthorized(user) @@ -133,7 +133,7 @@ public class EssentialsSign public final boolean onBlockPlace(final Block block, final Player player, final IEssentials ess) { - final IUser user = ess.getUser(player); + final IUser user = ess.getUserMap().getUser(player); try { return onBlockPlace(block, user, getUsername(user), ess); @@ -151,7 +151,7 @@ public class EssentialsSign public final boolean onBlockInteract(final Block block, final Player player, final IEssentials ess) { - final IUser user = ess.getUser(player); + final IUser user = ess.getUserMap().getUser(player); try { return onBlockInteract(block, user, getUsername(user), ess); @@ -169,7 +169,7 @@ public class EssentialsSign public final boolean onBlockBreak(final Block block, final Player player, final IEssentials ess) { - final IUser user = ess.getUser(player); + final IUser user = ess.getUserMap().getUser(player); try { return onBlockBreak(block, user, getUsername(user), ess); diff --git a/EssentialsSigns/src/net/ess3/signs/SignBlockListener.java b/EssentialsSigns/src/net/ess3/signs/SignBlockListener.java index 31cdfc970..f44f086c9 100644 --- a/EssentialsSigns/src/net/ess3/signs/SignBlockListener.java +++ b/EssentialsSigns/src/net/ess3/signs/SignBlockListener.java @@ -87,7 +87,7 @@ public class SignBlockListener implements Listener { return; } - IUser user = ess.getUser(event.getPlayer()); + IUser user = ess.getUserMap().getUser(event.getPlayer()); for (int i = 0; i < 4; i++) { diff --git a/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java index 88e1d9810..0881aa706 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java @@ -24,7 +24,7 @@ public class Commandxmpp extends EssentialsCommand else { final String message = getFinalArg(args, 1); - final String senderName = sender instanceof Player ? ess.getUser((Player)sender).getDisplayName() : Console.NAME; + final String senderName = sender instanceof Player ? ess.getUserMap().getUser((Player)sender).getDisplayName() : Console.NAME; sender.sendMessage("[" + senderName + ">" + address + "] " + message); if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message)) { diff --git a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java index 74ab09fd5..f62f3c3f5 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java @@ -92,7 +92,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP public IUser getUserByAddress(final String address) { String username = instance.users.getUserByAddress(address); - return username == null ? null : ess.getUser(username); + return username == null ? null : ess.getUserMap().getUser(username); } @Override diff --git a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java index 4880aead7..de8a62405 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java @@ -23,21 +23,21 @@ class EssentialsXMPPPlayerListener implements Listener @EventHandler(priority= EventPriority.MONITOR) public void onPlayerJoin(final PlayerJoinEvent event) { - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); sendMessageToSpyUsers("Player " + user.getDisplayName() + " joined the game"); } @EventHandler(priority= EventPriority.MONITOR) public void onPlayerChat(final PlayerChatEvent event) { - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); sendMessageToSpyUsers(String.format(event.getFormat(), user.getDisplayName(), event.getMessage())); } @EventHandler(priority= EventPriority.MONITOR) public void onPlayerQuit(final PlayerQuitEvent event) { - final IUser user = ess.getUser(event.getPlayer()); + final IUser user = ess.getUserMap().getUser(event.getPlayer()); sendMessageToSpyUsers("Player " + user.getDisplayName() + " left the game"); } |