mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-30 02:08:24 +00:00
Format /seen account history list, optimize map loading.
This commit is contained in:
parent
b080187808
commit
b6c0871daa
29 changed files with 95 additions and 33 deletions
|
@ -170,7 +170,6 @@ public class EssentialsConf extends YamlConfiguration
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
|
|
|
@ -117,6 +117,10 @@ public class UUIDMap
|
||||||
public Future<?> _writeUUIDMap()
|
public Future<?> _writeUUIDMap()
|
||||||
{
|
{
|
||||||
final ConcurrentSkipListMap<String, UUID> names = ess.getUserMap().getNames().clone();
|
final ConcurrentSkipListMap<String, UUID> names = ess.getUserMap().getNames().clone();
|
||||||
|
if (names.size() < 1)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
pendingDiskWrites.incrementAndGet();
|
pendingDiskWrites.incrementAndGet();
|
||||||
Future<?> future = EXECUTOR_SERVICE.submit(new WriteRunner(ess.getDataFolder(), userList, names, pendingDiskWrites));
|
Future<?> future = EXECUTOR_SERVICE.submit(new WriteRunner(ess.getDataFolder(), userList, names, pendingDiskWrites));
|
||||||
return future;
|
return future;
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
|
||||||
import java.util.concurrent.ConcurrentSkipListSet;
|
import java.util.concurrent.ConcurrentSkipListSet;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +34,6 @@ public class UserMap extends CacheLoader<UUID, User> implements IConf
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
uuidMap = new UUIDMap(ess);
|
uuidMap = new UUIDMap(ess);
|
||||||
users = CacheBuilder.newBuilder().maximumSize(ess.getSettings().getMaxUserCacheCount()).softValues().build(this);
|
users = CacheBuilder.newBuilder().maximumSize(ess.getSettings().getMaxUserCacheCount()).softValues().build(this);
|
||||||
loadAllUsersAsync(ess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadAllUsersAsync(final IEssentials ess)
|
private void loadAllUsersAsync(final IEssentials ess)
|
||||||
|
@ -42,6 +42,8 @@ public class UserMap extends CacheLoader<UUID, User> implements IConf
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
|
{
|
||||||
|
synchronized (users)
|
||||||
{
|
{
|
||||||
final File userdir = new File(ess.getDataFolder(), "userdata");
|
final File userdir = new File(ess.getDataFolder(), "userdata");
|
||||||
if (!userdir.exists())
|
if (!userdir.exists())
|
||||||
|
@ -67,9 +69,8 @@ public class UserMap extends CacheLoader<UUID, User> implements IConf
|
||||||
//Ignore these users till they rejoin.
|
//Ignore these users till they rejoin.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uuidMap.loadAllUsers(names, history);
|
uuidMap.loadAllUsers(names, history);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,9 +74,9 @@ public class Commandseen extends EssentialsCommand
|
||||||
sender.sendMessage(tl("seenOnline", user.getDisplayName(), DateUtil.formatDateDiff(user.getLastLogin())));
|
sender.sendMessage(tl("seenOnline", user.getDisplayName(), DateUtil.formatDateDiff(user.getLastLogin())));
|
||||||
|
|
||||||
List<String> history = ess.getUserMap().getUserHistory(user.getBase().getUniqueId());
|
List<String> history = ess.getUserMap().getUserHistory(user.getBase().getUniqueId());
|
||||||
if (history.size() > 1)
|
if (history != null && history.size() > 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage("User has also been known as: " + StringUtil.joinList(history)); //TODO: TL
|
sender.sendMessage(tl("seenAccounts", StringUtil.joinListSkip(", ", user.getName(), history)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.isAfk())
|
if (user.isAfk())
|
||||||
|
@ -119,9 +119,9 @@ public class Commandseen extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> history = ess.getUserMap().getUserHistory(user.getBase().getUniqueId());
|
List<String> history = ess.getUserMap().getUserHistory(user.getBase().getUniqueId());
|
||||||
if (history.size() > 1)
|
if (history != null && history.size() > 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage("User has also been known as: " + StringUtil.joinList(history)); //TODO: TL
|
sender.sendMessage(tl("seenAccounts", StringUtil.joinListSkip(", ", user.getName(), history)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.getBase().isBanned())
|
if (user.getBase().isBanned())
|
||||||
|
|
|
@ -60,6 +60,40 @@ public class StringUtil
|
||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String joinListSkip(String seperator, String skip, Object... list)
|
||||||
|
{
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
for (Object each : list)
|
||||||
|
{
|
||||||
|
if (each.toString().equalsIgnoreCase(skip)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buf.length() > 0)
|
||||||
|
{
|
||||||
|
buf.append(seperator);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (each instanceof Collection)
|
||||||
|
{
|
||||||
|
buf.append(joinListSkip(seperator, skip, ((Collection)each).toArray()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
buf.append(each.toString());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
buf.append(each.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private StringUtil()
|
private StringUtil()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000 characters.
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000 characters.
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000 characters.
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000 characters.
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -545,3 +545,4 @@ weatherInvalidWorld=World named {0} not found\!
|
||||||
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
gameModeInvalid=\u00a74You need to specify a valid player/mode.
|
||||||
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
mailTooLong=\u00a74Mail message too long. Try to keep it below 1000
|
||||||
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
mailDelay=Too many mails have been sent within the last minute. Maximum\: {0}
|
||||||
|
seenAccounts=\u00a76Player has also been known as:\u00a7c {0}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<actionName>build</actionName>
|
<actionName>build</actionName>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>package</goal>
|
<goal>package</goal>
|
||||||
|
<goal>dependency:copy</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</action>
|
</action>
|
||||||
</actions>
|
</actions>
|
||||||
|
|
Loading…
Reference in a new issue