SteamWar/BauSystem
Archiviert
13
0

Refactor to BauServerInfo #263

Zusammengeführt
YoyoNow hat 1 Commits von refactor_bauserverinfo nach master 2022-02-01 11:23:02 +01:00 zusammengeführt
Nur Änderungen aus Commit 5d1e8df113 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

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