mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +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.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
|
||||||
Settings.DELETE_PLOTS_ON_BAN = config.getBoolean("clear.on.ban");
|
Settings.DELETE_PLOTS_ON_BAN = config.getBoolean("clear.on.ban");
|
||||||
Settings.API_URL = config.getString("api.location");
|
Settings.API_URL = config.getString("api.location");
|
||||||
|
Settings.CUSTOM_API = config.getBoolean("api.custom");
|
||||||
}
|
}
|
||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
Map<String, String> settings = new HashMap<>();
|
Map<String, String> settings = new HashMap<>();
|
||||||
@ -1087,6 +1088,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
options.put("max_plots", Settings.MAX_PLOTS);
|
options.put("max_plots", Settings.MAX_PLOTS);
|
||||||
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
|
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH);
|
||||||
options.put("api.location", Settings.API_URL);
|
options.put("api.location", Settings.API_URL);
|
||||||
|
options.put("api.custom", Settings.CUSTOM_API);
|
||||||
|
|
||||||
for (Entry<String, Object> node : options.entrySet()) {
|
for (Entry<String, Object> node : options.entrySet()) {
|
||||||
if (!config.contains(node.getKey())) {
|
if (!config.contains(node.getKey())) {
|
||||||
|
@ -61,6 +61,7 @@ public class Settings {
|
|||||||
public static boolean AUTO_CLEAR = false;
|
public static boolean AUTO_CLEAR = false;
|
||||||
public static int AUTO_CLEAR_DAYS = 365;
|
public static int AUTO_CLEAR_DAYS = 365;
|
||||||
public static String API_URL = "http://www.intellectualsites.com/minecraft.php";
|
public static String API_URL = "http://www.intellectualsites.com/minecraft.php";
|
||||||
|
public static boolean CUSTOM_API = true;
|
||||||
|
|
||||||
public static class Update {
|
public static class Update {
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +73,7 @@ public class UUIDHandler {
|
|||||||
}
|
}
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
if (online) {
|
if (online) {
|
||||||
|
if(Settings.CUSTOM_API) {
|
||||||
if ((uuid = getUuidOnlinePlayer(nameWrap)) != null) {
|
if ((uuid = getUuidOnlinePlayer(nameWrap)) != null) {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
@ -89,6 +90,15 @@ public class UUIDHandler {
|
|||||||
ex.printStackTrace();
|
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 {
|
else {
|
||||||
return getUuidOfflineMode(nameWrap);
|
return getUuidOfflineMode(nameWrap);
|
||||||
@ -120,6 +130,16 @@ public class UUIDHandler {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
if (online) {
|
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 {
|
try {
|
||||||
return PlotMain.getUUIDSaver().mojangName(uuid);
|
return PlotMain.getUUIDSaver().mojangName(uuid);
|
||||||
} catch(Exception e) {
|
} 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 {
|
else {
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user