mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-14 10:34:41 +02:00
Allow disabling userfile cache on uuid convert.
Add "ignore-userfiles-cache: true" to "upgrades-done.yml" to disable cache, forcing uuid lookup requests.
This commit is contained in:
@@ -501,6 +501,8 @@ public class EssentialsUpgrade
|
||||
return;
|
||||
}
|
||||
|
||||
Boolean ignoreUFCache = doneFile.getBoolean("ignore-userfiles-cache", false);
|
||||
|
||||
final File userdir = new File(ess.getDataFolder(), "userdata");
|
||||
if (!userdir.exists())
|
||||
{
|
||||
@@ -553,13 +555,13 @@ public class EssentialsUpgrade
|
||||
// NOOP
|
||||
}
|
||||
|
||||
uuidFileConvert(ess);
|
||||
uuidFileConvert(ess, ignoreUFCache);
|
||||
|
||||
doneFile.setProperty("uuidFileChange", true);
|
||||
doneFile.save();
|
||||
}
|
||||
|
||||
public static void uuidFileConvert(IEssentials ess)
|
||||
public static void uuidFileConvert(IEssentials ess, Boolean ignoreUFCache)
|
||||
{
|
||||
ess.getLogger().info("Starting Essentials UUID userdata conversion");
|
||||
|
||||
@@ -608,7 +610,9 @@ public class EssentialsUpgrade
|
||||
conf.setProperty("lastAccountName", name);
|
||||
conf.save();
|
||||
|
||||
String uuidString = conf.getString("uuid", null);
|
||||
String uuidConf = ignoreUFCache ? "force-uuid" : "uuid";
|
||||
|
||||
String uuidString = conf.getString(uuidConf, null);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
@@ -11,6 +11,7 @@ import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Material;
|
||||
@@ -332,7 +333,10 @@ public class Commandessentials extends EssentialsCommand
|
||||
private void run_uuidconvert(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
sender.sendMessage("Starting Essentials UUID userdata conversion, this may lag the server.");
|
||||
EssentialsUpgrade.uuidFileConvert(ess);
|
||||
|
||||
Boolean ignoreUFCache = (args.length > 2 && args[1].toLowerCase(Locale.ENGLISH).contains("ignore"));
|
||||
EssentialsUpgrade.uuidFileConvert(ess, ignoreUFCache);
|
||||
|
||||
sender.sendMessage("UUID conversion complete, check your server log for more information.");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user