SteamWar/BauSystem
Archiviert
13
0

Refactor to BauServerInfo
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaos 2022-01-29 15:30:37 +01:00
Ursprung 50a27a0271
Commit 5d1e8df113

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.bausystem.commands.*;
import de.steamwar.bausystem.world.*;
import de.steamwar.bausystem.world.regions.Region;
import de.steamwar.core.Core;
import de.steamwar.providers.BauServerInfo;
import de.steamwar.scoreboard.SWScoreboard;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
@ -47,7 +48,7 @@ import java.util.logging.Level;
public class BauSystem extends JavaPlugin implements Listener {
private static BauSystem plugin;
private static UUID owner;
private static Integer owner;
public static final String PREFIX = "§eBauSystem§8» §7";
private BukkitTask autoShutdown;
@ -56,12 +57,6 @@ public class BauSystem extends JavaPlugin implements Listener {
public void onEnable() {
plugin = this;
try {
owner = UUID.fromString(Bukkit.getWorlds().get(0).getName());
} catch (IllegalArgumentException e) {
owner = null;
}
Mapper.init();
new CommandTrace();
@ -125,20 +120,15 @@ public class BauSystem extends JavaPlugin implements Listener {
}
public static 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 static 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;
}
@EventHandler