diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java index 67c46a310..7ca4d3bcd 100644 --- a/Essentials/src/com/earth2me/essentials/Jails.java +++ b/Essentials/src/com/earth2me/essentials/Jails.java @@ -115,7 +115,7 @@ public class Jails extends AsyncStorageObjectHolder, IReplyTo, IUser try { final String opPrefix = ess.getSettings().getOperatorColor().toString(); - if (opPrefix.length() > 0) { + if (opPrefix.length() > 0) + { nickname.insert(0, opPrefix); nickname.append("§f"); } @@ -326,7 +327,7 @@ public class User extends UserData implements Comparable, IReplyTo, IUser @Override public String getDisplayName() { - if (!(base instanceof OfflinePlayer) && ess.getSettings().changeDisplayName()) + if (base.isOnline() && ess.getSettings().changeDisplayName()) { setDisplayNick(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index d39419686..bc09cbba8 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -24,7 +23,7 @@ public class Commandban extends EssentialsCommand throw new NotEnoughArgumentsException(); } final User user = getPlayer(server, args, 0, true); - if (user.getBase() instanceof OfflinePlayer) + if (!user.isOnline()) { if (sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.ban.offline")) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index cf500e094..131d38f81 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -23,20 +23,20 @@ public class Commandseen extends EssentialsCommand } try { - User u = getPlayer(server, args, 0); - sender.sendMessage(_("seenOnline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogin()))); + User user = getPlayer(server, args, 0); + sender.sendMessage(_("seenOnline", user.getDisplayName(), Util.formatDateDiff(user.getLastLogin()))); } catch (NoSuchFieldException e) { - User u = ess.getOfflineUser(args[0]); - if (u == null) + User user = ess.getOfflineUser(args[0]); + if (user == null) { throw new Exception(_("playerNotFound")); } - sender.sendMessage(_("seenOffline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogout()))); - if (u.isBanned()) + sender.sendMessage(_("seenOffline", user.getDisplayName(), Util.formatDateDiff(user.getLastLogout()))); + if (user.isBanned()) { - sender.sendMessage(_("whoisBanned", _("true"))); + sender.sendMessage(_("whoisBanned", user.getBanReason())); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index 144d19d15..25c457a20 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import org.bukkit.Server; @@ -25,7 +24,7 @@ public class Commandtempban extends EssentialsCommand throw new NotEnoughArgumentsException(); } final User user = getPlayer(server, args, 0, true); - if (user.getBase() instanceof OfflinePlayer) + if (!user.isOnline()) { if (sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.tempban.offline")) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java index f98343311..3240b73a9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import org.bukkit.Server; @@ -28,7 +27,7 @@ public class Commandtogglejail extends EssentialsCommand if (args.length >= 2 && !player.isJailed()) { - if (player.getBase() instanceof OfflinePlayer) + if (!player.isOnline()) { if (sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.togglejail.offline")) @@ -45,7 +44,7 @@ public class Commandtogglejail extends EssentialsCommand return; } } - if (!(player.getBase() instanceof OfflinePlayer)) + if (player.isOnline()) { ess.getJails().sendToJail(player, args[1]); } @@ -96,7 +95,7 @@ public class Commandtogglejail extends EssentialsCommand player.setJailTimeout(0); player.sendMessage(_("jailReleasedPlayerNotify")); player.setJail(null); - if (!(player.getBase() instanceof OfflinePlayer)) + if (player.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 891742043..449ae7489 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Server; @@ -21,7 +20,7 @@ public class Commandtpaccept extends EssentialsCommand final User target = user.getTeleportRequest(); if (target == null - || target.getBase() instanceof OfflinePlayer + || !target.isOnline() || (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")) || (!user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpa") && !target.isAuthorized("essentials.tpaall")) ) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java index 7c13b80d4..b10f0a301 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -25,7 +24,7 @@ public class Commandtpo extends EssentialsCommand //Just basically the old tp command final User player = getPlayer(server, args, 0, true); // Check if user is offline - if (player.getBase() instanceof OfflinePlayer) + if (!player.isOnline()) { throw new NoSuchFieldException(_("playerNotFound")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java index e226f0702..6183bcf74 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -26,7 +25,7 @@ public class Commandtpohere extends EssentialsCommand final User player = getPlayer(server, args, 0, true); // Check if user is offline - if (player.getBase() instanceof OfflinePlayer) + if (!player.isOnline()) { throw new NoSuchFieldException(_("playerNotFound")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index 13328e1b5..6bc0649e9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.IEssentialsModule; -import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import java.util.List; @@ -31,7 +30,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand { this.ess = ess; } - + @Override public void setEssentialsModule(final IEssentialsModule module) { @@ -62,7 +61,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand final User user = ess.getUser(args[pos]); if (user != null) { - if (!getOffline && (user.getBase() instanceof OfflinePlayer || user.isHidden())) + if (!getOffline && (!user.isOnline() || user.isHidden())) { throw new NoSuchFieldException(_("playerNotFound")); }