SteamWar/BauSystem2.0
Archiviert
12
0

Merge pull request 'Refactor BauServer.java' (#65) from use_spigotcore_data into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #65
Dieser Commit ist enthalten in:
YoyoNow 2022-02-01 09:03:35 +01:00
Commit ed6367e90a

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.config;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.providers.BauServerInfo;
import de.steamwar.sql.SteamwarUser;
import lombok.Getter;
import org.bukkit.Bukkit;
@ -35,30 +36,19 @@ public class BauServer {
public BauServer() {
instance = this;
try {
owner = UUID.fromString(Bukkit.getWorlds().get(0).getName());
} catch (IllegalArgumentException e) {
owner = null;
}
}
private UUID owner;
private Integer owner;
public UUID getOwner() {
//Lazy loading to improve startup time of the server in 1.15
if (owner == null) {
try {
owner = SteamwarUser.get(Integer.parseInt(Bukkit.getWorlds().get(0).getName())).getUUID();
} catch (NumberFormatException e) {
Bukkit.shutdown();
throw new SecurityException("owner is not a UserID", e);
}
}
return owner;
return SteamwarUser.get(getOwnerID()).getUUID();
}
public int getOwnerID() {
return SteamwarUser.get(getOwner()).getId();
//Lazy loading to improve startup time of the server in 1.15
if (owner == null) {
owner = BauServerInfo.getOwnerId();
}
return owner;
}
}