Merge pull request 'Refactor BauServer.java' (#65) from use_spigotcore_data into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #65
Dieser Commit ist enthalten in:
Commit
ed6367e90a
@ -21,6 +21,7 @@ package de.steamwar.bausystem.config;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import de.steamwar.providers.BauServerInfo;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -35,30 +36,19 @@ public class BauServer {
|
|||||||
|
|
||||||
public BauServer() {
|
public BauServer() {
|
||||||
instance = this;
|
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() {
|
public 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 int getOwnerID() {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren