mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-01 19:41:41 +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
This commit is contained in:
parent
03fd6249fc
commit
224c18348a
126 changed files with 3542 additions and 3145 deletions
|
@ -15,26 +15,29 @@ public class Commandeco extends EssentialsCommand
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run(Server server, Essentials parent, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
EcoCommands cmd;
|
||||
int amount;
|
||||
double amount;
|
||||
try
|
||||
{
|
||||
cmd = EcoCommands.valueOf(args[0].toUpperCase());
|
||||
amount = Integer.parseInt(args[2].replaceAll("[^0-9]", ""));
|
||||
amount = Double.parseDouble(args[2].replaceAll("[^0-9\\.]", ""));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sender.sendMessage("§cUsage: /eco [give|take|reset] [player] [money]");
|
||||
return;
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
if (args[1].contentEquals("*"))
|
||||
{
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
User u = User.get(p);
|
||||
User u = ess.getUser(p);
|
||||
switch (cmd)
|
||||
{
|
||||
case GIVE:
|
||||
|
@ -46,7 +49,7 @@ public class Commandeco extends EssentialsCommand
|
|||
break;
|
||||
|
||||
case RESET:
|
||||
u.setMoney(amount == 0 ? Essentials.getSettings().getStartingBalance() : amount);
|
||||
u.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +58,7 @@ public class Commandeco extends EssentialsCommand
|
|||
{
|
||||
for (Player p : server.matchPlayer(args[1]))
|
||||
{
|
||||
User u = User.get(p);
|
||||
User u = ess.getUser(p);
|
||||
switch (cmd)
|
||||
{
|
||||
case GIVE:
|
||||
|
@ -67,7 +70,7 @@ public class Commandeco extends EssentialsCommand
|
|||
break;
|
||||
|
||||
case RESET:
|
||||
u.setMoney(amount == 0 ? Essentials.getSettings().getStartingBalance() : amount);
|
||||
u.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue