version 1.1 release
This commit is contained in:
parent
4702589c25
commit
dd713732c6
@ -18,6 +18,7 @@ import net.minestom.server.event.GlobalEventHandler;
|
||||
import net.minestom.server.event.inventory.InventoryPreClickEvent;
|
||||
import net.minestom.server.event.item.ItemDropEvent;
|
||||
import net.minestom.server.event.player.*;
|
||||
import net.minestom.server.extras.bungee.BungeeCordProxy;
|
||||
import net.minestom.server.timer.TaskSchedule;
|
||||
|
||||
import java.time.Duration;
|
||||
@ -44,6 +45,10 @@ public class Main {
|
||||
Config config = Config.getInstance();
|
||||
config.loadConfig();
|
||||
World startworld = config.getStart_world();
|
||||
if (config.isBungeecordEnabled()) {
|
||||
BungeeCordProxy.enable();
|
||||
System.out.println("[Info] Bungeecord enabled");
|
||||
}
|
||||
|
||||
// Add an event callback to specify the spawning instance (and the spawn position)
|
||||
GlobalEventHandler globalEventHandler = MinecraftServer.getGlobalEventHandler();
|
||||
@ -90,7 +95,7 @@ public class Main {
|
||||
if (args.length != 0) System.out.println("Given port doesn't work.");
|
||||
}
|
||||
// Start the server on port default port 25565 if none is given
|
||||
System.out.println("Running on " + IP + ":" + PORT);
|
||||
System.out.println("[Info] Running on " + IP + ":" + PORT);
|
||||
minecraftServer.start(IP, PORT);
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"start_world": "world"
|
||||
"start_world": "world",
|
||||
"bungeecord": false
|
||||
}
|
@ -12,6 +12,7 @@ import java.io.IOException;
|
||||
public class Config {
|
||||
private static Config instance;
|
||||
private World start_world;
|
||||
private boolean bungeecordEnabled = false;
|
||||
public static Config getInstance() {
|
||||
if (instance == null) instance = new Config();
|
||||
return instance;
|
||||
@ -28,6 +29,7 @@ public class Config {
|
||||
System.out.println("no starting world set");
|
||||
System.exit(0);
|
||||
}
|
||||
this.bungeecordEnabled = config.get("bungeecord").getAsBoolean();
|
||||
|
||||
}catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -41,7 +43,8 @@ public class Config {
|
||||
FileWriter fileWriter = new FileWriter("config.json");
|
||||
String default_config = """
|
||||
{
|
||||
"start_world": "world"
|
||||
"start_world": "world",
|
||||
"bungeecord": false
|
||||
}""";
|
||||
fileWriter.write(default_config);
|
||||
fileWriter.close();
|
||||
@ -54,4 +57,8 @@ public class Config {
|
||||
public World getStart_world() {
|
||||
return start_world;
|
||||
}
|
||||
|
||||
public boolean isBungeecordEnabled() {
|
||||
return bungeecordEnabled;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user