mirror of
https://github.com/essentials/Essentials.git
synced 2025-02-24 16:32:35 +01:00
Set sleeping ignored for afk players & disable afk mode on login
This commit is contained in:
parent
79640a26e0
commit
c07cef7de8
@ -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"))
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
setBase(base);
|
setBase(base);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuthorized(IEssentialsCommand cmd)
|
public boolean isAuthorized(IEssentialsCommand cmd)
|
||||||
{
|
{
|
||||||
return isAuthorized(cmd, "essentials.");
|
return isAuthorized(cmd, "essentials.");
|
||||||
@ -53,7 +53,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ess.getPermissionsHandler().hasPermission(this, node);
|
return ess.getPermissionsHandler().hasPermission(this, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
{
|
{
|
||||||
setMoney(getMoney() - value);
|
setMoney(getMoney() - value);
|
||||||
reciever.setMoney(reciever.getMoney() + value);
|
reciever.setMoney(reciever.getMoney() + value);
|
||||||
sendMessage(Util.format("moneySentTo", Util.formatCurrency(value), reciever.getDisplayName()));
|
sendMessage(Util.format("moneySentTo", Util.formatCurrency(value), reciever.getDisplayName()));
|
||||||
reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value), getDisplayName()));
|
reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value), getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,8 +157,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User) o).getDisplayName()));
|
return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User)o).getDisplayName()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -220,7 +220,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
{
|
{
|
||||||
nickname = ess.getSettings().getOperatorColor().toString() + nickname + "§f";
|
nickname = ess.getSettings().getOperatorColor().toString() + nickname + "§f";
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,14 +250,15 @@ 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());
|
||||||
return account.balance();
|
return account.balance();
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.getMoney();
|
return super.getMoney();
|
||||||
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user