mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Option to not use UUIDFetcher for the time being.
This commit is contained in:
parent
8e03638d8d
commit
d0876c60b0
@ -776,8 +776,9 @@ import java.util.concurrent.TimeUnit;
|
||||
Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
|
||||
Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
||||
Settings.DELETE_PLOTS_ON_BAN = config.getBoolean("clear.on.ban");
|
||||
Settings.API_URL = config.getString("api.location");
|
||||
Settings.CUSTOM_API = config.getBoolean("api.custom");
|
||||
Settings.API_URL = config.getString("uuid.api.location");
|
||||
Settings.CUSTOM_API = config.getBoolean("uuid.api.custom");
|
||||
Settings.UUID_FECTHING = config.getBoolean("uuid.fetching");
|
||||
}
|
||||
if (Settings.DEBUG) {
|
||||
final Map<String, String> settings = new HashMap<>();
|
||||
@ -864,8 +865,9 @@ import java.util.concurrent.TimeUnit;
|
||||
options.put("clear.on.ban", false);
|
||||
options.put("max_plots", Settings.MAX_PLOTS);
|
||||
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
|
||||
options.put("api.location", Settings.API_URL);
|
||||
options.put("api.custom", Settings.CUSTOM_API);
|
||||
options.put("uuid.api.location", Settings.API_URL);
|
||||
options.put("uuid.api.custom", Settings.CUSTOM_API);
|
||||
options.put("uuid.fecthing", Settings.UUID_FECTHING);
|
||||
options.put("titles", Settings.TITLES);
|
||||
options.put("teleport.on_login", Settings.TELEPORT_ON_LOGIN);
|
||||
options.put("perm-based-mob-cap.enabled", Settings.MOB_CAP_ENABLED);
|
||||
@ -1533,13 +1535,21 @@ import java.util.concurrent.TimeUnit;
|
||||
{
|
||||
if (Settings.OFFLINE_MODE) {
|
||||
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
|
||||
Settings.OFFLINE_MODE = true;
|
||||
}
|
||||
else if (checkVersion() && Bukkit.getOnlineMode()) {
|
||||
UUIDHandler.uuidWrapper = new DefaultUUIDWrapper();
|
||||
Settings.OFFLINE_MODE = false;
|
||||
}
|
||||
else {
|
||||
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
|
||||
Settings.OFFLINE_MODE = true;
|
||||
}
|
||||
|
||||
if (Settings.OFFLINE_MODE) {
|
||||
sendConsoleSenderMessage(C.PREFIX.s()+" &6PlotSquared &cis using Offline Mode UUIDs either because of user preference, or because of the version of the Bukkit API");
|
||||
}
|
||||
|
||||
setUUIDSaver(new PlotUUIDSaver());
|
||||
// Looks really cool xD
|
||||
getUUIDSaver().globalPopulate();
|
||||
|
@ -219,7 +219,7 @@ import java.util.UUID;
|
||||
|
||||
private String getPlayerName(final UUID uuid) {
|
||||
if (uuid == null) {
|
||||
return "unknown";
|
||||
return uuid.toString();
|
||||
}
|
||||
if (uuid.equals(DBFunc.everyone) || uuid.toString().equalsIgnoreCase(DBFunc.everyone.toString())) {
|
||||
return "everyone";
|
||||
|
@ -28,6 +28,10 @@ package com.intellectualcrafters.plot.config;
|
||||
* @author Empire92
|
||||
*/
|
||||
public class Settings {
|
||||
/**
|
||||
* Default UUID_FECTHING: false
|
||||
*/
|
||||
public static boolean UUID_FECTHING = false;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -111,6 +111,9 @@ import java.util.UUID;
|
||||
* @param uuid to cache
|
||||
*/
|
||||
public static void add(final StringWrapper name, final UUID uuid) {
|
||||
if (uuid == null || name == null) {
|
||||
return;
|
||||
}
|
||||
if (!uuidMap.containsKey(name) && !uuidMap.inverse().containsKey(uuid)) {
|
||||
uuidMap.put(name, uuid);
|
||||
}
|
||||
@ -190,6 +193,10 @@ import java.util.UUID;
|
||||
return name;
|
||||
}
|
||||
if (online && !Settings.OFFLINE_MODE) {
|
||||
if (!Settings.UUID_FECTHING) {
|
||||
name = getNameOfflineFromOnlineUUID(uuid);
|
||||
return name;
|
||||
}
|
||||
if (!Settings.CUSTOM_API) {
|
||||
try {
|
||||
final NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
|
||||
@ -272,6 +279,14 @@ import java.util.UUID;
|
||||
return name;
|
||||
}
|
||||
|
||||
private static UUID getUuidOnlineFromOfflinePlayer(final StringWrapper name) {
|
||||
return getUUID(Bukkit.getOfflinePlayer(name.toString()));
|
||||
}
|
||||
|
||||
private static String getNameOfflineFromOnlineUUID(final UUID uuid) {
|
||||
return uuidWrapper.getOfflinePlayer(uuid).getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name to use as key
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user