mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-04 11:36:24 +00:00
Make sure we don't bounce people with expired tempbans.
This commit is contained in:
parent
8b23f8608d
commit
8e0560ae1a
2 changed files with 17 additions and 8 deletions
|
@ -108,7 +108,8 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
}
|
}
|
||||||
|
|
||||||
Location afk = user.getAfkPosition();
|
Location afk = user.getAfkPosition();
|
||||||
if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9) {
|
if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9)
|
||||||
|
{
|
||||||
user.updateActivity(true);
|
user.updateActivity(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,14 +315,13 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
user.setNPC(false);
|
user.setNPC(false);
|
||||||
|
|
||||||
final long currentTime = System.currentTimeMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
user.checkBanTimeout(currentTime);
|
boolean banExpired = user.checkBanTimeout(currentTime);
|
||||||
user.checkMuteTimeout(currentTime);
|
user.checkMuteTimeout(currentTime);
|
||||||
user.checkJailTimeout(currentTime);
|
user.checkJailTimeout(currentTime);
|
||||||
|
|
||||||
if (user.isBanned() || event.getResult() == Result.KICK_BANNED)
|
if (banExpired == false && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
|
||||||
{
|
{
|
||||||
final String banReason = user.getBanReason();
|
final String banReason = user.getBanReason();
|
||||||
LOGGER.log(Level.INFO, "Banned for '" + banReason + "'");
|
|
||||||
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : Util.i18n("defaultBanReason"));
|
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : Util.i18n("defaultBanReason"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
this.hidden = hidden;
|
this.hidden = hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkJailTimeout(final long currentTime)
|
//Returns true if status expired during this check
|
||||||
|
public boolean checkJailTimeout(final long currentTime)
|
||||||
{
|
{
|
||||||
if (getJailTimeout() > 0 && getJailTimeout() < currentTime && isJailed())
|
if (getJailTimeout() > 0 && getJailTimeout() < currentTime && isJailed())
|
||||||
{
|
{
|
||||||
|
@ -396,26 +397,34 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkMuteTimeout(final long currentTime)
|
//Returns true if status expired during this check
|
||||||
|
public boolean checkMuteTimeout(final long currentTime)
|
||||||
{
|
{
|
||||||
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
|
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
|
||||||
{
|
{
|
||||||
setMuteTimeout(0);
|
setMuteTimeout(0);
|
||||||
sendMessage(Util.i18n("canTalkAgain"));
|
sendMessage(Util.i18n("canTalkAgain"));
|
||||||
setMuted(false);
|
setMuted(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkBanTimeout(final long currentTime)
|
//Returns true if status expired during this check
|
||||||
|
public boolean checkBanTimeout(final long currentTime)
|
||||||
{
|
{
|
||||||
if (getBanTimeout() > 0 && getBanTimeout() < currentTime && isBanned())
|
if (getBanTimeout() > 0 && getBanTimeout() < currentTime && isBanned())
|
||||||
{
|
{
|
||||||
setBanTimeout(0);
|
setBanTimeout(0);
|
||||||
setBanned(false);
|
setBanned(false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateActivity(final boolean broadcast)
|
public void updateActivity(final boolean broadcast)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue