SteamWar/BauSystem
Archiviert
13
0

Merge pull request 'Refactor to BauServerInfo' (#263) from refactor_bauserverinfo into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #263
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
YoyoNow 2022-02-01 11:23:02 +01:00
Commit ea33274358

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