mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Support asynchronous events; Addresses BUKKIT-1212
This commit is contained in:
parent
f58e514192
commit
ed6d4c7759
2 changed files with 9 additions and 3 deletions
|
@ -14,7 +14,6 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import jline.console.ConsoleReader;
|
import jline.console.ConsoleReader;
|
||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
|
@ -83,6 +82,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
|
||||||
public RemoteConsoleCommandSender remoteConsole;
|
public RemoteConsoleCommandSender remoteConsole;
|
||||||
public ConsoleReader reader;
|
public ConsoleReader reader;
|
||||||
public static int currentTick;
|
public static int currentTick;
|
||||||
|
public final Thread primaryThread;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public MinecraftServer(OptionSet options) { // CraftBukkit - adds argument OptionSet
|
public MinecraftServer(OptionSet options) { // CraftBukkit - adds argument OptionSet
|
||||||
|
@ -106,6 +106,8 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Runtime.getRuntime().addShutdownHook(new ServerShutdownThread(this));
|
Runtime.getRuntime().addShutdownHook(new ServerShutdownThread(this));
|
||||||
|
|
||||||
|
primaryThread = new ThreadServerApplication("Server thread", this); // Moved from main
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,7 +627,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
|
||||||
|
|
||||||
// CraftBukkit - remove gui
|
// CraftBukkit - remove gui
|
||||||
|
|
||||||
(new ThreadServerApplication("Server thread", minecraftserver)).start();
|
minecraftserver.primaryThread.start(); // CraftBukkit - let MinecraftServer construct the thread
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
log.log(Level.SEVERE, "Failed to start the minecraft server", exception);
|
log.log(Level.SEVERE, "Failed to start the minecraft server", exception);
|
||||||
}
|
}
|
||||||
|
@ -779,7 +781,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
|
||||||
public String[] r() {
|
public String[] r() {
|
||||||
return (String[]) this.serverConfigurationManager.getBannedPlayers().toArray(new String[0]);
|
return (String[]) this.serverConfigurationManager.getBannedPlayers().toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getServerModName() {
|
public String getServerModName() {
|
||||||
return "craftbukkit"; // CraftBukkit - cb > vanilla!
|
return "craftbukkit"; // CraftBukkit - cb > vanilla!
|
||||||
}
|
}
|
||||||
|
|
|
@ -1182,4 +1182,8 @@ public final class CraftServer implements Server {
|
||||||
public int getWaterAnimalSpawnLimit() {
|
public int getWaterAnimalSpawnLimit() {
|
||||||
return waterAnimalSpawn;
|
return waterAnimalSpawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPrimaryThread() {
|
||||||
|
return Thread.currentThread().equals(console.primaryThread);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue