mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-25 17:08:32 +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,19 +73,29 @@ public class UUIDHandler {
|
||||
}
|
||||
UUID uuid;
|
||||
if (online) {
|
||||
if ((uuid = getUuidOnlinePlayer(nameWrap)) != null) {
|
||||
return uuid;
|
||||
}
|
||||
try {
|
||||
return PlotMain.getUUIDSaver().mojangUUID(name);
|
||||
}
|
||||
catch(Exception e) {
|
||||
if(Settings.CUSTOM_API) {
|
||||
if ((uuid = getUuidOnlinePlayer(nameWrap)) != null) {
|
||||
return uuid;
|
||||
}
|
||||
try {
|
||||
return PlotMain.getUUIDSaver().mojangUUID(name);
|
||||
}
|
||||
catch(Exception e) {
|
||||
try {
|
||||
UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
|
||||
uuid = fetcher.call().get(name);
|
||||
add(nameWrap, uuid);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
UUIDFetcher fetcher = new UUIDFetcher(Arrays.asList(name));
|
||||
uuid = fetcher.call().get(name);
|
||||
add(nameWrap, uuid);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -120,6 +130,29 @@ 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) {
|
||||
try {
|
||||
NameFetcher fetcher = new NameFetcher(Arrays.asList(uuid));
|
||||
name = fetcher.call().get(uuid);
|
||||
add(new StringWrapper(name), uuid);
|
||||
return name;
|
||||
} catch (Exception ex) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
return PlotMain.getUUIDSaver().mojangName(uuid);
|
||||
} catch(Exception e) {
|
||||
@ -129,7 +162,7 @@ public class UUIDHandler {
|
||||
add(new StringWrapper(name), uuid);
|
||||
return name;
|
||||
} catch (Exception ex) {
|
||||
e.printStackTrace();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user