mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-13 19:52:03 +01:00
missed this from checkin oops
This commit is contained in:
parent
962b6848c4
commit
8a1fb88ecd
@ -6,7 +6,6 @@ import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -20,44 +19,44 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
private boolean teleportRequestHere;
|
||||
private final Teleport teleport;
|
||||
private long lastActivity;
|
||||
|
||||
|
||||
User(Player base, IEssentials ess)
|
||||
{
|
||||
super(base, ess);
|
||||
teleport = new Teleport(this, ess);
|
||||
}
|
||||
|
||||
|
||||
User update(Player base)
|
||||
{
|
||||
setBase(base);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public boolean isAuthorized(IEssentialsCommand cmd)
|
||||
{
|
||||
return isAuthorized(cmd, "essentials.");
|
||||
}
|
||||
|
||||
|
||||
public boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix)
|
||||
{
|
||||
return isAuthorized(permissionPrefix + (cmd.getName().equals("r") ? "msg" : cmd.getName()));
|
||||
}
|
||||
|
||||
|
||||
public boolean isAuthorized(String node)
|
||||
{
|
||||
if (isOp())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (isJailed())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return ess.getPermissionsHandler().hasPermission(this, node);
|
||||
}
|
||||
|
||||
|
||||
public void healCooldown() throws Exception
|
||||
{
|
||||
Calendar now = new GregorianCalendar();
|
||||
@ -75,8 +74,13 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
setLastHealTimestamp(now.getTimeInMillis());
|
||||
}
|
||||
|
||||
|
||||
public void giveMoney(double value)
|
||||
{
|
||||
giveMoney(value, null);
|
||||
}
|
||||
|
||||
public void giveMoney(double value, CommandSender initiator)
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
@ -84,8 +88,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
setMoney(getMoney() + value);
|
||||
sendMessage(Util.format("addedToAccount", Util.formatCurrency(value)));
|
||||
if (initiator != null)
|
||||
{
|
||||
initiator.sendMessage((Util.format("addedToAccount", Util.formatCurrency(value))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void payUser(User reciever, double value) throws Exception
|
||||
{
|
||||
if (value == 0)
|
||||
@ -104,8 +112,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value), getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void takeMoney(double value)
|
||||
{
|
||||
takeMoney(value, null);
|
||||
}
|
||||
public void takeMoney(double value, CommandSender initiator)
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
@ -113,44 +125,48 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
setMoney(getMoney() - value);
|
||||
sendMessage(Util.format("takenFromAccount", Util.formatCurrency(value)));
|
||||
if (initiator != null)
|
||||
{
|
||||
initiator.sendMessage((Util.format("addedToAccount", Util.formatCurrency(value))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean canAfford(double cost)
|
||||
{
|
||||
double mon = getMoney();
|
||||
return mon >= cost || isAuthorized("essentials.eco.loan");
|
||||
}
|
||||
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
this.base = new OfflinePlayer(getName());
|
||||
}
|
||||
|
||||
|
||||
public boolean getJustPortaled()
|
||||
{
|
||||
return justPortaled;
|
||||
}
|
||||
|
||||
|
||||
public void setJustPortaled(boolean value)
|
||||
{
|
||||
justPortaled = value;
|
||||
}
|
||||
|
||||
|
||||
public void setReplyTo(CommandSender user)
|
||||
{
|
||||
replyTo = user;
|
||||
}
|
||||
|
||||
|
||||
public CommandSender getReplyTo()
|
||||
{
|
||||
return replyTo;
|
||||
}
|
||||
|
||||
|
||||
public int compareTo(User t)
|
||||
{
|
||||
return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(t.getDisplayName()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
@ -159,51 +175,51 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
return false;
|
||||
}
|
||||
return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User)o).getDisplayName()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return ChatColor.stripColor(this.getDisplayName()).hashCode();
|
||||
}
|
||||
|
||||
|
||||
public Boolean canSpawnItem(int itemId)
|
||||
{
|
||||
return !ess.getSettings().itemSpawnBlacklist().contains(itemId);
|
||||
}
|
||||
|
||||
|
||||
public void setHome()
|
||||
{
|
||||
setHome(getLocation(), true);
|
||||
}
|
||||
|
||||
|
||||
public void setHome(boolean defaultHome)
|
||||
{
|
||||
setHome(getLocation(), defaultHome);
|
||||
}
|
||||
|
||||
|
||||
public void setLastLocation()
|
||||
{
|
||||
setLastLocation(getLocation());
|
||||
}
|
||||
|
||||
|
||||
public void requestTeleport(User player, boolean here)
|
||||
{
|
||||
teleportRequester = player;
|
||||
teleportRequestHere = here;
|
||||
}
|
||||
|
||||
|
||||
public User getTeleportRequest()
|
||||
{
|
||||
return teleportRequester;
|
||||
}
|
||||
|
||||
|
||||
public boolean isTeleportRequestHere()
|
||||
{
|
||||
return teleportRequestHere;
|
||||
}
|
||||
|
||||
|
||||
public String getNick()
|
||||
{
|
||||
String nickname = getNickname();
|
||||
@ -227,22 +243,22 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
return nickname;
|
||||
}
|
||||
|
||||
|
||||
public Teleport getTeleport()
|
||||
{
|
||||
return teleport;
|
||||
}
|
||||
|
||||
|
||||
public long getLastActivity()
|
||||
{
|
||||
return lastActivity;
|
||||
}
|
||||
|
||||
|
||||
public void setLastActivity(long timestamp)
|
||||
{
|
||||
lastActivity = timestamp;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getMoney()
|
||||
{
|
||||
@ -264,7 +280,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
return super.getMoney();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setMoney(double value)
|
||||
{
|
||||
@ -286,14 +302,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
super.setMoney(value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setAfk(boolean set)
|
||||
{
|
||||
this.setSleepingIgnored(set);
|
||||
super.setAfk(set);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean toggleAfk()
|
||||
{
|
||||
@ -301,4 +317,4 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
this.setSleepingIgnored(now);
|
||||
return now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user