2011-03-30 06:03:21 +02:00
|
|
|
package com.earth2me.essentials;
|
|
|
|
|
|
|
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
2011-08-23 07:09:34 +02:00
|
|
|
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
2011-05-14 01:39:18 +02:00
|
|
|
import com.earth2me.essentials.register.payment.Method;
|
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 23:07:30 +02:00
|
|
|
import java.util.Calendar;
|
|
|
|
import java.util.GregorianCalendar;
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
import org.bukkit.ChatColor;
|
2011-08-23 04:42:32 +02:00
|
|
|
import org.bukkit.Location;
|
2011-04-05 17:57:54 +02: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 23:07:30 +02:00
|
|
|
import org.bukkit.entity.Player;
|
2011-03-30 06:03:21 +02:00
|
|
|
|
|
|
|
|
2011-06-01 12:40:12 +02:00
|
|
|
public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
2011-03-30 06:03:21 +02:00
|
|
|
{
|
|
|
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
|
|
|
private boolean justPortaled = false;
|
2011-04-05 17:57:54 +02:00
|
|
|
private CommandSender replyTo = null;
|
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 23:07:30 +02:00
|
|
|
private User teleportRequester;
|
|
|
|
private boolean teleportRequestHere;
|
2011-06-01 12:40:12 +02:00
|
|
|
private final Teleport teleport;
|
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 23:07:30 +02:00
|
|
|
private long lastActivity;
|
2011-07-18 03:42:21 +02:00
|
|
|
private boolean hidden = false;
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-06-01 12:40:12 +02:00
|
|
|
User(Player base, IEssentials ess)
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
super(base, ess);
|
|
|
|
teleport = new Teleport(this, ess);
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
User update(Player base)
|
2011-03-30 06:03:21 +02:00
|
|
|
{
|
|
|
|
setBase(base);
|
|
|
|
return this;
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-03-30 06:03:21 +02:00
|
|
|
public boolean isAuthorized(IEssentialsCommand cmd)
|
|
|
|
{
|
2011-06-26 15:47:28 +02:00
|
|
|
return isAuthorized(cmd, "essentials.");
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-06-26 15:47:28 +02:00
|
|
|
public boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix)
|
|
|
|
{
|
|
|
|
return isAuthorized(permissionPrefix + (cmd.getName().equals("r") ? "msg" : cmd.getName()));
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-03-30 06:03:21 +02:00
|
|
|
public boolean isAuthorized(String node)
|
|
|
|
{
|
|
|
|
if (isOp())
|
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 23:07:30 +02:00
|
|
|
{
|
2011-03-30 06:03:21 +02:00
|
|
|
return true;
|
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 23:07:30 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-03-30 06:03:21 +02:00
|
|
|
if (isJailed())
|
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 23:07:30 +02:00
|
|
|
{
|
2011-03-30 06:03:21 +02:00
|
|
|
return false;
|
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 23:07:30 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-06-07 00:24:39 +02:00
|
|
|
return ess.getPermissionsHandler().hasPermission(this, node);
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-03-30 06:03:21 +02:00
|
|
|
public void healCooldown() throws Exception
|
|
|
|
{
|
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 23:07:30 +02:00
|
|
|
Calendar now = new GregorianCalendar();
|
|
|
|
if (getLastHealTimestamp() > 0)
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
double cooldown = ess.getSettings().getHealCooldown();
|
|
|
|
Calendar cooldownTime = new GregorianCalendar();
|
|
|
|
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 11:36:25 +02:00
|
|
|
{
|
2011-05-10 21:02:59 +02:00
|
|
|
throw new Exception(Util.format("timeBeforeHeal", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
setLastHealTimestamp(now.getTimeInMillis());
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public void giveMoney(double value)
|
2011-07-08 13:29:06 +02:00
|
|
|
{
|
|
|
|
giveMoney(value, null);
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-07-08 13:29:06 +02:00
|
|
|
public void giveMoney(double value, CommandSender initiator)
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
if (value == 0)
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
return;
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
|
|
|
setMoney(getMoney() + value);
|
2011-07-16 01:33:22 +02:00
|
|
|
sendMessage(Util.format("addedToAccount", Util.formatCurrency(value, ess)));
|
2011-07-08 13:29:06 +02:00
|
|
|
if (initiator != null)
|
|
|
|
{
|
2011-07-16 01:33:22 +02:00
|
|
|
initiator.sendMessage((Util.format("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName())));
|
2011-07-08 13:29:06 +02:00
|
|
|
}
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public void payUser(User reciever, double value) throws Exception
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
if (value == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2011-03-30 06:03:21 +02:00
|
|
|
if (!canAfford(value))
|
|
|
|
{
|
2011-05-10 21:02:59 +02:00
|
|
|
throw new Exception(Util.i18n("notEnoughMoney"));
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setMoney(getMoney() - value);
|
|
|
|
reciever.setMoney(reciever.getMoney() + value);
|
2011-07-16 01:33:22 +02:00
|
|
|
sendMessage(Util.format("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName()));
|
|
|
|
reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName()));
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-03-30 06:03:21 +02:00
|
|
|
public void takeMoney(double value)
|
2011-07-08 13:29:06 +02:00
|
|
|
{
|
|
|
|
takeMoney(value, null);
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-07-08 13:29:06 +02:00
|
|
|
public void takeMoney(double value, CommandSender initiator)
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
if (value == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2011-03-30 06:03:21 +02:00
|
|
|
setMoney(getMoney() - value);
|
2011-07-16 01:33:22 +02:00
|
|
|
sendMessage(Util.format("takenFromAccount", Util.formatCurrency(value, ess)));
|
2011-07-08 13:29:06 +02:00
|
|
|
if (initiator != null)
|
|
|
|
{
|
2011-07-16 01:33:22 +02:00
|
|
|
initiator.sendMessage((Util.format("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName())));
|
2011-07-08 13:29:06 +02:00
|
|
|
}
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-03-30 06:03:21 +02:00
|
|
|
public boolean canAfford(double cost)
|
|
|
|
{
|
|
|
|
double mon = getMoney();
|
2011-06-01 12:40:12 +02:00
|
|
|
return mon >= cost || isAuthorized("essentials.eco.loan");
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-03-30 06:03:21 +02:00
|
|
|
public void dispose()
|
|
|
|
{
|
2011-07-16 01:33:22 +02:00
|
|
|
this.base = new OfflinePlayer(getName(), ess);
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-03-30 06:03:21 +02:00
|
|
|
public boolean getJustPortaled()
|
|
|
|
{
|
|
|
|
return justPortaled;
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-03-30 06:03:21 +02:00
|
|
|
public void setJustPortaled(boolean value)
|
|
|
|
{
|
|
|
|
justPortaled = value;
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-04-05 17:57:54 +02:00
|
|
|
public void setReplyTo(CommandSender user)
|
2011-03-30 06:03:21 +02:00
|
|
|
{
|
|
|
|
replyTo = user;
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-04-05 17:57:54 +02:00
|
|
|
public CommandSender getReplyTo()
|
2011-03-30 06:03:21 +02:00
|
|
|
{
|
|
|
|
return replyTo;
|
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public int compareTo(User t)
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(t.getDisplayName()));
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-06-01 12:40:12 +02:00
|
|
|
@Override
|
|
|
|
public boolean equals(Object o)
|
|
|
|
{
|
|
|
|
if (!(o instanceof User))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2011-07-06 00:05:44 +02:00
|
|
|
return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User)o).getDisplayName()));
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-06-01 12:40:12 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-06-01 12:40:12 +02:00
|
|
|
@Override
|
|
|
|
public int hashCode()
|
|
|
|
{
|
|
|
|
return ChatColor.stripColor(this.getDisplayName()).hashCode();
|
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public Boolean canSpawnItem(int itemId)
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
return !ess.getSettings().itemSpawnBlacklist().contains(itemId);
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-08-24 06:18:35 +02:00
|
|
|
public Location getHome() throws Exception
|
2011-08-23 04:42:32 +02:00
|
|
|
{
|
|
|
|
return getHome(getHomes().get(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 23:07:30 +02:00
|
|
|
public void setHome()
|
2011-03-30 06:03:21 +02:00
|
|
|
{
|
2011-08-23 04:42:32 +02:00
|
|
|
setHome("home", getLocation());
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
|
|
|
public void setHome(String name)
|
2011-03-30 06:03:21 +02:00
|
|
|
{
|
2011-08-23 04:42:32 +02:00
|
|
|
setHome(name, getLocation());
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public void setLastLocation()
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
setLastLocation(getLocation());
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public void requestTeleport(User player, boolean here)
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
teleportRequester = player;
|
|
|
|
teleportRequestHere = here;
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public User getTeleportRequest()
|
2011-04-14 11:36:25 +02: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 23:07:30 +02:00
|
|
|
return teleportRequester;
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public boolean isTeleportRequestHere()
|
2011-03-30 06:03:21 +02: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 23:07:30 +02:00
|
|
|
return teleportRequestHere;
|
2011-03-30 06:03:21 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public String getNick()
|
2011-04-14 11:36:25 +02:00
|
|
|
{
|
2011-07-15 20:35:09 +02:00
|
|
|
final StringBuilder nickname = new StringBuilder();
|
|
|
|
final String nick = getNickname();
|
|
|
|
if (ess.getSettings().isCommandDisabled("nick") || nick == null || nick.isEmpty() || nick.equals(getName()))
|
2011-04-14 11:36:25 +02:00
|
|
|
{
|
2011-07-15 20:35:09 +02:00
|
|
|
nickname.append(getName());
|
2011-04-03 22:21:20 +02: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 23:07:30 +02:00
|
|
|
else
|
2011-04-14 11:36:25 +02:00
|
|
|
{
|
2011-07-15 20:35:09 +02:00
|
|
|
nickname.append(ess.getSettings().getNicknamePrefix()).append(nick);
|
2011-04-03 22:39:39 +02: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 23:07:30 +02:00
|
|
|
if (isOp())
|
2011-04-14 11:36:25 +02:00
|
|
|
{
|
2011-05-10 22:40:32 +02:00
|
|
|
try
|
|
|
|
{
|
2011-07-15 20:35:09 +02:00
|
|
|
nickname.insert(0, ess.getSettings().getOperatorColor().toString());
|
|
|
|
nickname.append("§f");
|
2011-05-10 22:40:32 +02:00
|
|
|
}
|
2011-07-06 00:05:44 +02:00
|
|
|
catch (Exception e)
|
2011-05-10 22:40:32 +02:00
|
|
|
{
|
|
|
|
}
|
2011-04-03 22:21:20 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-07-23 01:43:02 +02:00
|
|
|
if (ess.getSettings().addPrefixSuffix())
|
2011-07-20 18:36:29 +02:00
|
|
|
{
|
2011-07-23 01:43:02 +02:00
|
|
|
final String prefix = ess.getPermissionsHandler().getPrefix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
|
|
|
|
final String suffix = ess.getPermissionsHandler().getSuffix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-07-23 01:43:02 +02:00
|
|
|
nickname.insert(0, prefix);
|
|
|
|
nickname.append(suffix);
|
|
|
|
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
|
|
|
|
{
|
|
|
|
nickname.append("§f");
|
|
|
|
}
|
2011-07-20 18:36:29 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-07-15 20:35:09 +02:00
|
|
|
return nickname.toString();
|
2011-04-03 22:21:20 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public Teleport getTeleport()
|
2011-04-14 11:36:25 +02: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 23:07:30 +02:00
|
|
|
return teleport;
|
2011-04-04 03:26:45 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public long getLastActivity()
|
2011-04-14 11:36:25 +02: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 23:07:30 +02:00
|
|
|
return lastActivity;
|
2011-05-01 13:04:34 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02: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 23:07:30 +02:00
|
|
|
public void setLastActivity(long timestamp)
|
|
|
|
{
|
|
|
|
lastActivity = timestamp;
|
2011-05-01 13:04:34 +02:00
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-05-13 18:57:45 +02:00
|
|
|
@Override
|
|
|
|
public double getMoney()
|
|
|
|
{
|
2011-07-15 23:39:56 +02:00
|
|
|
if (ess.getPaymentMethod().hasMethod())
|
2011-05-13 18:57:45 +02:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2011-05-13 22:41:49 +02:00
|
|
|
Method method = ess.getPaymentMethod().getMethod();
|
2011-07-06 00:05:44 +02:00
|
|
|
if (!method.hasAccount(this.getName()))
|
|
|
|
{
|
2011-05-13 22:41:49 +02:00
|
|
|
throw new Exception();
|
|
|
|
}
|
|
|
|
Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
|
|
|
|
return account.balance();
|
2011-05-13 18:57:45 +02:00
|
|
|
}
|
|
|
|
catch (Throwable ex)
|
2011-07-06 00:05:44 +02:00
|
|
|
{
|
2011-05-13 18:57:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return super.getMoney();
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-05-13 18:57:45 +02:00
|
|
|
@Override
|
|
|
|
public void setMoney(double value)
|
|
|
|
{
|
2011-07-15 23:39:56 +02:00
|
|
|
if (ess.getPaymentMethod().hasMethod())
|
2011-05-13 18:57:45 +02:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2011-05-13 22:41:49 +02:00
|
|
|
Method method = ess.getPaymentMethod().getMethod();
|
2011-07-06 00:05:44 +02:00
|
|
|
if (!method.hasAccount(this.getName()))
|
|
|
|
{
|
2011-05-13 22:41:49 +02:00
|
|
|
throw new Exception();
|
|
|
|
}
|
|
|
|
Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
|
2011-05-14 04:16:47 +02:00
|
|
|
account.set(value);
|
2011-05-13 18:57:45 +02:00
|
|
|
}
|
|
|
|
catch (Throwable ex)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
super.setMoney(value);
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-07-06 00:05:44 +02:00
|
|
|
@Override
|
|
|
|
public void setAfk(boolean set)
|
|
|
|
{
|
2011-07-15 20:13:52 +02:00
|
|
|
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
|
2011-07-06 00:05:44 +02:00
|
|
|
super.setAfk(set);
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-07-06 00:05:44 +02:00
|
|
|
@Override
|
|
|
|
public boolean toggleAfk()
|
|
|
|
{
|
|
|
|
boolean now = super.toggleAfk();
|
2011-07-15 20:13:52 +02:00
|
|
|
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : now);
|
2011-07-06 00:05:44 +02:00
|
|
|
return now;
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-07-18 03:42:21 +02:00
|
|
|
public boolean isHidden()
|
|
|
|
{
|
|
|
|
return hidden;
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-07-18 03:42:21 +02:00
|
|
|
public void setHidden(boolean hidden)
|
|
|
|
{
|
|
|
|
this.hidden = hidden;
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-08-08 14:40:30 +02:00
|
|
|
public void checkJailTimeout(final long currentTime)
|
|
|
|
{
|
|
|
|
if (getJailTimeout() > 0 && getJailTimeout() < currentTime && isJailed())
|
|
|
|
{
|
|
|
|
setJailTimeout(0);
|
|
|
|
setJailed(false);
|
|
|
|
sendMessage(Util.i18n("haveBeenReleased"));
|
|
|
|
setJail(null);
|
|
|
|
try
|
|
|
|
{
|
|
|
|
getTeleport().back();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-08-08 14:40:30 +02:00
|
|
|
public void checkMuteTimeout(final long currentTime)
|
|
|
|
{
|
|
|
|
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
|
|
|
|
{
|
|
|
|
setMuteTimeout(0);
|
|
|
|
sendMessage(Util.i18n("canTalkAgain"));
|
|
|
|
setMuted(false);
|
|
|
|
}
|
|
|
|
}
|
2011-08-23 04:42:32 +02:00
|
|
|
|
2011-08-08 14:40:30 +02:00
|
|
|
public void checkBanTimeout(final long currentTime)
|
|
|
|
{
|
|
|
|
if (getBanTimeout() > 0 && getBanTimeout() < currentTime && ess.getBans().isNameBanned(getName()))
|
|
|
|
{
|
|
|
|
setBanTimeout(0);
|
|
|
|
ess.getBans().unbanByName(getName());
|
|
|
|
}
|
|
|
|
}
|
2011-07-08 13:29:06 +02:00
|
|
|
}
|