From 517853fb73b2fb21d08c03a3b8d99cc98ff5abc7 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 13 Apr 2014 01:01:49 +0100 Subject: Converted emulated player class calls to use base class. --- .../essentials/EssentialsBlockListener.java | 2 +- .../essentials/EssentialsEntityListener.java | 12 ++--- .../essentials/EssentialsPlayerListener.java | 58 +++++++++++----------- Essentials/src/com/earth2me/essentials/ItemDb.java | 8 +-- Essentials/src/com/earth2me/essentials/Kit.java | 8 +-- Essentials/src/com/earth2me/essentials/User.java | 12 ++--- Essentials/src/com/earth2me/essentials/Worth.java | 2 +- .../earth2me/essentials/commands/Commandban.java | 6 +-- .../earth2me/essentials/commands/Commandbook.java | 6 +-- .../earth2me/essentials/commands/Commandbreak.java | 2 +- .../earth2me/essentials/commands/Commandburn.java | 2 +- .../essentials/commands/Commandenchant.java | 6 +-- .../essentials/commands/Commandenderchest.java | 8 +-- .../earth2me/essentials/commands/Commandexp.java | 4 +- .../essentials/commands/Commandfireball.java | 4 +- .../essentials/commands/Commandfirework.java | 4 +- .../earth2me/essentials/commands/Commandfly.java | 10 ++-- .../essentials/commands/Commandgamemode.java | 10 ++-- .../earth2me/essentials/commands/Commandgive.java | 6 +-- .../earth2me/essentials/commands/Commandgod.java | 6 +-- .../earth2me/essentials/commands/Commandhat.java | 10 ++-- .../earth2me/essentials/commands/Commandhome.java | 6 +-- .../essentials/commands/Commandinvsee.java | 8 +-- .../earth2me/essentials/commands/Commanditem.java | 6 +-- .../earth2me/essentials/commands/Commandkick.java | 2 +- .../essentials/commands/Commandkittycannon.java | 4 +- .../essentials/commands/Commandlightning.java | 2 +- .../earth2me/essentials/commands/Commandmore.java | 4 +- .../earth2me/essentials/commands/Commandmute.java | 2 +- .../essentials/commands/Commandpotion.java | 2 +- .../essentials/commands/Commandpowertool.java | 2 +- .../earth2me/essentials/commands/Commandptime.java | 12 ++--- .../essentials/commands/Commandpweather.java | 8 +-- .../essentials/commands/Commandrecipe.java | 6 +-- .../essentials/commands/Commandrepair.java | 10 ++-- .../earth2me/essentials/commands/Commandseen.java | 4 +- .../earth2me/essentials/commands/Commandsell.java | 6 +-- .../essentials/commands/Commandsetworth.java | 2 +- .../earth2me/essentials/commands/Commandspeed.java | 6 +-- .../earth2me/essentials/commands/Commandsudo.java | 2 +- .../essentials/commands/Commandsuicide.java | 6 +-- .../essentials/commands/Commandtempban.java | 6 +-- .../essentials/commands/Commandtogglejail.java | 6 +-- .../essentials/commands/Commandtpaccept.java | 2 +- .../earth2me/essentials/commands/Commandunban.java | 2 +- .../essentials/commands/Commandunlimited.java | 4 +- .../earth2me/essentials/commands/Commandwhois.java | 14 +++--- .../essentials/commands/Commandworkbench.java | 2 +- .../essentials/commands/EssentialsCommand.java | 2 +- .../earth2me/essentials/signs/EssentialsSign.java | 4 +- .../com/earth2me/essentials/signs/SignEnchant.java | 4 +- .../com/earth2me/essentials/signs/SignFree.java | 2 +- .../earth2me/essentials/signs/SignGameMode.java | 2 +- .../com/earth2me/essentials/signs/SignHeal.java | 8 +-- .../com/earth2me/essentials/signs/SignTrade.java | 12 ++--- .../essentials/textreader/KeywordReplacer.java | 4 +- .../com/earth2me/essentials/utils/StringUtil.java | 2 +- .../test/com/earth2me/essentials/ToggleTest.java | 56 ++++++++++----------- .../antibuild/EssentialsAntiBuildListener.java | 4 +- .../chat/EssentialsChatPlayerListenerLowest.java | 2 +- .../spawn/EssentialsSpawnPlayerListener.java | 4 +- 61 files changed, 214 insertions(+), 214 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java index 225965c2b..ea806eea7 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java @@ -54,7 +54,7 @@ public class EssentialsBlockListener implements Listener } final User user = ess.getUser(event.getPlayer()); - if (user.hasUnlimited(is) && user.getGameMode() == GameMode.SURVIVAL) + if (user.hasUnlimited(is) && user.getBase().getGameMode() == GameMode.SURVIVAL) { ess.scheduleSyncDelayedTask( new Runnable() diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 649dca27c..b99311805 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -42,13 +42,13 @@ public class EssentialsEntityListener implements Listener } else if (eDefend instanceof Ageable) { - final ItemStack hand = attacker.getItemInHand(); + final ItemStack hand = attacker.getBase().getItemInHand(); if (hand != null && hand.getType() == Material.MILK_BUCKET) { ((Ageable)eDefend).setBaby(); hand.setType(Material.BUCKET); - attacker.setItemInHand(hand); - attacker.updateInventory(); + attacker.getBase().setItemInHand(hand); + attacker.getBase().updateInventory(); event.setCancelled(true); } } @@ -97,7 +97,7 @@ public class EssentialsEntityListener implements Listener private void onPlayerVsPlayerPowertool(final EntityDamageByEntityEvent event, final Player defender, final User attacker) { - final List commandList = attacker.getPowertool(attacker.getItemInHand()); + final List commandList = attacker.getPowertool(attacker.getBase().getItemInHand()); if (commandList != null && !commandList.isEmpty()) { for (final String tempCommand : commandList) @@ -180,8 +180,8 @@ public class EssentialsEntityListener implements Listener { if (user.isGodModeEnabledRaw()) { - user.setFoodLevel(20); - user.setSaturation(10); + user.getBase().setFoodLevel(20); + user.getBase().setSaturation(10); } event.setCancelled(true); } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 1e55b9325..70943e149 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -225,7 +225,7 @@ public class EssentialsPlayerListener implements Listener @Override public void run() { - if (!user.isOnline()) + if (!user.getBase().isOnline()) { return; } @@ -242,14 +242,14 @@ public class EssentialsPlayerListener implements Listener Player toVanish = ess.getServer().getPlayerExact(p); if (toVanish != null && toVanish.isOnline()) { - user.hidePlayer(toVanish); + user.getBase().hidePlayer(toVanish); } } } if (user.isAuthorized("essentials.sleepingignored")) { - user.setSleepingIgnored(true); + user.getBase().setSleepingIgnored(true); } if ((ess.getSettings().allowSilentJoinQuit() && user.isAuthorized("essentials.silentjoin")) || message == null) @@ -305,16 +305,16 @@ public class EssentialsPlayerListener implements Listener if (user.isAuthorized("essentials.fly.safelogin")) { - user.setFallDistance(0); + user.getBase().setFallDistance(0); if (LocationUtil.shouldFly(user.getLocation())) { - user.setAllowFlight(true); - user.setFlying(true); - user.sendMessage(tl("flyMode", tl("enabled"), user.getDisplayName())); + user.getBase().setAllowFlight(true); + user.getBase().setFlying(true); + user.getBase().sendMessage(tl("flyMode", tl("enabled"), user.getDisplayName())); } } - user.setFlySpeed(0.1f); - user.setWalkSpeed(0.2f); + user.getBase().setFlySpeed(0.1f); + user.getBase().setWalkSpeed(0.2f); } }); @@ -326,12 +326,12 @@ public class EssentialsPlayerListener implements Listener Location loc = user.getHome(user.getLocation()); if (loc == null) { - loc = user.getBedSpawnLocation(); + loc = user.getBase().getBedSpawnLocation(); } if (loc != null) { final Location updateLoc = loc; - user.setCompassTarget(updateLoc); + user.getBase().setCompassTarget(updateLoc); } } @@ -364,7 +364,7 @@ public class EssentialsPlayerListener implements Listener final User user = ess.getUser(event.getPlayer()); - if (event.getResult() == Result.KICK_BANNED || user.isBanned()) + if (event.getResult() == Result.KICK_BANNED || user.getBase().isBanned()) { final boolean banExpired = user.checkBanTimeout(System.currentTimeMillis()); if (!banExpired) @@ -419,8 +419,8 @@ public class EssentialsPlayerListener implements Listener final ItemStack stack = new ItemStack(Material.EGG, 1); if (user.hasUnlimited(stack)) { - user.getInventory().addItem(stack); - user.updateInventory(); + user.getBase().getInventory().addItem(stack); + user.getBase().updateInventory(); } } @@ -436,7 +436,7 @@ public class EssentialsPlayerListener implements Listener @Override public void run() { - user.updateInventory(); + user.getBase().updateInventory(); } }); } @@ -469,34 +469,34 @@ public class EssentialsPlayerListener implements Listener public void onPlayerChangedWorldFlyReset(final PlayerChangedWorldEvent event) { final User user = ess.getUser(event.getPlayer()); - if (user.getGameMode() != GameMode.CREATIVE && !user.isAuthorized("essentials.fly")) + if (user.getBase().getGameMode() != GameMode.CREATIVE && !user.isAuthorized("essentials.fly")) { - user.setFallDistance(0f); - user.setAllowFlight(false); + user.getBase().setFallDistance(0f); + user.getBase().setAllowFlight(false); } if (!user.isAuthorized("essentials.speed")) { - user.setFlySpeed(0.1f); - user.setWalkSpeed(0.2f); + user.getBase().setFlySpeed(0.1f); + user.getBase().setWalkSpeed(0.2f); } else { - if (user.getFlySpeed() > ess.getSettings().getMaxFlySpeed() && !user.isAuthorized("essentials.speed.bypass")) + if (user.getBase().getFlySpeed() > ess.getSettings().getMaxFlySpeed() && !user.isAuthorized("essentials.speed.bypass")) { - user.setFlySpeed((float)ess.getSettings().getMaxFlySpeed()); + user.getBase().setFlySpeed((float)ess.getSettings().getMaxFlySpeed()); } else { - user.setFlySpeed(user.getFlySpeed() * 0.99999f); + user.getBase().setFlySpeed(user.getBase().getFlySpeed() * 0.99999f); } - if (user.getWalkSpeed() > ess.getSettings().getMaxWalkSpeed() && !user.isAuthorized("essentials.speed.bypass")) + if (user.getBase().getWalkSpeed() > ess.getSettings().getMaxWalkSpeed() && !user.isAuthorized("essentials.speed.bypass")) { - user.setWalkSpeed((float)ess.getSettings().getMaxWalkSpeed()); + user.getBase().setWalkSpeed((float)ess.getSettings().getMaxWalkSpeed()); } else { - user.setWalkSpeed(user.getWalkSpeed() * 0.99999f); + user.getBase().setWalkSpeed(user.getBase().getWalkSpeed() * 0.99999f); } } } @@ -534,7 +534,7 @@ public class EssentialsPlayerListener implements Listener User player = ess.getUser(event.getPlayer()); if (player.isAuthorized("essentials.sethome.bed")) { - player.setBedSpawnLocation(event.getClickedBlock().getLocation()); + player.getBase().setBedSpawnLocation(event.getClickedBlock().getLocation()); player.sendMessage(tl("bedSet", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ())); } } @@ -616,7 +616,7 @@ public class EssentialsPlayerListener implements Listener else if (command.startsWith("c:")) { used = true; - user.chat(command.substring(2)); + user.getBase().chat(command.substring(2)); } else { @@ -664,7 +664,7 @@ public class EssentialsPlayerListener implements Listener final User invOwner = ess.getUser((Player)invHolder); if (user.isInvSee() && (!user.isAuthorized("essentials.invsee.modify") || invOwner.isAuthorized("essentials.invsee.preventmodify") - || !invOwner.isOnline())) + || !invOwner.getBase().isOnline())) { event.setCancelled(true); refreshPlayer = user.getBase(); diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index 508ba903a..6d0b1725a 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -171,15 +171,15 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb if (args.length < 1) { - is.add(user.getItemInHand()); + is.add(user.getBase().getItemInHand()); } else if (args[0].equalsIgnoreCase("hand")) { - is.add(user.getItemInHand()); + is.add(user.getBase().getItemInHand()); } else if (args[0].equalsIgnoreCase("inventory") || args[0].equalsIgnoreCase("invent") || args[0].equalsIgnoreCase("all")) { - for (ItemStack stack : user.getInventory().getContents()) + for (ItemStack stack : user.getBase().getInventory().getContents()) { if (stack == null || stack.getType() == Material.AIR) { @@ -190,7 +190,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb } else if (args[0].equalsIgnoreCase("blocks")) { - for (ItemStack stack : user.getInventory().getContents()) + for (ItemStack stack : user.getBase().getInventory().getContents()) { if (stack == null || stack.getTypeId() > 255 || stack.getType() == Material.AIR) { diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java index 994a2d594..3a6b99dae 100644 --- a/Essentials/src/com/earth2me/essentials/Kit.java +++ b/Essentials/src/com/earth2me/essentials/Kit.java @@ -204,11 +204,11 @@ public class Kit final boolean allowOversizedStacks = user.isAuthorized("essentials.oversizedstacks"); if (allowOversizedStacks) { - overfilled = InventoryWorkaround.addOversizedItems(user.getInventory(), ess.getSettings().getOversizedStackSize(), metaStack.getItemStack()); + overfilled = InventoryWorkaround.addOversizedItems(user.getBase().getInventory(), ess.getSettings().getOversizedStackSize(), metaStack.getItemStack()); } else { - overfilled = InventoryWorkaround.addItems(user.getInventory(), metaStack.getItemStack()); + overfilled = InventoryWorkaround.addItems(user.getBase().getInventory(), metaStack.getItemStack()); } for (ItemStack itemStack : overfilled.values()) { @@ -223,7 +223,7 @@ public class Kit spew = true; } } - user.updateInventory(); + user.getBase().updateInventory(); if (spew) { user.sendMessage(tl("kitInvFull")); @@ -231,7 +231,7 @@ public class Kit } catch (Exception e) { - user.updateInventory(); + user.getBase().updateInventory(); ess.getLogger().log(Level.WARNING, e.getMessage()); throw new Exception(tl("kitError2"), e); } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index ebae1681f..8107727d1 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -51,7 +51,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es teleport = new Teleport(this, ess); if (isAfk()) { - afkPosition = this.getBase().getLocation(); + afkPosition = this.getLocation(); } if (this.getBase().isOnline()) { @@ -237,13 +237,13 @@ public class User extends UserData implements Comparable, IReplyTo, net.es @Override public void setLastLocation() { - setLastLocation(this.getBase().getLocation()); + setLastLocation(this.getLocation()); } @Override public void setLogoutLocation() { - setLogoutLocation(this.getBase().getLocation()); + setLogoutLocation(this.getLocation()); } @Override @@ -258,7 +258,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es } else { - teleportLocation = here ? player.getBase().getLocation() : this.getBase().getLocation(); + teleportLocation = here ? player.getLocation() : this.getLocation(); } } @@ -497,7 +497,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es this.getBase().setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set); if (set && !isAfk()) { - afkPosition = this.getBase().getLocation(); + afkPosition = this.getLocation(); } else if (!set && isAfk()) { @@ -643,7 +643,7 @@ public class User extends UserData implements Comparable, IReplyTo, net.es @Override public boolean isGodModeEnabled() { - return (super.isGodModeEnabled() && !ess.getSettings().getNoGodWorlds().contains(this.getBase().getLocation().getWorld().getName())) + return (super.isGodModeEnabled() && !ess.getSettings().getNoGodWorlds().contains(this.getLocation().getWorld().getName())) || (isAfk() && ess.getSettings().getFreezeAfkPlayers()); } diff --git a/Essentials/src/com/earth2me/essentials/Worth.java b/Essentials/src/com/earth2me/essentials/Worth.java index 9a3e3fe51..91394a35a 100644 --- a/Essentials/src/com/earth2me/essentials/Worth.java +++ b/Essentials/src/com/earth2me/essentials/Worth.java @@ -114,7 +114,7 @@ public class Worth implements IConf } int max = 0; - for (ItemStack s : user.getInventory().getContents()) + for (ItemStack s : user.getBase().getInventory().getContents()) { if (s == null || !s.isSimilar(is)) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index 3a2b0267c..1864591a7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -35,7 +35,7 @@ public class Commandban extends EssentialsCommand nomatch = true; user = ess.getUser(new OfflinePlayer(args[0], ess)); } - if (!user.isOnline()) + if (!user.getBase().isOnline()) { if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.ban.offline")) { @@ -62,9 +62,9 @@ public class Commandban extends EssentialsCommand } user.setBanReason(tl("banFormat", banReason, senderName)); - user.setBanned(true); + user.getBase().setBanned(true); user.setBanTimeout(0); - user.kickPlayer(tl("banFormat", banReason, senderName)); + user.getBase().kickPlayer(tl("banFormat", banReason, senderName)); server.getLogger().log(Level.INFO, tl("playerBanned", senderName, user.getName(), banReason)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbook.java b/Essentials/src/com/earth2me/essentials/commands/Commandbook.java index f2cb79bd2..9b602c357 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbook.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbook.java @@ -19,7 +19,7 @@ public class Commandbook extends EssentialsCommand @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - final ItemStack item = user.getItemInHand(); + final ItemStack item = user.getBase().getItemInHand(); final String player = user.getName(); if (item.getType() == Material.WRITTEN_BOOK) { @@ -57,7 +57,7 @@ public class Commandbook extends EssentialsCommand { ItemStack newItem = new ItemStack(Material.BOOK_AND_QUILL, item.getAmount()); newItem.setItemMeta(bmeta); - user.setItemInHand(newItem); + user.getBase().setItemInHand(newItem); user.sendMessage(tl("editBookContents")); } else @@ -75,7 +75,7 @@ public class Commandbook extends EssentialsCommand } ItemStack newItem = new ItemStack(Material.WRITTEN_BOOK, item.getAmount()); newItem.setItemMeta(bmeta); - user.setItemInHand(newItem); + user.getBase().setItemInHand(newItem); user.sendMessage(tl("bookLocked")); } else diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java index 92ccd9dc4..f4b4a6764 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbreak.java @@ -19,7 +19,7 @@ public class Commandbreak extends EssentialsCommand @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - final Block block = user.getTargetBlock(null, 20); + final Block block = user.getBase().getTargetBlock(null, 20); if (block == null) { throw new NoChargeException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java index b0ae498de..e9665a745 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java @@ -27,7 +27,7 @@ public class Commandburn extends EssentialsCommand } User user = getPlayer(server, sender, args, 0); - user.setFireTicks(Integer.parseInt(args[1]) * 20); + user.getBase().setFireTicks(Integer.parseInt(args[1]) * 20); sender.sendMessage(tl("burnMsg", user.getDisplayName(), Integer.parseInt(args[1]))); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java index 1a41147b7..feb04e97b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java @@ -26,7 +26,7 @@ public class Commandenchant extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - final ItemStack stack = user.getItemInHand(); + final ItemStack stack = user.getBase().getItemInHand(); if (stack == null || stack.getType() == Material.AIR) { throw new Exception(tl("nothingInHand")); @@ -64,9 +64,9 @@ public class Commandenchant extends EssentialsCommand final MetaItemStack metaStack = new MetaItemStack(stack); final Enchantment enchantment = metaStack.getEnchantment(user, args[0]); metaStack.addEnchantment(user.getSource(), allowUnsafe, enchantment, level); - user.getInventory().setItemInHand(metaStack.getItemStack()); + user.getBase().getInventory().setItemInHand(metaStack.getItemStack()); - user.updateInventory(); + user.getBase().updateInventory(); final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); if (level == 0) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java b/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java index 829eeefb1..94f27c42e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandenderchest.java @@ -17,14 +17,14 @@ public class Commandenderchest extends EssentialsCommand if (args.length > 0 && user.isAuthorized("essentials.enderchest.others")) { final User invUser = getPlayer(server, user, args, 0); - user.closeInventory(); - user.openInventory(invUser.getEnderChest()); + user.getBase().closeInventory(); + user.getBase().openInventory(invUser.getBase().getEnderChest()); user.setEnderSee(true); } else { - user.closeInventory(); - user.openInventory(user.getEnderChest()); + user.getBase().closeInventory(); + user.getBase().openInventory(user.getBase().getEnderChest()); user.setEnderSee(false); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index 86a11f7d4..4cbe72de6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -159,7 +159,7 @@ public class Commandexp extends EssentialsCommand private void showExp(final CommandSource sender, final User target) { - sender.sendMessage(tl("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target.getBase()), target.getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase()))); + sender.sendMessage(tl("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target.getBase()), target.getBase().getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase()))); } //TODO: Limit who can give negative exp? @@ -173,7 +173,7 @@ public class Commandexp extends EssentialsCommand int neededLevel = Integer.parseInt(strAmount); if (give) { - neededLevel += target.getLevel(); + neededLevel += target.getBase().getLevel(); } amount = (long)SetExpFix.getExpToLevel(neededLevel); SetExpFix.setTotalExperience(target.getBase(), 0); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java b/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java index c206db4ef..d4759802a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java @@ -50,8 +50,8 @@ public class Commandfireball extends EssentialsCommand type = LargeFireball.class; } } - final Vector direction = user.getEyeLocation().getDirection().multiply(speed); - projectile = (Projectile)user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type); + final Vector direction = user.getBase().getEyeLocation().getDirection().multiply(speed); + projectile = (Projectile)user.getWorld().spawn(user.getBase().getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), type); projectile.setShooter(user.getBase()); projectile.setVelocity(direction); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java index 99ac62184..f154a28bf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java @@ -41,7 +41,7 @@ public class Commandfirework extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - final ItemStack stack = user.getItemInHand(); + final ItemStack stack = user.getBase().getItemInHand(); if (stack.getType() == Material.FIREWORK) { if (args.length > 0) @@ -95,7 +95,7 @@ public class Commandfirework extends EssentialsCommand FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); if (direction) { - final Vector vector = user.getEyeLocation().getDirection().multiply(0.070); + final Vector vector = user.getBase().getEyeLocation().getDirection().multiply(0.070); if (fmeta.getPower() > 1) { fmeta.setPower(1); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java index 3628884b1..790d351ab 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java @@ -49,15 +49,15 @@ public class Commandfly extends EssentialsToggleCommand { if (enabled == null) { - enabled = !user.getAllowFlight(); + enabled = !user.getBase().getAllowFlight(); } - user.setFallDistance(0f); - user.setAllowFlight(enabled); + user.getBase().setFallDistance(0f); + user.getBase().setAllowFlight(enabled); - if (!user.getAllowFlight()) + if (!user.getBase().getAllowFlight()) { - user.setFlying(false); + user.getBase().setFlying(false); } user.sendMessage(tl("flyMode", tl(enabled ? "enabled" : "disabled"), user.getDisplayName())); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java index f5ce82b95..ae303f493 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java @@ -71,10 +71,10 @@ public class Commandgamemode extends EssentialsCommand } if (gameMode == null) { - gameMode = user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL; + gameMode = user.getBase().getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : user.getBase().getGameMode() == GameMode.CREATIVE ? GameMode.ADVENTURE : GameMode.SURVIVAL; } - user.setGameMode(gameMode); - user.sendMessage(tl("gameMode", tl(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName())); + user.getBase().setGameMode(gameMode); + user.sendMessage(tl("gameMode", tl(user.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName())); } private void gamemodeOtherPlayers(final Server server, final CommandSource sender, final GameMode gameMode, final String name) throws NotEnoughArgumentsException, PlayerNotFoundException @@ -95,8 +95,8 @@ public class Commandgamemode extends EssentialsCommand continue; } foundUser = true; - player.setGameMode(gameMode); - sender.sendMessage(tl("gameMode", tl(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); + player.getBase().setGameMode(gameMode); + sender.sendMessage(tl("gameMode", tl(player.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); } if (!foundUser) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index 1f4f66b72..982054bbb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -100,11 +100,11 @@ public class Commandgive extends EssentialsCommand if (giveTo.isAuthorized("essentials.oversizedstacks")) { - leftovers = InventoryWorkaround.addOversizedItems(giveTo.getInventory(), ess.getSettings().getOversizedStackSize(), stack); + leftovers = InventoryWorkaround.addOversizedItems(giveTo.getBase().getInventory(), ess.getSettings().getOversizedStackSize(), stack); } else { - leftovers = InventoryWorkaround.addItems(giveTo.getInventory(), stack); + leftovers = InventoryWorkaround.addItems(giveTo.getBase().getInventory(), stack); } for (ItemStack item : leftovers.values()) @@ -112,6 +112,6 @@ public class Commandgive extends EssentialsCommand sender.sendMessage(tl("giveSpawnFailure", item.getAmount(), itemName, giveTo.getDisplayName())); } - giveTo.updateInventory(); + giveTo.getBase().updateInventory(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java index 2fb647cc2..b758f6493 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java @@ -60,10 +60,10 @@ public class Commandgod extends EssentialsToggleCommand { user.setGodModeEnabled(enabled); - if (enabled && user.getHealth() != 0) + if (enabled && user.getBase().getHealth() != 0) { - user.setHealth(user.getMaxHealth()); - user.setFoodLevel(20); + user.getBase().setHealth(user.getBase().getMaxHealth()); + user.getBase().setFoodLevel(20); } user.sendMessage(tl("godMode", enabled ? tl("enabled") : tl("disabled"))); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhat.java b/Essentials/src/com/earth2me/essentials/commands/Commandhat.java index 9919ffbe7..4f042ba60 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhat.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhat.java @@ -21,7 +21,7 @@ public class Commandhat extends EssentialsCommand { if (args.length > 0 && (args[0].contains("rem") || args[0].contains("off") || args[0].equalsIgnoreCase("0"))) { - final PlayerInventory inv = user.getInventory(); + final PlayerInventory inv = user.getBase().getInventory(); final ItemStack head = inv.getHelmet(); if (head == null || head.getType() == Material.AIR) { @@ -31,18 +31,18 @@ public class Commandhat extends EssentialsCommand { final ItemStack air = new ItemStack(Material.AIR); inv.setHelmet(air); - InventoryWorkaround.addItems(user.getInventory(), head); + InventoryWorkaround.addItems(user.getBase().getInventory(), head); user.sendMessage(tl("hatRemoved")); } } else { - if (user.getItemInHand().getType() != Material.AIR) + if (user.getBase().getItemInHand().getType() != Material.AIR) { - final ItemStack hand = user.getItemInHand(); + final ItemStack hand = user.getBase().getItemInHand(); if (hand.getType().getMaxDurability() == 0) { - final PlayerInventory inv = user.getInventory(); + final PlayerInventory inv = user.getBase().getInventory(); final ItemStack head = inv.getHelmet(); inv.setHelmet(hand); inv.setItemInHand(head); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index f06f22b95..62b0c4161 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -46,7 +46,7 @@ public class Commandhome extends EssentialsCommand { if ("bed".equalsIgnoreCase(homeName) && user.isAuthorized("essentials.home.bed")) { - final Location bed = player.getBedSpawnLocation(); + final Location bed = player.getBase().getBedSpawnLocation(); if (bed != null) { user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND); @@ -61,7 +61,7 @@ public class Commandhome extends EssentialsCommand } catch (NotEnoughArgumentsException e) { - Location bed = player.getBedSpawnLocation(); + Location bed = player.getBase().getBedSpawnLocation(); final List homes = player.getHomes(); if (homes.isEmpty() && player.equals(user)) { @@ -97,7 +97,7 @@ public class Commandhome extends EssentialsCommand private String getHomeLimit(final User player) { - if (!player.isOnline()) + if (!player.getBase().isOnline()) { return "?"; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java index 368a03a74..f1800eb8e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java @@ -27,14 +27,14 @@ public class Commandinvsee extends EssentialsCommand if (args.length > 1 && user.isAuthorized("essentials.invsee.equip")) { inv = server.createInventory(invUser.getBase(), 9, "Equipped"); - inv.setContents(invUser.getInventory().getArmorContents()); + inv.setContents(invUser.getBase().getInventory().getArmorContents()); } else { - inv = invUser.getInventory(); + inv = invUser.getBase().getInventory(); } - user.closeInventory(); - user.openInventory(inv); + user.getBase().closeInventory(); + user.getBase().openInventory(inv); user.setInvSee(true); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index ef5756ec4..97d818172 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -75,12 +75,12 @@ public class Commanditem extends EssentialsCommand user.sendMessage(tl("itemSpawn", stack.getAmount(), displayName)); if (user.isAuthorized("essentials.oversizedstacks")) { - InventoryWorkaround.addOversizedItems(user.getInventory(), ess.getSettings().getOversizedStackSize(), stack); + InventoryWorkaround.addOversizedItems(user.getBase().getInventory(), ess.getSettings().getOversizedStackSize(), stack); } else { - InventoryWorkaround.addItems(user.getInventory(), stack); + InventoryWorkaround.addItems(user.getBase().getInventory(), stack); } - user.updateInventory(); + user.getBase().updateInventory(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java index 30d7d9d8d..e7095f44c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java @@ -42,7 +42,7 @@ public class Commandkick extends EssentialsCommand String kickReason = args.length > 1 ? getFinalArg(args, 1) : tl("kickDefault"); kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); - target.kickPlayer(kickReason); + target.getBase().kickPlayer(kickReason); final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; server.getLogger().log(Level.INFO, tl("playerKicked", senderName, target.getName(), kickReason)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java b/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java index d187274a9..89e90797b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java @@ -21,7 +21,7 @@ public class Commandkittycannon extends EssentialsCommand protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { final Mob cat = Mob.OCELOT; - final Ocelot ocelot = (Ocelot)cat.spawn(user.getWorld(), server, user.getEyeLocation()); + final Ocelot ocelot = (Ocelot)cat.spawn(user.getWorld(), server, user.getBase().getEyeLocation()); if (ocelot == null) { return; @@ -30,7 +30,7 @@ public class Commandkittycannon extends EssentialsCommand ocelot.setCatType(Ocelot.Type.values()[i]); ocelot.setTamed(true); ocelot.setBaby(); - ocelot.setVelocity(user.getEyeLocation().getDirection().multiply(2)); + ocelot.setVelocity(user.getBase().getEyeLocation().getDirection().multiply(2)); ess.scheduleSyncDelayedTask(new Runnable() { @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java index a3f7e10a4..75e3c0579 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java @@ -25,7 +25,7 @@ public class Commandlightning extends EssentialsLoopCommand user = ess.getUser(sender.getPlayer()); if ((args.length < 1 || user != null && !user.isAuthorized("essentials.lightning.others"))) { - user.getWorld().strikeLightning(user.getTargetBlock(null, 600).getLocation()); + user.getWorld().strikeLightning(user.getBase().getTargetBlock(null, 600).getLocation()); return; } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmore.java b/Essentials/src/com/earth2me/essentials/commands/Commandmore.java index 61e951e1e..f0fa43efc 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmore.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmore.java @@ -17,7 +17,7 @@ public class Commandmore extends EssentialsCommand @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - final ItemStack stack = user.getItemInHand(); + final ItemStack stack = user.getBase().getItemInHand(); if (stack == null) { throw new Exception(tl("cantSpawnItem", "Air")); @@ -45,6 +45,6 @@ public class Commandmore extends EssentialsCommand { stack.setAmount(stack.getMaxStackSize()); } - user.updateInventory(); + user.getBase().updateInventory(); } } \ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index a2ee68556..fb7968f8e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -34,7 +34,7 @@ public class Commandmute extends EssentialsCommand nomatch = true; user = ess.getUser(new OfflinePlayer(args[0], ess)); } - if (!user.isOnline()) + if (!user.getBase().isOnline()) { if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.mute.offline")) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java index b7dbd4dfa..108644649 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpotion.java @@ -27,7 +27,7 @@ public class Commandpotion extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - final ItemStack stack = user.getItemInHand(); + final ItemStack stack = user.getBase().getItemInHand(); if (args.length == 0) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index 65bb73320..9c951395c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -23,7 +23,7 @@ public class Commandpowertool extends EssentialsCommand protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { final String command = getFinalArg(args, 0); - final ItemStack itemStack = user.getItemInHand(); + final ItemStack itemStack = user.getBase().getItemInHand(); powertool(server, user.getSource(), user, commandLabel, itemStack, command); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java index 077cdef93..c14f31cbb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java @@ -101,14 +101,14 @@ public class Commandptime extends EssentialsCommand for (User user : users) { - if (user.getPlayerTimeOffset() == 0) + if (user.getBase().getPlayerTimeOffset() == 0) { sender.sendMessage(tl("pTimeNormal", user.getName())); } else { - String time = DescParseTickFormat.format(user.getPlayerTime()); - if (!user.isPlayerTimeRelative()) + String time = DescParseTickFormat.format(user.getBase().getPlayerTime()); + if (!user.getBase().isPlayerTimeRelative()) { sender.sendMessage(tl("pTimeCurrentFixed", user.getName(), time)); } @@ -131,7 +131,7 @@ public class Commandptime extends EssentialsCommand // Reset for (User user : users) { - user.resetPlayerTime(); + user.getBase().resetPlayerTime(); } } else @@ -140,14 +140,14 @@ public class Commandptime extends EssentialsCommand for (User user : users) { final World world = user.getWorld(); - long time = user.getPlayerTime(); + long time = user.getBase().getPlayerTime(); time -= time % 24000; time += 24000 + ticks; if (relative) { time -= world.getTime(); } - user.setPlayerTime(time, relative); + user.getBase().setPlayerTime(time, relative); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java index 79969a0cd..cf47e8b17 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpweather.java @@ -79,13 +79,13 @@ public class Commandpweather extends EssentialsCommand for (User user : users) { - if (user.getPlayerWeather() == null) + if (user.getBase().getPlayerWeather() == null) { sender.sendMessage(tl("pWeatherNormal", user.getName())); } else { - sender.sendMessage(tl("pWeatherCurrent", user.getName(), user.getPlayerWeather().toString().toLowerCase(Locale.ENGLISH))); + sender.sendMessage(tl("pWeatherCurrent", user.getName(), user.getBase().getPlayerWeather().toString().toLowerCase(Locale.ENGLISH))); } } } @@ -111,7 +111,7 @@ public class Commandpweather extends EssentialsCommand { for (User user : users) { - user.resetPlayerWeather(); + user.getBase().resetPlayerWeather(); } sender.sendMessage(tl("pWeatherReset", msg)); @@ -125,7 +125,7 @@ public class Commandpweather extends EssentialsCommand for (User user : users) { - user.setPlayerWeather(weatherAliases.get(weatherType)); + user.getBase().setPlayerWeather(weatherAliases.get(weatherType)); } sender.sendMessage(tl("pWeatherSet", weatherType, msg.toString())); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java index 01289a0e9..3c2a69fa0 100755 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java @@ -88,9 +88,9 @@ public class Commandrecipe extends EssentialsCommand if (sender.isPlayer()) { final User user = ess.getUser(sender.getPlayer()); - user.closeInventory(); + user.getBase().closeInventory(); user.setRecipeSee(true); - final InventoryView view = user.openWorkbench(null, true); + final InventoryView view = user.getBase().openWorkbench(null, true); final String[] recipeShape = recipe.getShape(); final Map ingredientMap = recipe.getIngredientMap(); for (int j = 0; j < recipeShape.length; j++) @@ -148,7 +148,7 @@ public class Commandrecipe extends EssentialsCommand { final User user = ess.getUser(sender.getPlayer()); user.setRecipeSee(true); - final InventoryView view = user.openWorkbench(null, true); + final InventoryView view = user.getBase().openWorkbench(null, true); for (int i = 0; i < ingredients.size(); i++) { view.setItem(i + 1, ingredients.get(i)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java index 91bbaa9d8..f0b503d2d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java @@ -41,7 +41,7 @@ public class Commandrepair extends EssentialsCommand public void repairHand(User user) throws Exception { - final ItemStack item = user.getItemInHand(); + final ItemStack item = user.getBase().getItemInHand(); if (item == null || item.getType().isBlock() || item.getDurability() == 0) { throw new Exception(tl("repairInvalidType")); @@ -62,21 +62,21 @@ public class Commandrepair extends EssentialsCommand repairItem(item); charge.charge(user); - user.updateInventory(); + user.getBase().updateInventory(); user.sendMessage(tl("repair", itemName.replace('_', ' '))); } public void repairAll(User user) throws Exception { final List repaired = new ArrayList(); - repairItems(user.getInventory().getContents(), user, repaired); + repairItems(user.getBase().getInventory().getContents(), user, repaired); if (user.isAuthorized("essentials.repair.armor")) { - repairItems(user.getInventory().getArmorContents(), user, repaired); + repairItems(user.getBase().getInventory().getArmorContents(), user, repaired); } - user.updateInventory(); + user.getBase().updateInventory(); if (repaired.isEmpty()) { throw new Exception(tl("repairNone")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index 146a74fa3..38453efc5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -94,7 +94,7 @@ public class Commandseen extends EssentialsCommand } if (extra) { - sender.sendMessage(tl("whoisIPAddress", user.getAddress().getAddress().toString())); + sender.sendMessage(tl("whoisIPAddress", user.getBase().getAddress().getAddress().toString())); } } @@ -109,7 +109,7 @@ public class Commandseen extends EssentialsCommand { sender.sendMessage(tl("userUnknown", user.getName())); } - if (user.isBanned()) + if (user.getBase().isBanned()) { sender.sendMessage(tl("whoisBanned", showBan ? user.getBanReason() : tl("true"))); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index c5722df26..aa5eea125 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -95,13 +95,13 @@ public class Commandsell extends EssentialsCommand //TODO: Prices for Enchantments final ItemStack ris = is.clone(); ris.setAmount(amount); - if (!user.getInventory().containsAtLeast(ris, amount)) + if (!user.getBase().getInventory().containsAtLeast(ris, amount)) { // This should never happen. throw new IllegalStateException("Trying to remove more items than are available."); } - user.getInventory().removeItem(ris); - user.updateInventory(); + user.getBase().getInventory().removeItem(ris); + user.getBase().updateInventory(); Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(result, ess), user.getLocation(), ess); user.giveMoney(result); user.sendMessage(tl("itemSold", NumberUtil.displayCurrency(result, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), NumberUtil.displayCurrency(worth, ess))); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java index 07938ef72..3a0e6b5ea 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java @@ -27,7 +27,7 @@ public class Commandsetworth extends EssentialsCommand if (args.length == 1) { - stack = user.getInventory().getItemInHand(); + stack = user.getBase().getInventory().getItemInHand(); price = args[0]; } else diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java index 9dca9dead..f155c5dec 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java @@ -40,7 +40,7 @@ public class Commandspeed extends EssentialsCommand boolean isBypass = user.isAuthorized("essentials.speed.bypass"); if (args.length == 1) { - isFly = flyPermCheck(user, user.isFlying()); + isFly = flyPermCheck(user, user.getBase().isFlying()); speed = getMoveSpeed(args[0]); } else @@ -60,12 +60,12 @@ public class Commandspeed extends EssentialsCommand if (isFly) { - user.setFlySpeed(getRealMoveSpeed(speed, isFly, isBypass)); + user.getBase().setFlySpeed(getRealMoveSpeed(speed, isFly, isBypass)); user.sendMessage(tl("moveSpeed", tl("flying"), speed, user.getDisplayName())); } else { - user.setWalkSpeed(getRealMoveSpeed(speed, isFly, isBypass)); + user.getBase().setWalkSpeed(getRealMoveSpeed(speed, isFly, isBypass)); user.sendMessage(tl("moveSpeed", tl("walking"), speed, user.getDisplayName())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java index 2c2567be2..7ee8f8180 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java @@ -33,7 +33,7 @@ public class Commandsudo extends EssentialsCommand { throw new Exception(tl("sudoExempt")); } - user.chat(getFinalArg(args, 1).substring(2)); + user.getBase().chat(getFinalArg(args, 1).substring(2)); return; } final String command = args[1]; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java index 69c1137c9..fdd9e0bbb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java @@ -18,10 +18,10 @@ public class Commandsuicide extends EssentialsCommand { EntityDamageEvent ede = new EntityDamageEvent(user.getBase(), EntityDamageEvent.DamageCause.SUICIDE, Short.MAX_VALUE); server.getPluginManager().callEvent(ede); - user.damage(Short.MAX_VALUE); - if (user.getHealth() > 0) + user.getBase().damage(Short.MAX_VALUE); + if (user.getBase().getHealth() > 0) { - user.setHealth(0); + user.getBase().setHealth(0); } user.sendMessage(tl("suicideMessage")); user.setDisplayNick(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index 1565d1f65..5310e0c55 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -25,7 +25,7 @@ public class Commandtempban extends EssentialsCommand throw new NotEnoughArgumentsException(); } final User user = getPlayer(server, args, 0, true, true); - if (!user.isOnline()) + if (!user.getBase().isOnline()) { if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.tempban.offline")) @@ -57,8 +57,8 @@ public class Commandtempban extends EssentialsCommand final String banReason = tl("tempBanned", DateUtil.formatDateDiff(banTimestamp), senderName); user.setBanReason(banReason); user.setBanTimeout(banTimestamp); - user.setBanned(true); - user.kickPlayer(banReason); + user.getBase().setBanned(true); + user.getBase().kickPlayer(banReason); final String message = tl("playerBanned", senderName, user.getName(), banReason, DateUtil.formatDateDiff(banTimestamp)); server.getLogger().log(Level.INFO, message); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java index 927462f21..8d67a21d0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java @@ -26,7 +26,7 @@ public class Commandtogglejail extends EssentialsCommand if (args.length >= 2 && !player.isJailed()) { - if (!player.isOnline()) + if (!player.getBase().isOnline()) { if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.togglejail.offline")) @@ -43,7 +43,7 @@ public class Commandtogglejail extends EssentialsCommand return; } } - if (player.isOnline()) + if (player.getBase().isOnline()) { ess.getJails().sendToJail(player, args[1]); } @@ -94,7 +94,7 @@ public class Commandtogglejail extends EssentialsCommand player.setJailTimeout(0); player.sendMessage(tl("jailReleasedPlayerNotify")); player.setJail(null); - if (player.isOnline()) + if (player.getBase().isOnline()) { player.getTeleport().back(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 4ae22a01a..ed56a6275 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -28,7 +28,7 @@ public class Commandtpaccept extends EssentialsCommand throw new Exception(tl("noPendingRequest")); } - if (!requester.isOnline()) + if (!requester.getBase().isOnline()) { throw new Exception(tl("noPendingRequest")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java index b64c0f6c3..44777dcd1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java @@ -28,7 +28,7 @@ public class Commandunban extends EssentialsCommand { final User user = getPlayer(server, args, 0, true, true); name = user.getName(); - user.setBanned(false); + user.getBase().setBanned(false); user.setBanTimeout(0); } catch (NoSuchFieldException e) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java index df005421f..c07f900b8 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java @@ -102,9 +102,9 @@ public class Commandunlimited extends EssentialsCommand { message = "enableUnlimited"; enableUnlimited = true; - if (!target.getInventory().containsAtLeast(stack, stack.getAmount())) + if (!target.getBase().getInventory().containsAtLeast(stack, stack.getAmount())) { - target.getInventory().addItem(stack); + target.getBase().getInventory().addItem(stack); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index a3f7f6ae8..a22bd4870 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -30,25 +30,25 @@ public class Commandwhois extends EssentialsCommand sender.sendMessage(tl("whoisTop", user.getName())); user.setDisplayNick(); sender.sendMessage(tl("whoisNick", user.getDisplayName())); - sender.sendMessage(tl("whoisHealth", user.getHealth())); - sender.sendMessage(tl("whoisHunger", user.getFoodLevel(), user.getSaturation())); - sender.sendMessage(tl("whoisExp", SetExpFix.getTotalExperience(user.getBase()), user.getLevel())); + sender.sendMessage(tl("whoisHealth", user.getBase().getHealth())); + sender.sendMessage(tl("whoisHunger", user.getBase().getFoodLevel(), user.getBase().getSaturation())); + sender.sendMessage(tl("whoisExp", SetExpFix.getTotalExperience(user.getBase()), user.getBase().getLevel())); sender.sendMessage(tl("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ())); if (!ess.getSettings().isEcoDisabled()) { sender.sendMessage(tl("whoisMoney", NumberUtil.displayCurrency(user.getMoney(), ess))); } - sender.sendMessage(tl("whoisIPAddress", user.getAddress().getAddress().toString())); + sender.sendMessage(tl("whoisIPAddress", user.getBase().getAddress().getAddress().toString())); final String location = user.getGeoLocation(); if (location != null && (sender.isPlayer() ? ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show") : true)) { sender.sendMessage(tl("whoisGeoLocation", location)); } - sender.sendMessage(tl("whoisGamemode", tl(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)))); + sender.sendMessage(tl("whoisGamemode", tl(user.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)))); sender.sendMessage(tl("whoisGod", (user.isGodModeEnabled() ? tl("true") : tl("false")))); - sender.sendMessage(tl("whoisOp", (user.isOp() ? tl("true") : tl("false")))); - sender.sendMessage(tl("whoisFly", user.getAllowFlight() ? tl("true") : tl("false"), user.isFlying() ? tl("flying") : tl("notFlying"))); + sender.sendMessage(tl("whoisOp", (user.getBase().isOp() ? tl("true") : tl("false")))); + sender.sendMessage(tl("whoisFly", user.getBase().getAllowFlight() ? tl("true") : tl("false"), user.getBase().isFlying() ? tl("flying") : tl("notFlying"))); sender.sendMessage(tl("whoisAFK", (user.isAfk() ? tl("true") : tl("false")))); sender.sendMessage(tl("whoisJail", (user.isJailed() ? user.getJailTimeout() > 0 diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworkbench.java b/Essentials/src/com/earth2me/essentials/commands/Commandworkbench.java index 265c519ab..61b0f19f4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworkbench.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworkbench.java @@ -15,6 +15,6 @@ public class Commandworkbench extends EssentialsCommand @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - user.openWorkbench(null, true); + user.getBase().openWorkbench(null, true); } } \ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index b13e6a92f..fd492ed6c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -90,7 +90,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand final User user = ess.getUser(searchTerm); if (user != null) { - if (!getOffline && !user.isOnline()) + if (!getOffline && !user.getBase().isOnline()) { throw new PlayerNotFoundException(); } diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java index 096a7fc5e..6231bbc09 100644 --- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -103,7 +103,7 @@ public class EssentialsSign } try { - if (user.isDead() || !(user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".use") + if (user.getBase().isDead() || !(user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".use") || user.isAuthorized("essentials.signs.use." + signName.toLowerCase(Locale.ENGLISH)))) { return false; @@ -361,7 +361,7 @@ public class EssentialsSign return new Trade(amount, ess); } final ItemStack item = getItemStack(itemType, 1, ess); - final int amount = Math.min(getIntegerPositive(getSignText(sign, amountIndex)), item.getType().getMaxStackSize() * player.getInventory().getSize()); + final int amount = Math.min(getIntegerPositive(getSignText(sign, amountIndex)), item.getType().getMaxStackSize() * player.getBase().getInventory().getSize()); if (item.getType() == Material.AIR || amount < 1) { throw new SignException(tl("moreThanZero")); diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java b/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java index 94425be18..89cfa30e9 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java @@ -105,7 +105,7 @@ public class SignEnchant extends EssentialsSign level = enchantment.getMaxLevel(); } - final ItemStack playerHand = player.getItemInHand(); + final ItemStack playerHand = player.getBase().getItemInHand(); if (playerHand == null || playerHand.getAmount() != 1 || (playerHand.containsEnchantment(enchantment) @@ -154,7 +154,7 @@ public class SignEnchant extends EssentialsSign charge.charge(player); Trade.log("Sign", "Enchant", "Interact", username, charge, username, charge, sign.getBlock().getLocation(), ess); - player.updateInventory(); + player.getBase().updateInventory(); return true; } } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignFree.java b/Essentials/src/com/earth2me/essentials/signs/SignFree.java index 741498188..9771d4868 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignFree.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignFree.java @@ -55,7 +55,7 @@ public class SignFree extends EssentialsSign for (int i = 0; i < 36; i++) { invent.addItem(item); } - player.openInventory(invent); + player.getBase().openInventory(invent); Trade.log("Sign", "Free", "Interact", username, null, username, new Trade(item, ess), sign.getBlock().getLocation(), ess); return true; } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java b/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java index 396b2cf6a..51580f7de 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java @@ -45,7 +45,7 @@ public class SignGameMode extends EssentialsSign charge.isAffordableFor(player); performSetMode(mode.toLowerCase(Locale.ENGLISH), player.getBase()); - player.sendMessage(tl("gameMode", tl(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); + player.sendMessage(tl("gameMode", tl(player.getBase().getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); Trade.log("Sign", "gameMode", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess); charge.charge(player); return true; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignHeal.java b/Essentials/src/com/earth2me/essentials/signs/SignHeal.java index 18b744bef..9f19d2968 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignHeal.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignHeal.java @@ -24,15 +24,15 @@ public class SignHeal extends EssentialsSign @Override protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException { - if (player.getHealth() == 0) + if (player.getBase().getHealth() == 0) { throw new SignException(tl("healDead")); } final Trade charge = getTrade(sign, 1, ess); charge.isAffordableFor(player); - player.setHealth(20); - player.setFoodLevel(20); - player.setFireTicks(0); + player.getBase().setHealth(20); + player.getBase().setFoodLevel(20); + player.getBase().setFireTicks(0); player.sendMessage(tl("youAreHealed")); charge.charge(player); Trade.log("Sign", "Heal", "Interact", username, null, username, charge, sign.getBlock().getLocation(), ess); diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index f51611aaf..06a410775 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -95,16 +95,16 @@ public class SignTrade extends EssentialsSign private Trade rechargeSign(final ISign sign, final IEssentials ess, final User player) throws SignException, ChargeException { final Trade trade = getTrade(sign, 2, AmountType.COST, false, ess); - if (trade.getItemStack() != null && player.getItemInHand() != null - && trade.getItemStack().getType() == player.getItemInHand().getType() - && trade.getItemStack().getDurability() == player.getItemInHand().getDurability() - && trade.getItemStack().getEnchantments().equals(player.getItemInHand().getEnchantments())) + if (trade.getItemStack() != null && player.getBase().getItemInHand() != null + && trade.getItemStack().getType() == player.getBase().getItemInHand().getType() + && trade.getItemStack().getDurability() == player.getBase().getItemInHand().getDurability() + && trade.getItemStack().getEnchantments().equals(player.getBase().getItemInHand().getEnchantments())) { - int amount = player.getItemInHand().getAmount(); + int amount = player.getBase().getItemInHand().getAmount(); amount -= amount % trade.getItemStack().getAmount(); if (amount > 0) { - final ItemStack stack = player.getItemInHand().clone(); + final ItemStack stack = player.getBase().getItemInHand().clone(); stack.setAmount(amount); final Trade store = new Trade(stack, ess); addAmount(sign, 2, store, ess); diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java index 2f4b1f2a5..73dbf0538 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java +++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java @@ -296,13 +296,13 @@ public class KeywordReplacer implements IText case IP: if (user != null) { - replacer = user.getAddress() == null || user.getAddress().getAddress() == null ? "" : user.getAddress().getAddress().toString(); + replacer = user.getBase().getAddress() == null || user.getBase().getAddress().getAddress() == null ? "" : user.getBase().getAddress().getAddress().toString(); } break; case ADDRESS: if (user != null) { - replacer = user.getAddress() == null ? "" : user.getAddress().toString(); + replacer = user.getBase().getAddress() == null ? "" : user.getBase().getAddress().toString(); } break; case PLUGINS: diff --git a/Essentials/src/com/earth2me/essentials/utils/StringUtil.java b/Essentials/src/com/earth2me/essentials/utils/StringUtil.java index 9858c77ca..cd6c579f6 100644 --- a/Essentials/src/com/earth2me/essentials/utils/StringUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/StringUtil.java @@ -6,7 +6,7 @@ import java.util.regex.Pattern; public class StringUtil { - private static final Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]"); + private static final Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9-]"); private static final Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]"); //Used to clean file names before saving to disk diff --git a/Essentials/test/com/earth2me/essentials/ToggleTest.java b/Essentials/test/com/earth2me/essentials/ToggleTest.java index c45bd3916..db178cf35 100644 --- a/Essentials/test/com/earth2me/essentials/ToggleTest.java +++ b/Essentials/test/com/earth2me/essentials/ToggleTest.java @@ -76,55 +76,55 @@ public class ToggleTest extends TestCase { User user = ess.getUser(base1); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runCommand("fly", user, new String[] { "on" }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runCommand("fly", user, new String[] { "on" }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runCommand("fly", user, new String[] { "off" }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runCommand("fly", user, new String[] { "off" }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runCommand("fly", user, new String[] { }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runCommand("fly", user, new String[] { }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); } public void testFlyDisOnToggle() throws Exception { User user = ess.getUser(base1); - user.setAllowFlight(true); - user.setFlying(true); - assertTrue(user.isFlying()); + user.getBase().setAllowFlight(true); + user.getBase().setFlying(true); + assertTrue(user.getBase().isFlying()); runCommand("fly", user, new String[] { }); - assertFalse(user.getAllowFlight()); - assertFalse(user.isFlying()); + assertFalse(user.getBase().getAllowFlight()); + assertFalse(user.getBase().isFlying()); } public void testGodToggle() throws Exception @@ -172,98 +172,98 @@ public class ToggleTest extends TestCase { User user = ess.getUser(base1); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "on" }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "on" }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "off" }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "off" }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName() }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName() }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); } public void testAliasesToggle() throws Exception { User user = ess.getUser(base1); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "enable" }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "enable" }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "disable" }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "disable" }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "1" }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "1" }); - assertTrue(user.getAllowFlight()); + assertTrue(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "0" }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); runConsoleCommand("fly", new String[] { base1.getName(), "0" }); - assertFalse(user.getAllowFlight()); + assertFalse(user.getBase().getAllowFlight()); } } diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java index 43fb60d2e..f9e924931 100644 --- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -57,7 +57,7 @@ public class EssentialsAntiBuildListener implements Listener final String blockPerm = "essentials.build." + action + "." + blockId; final String dataPerm = blockPerm + ":" + data; - if (user.isPermissionSet(dataPerm)) + if (user.getBase().isPermissionSet(dataPerm)) { return user.isAuthorized(dataPerm); } @@ -304,7 +304,7 @@ public class EssentialsAntiBuildListener implements Listener if (!metaPermCheck(user, "drop", item.getTypeId(), item.getDurability())) { event.setCancelled(true); - user.updateInventory(); + user.getBase().updateInventory(); if (ess.getSettings().warnOnBuildDisallow()) { user.sendMessage(tl("antiBuildDrop", item.getType().toString())); diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java index 7789dbeac..aa40a8148 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListenerLowest.java @@ -47,7 +47,7 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer event.setMessage(FormatUtil.formatMessage(user, "essentials.chat", event.getMessage())); String group = user.getGroup(); String world = user.getWorld().getName(); - Team team = user.getScoreboard().getPlayerTeam(user.getBase()); + Team team = user.getBase().getScoreboard().getPlayerTeam(user.getBase()); String format = ess.getSettings().getChatFormat(group); format = format.replace("{0}", group); diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index e5611b494..648ba33e3 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -47,7 +47,7 @@ public class EssentialsSpawnPlayerListener implements Listener if (ess.getSettings().getRespawnAtHome()) { Location home; - final Location bed = user.getBedSpawnLocation(); + final Location bed = user.getBase().getBedSpawnLocation(); if (bed != null) { home = bed; @@ -101,7 +101,7 @@ public class EssentialsSpawnPlayerListener implements Listener @Override public void run() { - if (!user.isOnline()) { + if (!user.getBase().isOnline()) { return; } -- cgit v1.2.3