diff options
author | KHobbits <rob@khobbits.co.uk> | 2013-07-07 13:02:40 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2013-07-07 13:02:40 +0100 |
commit | fe85668021d81f821246481080d73d2d2009706e (patch) | |
tree | 3dae91e9814ea93820bac5f05827a4d0a3f2e687 | |
parent | 0be9986dfbba5a28e18363a80c73e555d935721a (diff) | |
download | Essentials-fe85668021d81f821246481080d73d2d2009706e.tar Essentials-fe85668021d81f821246481080d73d2d2009706e.tar.gz Essentials-fe85668021d81f821246481080d73d2d2009706e.tar.lz Essentials-fe85668021d81f821246481080d73d2d2009706e.tar.xz Essentials-fe85668021d81f821246481080d73d2d2009706e.zip |
More cleanup
32 files changed, 83 insertions, 78 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index c8b00cdc3..b41212ae4 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -222,10 +222,10 @@ public class EssentialsPlayerListener implements Listener { try { - final IText input = new TextInput(user, "motd", true, ess); - final IText output = new KeywordReplacer(input, user, ess); + final IText input = new TextInput(user.getBase(), "motd", true, ess); + final IText output = new KeywordReplacer(input, user.getBase(), ess); final TextPager pager = new TextPager(output, true); - pager.showPage("1", null, "motd", user); + pager.showPage("1", null, "motd", user.getBase()); } catch (IOException ex) { diff --git a/Essentials/src/com/earth2me/essentials/IUser.java b/Essentials/src/com/earth2me/essentials/IUser.java index 380ab35f0..83808554d 100644 --- a/Essentials/src/com/earth2me/essentials/IUser.java +++ b/Essentials/src/com/earth2me/essentials/IUser.java @@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -public interface IUser extends CommandSender +public interface IUser { long getLastTeleportTimestamp(); @@ -86,4 +86,8 @@ public interface IUser extends CommandSender Map<String, Object> getConfigMap(); Map<String, Object> getConfigMap(String node); + + public void sendMessage(String message); + + public String getName(); } diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java index e06727dfb..11d1c9cc1 100644 --- a/Essentials/src/com/earth2me/essentials/Kit.java +++ b/Essentials/src/com/earth2me/essentials/Kit.java @@ -169,7 +169,7 @@ public class Kit try { IText input = new SimpleTextInput(items); - IText output = new KeywordReplacer(input, user, ess); + IText output = new KeywordReplacer(input, user.getBase(), ess); boolean spew = false; final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments(); diff --git a/Essentials/src/com/earth2me/essentials/SpawnMob.java b/Essentials/src/com/earth2me/essentials/SpawnMob.java index acdd25a9f..f3f54d653 100644 --- a/Essentials/src/com/earth2me/essentials/SpawnMob.java +++ b/Essentials/src/com/earth2me/essentials/SpawnMob.java @@ -88,7 +88,7 @@ public class SpawnMob { throw new Exception(_("unableToSpawnMob")); } - spawnmob(ess, server, user, user, block.getLocation(), parts, data, mobCount); + spawnmob(ess, server, user.getBase(), user, block.getLocation(), parts, data, mobCount); } // This method spawns a mob at loc, owned by noone diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java index ba2e9fd44..9119b1696 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java @@ -25,7 +25,7 @@ public class Commandclearinventory extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - parseCommand(server, user, args, user.isAuthorized("essentials.clearinventory.others"), user.isAuthorized("essentials.clearinventory.all")); + parseCommand(server, user.getBase(), args, user.isAuthorized("essentials.clearinventory.others"), user.isAuthorized("essentials.clearinventory.all")); } @Override @@ -39,9 +39,9 @@ public class Commandclearinventory extends EssentialsCommand List<Player> players = new ArrayList<Player>(); int offset = 0; - if (sender instanceof User) + if (sender instanceof Player) { - players.add(((User)sender).getBase()); + players.add((Player)sender); } if (allowAll && args.length > 0 && args[0].contentEquals("*")) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 6f6bbca78..88d76e573 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -63,7 +63,7 @@ public class Commandenchant extends EssentialsCommand final MetaItemStack metaStack = new MetaItemStack(stack); final Enchantment enchantment = metaStack.getEnchantment(user, args[0]); - metaStack.addEnchantment(user, allowUnsafe, enchantment, level); + metaStack.addEnchantment(user.getBase(), allowUnsafe, enchantment, level); user.getInventory().setItemInHand(metaStack.getItemStack()); user.updateInventory(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index 519292758..09c325481 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -23,28 +23,28 @@ public class Commandexp extends EssentialsCommand {
if (args.length == 0)
{
- showExp(user, user);
+ showExp(user.getBase(), user);
}
else if (args.length > 1 && args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set"))
{
if (args.length == 3 && user.isAuthorized("essentials.exp.set.others"))
{
- expMatch(server, user, args[1], args[2], false);
+ expMatch(server, user.getBase(), args[1], args[2], false);
}
else
{
- setExp(user, user, args[1], false);
+ setExp(user.getBase(), user, args[1], false);
}
}
else if (args.length > 1 && args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give"))
{
if (args.length == 3 && user.isAuthorized("essentials.exp.give.others"))
{
- expMatch(server, user, args[1], args[2], true);
+ expMatch(server, user.getBase(), args[1], args[2], true);
}
else
{
- setExp(user, user, args[1], true);
+ setExp(user.getBase(), user, args[1], true);
}
}
else if (args[0].equalsIgnoreCase("show"))
@@ -52,11 +52,11 @@ public class Commandexp extends EssentialsCommand if (args.length >= 2 && user.isAuthorized("essentials.exp.others"))
{
String match = args[1].trim();
- showMatch(server, user, match);
+ showMatch(server, user.getBase(), match);
}
else
{
- showExp(user, user);
+ showExp(user.getBase(), user);
}
}
else
@@ -65,21 +65,21 @@ public class Commandexp extends EssentialsCommand {
if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others"))
{
- expMatch(server, user, args[1], args[0], true);
+ expMatch(server, user.getBase(), args[1], args[0], true);
}
else
{
- setExp(user, user, args[0], true);
+ setExp(user.getBase(), user, args[0], true);
}
}
else if (args.length >= 1 && user.isAuthorized("essentials.exp.others"))
{
String match = args[0].trim();
- showMatch(server, user, match);
+ showMatch(server, user.getBase(), match);
}
else
{
- showExp(user, user);
+ showExp(user.getBase(), user);
}
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java index 30601d659..47efe518f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java @@ -41,7 +41,7 @@ public class Commandext extends EssentialsCommand throw new PlayerNotFoundException(); } - extinguishPlayers(server, user, args[0]); + extinguishPlayers(server, user.getBase(), args[0]); } private void extinguishPlayers(final Server server, final CommandSender sender, final String name) throws Exception diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java index 6f11fd8b5..c691e9572 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfeed.java @@ -29,7 +29,7 @@ public class Commandfeed extends EssentialsCommand { user.healCooldown(); } - feedOtherPlayers(server, user, args[0]); + feedOtherPlayers(server, user.getBase(), args[0]); return; } @@ -39,7 +39,7 @@ public class Commandfeed extends EssentialsCommand } try { - feedPlayer(user, user.getBase()); + feedPlayer(user.getBase(), user.getBase()); } catch (QuietAbortException e) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java index 39ba4d421..d01e5bf85 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java @@ -113,7 +113,7 @@ public class Commandfirework extends EssentialsCommand { try { - mStack.addFireworkMeta(user, true, arg, ess); + mStack.addFireworkMeta(user.getBase(), true, arg, ess); } catch (Exception e) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java index 7b320102d..d419d78d1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java @@ -27,20 +27,20 @@ public class Commandfly extends EssentialsToggleCommand Boolean toggle = matchToggleArgument(args[0]); if (toggle == null && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user, args); + toggleOtherPlayers(server, user.getBase(), args); } else { - togglePlayer(user, user, toggle); + togglePlayer(user.getBase(), user, toggle); } } else if (args.length == 2 && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user, args); + toggleOtherPlayers(server, user.getBase(), args); } else { - togglePlayer(user, user, null); + togglePlayer(user.getBase(), user, null); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index 96248b196..c96a6116f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -49,7 +49,7 @@ public class Commandgamemode extends EssentialsCommand else if (args.length > 1 && args[1].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others")) { gameMode = matchGameMode(args[0].toLowerCase(Locale.ENGLISH)); - gamemodeOtherPlayers(server, user, gameMode, args[1]); + gamemodeOtherPlayers(server, user.getBase(), gameMode, args[1]); return; } else @@ -63,7 +63,7 @@ public class Commandgamemode extends EssentialsCommand if (user.isAuthorized("essentials.gamemode.others")) { gameMode = matchGameMode(commandLabel); - gamemodeOtherPlayers(server, user, gameMode, args[0]); + gamemodeOtherPlayers(server, user.getBase(), gameMode, args[0]); return; } throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java index 7b652b0a0..021d711a8 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java @@ -20,10 +20,10 @@ public class Commandgetpos extends EssentialsCommand if (args.length > 0 && user.isAuthorized("essentials.getpos.others")) { final User otherUser = getPlayer(server, user, args, 0); - outputPosition(user, otherUser.getLocation(), user.getLocation()); + outputPosition(user.getBase(), otherUser.getLocation(), user.getLocation()); return; } - outputPosition(user, user.getLocation(), null); + outputPosition(user.getBase(), user.getLocation(), null); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java index 8566e47d6..60acb0fbf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java @@ -27,20 +27,20 @@ public class Commandgod extends EssentialsToggleCommand Boolean toggle = matchToggleArgument(args[0]); if (toggle == null && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user, args); + toggleOtherPlayers(server, user.getBase(), args); } else { - togglePlayer(user, user, toggle); + togglePlayer(user.getBase(), user, toggle); } } else if (args.length == 2 && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user, args); + toggleOtherPlayers(server, user.getBase(), args); } else { - togglePlayer(user, user, null); + togglePlayer(user.getBase(), user, null); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java index 02f6de186..01e698637 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java @@ -32,7 +32,7 @@ public class Commandheal extends EssentialsCommand { user.healCooldown(); } - healOtherPlayers(server, user, args[0]); + healOtherPlayers(server, user.getBase(), args[0]); return; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 13f58f8fe..36b93e82b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -23,7 +23,7 @@ public class Commandhelp extends EssentialsCommand String pageStr = args.length > 0 ? args[0] : null; String chapterPageStr = args.length > 1 ? args[1] : null; String command = commandLabel; - final IText input = new TextInput(user, "help", false, ess); + final IText input = new TextInput(user.getBase(), "help", false, ess); if (input.getLines().isEmpty()) { @@ -45,10 +45,10 @@ public class Commandhelp extends EssentialsCommand } else { - output = new KeywordReplacer(input, user, ess); + output = new KeywordReplacer(input, user.getBase(), ess); } final TextPager pager = new TextPager(output); - pager.showPage(pageStr, chapterPageStr, command, user); + pager.showPage(pageStr, chapterPageStr, command, user.getBase()); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java index f7f2c50bb..d1dec09a0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java @@ -20,7 +20,7 @@ public class Commandhelpop extends EssentialsCommand public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { user.setDisplayNick(); - sendMessage(server, user, user.getDisplayName(), args); + sendMessage(server, user.getBase(), user.getDisplayName(), args); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index 09a56ebd9..869028af4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -60,7 +60,7 @@ public class Commanditem extends EssentialsCommand MetaItemStack metaStack = new MetaItemStack(stack); final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchantments.allowunsafe"); - metaStack.parseStringMeta(user, allowUnsafe, args, 2, ess); + metaStack.parseStringMeta(user.getBase(), allowUnsafe, args, 2, ess); stack = metaStack.getItemStack(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java index f09b797ef..52ab627ae 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java @@ -69,7 +69,7 @@ public class Commandpotion extends EssentialsCommand final MetaItemStack mStack = new MetaItemStack(stack); for (String arg : args) { - mStack.addPotionMeta(user, true, arg, ess); + mStack.addPotionMeta(user.getBase(), true, arg, ess); } if (mStack.completePotion()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index 5aad27e1a..dc04c0e04 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -24,7 +24,7 @@ public class Commandpowertool extends EssentialsCommand { final String command = getFinalArg(args, 0); final ItemStack itemStack = user.getItemInHand(); - powertool(server, user, user, commandLabel, itemStack, command); + powertool(server, user.getBase(), user, commandLabel, itemStack, command); } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index 9e7d2df01..2bf8c4081 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -30,7 +30,7 @@ public class Commandseen extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - seen(server, user, args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.extra"), user.isAuthorized("essentials.seen.ipsearch")); + seen(server, user.getBase(), args, user.isAuthorized("essentials.seen.banreason"), user.isAuthorized("essentials.seen.extra"), user.isAuthorized("essentials.seen.ipsearch")); } protected void seen(final Server server, final CommandSender sender, final String[] args, final boolean showBan, final boolean extra, final boolean ipLookup) throws Exception diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java index 7796806b6..ccdb242e0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java @@ -27,20 +27,20 @@ public class Commandsocialspy extends EssentialsToggleCommand Boolean toggle = matchToggleArgument(args[0]); if (toggle == null && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user, args); + toggleOtherPlayers(server, user.getBase(), args); } else { - togglePlayer(user, user, toggle); + togglePlayer(user.getBase(), user, toggle); } } else if (args.length == 2 && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user, args); + toggleOtherPlayers(server, user.getBase(), args); } else { - togglePlayer(user, user, null); + togglePlayer(user.getBase(), user, null); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index 6b1fe596a..3722d6412 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -43,7 +43,7 @@ public class Commandspawnmob extends EssentialsCommand if (args.length >= 3) { final User target = getPlayer(ess.getServer(), user, args, 2); - SpawnMob.spawnmob(ess, server, user, target, mobParts, mobData, mobCount); + SpawnMob.spawnmob(ess, server, user.getBase(), target, mobParts, mobData, mobCount); return; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java index 700e7eab7..f471bb622 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java @@ -53,7 +53,7 @@ public class Commandspeed extends EssentialsCommand { throw new PlayerNotFoundException(); } - speedOtherPlayers(server, user, isFly, isBypass, speed, args[2]); + speedOtherPlayers(server, user.getBase(), isFly, isBypass, speed, args[2]); return; } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index cba791c6a..6086ee193 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -69,7 +69,7 @@ public class Commandtpaccept extends EssentialsCommand catch (Exception ex) { user.sendMessage(_("pendingTeleportCancelled")); - ess.showError(target, ex, commandLabel); + ess.showError(target.getBase(), ex, commandLabel); } user.requestTeleport(null, false); throw new NoChargeException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java index 777473091..c9e5ca94a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java @@ -27,20 +27,20 @@ public class Commandtptoggle extends EssentialsToggleCommand Boolean toggle = matchToggleArgument(args[0]); if (toggle == null && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user, args); + toggleOtherPlayers(server, user.getBase(), args); } else { - togglePlayer(user, user, toggle); + togglePlayer(user.getBase(), user, toggle); } } else if (args.length == 2 && user.isAuthorized(othersPermission)) { - toggleOtherPlayers(server, user, args); + toggleOtherPlayers(server, user.getBase(), args); } else { - togglePlayer(user, user, null); + togglePlayer(user.getBase(), user, null); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index aa44878de..6749aafd0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.IUser; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.StringUtil; @@ -34,7 +35,7 @@ public class Commandwarp extends EssentialsCommand { throw new Exception(_("warpListPermission")); } - warpList(user, args); + warpList(user.getBase(), args, user); throw new NoChargeException(); } if (args.length > 0) @@ -57,7 +58,7 @@ public class Commandwarp extends EssentialsCommand { if (args.length < 2 || NumberUtil.isInt(args[0])) { - warpList(sender, args); + warpList(sender, args, null); throw new NoChargeException(); } User otherUser = getPlayer(server, args, 1, true, false); @@ -67,7 +68,7 @@ public class Commandwarp extends EssentialsCommand } //TODO: Use one of the new text classes, like /help ? - private void warpList(final CommandSender sender, final String[] args) throws Exception + private void warpList(final CommandSender sender, final String[] args, final IUser user) throws Exception { final IWarps warps = ess.getWarps(); if (warps.isEmpty()) @@ -76,13 +77,13 @@ public class Commandwarp extends EssentialsCommand } final List<String> warpNameList = new ArrayList<String>(warps.getList()); - if (sender instanceof User) + if (user != null) { final Iterator<String> iterator = warpNameList.iterator(); while (iterator.hasNext()) { final String warpName = iterator.next(); - if (ess.getSettings().getPerWarpPermission() && !((User)sender).isAuthorized("essentials.warps." + warpName)) + if (ess.getSettings().getPerWarpPermission() && !user.isAuthorized("essentials.warps." + warpName)) { iterator.remove(); } diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java index a8b9db45b..08b0b9911 100644 --- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -50,11 +50,11 @@ public class EssentialsSign } catch (ChargeException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); } catch (SignException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); } // Return true, so the player sees the wrong sign. return true; @@ -96,12 +96,12 @@ public class EssentialsSign } catch (ChargeException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); return false; } catch (SignException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); return false; } } @@ -118,7 +118,7 @@ public class EssentialsSign } catch (SignException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); return false; } } @@ -147,11 +147,11 @@ public class EssentialsSign } catch (ChargeException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); } catch (SignException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); } return false; } @@ -165,11 +165,11 @@ public class EssentialsSign } catch (ChargeException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); } catch (SignException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); } return false; } @@ -183,7 +183,7 @@ public class EssentialsSign } catch (SignException ex) { - ess.showError(user, ex, signName); + ess.showError(user.getBase(), ex, signName); } return false; } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java index fa79f9c63..b0fe380dd 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java @@ -37,10 +37,10 @@ public class SignInfo extends EssentialsSign final IText input; try { - input = new TextInput(player, "info", true, ess); - final IText output = new KeywordReplacer(input, player, ess); + input = new TextInput(player.getBase(), "info", true, ess); + final IText output = new KeywordReplacer(input, player.getBase(), ess); final TextPager pager = new TextPager(output); - pager.showPage(chapter, page, null, player); + pager.showPage(chapter, page, null, player.getBase()); } catch (IOException ex) diff --git a/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java b/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java index e112a8021..814ed9b29 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java @@ -29,7 +29,7 @@ public class SignSpawnmob extends EssentialsSign { List<String> mobParts = SpawnMob.mobParts(sign.getLine(2)); List<String> mobData = SpawnMob.mobData(sign.getLine(2)); - SpawnMob.spawnmob(ess, ess.getServer(), player, player, mobParts, mobData, Integer.parseInt(sign.getLine(1))); + SpawnMob.spawnmob(ess, ess.getServer(), player.getBase(), player, mobParts, mobData, Integer.parseInt(sign.getLine(1))); } catch (Exception ex) { diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java index 8ca1e0726..83996ea21 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java @@ -114,7 +114,7 @@ public abstract class EssentialsChatPlayer implements Listener } catch (ChargeException e) { - ess.showError(chatStore.getUser(), e, chatStore.getLongType()); + ess.showError(chatStore.getUser().getBase(), e, chatStore.getLongType()); event.setCancelled(true); return false; } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index d4ae14b9d..b98084a08 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -108,7 +108,7 @@ public class EssentialsSpawnPlayerListener implements Listener //This method allows for multiple line player announce messages using multiline yaml syntax #EasterEgg if (ess.getSettings().getAnnounceNewPlayers()) { - final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user, ess); + final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user.getBase(), ess); final SimpleTextPager pager = new SimpleTextPager(output); for (String line : pager.getLines()) |