2011-03-30 04:03:21 +00:00
|
|
|
package com.earth2me.essentials;
|
|
|
|
|
2011-11-21 01:55:26 +00:00
|
|
|
import static com.earth2me.essentials.I18n._;
|
2011-03-30 04:03:21 +00:00
|
|
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
2011-05-13 23:39:18 +00:00
|
|
|
import com.earth2me.essentials.register.payment.Method;
|
2013-11-07 02:22:32 +00:00
|
|
|
import com.earth2me.essentials.register.payment.Methods;
|
2013-06-08 21:31:19 +00:00
|
|
|
import com.earth2me.essentials.utils.DateUtil;
|
|
|
|
import com.earth2me.essentials.utils.FormatUtil;
|
2013-10-11 02:44:41 +00:00
|
|
|
import com.earth2me.essentials.utils.NumberUtil;
|
2013-05-05 03:13:17 +00:00
|
|
|
import java.math.BigDecimal;
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
import java.util.Calendar;
|
|
|
|
import java.util.GregorianCalendar;
|
2011-11-18 23:08:16 +00:00
|
|
|
import java.util.logging.Level;
|
|
|
|
import java.util.logging.Logger;
|
2013-10-11 02:44:41 +00:00
|
|
|
import net.ess3.api.IEssentials;
|
2012-08-03 20:57:29 +00:00
|
|
|
import org.bukkit.ChatColor;
|
2011-08-23 02:42:32 +00:00
|
|
|
import org.bukkit.Location;
|
2013-10-19 11:26:28 +00:00
|
|
|
import org.bukkit.command.CommandSender;
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
import org.bukkit.entity.Player;
|
2012-08-28 01:06:11 +00:00
|
|
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
2013-01-01 21:12:26 +00:00
|
|
|
import org.bukkit.potion.PotionEffect;
|
|
|
|
import org.bukkit.potion.PotionEffectType;
|
2011-03-30 04:03:21 +00:00
|
|
|
|
|
|
|
|
2013-07-13 16:52:08 +00:00
|
|
|
public class User extends UserData implements Comparable<User>, IReplyTo, net.ess3.api.IUser
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2013-11-07 02:22:32 +00:00
|
|
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
2013-10-16 19:59:39 +00:00
|
|
|
private CommandSource replyTo = null;
|
2013-05-02 22:12:40 +00:00
|
|
|
private transient String teleportRequester;
|
2011-08-27 11:59:39 +00:00
|
|
|
private transient boolean teleportRequestHere;
|
2013-08-11 15:37:21 +00:00
|
|
|
private transient Location teleportLocation;
|
2012-05-17 10:25:02 +00:00
|
|
|
private transient boolean vanished;
|
2011-08-27 11:59:39 +00:00
|
|
|
private transient final Teleport teleport;
|
2011-12-08 23:43:09 +00:00
|
|
|
private transient long teleportRequestTime;
|
2011-08-31 10:51:59 +00:00
|
|
|
private transient long lastOnlineActivity;
|
2012-06-17 18:28:59 +00:00
|
|
|
private transient long lastThrottledAction;
|
2011-08-27 20:29:57 +00:00
|
|
|
private transient long lastActivity = System.currentTimeMillis();
|
2011-07-18 01:42:21 +00:00
|
|
|
private boolean hidden = false;
|
2012-08-30 23:47:53 +00:00
|
|
|
private boolean rightClickJump = false;
|
2012-01-15 23:50:52 +00:00
|
|
|
private transient Location afkPosition = null;
|
2012-03-25 09:44:33 +00:00
|
|
|
private boolean invSee = false;
|
2012-12-19 03:57:12 +00:00
|
|
|
private boolean recipeSee = false;
|
2012-08-21 19:02:20 +00:00
|
|
|
private boolean enderSee = false;
|
2013-11-07 02:22:32 +00:00
|
|
|
private transient long teleportInvulnerabilityTimestamp = 0;
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
User(final Player base, final IEssentials ess)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
super(base, ess);
|
|
|
|
teleport = new Teleport(this, ess);
|
2012-01-15 23:50:52 +00:00
|
|
|
if (isAfk())
|
|
|
|
{
|
|
|
|
afkPosition = getLocation();
|
|
|
|
}
|
2013-08-28 16:50:28 +00:00
|
|
|
if (isOnline())
|
|
|
|
{
|
|
|
|
lastOnlineActivity = System.currentTimeMillis();
|
2013-06-02 16:45:56 +00:00
|
|
|
}
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
User update(final Player base)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
|
|
|
setBase(base);
|
|
|
|
return this;
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
@Override
|
|
|
|
public boolean isAuthorized(final IEssentialsCommand cmd)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2011-06-26 13:47:28 +00:00
|
|
|
return isAuthorized(cmd, "essentials.");
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
@Override
|
|
|
|
public boolean isAuthorized(final IEssentialsCommand cmd, final String permissionPrefix)
|
2011-06-26 13:47:28 +00:00
|
|
|
{
|
|
|
|
return isAuthorized(permissionPrefix + (cmd.getName().equals("r") ? "msg" : cmd.getName()));
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
@Override
|
|
|
|
public boolean isAuthorized(final String node)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2012-09-16 19:27:35 +00:00
|
|
|
final boolean result = isAuthorizedCheck(node);
|
2012-03-26 12:28:32 +00:00
|
|
|
if (ess.getSettings().isDebug())
|
|
|
|
{
|
2012-09-16 19:27:35 +00:00
|
|
|
ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node + " - " + result);
|
2012-03-26 12:28:32 +00:00
|
|
|
}
|
2012-09-16 19:27:35 +00:00
|
|
|
return result;
|
|
|
|
}
|
2012-11-04 21:49:48 +00:00
|
|
|
|
|
|
|
private boolean isAuthorizedCheck(final String node)
|
2012-09-16 19:27:35 +00:00
|
|
|
{
|
|
|
|
|
2011-08-31 10:51:59 +00:00
|
|
|
if (base instanceof OfflinePlayer)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2012-03-21 23:54:57 +00:00
|
|
|
try
|
|
|
|
{
|
2012-03-15 23:15:19 +00:00
|
|
|
return ess.getPermissionsHandler().hasPermission(base, node);
|
|
|
|
}
|
2012-03-21 23:54:57 +00:00
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2012-09-02 17:30:59 +00:00
|
|
|
if (ess.getSettings().isDebug())
|
|
|
|
{
|
|
|
|
ess.getLogger().log(Level.SEVERE, "Permission System Error: " + ess.getPermissionsHandler().getName() + " returned: " + ex.getMessage(), ex);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ess.getLogger().log(Level.SEVERE, "Permission System Error: " + ess.getPermissionsHandler().getName() + " returned: " + ex.getMessage());
|
|
|
|
}
|
|
|
|
|
2012-03-15 23:15:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-07-14 11:41:27 +00:00
|
|
|
@Override
|
2011-03-30 04:03:21 +00:00
|
|
|
public void healCooldown() throws Exception
|
|
|
|
{
|
2011-08-27 11:59:39 +00:00
|
|
|
final Calendar now = new GregorianCalendar();
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
if (getLastHealTimestamp() > 0)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2011-08-27 11:59:39 +00:00
|
|
|
final double cooldown = ess.getSettings().getHealCooldown();
|
|
|
|
final Calendar cooldownTime = new GregorianCalendar();
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
cooldownTime.setTimeInMillis(getLastHealTimestamp());
|
|
|
|
cooldownTime.add(Calendar.SECOND, (int)cooldown);
|
|
|
|
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
|
|
|
|
if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass"))
|
2011-04-14 09:36:25 +00:00
|
|
|
{
|
2013-06-08 21:31:19 +00:00
|
|
|
throw new Exception(_("timeBeforeHeal", DateUtil.formatDateDiff(cooldownTime.getTimeInMillis())));
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
setLastHealTimestamp(now.getTimeInMillis());
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
@Override
|
2013-05-05 03:13:17 +00:00
|
|
|
public void giveMoney(final BigDecimal value)
|
2011-07-08 11:29:06 +00:00
|
|
|
{
|
2013-10-19 11:26:28 +00:00
|
|
|
giveMoney(value, (CommandSource) null);
|
2011-07-08 11:29:06 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-07-14 11:41:27 +00:00
|
|
|
@Override
|
2013-10-16 19:59:39 +00:00
|
|
|
public void giveMoney(final BigDecimal value, final CommandSource initiator)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2013-05-05 19:05:28 +00:00
|
|
|
if (value.signum() == 0)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
return;
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2013-05-05 03:13:17 +00:00
|
|
|
setMoney(getMoney().add(value));
|
2013-06-08 21:31:19 +00:00
|
|
|
sendMessage(_("addedToAccount", NumberUtil.displayCurrency(value, ess)));
|
2011-07-08 11:29:06 +00:00
|
|
|
if (initiator != null)
|
|
|
|
{
|
2013-06-08 21:31:19 +00:00
|
|
|
initiator.sendMessage(_("addedToOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess)));
|
2011-07-08 11:29:06 +00:00
|
|
|
}
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2013-11-07 02:22:32 +00:00
|
|
|
|
2013-10-19 11:26:28 +00:00
|
|
|
@Override
|
|
|
|
@Deprecated
|
|
|
|
public void giveMoney(final BigDecimal value, final CommandSender initiator)
|
|
|
|
{
|
|
|
|
giveMoney(value, new CommandSource(initiator));
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-07-14 11:41:27 +00:00
|
|
|
@Override
|
2013-09-28 16:21:16 +00:00
|
|
|
public void payUser(final User reciever, final BigDecimal value) throws ChargeException
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2013-05-05 19:05:28 +00:00
|
|
|
if (value.signum() == 0)
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2011-08-27 11:59:39 +00:00
|
|
|
if (canAfford(value))
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2013-05-05 03:13:17 +00:00
|
|
|
setMoney(getMoney().subtract(value));
|
|
|
|
reciever.setMoney(reciever.getMoney().add(value));
|
2013-06-08 21:31:19 +00:00
|
|
|
sendMessage(_("moneySentTo", NumberUtil.displayCurrency(value, ess), reciever.getDisplayName()));
|
|
|
|
reciever.sendMessage(_("moneyRecievedFrom", NumberUtil.displayCurrency(value, ess), getDisplayName()));
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2011-08-27 11:59:39 +00:00
|
|
|
else
|
|
|
|
{
|
2013-09-28 16:21:16 +00:00
|
|
|
throw new ChargeException(_("notEnoughMoney"));
|
2011-08-27 11:59:39 +00:00
|
|
|
}
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
@Override
|
2013-05-05 03:13:17 +00:00
|
|
|
public void takeMoney(final BigDecimal value)
|
2011-07-08 11:29:06 +00:00
|
|
|
{
|
2013-10-19 11:26:28 +00:00
|
|
|
takeMoney(value, (CommandSource) null);
|
2011-07-08 11:29:06 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-07-14 11:41:27 +00:00
|
|
|
@Override
|
2013-10-16 19:59:39 +00:00
|
|
|
public void takeMoney(final BigDecimal value, final CommandSource initiator)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2013-05-05 19:05:28 +00:00
|
|
|
if (value.signum() == 0)
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2013-05-05 03:13:17 +00:00
|
|
|
setMoney(getMoney().subtract(value));
|
2013-06-08 21:31:19 +00:00
|
|
|
sendMessage(_("takenFromAccount", NumberUtil.displayCurrency(value, ess)));
|
2011-07-08 11:29:06 +00:00
|
|
|
if (initiator != null)
|
|
|
|
{
|
2013-06-08 21:31:19 +00:00
|
|
|
initiator.sendMessage(_("takenFromOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess)));
|
2011-07-08 11:29:06 +00:00
|
|
|
}
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2013-11-07 02:22:32 +00:00
|
|
|
|
2013-10-19 11:26:28 +00:00
|
|
|
@Override
|
|
|
|
@Deprecated
|
|
|
|
public void takeMoney(final BigDecimal value, final CommandSender initiator)
|
|
|
|
{
|
|
|
|
takeMoney(value, new CommandSource(initiator));
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2012-04-24 10:30:31 +00:00
|
|
|
@Override
|
2013-05-05 03:13:17 +00:00
|
|
|
public boolean canAfford(final BigDecimal cost)
|
2012-02-26 04:15:14 +00:00
|
|
|
{
|
|
|
|
return canAfford(cost, true);
|
|
|
|
}
|
|
|
|
|
2013-05-05 03:13:17 +00:00
|
|
|
public boolean canAfford(final BigDecimal cost, final boolean permcheck)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2013-05-12 03:07:14 +00:00
|
|
|
if (cost.signum() <= 0)
|
2012-08-28 01:06:11 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2013-05-05 03:13:17 +00:00
|
|
|
final BigDecimal remainingBalance = getMoney().subtract(cost);
|
2012-02-26 04:15:14 +00:00
|
|
|
if (!permcheck || isAuthorized("essentials.eco.loan"))
|
|
|
|
{
|
2013-05-05 03:13:17 +00:00
|
|
|
return (remainingBalance.compareTo(ess.getSettings().getMinMoney()) >= 0);
|
2012-02-26 04:15:14 +00:00
|
|
|
}
|
2013-05-05 09:41:19 +00:00
|
|
|
return (remainingBalance.signum() >= 0);
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-03-30 04:03:21 +00:00
|
|
|
public void dispose()
|
|
|
|
{
|
2011-07-15 23:33:22 +00:00
|
|
|
this.base = new OfflinePlayer(getName(), ess);
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
@Override
|
|
|
|
public Boolean canSpawnItem(final int itemId)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
return !ess.getSettings().itemSpawnBlacklist().contains(itemId);
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
@Override
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
public void setLastLocation()
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
setLastLocation(getLocation());
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2013-03-15 19:41:42 +00:00
|
|
|
|
2013-02-08 20:22:35 +00:00
|
|
|
@Override
|
|
|
|
public void setLogoutLocation()
|
|
|
|
{
|
|
|
|
setLogoutLocation(getLocation());
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-08-11 15:37:21 +00:00
|
|
|
@Override
|
2011-08-27 11:59:39 +00:00
|
|
|
public void requestTeleport(final User player, final boolean here)
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
2011-12-08 23:43:09 +00:00
|
|
|
teleportRequestTime = System.currentTimeMillis();
|
2013-05-05 08:08:49 +00:00
|
|
|
teleportRequester = player == null ? null : player.getName();
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
teleportRequestHere = here;
|
2013-08-28 16:50:28 +00:00
|
|
|
if (player == null)
|
|
|
|
{
|
2013-08-11 15:37:21 +00:00
|
|
|
teleportLocation = null;
|
|
|
|
}
|
2013-08-28 16:50:28 +00:00
|
|
|
else
|
|
|
|
{
|
2013-08-11 15:37:21 +00:00
|
|
|
teleportLocation = here ? player.getLocation() : this.getLocation();
|
2013-08-28 16:50:28 +00:00
|
|
|
}
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-05-02 22:12:40 +00:00
|
|
|
public String getTeleportRequest()
|
2011-04-14 09:36:25 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
return teleportRequester;
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2012-03-20 13:26:49 +00:00
|
|
|
public boolean isTpRequestHere()
|
2011-03-30 04:03:21 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
return teleportRequestHere;
|
2011-03-30 04:03:21 +00:00
|
|
|
}
|
2013-08-28 16:50:28 +00:00
|
|
|
|
2013-08-11 15:37:21 +00:00
|
|
|
public Location getTpRequestLocation()
|
|
|
|
{
|
|
|
|
return teleportLocation;
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2012-05-13 17:58:50 +00:00
|
|
|
public String getNick(final boolean longnick)
|
2011-04-14 09:36:25 +00:00
|
|
|
{
|
2012-05-13 17:58:50 +00:00
|
|
|
final StringBuilder prefix = new StringBuilder();
|
|
|
|
String nickname;
|
2012-06-16 16:42:42 +00:00
|
|
|
String suffix = "";
|
2011-07-15 18:35:09 +00:00
|
|
|
final String nick = getNickname();
|
2013-03-09 14:24:19 +00:00
|
|
|
if (ess.getSettings().isCommandDisabled("nick") || nick == null || nick.isEmpty() || nick.equalsIgnoreCase(getName()))
|
2011-04-14 09:36:25 +00:00
|
|
|
{
|
2012-05-13 17:58:50 +00:00
|
|
|
nickname = getName();
|
2011-04-03 20:21:20 +00:00
|
|
|
}
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
else
|
2011-04-14 09:36:25 +00:00
|
|
|
{
|
2012-05-13 17:58:50 +00:00
|
|
|
nickname = ess.getSettings().getNicknamePrefix() + nick;
|
2013-06-13 08:18:47 +00:00
|
|
|
suffix = "§r";
|
2011-04-03 20:39:39 +00:00
|
|
|
}
|
2012-03-02 19:05:30 +00:00
|
|
|
|
2012-05-13 17:58:50 +00:00
|
|
|
if (isOp())
|
2011-04-14 09:36:25 +00:00
|
|
|
{
|
2012-03-04 04:43:00 +00:00
|
|
|
try
|
2011-05-10 20:40:32 +00:00
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
final ChatColor opPrefix = ess.getSettings().getOperatorColor();
|
|
|
|
if (opPrefix != null && opPrefix.toString().length() > 0)
|
2012-03-12 01:00:57 +00:00
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
prefix.insert(0, opPrefix.toString());
|
2012-08-30 19:43:33 +00:00
|
|
|
suffix = "§r";
|
2012-03-04 08:18:25 +00:00
|
|
|
}
|
2011-05-10 20:40:32 +00:00
|
|
|
}
|
2012-03-04 04:43:00 +00:00
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2012-05-13 17:58:50 +00:00
|
|
|
|
|
|
|
if (ess.getSettings().addPrefixSuffix())
|
2012-03-04 04:43:00 +00:00
|
|
|
{
|
2012-10-06 02:31:34 +00:00
|
|
|
//These two extra toggles are not documented, because they are mostly redundant #EasterEgg
|
2011-10-27 05:17:18 +00:00
|
|
|
if (!ess.getSettings().disablePrefix())
|
|
|
|
{
|
2012-05-13 17:58:50 +00:00
|
|
|
final String ptext = ess.getPermissionsHandler().getPrefix(base).replace('&', '§');
|
|
|
|
prefix.insert(0, ptext);
|
2012-08-30 19:43:33 +00:00
|
|
|
suffix = "§r";
|
2011-10-27 05:17:18 +00:00
|
|
|
}
|
|
|
|
if (!ess.getSettings().disableSuffix())
|
|
|
|
{
|
2012-05-13 17:58:50 +00:00
|
|
|
final String stext = ess.getPermissionsHandler().getSuffix(base).replace('&', '§');
|
2012-08-30 19:43:33 +00:00
|
|
|
suffix = stext + "§r";
|
|
|
|
suffix = suffix.replace("§f§f", "§f").replace("§f§r", "§r").replace("§r§r", "§r");
|
2011-07-22 23:43:02 +00:00
|
|
|
}
|
2011-07-20 16:36:29 +00:00
|
|
|
}
|
2012-05-13 17:58:50 +00:00
|
|
|
final String strPrefix = prefix.toString();
|
|
|
|
String output = strPrefix + nickname + suffix;
|
|
|
|
if (!longnick && output.length() > 16)
|
|
|
|
{
|
|
|
|
output = strPrefix + nickname;
|
|
|
|
}
|
|
|
|
if (!longnick && output.length() > 16)
|
|
|
|
{
|
2013-06-08 21:31:19 +00:00
|
|
|
output = FormatUtil.lastCode(strPrefix) + nickname;
|
2012-05-13 17:58:50 +00:00
|
|
|
}
|
|
|
|
if (!longnick && output.length() > 16)
|
|
|
|
{
|
2013-06-08 21:31:19 +00:00
|
|
|
output = FormatUtil.lastCode(strPrefix) + nickname.substring(0, 14);
|
2012-05-13 17:58:50 +00:00
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
if (output.charAt(output.length() - 1) == '§')
|
|
|
|
{
|
2012-05-13 17:58:50 +00:00
|
|
|
output = output.substring(0, output.length() - 1);
|
|
|
|
}
|
|
|
|
return output;
|
2011-04-03 20:21:20 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-11-20 15:43:38 +00:00
|
|
|
public void setDisplayNick()
|
2011-10-04 06:21:09 +00:00
|
|
|
{
|
2012-03-21 23:54:57 +00:00
|
|
|
if (base.isOnline() && ess.getSettings().changeDisplayName())
|
2011-11-18 23:08:16 +00:00
|
|
|
{
|
2012-05-13 17:58:50 +00:00
|
|
|
setDisplayName(getNick(true));
|
2012-03-23 00:15:22 +00:00
|
|
|
if (ess.getSettings().changePlayerListName())
|
2012-03-21 23:54:57 +00:00
|
|
|
{
|
2012-05-13 17:58:50 +00:00
|
|
|
String name = getNick(false);
|
2012-03-23 00:15:22 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
setPlayerListName(name);
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException e)
|
2012-03-21 23:54:57 +00:00
|
|
|
{
|
2012-03-23 00:15:22 +00:00
|
|
|
if (ess.getSettings().isDebug())
|
|
|
|
{
|
|
|
|
logger.log(Level.INFO, "Playerlist for " + name + " was not updated. Name clashed with another online player.");
|
|
|
|
}
|
2012-03-21 23:54:57 +00:00
|
|
|
}
|
2012-03-18 03:29:49 +00:00
|
|
|
}
|
2011-11-18 23:08:16 +00:00
|
|
|
}
|
2011-10-04 06:21:09 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-10-20 23:23:35 +00:00
|
|
|
@Override
|
|
|
|
public String getDisplayName()
|
|
|
|
{
|
|
|
|
return super.getDisplayName() == null ? super.getName() : super.getDisplayName();
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2012-03-02 19:05:30 +00:00
|
|
|
@Override
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
public Teleport getTeleport()
|
2011-04-14 09:36:25 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
return teleport;
|
2011-04-04 01:26:45 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
public long getLastOnlineActivity()
|
2011-04-14 09:36:25 +00:00
|
|
|
{
|
2011-08-27 11:59:39 +00:00
|
|
|
return lastOnlineActivity;
|
2011-05-01 11:04:34 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
public void setLastOnlineActivity(final long timestamp)
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
{
|
2011-08-27 11:59:39 +00:00
|
|
|
lastOnlineActivity = timestamp;
|
2011-05-01 11:04:34 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-05-13 16:57:45 +00:00
|
|
|
@Override
|
2013-05-05 03:13:17 +00:00
|
|
|
public BigDecimal getMoney()
|
2013-05-12 03:07:14 +00:00
|
|
|
{
|
|
|
|
final long start = System.nanoTime();
|
|
|
|
final BigDecimal value = _getMoney();
|
2013-05-12 03:32:56 +00:00
|
|
|
final long elapsed = System.nanoTime() - start;
|
|
|
|
if (elapsed > ess.getSettings().getEconomyLagWarning())
|
2013-05-12 03:07:14 +00:00
|
|
|
{
|
2013-05-12 15:31:40 +00:00
|
|
|
ess.getLogger().log(Level.INFO, "Lag Notice - Slow Economy Response - Request took over {0}ms!", elapsed / 1000000.0);
|
2013-05-12 03:07:14 +00:00
|
|
|
}
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
private BigDecimal _getMoney()
|
2011-05-13 16:57:45 +00:00
|
|
|
{
|
2013-08-28 16:50:28 +00:00
|
|
|
if (ess.getSettings().isEcoDisabled())
|
|
|
|
{
|
|
|
|
if (ess.getSettings().isDebug())
|
|
|
|
{
|
|
|
|
ess.getLogger().info("Internal economy functions disabled, aborting balance check.");
|
|
|
|
}
|
|
|
|
return BigDecimal.ZERO;
|
|
|
|
}
|
2013-11-07 02:22:32 +00:00
|
|
|
if (Methods.hasMethod())
|
2011-05-13 16:57:45 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2013-11-07 02:22:32 +00:00
|
|
|
final Method method = Methods.getMethod();
|
2011-07-05 22:05:44 +00:00
|
|
|
if (!method.hasAccount(this.getName()))
|
|
|
|
{
|
2011-05-13 20:41:49 +00:00
|
|
|
throw new Exception();
|
|
|
|
}
|
2013-11-07 02:22:32 +00:00
|
|
|
final Method.MethodAccount account = Methods.getMethod().getAccount(this.getName());
|
2013-05-05 03:13:17 +00:00
|
|
|
return BigDecimal.valueOf(account.balance());
|
2011-05-13 16:57:45 +00:00
|
|
|
}
|
2013-11-07 02:22:32 +00:00
|
|
|
catch (Exception ex)
|
2011-07-05 22:05:44 +00:00
|
|
|
{
|
2011-05-13 16:57:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return super.getMoney();
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-05-13 16:57:45 +00:00
|
|
|
@Override
|
2013-05-05 03:13:17 +00:00
|
|
|
public void setMoney(final BigDecimal value)
|
2011-05-13 16:57:45 +00:00
|
|
|
{
|
2013-08-28 16:50:28 +00:00
|
|
|
if (ess.getSettings().isEcoDisabled())
|
|
|
|
{
|
|
|
|
if (ess.getSettings().isDebug())
|
|
|
|
{
|
|
|
|
ess.getLogger().info("Internal economy functions disabled, aborting balance change.");
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2013-11-07 02:22:32 +00:00
|
|
|
if (Methods.hasMethod())
|
2011-05-13 16:57:45 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2013-11-07 02:22:32 +00:00
|
|
|
final Method method = Methods.getMethod();
|
2011-07-05 22:05:44 +00:00
|
|
|
if (!method.hasAccount(this.getName()))
|
|
|
|
{
|
2011-05-13 20:41:49 +00:00
|
|
|
throw new Exception();
|
|
|
|
}
|
2013-11-07 02:22:32 +00:00
|
|
|
final Method.MethodAccount account = Methods.getMethod().getAccount(this.getName());
|
2013-05-05 03:13:17 +00:00
|
|
|
account.set(value.doubleValue());
|
2011-05-13 16:57:45 +00:00
|
|
|
}
|
2013-11-07 02:22:32 +00:00
|
|
|
catch (Exception ex)
|
2011-05-13 16:57:45 +00:00
|
|
|
{
|
|
|
|
}
|
2012-03-02 19:05:30 +00:00
|
|
|
}
|
2011-05-13 16:57:45 +00:00
|
|
|
super.setMoney(value);
|
2012-02-27 15:31:43 +00:00
|
|
|
Trade.log("Update", "Set", "API", getName(), new Trade(value, ess), null, null, null, ess);
|
2011-05-13 16:57:45 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-05-05 03:13:17 +00:00
|
|
|
public void updateMoneyCache(final BigDecimal value)
|
2012-02-23 15:17:23 +00:00
|
|
|
{
|
2013-08-28 16:50:28 +00:00
|
|
|
if (ess.getSettings().isEcoDisabled())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2013-11-07 02:22:32 +00:00
|
|
|
if (Methods.hasMethod() && super.getMoney() != value)
|
2012-02-26 04:15:14 +00:00
|
|
|
{
|
2012-02-23 15:17:23 +00:00
|
|
|
super.setMoney(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-05 22:05:44 +00:00
|
|
|
@Override
|
2011-08-27 11:59:39 +00:00
|
|
|
public void setAfk(final boolean set)
|
2011-07-05 22:05:44 +00:00
|
|
|
{
|
2011-07-15 18:13:52 +00:00
|
|
|
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
|
2011-10-20 23:23:35 +00:00
|
|
|
if (set && !isAfk())
|
|
|
|
{
|
2011-09-02 14:15:57 +00:00
|
|
|
afkPosition = getLocation();
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
else if (!set && isAfk())
|
|
|
|
{
|
|
|
|
afkPosition = null;
|
|
|
|
}
|
2011-07-05 22:05:44 +00:00
|
|
|
super.setAfk(set);
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-07-05 22:05:44 +00:00
|
|
|
@Override
|
|
|
|
public boolean toggleAfk()
|
|
|
|
{
|
2011-08-27 11:59:39 +00:00
|
|
|
final boolean now = super.toggleAfk();
|
2011-07-15 18:13:52 +00:00
|
|
|
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : now);
|
2011-07-05 22:05:44 +00:00
|
|
|
return now;
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-11-18 18:07:28 +00:00
|
|
|
@Override
|
2011-07-18 01:42:21 +00:00
|
|
|
public boolean isHidden()
|
|
|
|
{
|
|
|
|
return hidden;
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-06-02 16:45:56 +00:00
|
|
|
@Override
|
2011-08-27 11:59:39 +00:00
|
|
|
public void setHidden(final boolean hidden)
|
2011-07-18 01:42:21 +00:00
|
|
|
{
|
|
|
|
this.hidden = hidden;
|
2012-04-04 00:18:21 +00:00
|
|
|
if (hidden == true)
|
|
|
|
{
|
|
|
|
setLastLogout(getLastOnlineActivity());
|
|
|
|
}
|
2011-07-18 01:42:21 +00:00
|
|
|
}
|
2011-08-23 02:42:32 +00:00
|
|
|
|
2011-09-26 22:37:00 +00:00
|
|
|
//Returns true if status expired during this check
|
|
|
|
public boolean checkJailTimeout(final long currentTime)
|
2011-08-08 12:40:30 +00:00
|
|
|
{
|
|
|
|
if (getJailTimeout() > 0 && getJailTimeout() < currentTime && isJailed())
|
|
|
|
{
|
|
|
|
setJailTimeout(0);
|
|
|
|
setJailed(false);
|
2011-11-21 01:55:26 +00:00
|
|
|
sendMessage(_("haveBeenReleased"));
|
2011-08-08 12:40:30 +00:00
|
|
|
setJail(null);
|
|
|
|
try
|
|
|
|
{
|
|
|
|
getTeleport().back();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2012-08-28 01:06:11 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
getTeleport().respawn(null, TeleportCause.PLUGIN);
|
|
|
|
}
|
|
|
|
catch (Exception ex1)
|
|
|
|
{
|
|
|
|
}
|
2011-08-08 12:40:30 +00:00
|
|
|
}
|
2011-09-26 22:37:00 +00:00
|
|
|
return true;
|
2011-08-08 12:40:30 +00:00
|
|
|
}
|
2011-09-26 22:37:00 +00:00
|
|
|
return false;
|
2011-08-08 12:40:30 +00:00
|
|
|
}
|
2011-08-23 02:42:32 +00:00
|
|
|
|
2011-09-26 22:37:00 +00:00
|
|
|
//Returns true if status expired during this check
|
|
|
|
public boolean checkMuteTimeout(final long currentTime)
|
2011-08-08 12:40:30 +00:00
|
|
|
{
|
|
|
|
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
|
|
|
|
{
|
|
|
|
setMuteTimeout(0);
|
2011-11-21 01:55:26 +00:00
|
|
|
sendMessage(_("canTalkAgain"));
|
2011-08-08 12:40:30 +00:00
|
|
|
setMuted(false);
|
2011-09-26 22:37:00 +00:00
|
|
|
return true;
|
2011-08-08 12:40:30 +00:00
|
|
|
}
|
2011-09-26 22:37:00 +00:00
|
|
|
return false;
|
2011-08-08 12:40:30 +00:00
|
|
|
}
|
2011-08-23 02:42:32 +00:00
|
|
|
|
2011-09-26 22:37:00 +00:00
|
|
|
//Returns true if status expired during this check
|
|
|
|
public boolean checkBanTimeout(final long currentTime)
|
2011-08-08 12:40:30 +00:00
|
|
|
{
|
2011-09-07 20:34:53 +00:00
|
|
|
if (getBanTimeout() > 0 && getBanTimeout() < currentTime && isBanned())
|
2011-08-08 12:40:30 +00:00
|
|
|
{
|
|
|
|
setBanTimeout(0);
|
2011-09-07 20:34:53 +00:00
|
|
|
setBanned(false);
|
2011-09-26 22:37:00 +00:00
|
|
|
return true;
|
2011-08-08 12:40:30 +00:00
|
|
|
}
|
2011-09-26 22:37:00 +00:00
|
|
|
return false;
|
2011-08-08 12:40:30 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-09-01 13:29:45 +00:00
|
|
|
public void updateActivity(final boolean broadcast)
|
2011-08-27 11:59:39 +00:00
|
|
|
{
|
2013-02-03 04:48:39 +00:00
|
|
|
if (isAfk() && ess.getSettings().cancelAfkOnInteract())
|
2011-08-27 11:59:39 +00:00
|
|
|
{
|
|
|
|
setAfk(false);
|
2011-09-02 14:15:57 +00:00
|
|
|
if (broadcast && !isHidden())
|
2011-09-01 13:29:45 +00:00
|
|
|
{
|
2012-03-21 23:54:57 +00:00
|
|
|
setDisplayNick();
|
2012-11-04 21:49:48 +00:00
|
|
|
final String msg = _("userIsNotAway", getDisplayName());
|
|
|
|
if (!msg.isEmpty())
|
2013-01-01 21:12:26 +00:00
|
|
|
{
|
2012-11-04 21:49:48 +00:00
|
|
|
ess.broadcastMessage(this, msg);
|
|
|
|
}
|
2011-09-01 13:29:45 +00:00
|
|
|
}
|
2011-08-27 11:59:39 +00:00
|
|
|
}
|
|
|
|
lastActivity = System.currentTimeMillis();
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
public void checkActivity()
|
|
|
|
{
|
|
|
|
final long autoafkkick = ess.getSettings().getAutoAfkKick();
|
2011-12-03 13:50:32 +00:00
|
|
|
if (autoafkkick > 0 && lastActivity > 0 && (lastActivity + (autoafkkick * 1000)) < System.currentTimeMillis()
|
2011-09-02 14:15:57 +00:00
|
|
|
&& !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt"))
|
2011-08-27 11:59:39 +00:00
|
|
|
{
|
2011-11-21 01:55:26 +00:00
|
|
|
final String kickReason = _("autoAfkKickReason", autoafkkick / 60.0);
|
2011-12-03 13:50:32 +00:00
|
|
|
lastActivity = 0;
|
2011-08-27 11:59:39 +00:00
|
|
|
kickPlayer(kickReason);
|
2012-01-15 23:50:52 +00:00
|
|
|
|
|
|
|
|
2011-08-27 11:59:39 +00:00
|
|
|
for (Player player : ess.getServer().getOnlinePlayers())
|
|
|
|
{
|
|
|
|
final User user = ess.getUser(player);
|
|
|
|
if (user.isAuthorized("essentials.kick.notify"))
|
|
|
|
{
|
2013-08-15 00:53:22 +00:00
|
|
|
user.sendMessage(_("playerKicked", Console.NAME, getName(), kickReason));
|
2011-08-27 11:59:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
final long autoafk = ess.getSettings().getAutoAfk();
|
2012-09-09 18:09:35 +00:00
|
|
|
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis() && isAuthorized("essentials.afk.auto"))
|
2011-08-27 11:59:39 +00:00
|
|
|
{
|
|
|
|
setAfk(true);
|
2011-10-20 23:23:35 +00:00
|
|
|
if (!isHidden())
|
|
|
|
{
|
2012-03-21 23:54:57 +00:00
|
|
|
setDisplayNick();
|
2012-11-04 21:49:48 +00:00
|
|
|
final String msg = _("userIsAway", getDisplayName());
|
|
|
|
if (!msg.isEmpty())
|
2013-01-01 21:12:26 +00:00
|
|
|
{
|
2012-11-04 21:49:48 +00:00
|
|
|
ess.broadcastMessage(this, msg);
|
|
|
|
}
|
2011-09-02 14:15:57 +00:00
|
|
|
}
|
2011-08-27 11:59:39 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-09-02 14:15:57 +00:00
|
|
|
public Location getAfkPosition()
|
|
|
|
{
|
|
|
|
return afkPosition;
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-09-29 22:09:48 +00:00
|
|
|
@Override
|
|
|
|
public boolean isGodModeEnabled()
|
|
|
|
{
|
2011-11-25 06:12:21 +00:00
|
|
|
return (super.isGodModeEnabled() && !ess.getSettings().getNoGodWorlds().contains(getLocation().getWorld().getName()))
|
|
|
|
|| (isAfk() && ess.getSettings().getFreezeAfkPlayers());
|
2011-09-29 22:09:48 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-11-25 06:12:21 +00:00
|
|
|
public boolean isGodModeEnabledRaw()
|
|
|
|
{
|
|
|
|
return super.isGodModeEnabled();
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2012-04-24 10:30:31 +00:00
|
|
|
@Override
|
2011-11-22 02:02:08 +00:00
|
|
|
public String getGroup()
|
|
|
|
{
|
2013-10-21 00:20:09 +00:00
|
|
|
final String result = ess.getPermissionsHandler().getGroup(base);
|
|
|
|
if (ess.getSettings().isDebug())
|
|
|
|
{
|
|
|
|
ess.getLogger().log(Level.INFO, "looking up groupname of " + base.getName() + " - " + result);
|
|
|
|
}
|
|
|
|
return result;
|
2011-11-22 02:02:08 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-07-14 11:41:27 +00:00
|
|
|
@Override
|
2011-11-22 02:02:08 +00:00
|
|
|
public boolean inGroup(final String group)
|
|
|
|
{
|
2013-10-20 16:45:37 +00:00
|
|
|
final boolean result = ess.getPermissionsHandler().inGroup(base, group);
|
|
|
|
if (ess.getSettings().isDebug())
|
|
|
|
{
|
2013-10-21 00:20:09 +00:00
|
|
|
ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " is in group " + group + " - " + result);
|
2013-10-20 16:45:37 +00:00
|
|
|
}
|
|
|
|
return result;
|
2011-11-22 02:02:08 +00:00
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2013-07-14 11:41:27 +00:00
|
|
|
@Override
|
2011-11-22 02:02:08 +00:00
|
|
|
public boolean canBuild()
|
|
|
|
{
|
2012-02-02 10:43:17 +00:00
|
|
|
if (isOp())
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-11-22 02:02:08 +00:00
|
|
|
return ess.getPermissionsHandler().canBuild(base, getGroup());
|
|
|
|
}
|
2012-01-15 23:50:52 +00:00
|
|
|
|
2011-12-08 23:43:09 +00:00
|
|
|
public long getTeleportRequestTime()
|
|
|
|
{
|
|
|
|
return teleportRequestTime;
|
2012-01-15 23:50:52 +00:00
|
|
|
}
|
2012-03-25 09:44:33 +00:00
|
|
|
|
|
|
|
public boolean isInvSee()
|
|
|
|
{
|
|
|
|
return invSee;
|
|
|
|
}
|
|
|
|
|
2012-03-27 19:14:38 +00:00
|
|
|
public void setInvSee(final boolean set)
|
2012-03-25 09:44:33 +00:00
|
|
|
{
|
|
|
|
invSee = set;
|
|
|
|
}
|
2012-08-28 01:06:11 +00:00
|
|
|
|
2012-08-21 19:02:20 +00:00
|
|
|
public boolean isEnderSee()
|
|
|
|
{
|
|
|
|
return enderSee;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEnderSee(final boolean set)
|
|
|
|
{
|
|
|
|
enderSee = set;
|
|
|
|
}
|
2012-03-27 19:14:38 +00:00
|
|
|
|
2013-07-14 11:41:27 +00:00
|
|
|
@Override
|
2012-03-27 19:14:38 +00:00
|
|
|
public void enableInvulnerabilityAfterTeleport()
|
|
|
|
{
|
|
|
|
final long time = ess.getSettings().getTeleportInvulnerability();
|
|
|
|
if (time > 0)
|
|
|
|
{
|
|
|
|
teleportInvulnerabilityTimestamp = System.currentTimeMillis() + time;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-14 11:41:27 +00:00
|
|
|
@Override
|
2012-03-27 19:14:38 +00:00
|
|
|
public void resetInvulnerabilityAfterTeleport()
|
|
|
|
{
|
|
|
|
if (teleportInvulnerabilityTimestamp != 0
|
|
|
|
&& teleportInvulnerabilityTimestamp < System.currentTimeMillis())
|
|
|
|
{
|
|
|
|
teleportInvulnerabilityTimestamp = 0;
|
|
|
|
}
|
|
|
|
}
|
2012-03-30 20:44:14 +00:00
|
|
|
|
2013-11-07 02:22:32 +00:00
|
|
|
@Override
|
2012-03-27 19:14:38 +00:00
|
|
|
public boolean hasInvulnerabilityAfterTeleport()
|
|
|
|
{
|
|
|
|
return teleportInvulnerabilityTimestamp != 0 && teleportInvulnerabilityTimestamp >= System.currentTimeMillis();
|
|
|
|
}
|
2012-05-17 10:25:02 +00:00
|
|
|
|
2013-06-02 16:45:56 +00:00
|
|
|
@Override
|
2012-05-17 10:25:02 +00:00
|
|
|
public boolean isVanished()
|
|
|
|
{
|
|
|
|
return vanished;
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
|
2013-06-02 16:45:56 +00:00
|
|
|
@Override
|
2012-06-16 12:53:46 +00:00
|
|
|
public void setVanished(final boolean set)
|
2012-05-17 10:25:02 +00:00
|
|
|
{
|
2012-06-16 12:53:46 +00:00
|
|
|
vanished = set;
|
|
|
|
if (set)
|
2012-05-21 05:13:01 +00:00
|
|
|
{
|
2012-06-10 23:17:19 +00:00
|
|
|
for (Player p : ess.getServer().getOnlinePlayers())
|
|
|
|
{
|
|
|
|
if (!ess.getUser(p).isAuthorized("essentials.vanish.see"))
|
|
|
|
{
|
|
|
|
p.hidePlayer(getBase());
|
|
|
|
}
|
|
|
|
}
|
2012-06-10 22:36:10 +00:00
|
|
|
setHidden(true);
|
2012-05-21 05:13:01 +00:00
|
|
|
ess.getVanishedPlayers().add(getName());
|
2013-01-01 21:12:26 +00:00
|
|
|
if (isAuthorized("essentials.vanish.effect"))
|
|
|
|
{
|
|
|
|
this.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
|
|
|
|
}
|
2012-05-21 05:13:01 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-10 23:17:19 +00:00
|
|
|
for (Player p : ess.getServer().getOnlinePlayers())
|
|
|
|
{
|
|
|
|
p.showPlayer(getBase());
|
|
|
|
}
|
2012-06-10 22:36:10 +00:00
|
|
|
setHidden(false);
|
2012-05-21 05:13:01 +00:00
|
|
|
ess.getVanishedPlayers().remove(getName());
|
2013-01-01 21:12:26 +00:00
|
|
|
if (isAuthorized("essentials.vanish.effect"))
|
|
|
|
{
|
|
|
|
this.removePotionEffect(PotionEffectType.INVISIBILITY);
|
|
|
|
}
|
2012-05-21 05:13:01 +00:00
|
|
|
}
|
2012-05-17 10:25:02 +00:00
|
|
|
}
|
2012-06-16 12:53:46 +00:00
|
|
|
|
2012-08-03 20:57:29 +00:00
|
|
|
public boolean checkSignThrottle()
|
|
|
|
{
|
|
|
|
if (isSignThrottled())
|
|
|
|
{
|
2012-06-17 18:28:59 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
updateThrottle();
|
|
|
|
return false;
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
|
2012-06-17 18:28:59 +00:00
|
|
|
public boolean isSignThrottled()
|
|
|
|
{
|
|
|
|
final long minTime = lastThrottledAction + (1000 / ess.getSettings().getSignUsePerSecond());
|
|
|
|
return (System.currentTimeMillis() < minTime);
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
|
2012-06-17 18:28:59 +00:00
|
|
|
public void updateThrottle()
|
|
|
|
{
|
|
|
|
lastThrottledAction = System.currentTimeMillis();;
|
|
|
|
}
|
2012-08-30 23:47:53 +00:00
|
|
|
|
|
|
|
public boolean isFlyClickJump()
|
|
|
|
{
|
|
|
|
return rightClickJump;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRightClickJump(boolean rightClickJump)
|
|
|
|
{
|
|
|
|
this.rightClickJump = rightClickJump;
|
2012-08-31 16:47:35 +00:00
|
|
|
}
|
2012-11-27 17:45:02 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isIgnoreExempt()
|
|
|
|
{
|
2013-01-01 21:12:26 +00:00
|
|
|
return this.isAuthorized("essentials.chat.ignoreexempt");
|
2012-11-27 17:45:02 +00:00
|
|
|
}
|
2012-12-19 03:57:12 +00:00
|
|
|
|
|
|
|
public boolean isRecipeSee()
|
|
|
|
{
|
|
|
|
return recipeSee;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRecipeSee(boolean recipeSee)
|
|
|
|
{
|
|
|
|
this.recipeSee = recipeSee;
|
|
|
|
}
|
2013-08-28 16:50:28 +00:00
|
|
|
|
2013-07-13 17:46:26 +00:00
|
|
|
@Override
|
2013-08-28 16:50:28 +00:00
|
|
|
public void sendMessage(String message)
|
|
|
|
{
|
|
|
|
if (!message.isEmpty())
|
|
|
|
{
|
2013-07-13 17:46:26 +00:00
|
|
|
base.sendMessage(message);
|
|
|
|
}
|
|
|
|
}
|
2013-08-28 16:50:28 +00:00
|
|
|
|
2013-07-14 11:41:27 +00:00
|
|
|
@Override
|
2013-10-16 19:59:39 +00:00
|
|
|
public void setReplyTo(final CommandSource user)
|
2013-07-14 11:41:27 +00:00
|
|
|
{
|
|
|
|
replyTo = user;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-16 19:59:39 +00:00
|
|
|
public CommandSource getReplyTo()
|
2013-07-14 11:41:27 +00:00
|
|
|
{
|
|
|
|
return replyTo;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int compareTo(final User other)
|
|
|
|
{
|
|
|
|
return FormatUtil.stripFormat(this.getDisplayName()).compareToIgnoreCase(FormatUtil.stripFormat(other.getDisplayName()));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(final Object object)
|
|
|
|
{
|
|
|
|
if (!(object instanceof User))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return this.getName().equalsIgnoreCase(((User)object).getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode()
|
|
|
|
{
|
|
|
|
return this.getName().hashCode();
|
|
|
|
}
|
2013-10-16 19:59:39 +00:00
|
|
|
|
2013-11-07 02:22:32 +00:00
|
|
|
@Override
|
2013-10-16 19:59:39 +00:00
|
|
|
public CommandSource getSource()
|
|
|
|
{
|
|
|
|
return new CommandSource(getBase());
|
|
|
|
}
|
2011-07-08 11:29:06 +00:00
|
|
|
}
|