mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Update offline user check.
Add ban reason to /seen
This commit is contained in:
parent
8dcd591beb
commit
e11525ab64
10 changed files with 21 additions and 27 deletions
|
@ -115,7 +115,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
|||
acquireReadLock();
|
||||
try
|
||||
{
|
||||
if (!(user.getBase() instanceof OfflinePlayer))
|
||||
if (user.isOnline())
|
||||
{
|
||||
Location loc = getJail(jail);
|
||||
user.getTeleport().now(loc, false, TeleportCause.COMMAND);
|
||||
|
|
|
@ -267,7 +267,8 @@ public class User extends UserData implements Comparable<User>, 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<User>, IReplyTo, IUser
|
|||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
if (!(base instanceof OfflinePlayer) && ess.getSettings().changeDisplayName())
|
||||
if (base.isOnline() && ess.getSettings().changeDisplayName())
|
||||
{
|
||||
setDisplayNick();
|
||||
}
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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"))
|
||||
)
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue