Set sleeping ignored for afk players & disable afk mode on login

This commit is contained in:
snowleo 2011-07-06 00:05:44 +02:00
parent f280985dd6
commit f2107047da
2 changed files with 27 additions and 9 deletions

View file

@ -261,6 +261,7 @@ public class EssentialsPlayerListener extends PlayerListener
} }
user.setDisplayName(user.getNick()); user.setDisplayName(user.getNick());
user.setAfk(false);
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd")) if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
{ {

View file

@ -250,7 +250,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
try try
{ {
Method method = ess.getPaymentMethod().getMethod(); Method method = ess.getPaymentMethod().getMethod();
if (!method.hasAccount(this.getName())) { if (!method.hasAccount(this.getName()))
{
throw new Exception(); throw new Exception();
} }
Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName()); Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
@ -271,7 +272,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
try try
{ {
Method method = ess.getPaymentMethod().getMethod(); Method method = ess.getPaymentMethod().getMethod();
if (!method.hasAccount(this.getName())) { if (!method.hasAccount(this.getName()))
{
throw new Exception(); throw new Exception();
} }
Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName()); Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
@ -283,4 +285,19 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
} }
super.setMoney(value); super.setMoney(value);
} }
@Override
public void setAfk(boolean set)
{
this.setSleepingIgnored(set);
super.setAfk(set);
}
@Override
public boolean toggleAfk()
{
boolean now = super.toggleAfk();
this.setSleepingIgnored(now);
return now;
}
} }