mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 12:35:15 +01:00
Ability to disable the usage of the custom UUID API
This commit is contained in:
parent
e3ce39eff4
commit
dea069ca52
@ -940,6 +940,7 @@ public class PlotMain extends JavaPlugin {
|
||||
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");
|
||||
}
|
||||
if (Settings.DEBUG) {
|
||||
Map<String, String> settings = new HashMap<>();
|
||||
@ -1087,6 +1088,7 @@ public class PlotMain extends JavaPlugin {
|
||||
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);
|
||||
|
||||
for (Entry<String, Object> node : options.entrySet()) {
|
||||
if (!config.contains(node.getKey())) {
|
||||
|
@ -61,6 +61,7 @@ public class Settings {
|
||||
public static boolean AUTO_CLEAR = false;
|
||||
public static int AUTO_CLEAR_DAYS = 365;
|
||||
public static String API_URL = "http://www.intellectualsites.com/minecraft.php";
|
||||
public static boolean CUSTOM_API = true;
|
||||
|
||||
public static class Update {
|
||||
/**
|
||||
|
@ -73,6 +73,7 @@ public class UUIDHandler {
|
||||
}
|
||||
UUID uuid;
|
||||
if (online) {
|
||||
if(Settings.CUSTOM_API) {
|
||||
if ((uuid = getUuidOnlinePlayer(nameWrap)) != null) {
|
||||
return uuid;
|
||||
}
|
||||
@ -89,6 +90,15 @@ public class UUIDHandler {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
|
||||
uuid = fetcher.call().get(name);
|
||||
add(nameWrap, uuid);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return getUuidOfflineMode(nameWrap);
|
||||
@ -120,6 +130,16 @@ public class UUIDHandler {
|
||||
return name;
|
||||
}
|
||||
if (online) {
|
||||
if(!Settings.CUSTOM_API) {
|
||||
try {
|
||||
NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
|
||||
name = fetcher.call().get(uuid);
|
||||
add(new StringWrapper(name), uuid);
|
||||
return name;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return PlotMain.getUUIDSaver().mojangName(uuid);
|
||||
} catch(Exception e) {
|
||||
@ -133,6 +153,19 @@ public class UUIDHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
return PlotMain.getUUIDSaver().mojangName(uuid);
|
||||
} catch(Exception e) {
|
||||
try {
|
||||
NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
|
||||
name = fetcher.call().get(uuid);
|
||||
add(new StringWrapper(name), uuid);
|
||||
return name;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "unknown";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user