Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUID-based DB / DB overhaul 2023 (Redux) #6743

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Towny/src/main/java/com/palmergames/bukkit/towny/Towny.java
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,6 @@ else if (getServer().getName().equalsIgnoreCase("craftbukkit"))
metrics.addCustomChart(new SimplePie("town_block_size", () -> String.valueOf(TownySettings.getTownBlockSize())));

metrics.addCustomChart(new SimplePie("closed_economy_enabled", () -> String.valueOf(TownySettings.isEcoClosedEconomyEnabled())));

metrics.addCustomChart(new SimplePie("resident_uuids_stored", TownySettings::getUUIDPercent));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public record NationLevel(

private static CommentedConfiguration config;
private static CommentedConfiguration newConfig;
private static int uuidCount;
private static boolean areLevelTypeLimitsConfigured;

private static final SortedMap<Integer, TownLevel> configTownLevel = Collections.synchronizedSortedMap(new TreeMap<>(Collections.reverseOrder()));
Expand Down Expand Up @@ -1028,6 +1027,11 @@ public static String getSaveDatabase() {
return DatabaseConfig.getString(DatabaseConfig.DATABASE_SAVE);
}

public static boolean isServerUsingLegacySQLDB() {
return getLoadDatabase().toLowerCase(Locale.ROOT).equals("mysql")
&& getSaveDatabase().toLowerCase(Locale.ROOT).equals("mysql") && getDatabaseVersion().equals("1");
}

// SQL
public static String getSQLHostName() {

Expand Down Expand Up @@ -3121,37 +3125,6 @@ public static Map<String,String> getTownColorsMap() {
return townColorsMap;
}

public static String getUUIDPercent() {
double fraction = (double) uuidCount / TownyUniverse.getInstance().getNumResidents();

if (fraction == 1.00)
return "100%";
if (fraction > 0.89)
return "90%+";
if (fraction > 0.79)
return "80%+";
if (fraction > 0.69)
return "70%+";
if (fraction > 0.59)
return "60%+";
if (fraction > 0.49)
return "50%+";

return "<50%";
}

public static int getUUIDCount() {
return uuidCount;
}

public static void setUUIDCount(int hasUUID) {
uuidCount = hasUUID;
}

public static void incrementUUIDCount() {
uuidCount++;
}

public static boolean isTownBankruptcyEnabled() {
return getBoolean(ConfigNodes.ECO_BANKRUPTCY_ENABLED);
}
Expand Down
Loading