mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-02 22:47:41 +01:00
Converted emulated player class calls to use base class.
This commit is contained in:
parent
e007331581
commit
36e580474f
@ -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()
|
||||
|
@ -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<String> commandList = attacker.getPowertool(attacker.getItemInHand());
|
||||
final List<String> 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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class User extends UserData implements Comparable<User>, 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<User>, 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<User>, 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<User>, 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<User>, 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());
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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])));
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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()));
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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")));
|
||||
|
@ -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);
|
||||
|
@ -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<String> 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 "?";
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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"))
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()));
|
||||
}
|
||||
|
@ -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<Character, ItemStack> 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));
|
||||
|
@ -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<String> repaired = new ArrayList<String>();
|
||||
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"));
|
||||
|
@ -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")));
|
||||
}
|
||||
|
@ -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)));
|
||||
|
@ -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
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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"));
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
@ -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"));
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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()));
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user