mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-27 16:02:32 +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
|
@ -22,23 +22,25 @@ public class Commandlist 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
|
||||
{
|
||||
User.charge(sender, this);
|
||||
charge(sender);
|
||||
StringBuilder online = new StringBuilder();
|
||||
online.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length);
|
||||
online.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers());
|
||||
online.append(ChatColor.BLUE).append(" players online.");
|
||||
sender.sendMessage(online.toString());
|
||||
|
||||
if (Essentials.getSettings().getSortListByGroups()) {
|
||||
|
||||
if (ess.getSettings().getSortListByGroups())
|
||||
{
|
||||
Map<String, List<User>> sort = new HashMap<String, List<User>>();
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
User u = User.get(p);
|
||||
User u = ess.getUser(p);
|
||||
String group = u.getGroup();
|
||||
List<User> list = sort.get(group);
|
||||
if (list == null) {
|
||||
if (list == null)
|
||||
{
|
||||
list = new ArrayList<User>();
|
||||
sort.put(group, list);
|
||||
}
|
||||
|
@ -46,43 +48,56 @@ public class Commandlist extends EssentialsCommand
|
|||
}
|
||||
String[] groups = sort.keySet().toArray(new String[0]);
|
||||
Arrays.sort(groups, String.CASE_INSENSITIVE_ORDER);
|
||||
for (String group : groups) {
|
||||
for (String group : groups)
|
||||
{
|
||||
StringBuilder groupString = new StringBuilder();
|
||||
groupString.append(group).append(": ");
|
||||
List<User> users = sort.get(group);
|
||||
Collections.sort(users);
|
||||
boolean first = true;
|
||||
for (User user : users) {
|
||||
if (!first) {
|
||||
for (User user : users)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
groupString.append(", ");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
if (parent.away.contains(user)) {
|
||||
if (user.isAfk())
|
||||
{
|
||||
groupString.append("§7[AFK]§f");
|
||||
}
|
||||
groupString.append(user.getDisplayName());
|
||||
}
|
||||
sender.sendMessage(groupString.toString());
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
List<User> users = new ArrayList<User>();
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
users.add(User.get(p));
|
||||
users.add(ess.getUser(p));
|
||||
}
|
||||
Collections.sort(users);
|
||||
|
||||
|
||||
StringBuilder onlineUsers = new StringBuilder();
|
||||
onlineUsers.append("Connected players: ");
|
||||
boolean first = true;
|
||||
for (User user : users) {
|
||||
if (!first) {
|
||||
for (User user : users)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
onlineUsers.append(", ");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
if (parent.away.contains(user)) {
|
||||
if (user.isAfk())
|
||||
{
|
||||
onlineUsers.append("§7[AFK]§f");
|
||||
}
|
||||
onlineUsers.append(user.getDisplayName());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue