mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 14:38:53 +00:00
Fix initialisation crash failing compilation (#320)
This commit is contained in:
1 parent
23a7b2a903
commit
a31647be4a
2 files changed
+8
-9
No files matched your search
@@ -19,27 +19,26 @@ public class Server {
|
||||
/**
|
||||
* Default (unknown) server identifier
|
||||
*/
|
||||
public static Server getDefault() {
|
||||
final Server server = new Server();
|
||||
public static String getDefaultServerName() {
|
||||
try {
|
||||
final Path serverDirectory = Path.of(System.getProperty("user.dir"));
|
||||
server.name = serverDirectory.getFileName().toString().trim();
|
||||
return serverDirectory.getFileName().toString().trim();
|
||||
} catch (Exception e) {
|
||||
server.name = "server";
|
||||
return "server";
|
||||
}
|
||||
return server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy-defined name of this server
|
||||
*/
|
||||
@YamlKey("server_name")
|
||||
public String name = getDefault().name;
|
||||
public String name = getDefaultServerName();
|
||||
|
||||
public Server(@NotNull String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Server() {
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user