Commits

md_5 authored b0e81a4ede6
Update to Minecraft 1.8.6
No tags

nms-patches/DedicatedServer.patch

Modified
61 61 + } else {
62 62 + s = bufferedreader.readLine();
63 63 + }
64 64 + if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces
65 65 + issueCommand(s, DedicatedServer.this);
66 66 + }
67 67 + // CraftBukkit end
68 68 }
69 69 } catch (IOException ioexception) {
70 70 DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
71 -@@ -67,13 +93,35 @@
71 +@@ -65,6 +91,27 @@
72 + }
73 + };
72 74
73 - thread.setDaemon(true);
74 - thread.start();
75 -+
76 75 + // CraftBukkit start - TODO: handle command-line logging arguments
77 76 + java.util.logging.Logger global = java.util.logging.Logger.getLogger("");
78 77 + global.setUseParentHandlers(false);
79 78 + for (java.util.logging.Handler handler : global.getHandlers()) {
80 79 + global.removeHandler(handler);
81 80 + }
82 81 + global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler());
83 82 +
84 83 + final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger());
85 84 + for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) {
86 85 + if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) {
87 86 + logger.removeAppender(appender);
88 87 + }
89 88 + }
90 89 +
91 90 + new Thread(new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader)).start();
92 91 +
93 92 + System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
94 93 + System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
95 94 + // CraftBukkit end
96 95 +
97 - DedicatedServer.LOGGER.info("Starting minecraft server version 1.8.5");
98 - if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
99 - DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
96 + thread.setDaemon(true);
97 + thread.start();
98 + DedicatedServer.LOGGER.info("Starting minecraft server version 1.8.6");
99 +@@ -73,7 +120,7 @@
100 100 }
101 101
102 102 DedicatedServer.LOGGER.info("Loading properties");
103 103 - this.propertyManager = new PropertyManager(new File("server.properties"));
104 104 + this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
105 105 this.p = new EULA(new File("eula.txt"));
106 106 if (!this.p.a()) {
107 107 DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
108 -@@ -129,6 +177,8 @@
108 +@@ -129,6 +176,8 @@
109 109 return false;
110 110 }
111 111
112 112 + this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
113 113 +
114 114 if (!this.getOnlineMode()) {
115 115 DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
116 116 DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
117 -@@ -143,7 +193,7 @@
117 +@@ -143,7 +192,7 @@
118 118 if (!NameReferencingFileConverter.a(this.propertyManager)) {
119 119 return false;
120 120 } else {
121 121 - this.a((PlayerList) (new DedicatedPlayerList(this)));
122 122 + this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
123 123 long j = System.nanoTime();
124 124
125 125 if (this.U() == null) {
126 -@@ -198,8 +248,19 @@
126 +@@ -198,7 +247,18 @@
127 127 DedicatedServer.LOGGER.info("Starting remote control listener");
128 128 this.n = new RemoteControlListener(this);
129 129 this.n.a();
130 130 + this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
131 - }
132 -
131 ++ }
132 ++
133 133 + // CraftBukkit start
134 134 + if (this.server.getBukkitSpawnRadius() > -1) {
135 135 + DedicatedServer.LOGGER.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
136 136 + this.propertyManager.properties.remove("spawn-protection");
137 137 + this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
138 138 + this.server.removeBukkitSpawnRadius();
139 139 + this.propertyManager.savePropertiesFile();
140 -+ }
140 + }
141 141 + // CraftBukkit end
142 -+
142 +
143 143 if (this.aS() > 0L) {
144 144 Thread thread1 = new Thread(new ThreadWatchdog(this));
145 -
146 -@@ -213,6 +274,12 @@
145 +@@ -213,6 +273,12 @@
147 146 }
148 147 }
149 148
150 149 + // CraftBukkit start
151 150 + public PropertyManager getPropertyManager() {
152 151 + return this.propertyManager;
153 152 + }
154 153 + // CraftBukkit end
155 154 +
156 155 public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) {
157 156 super.setGamemode(worldsettings_enumgamemode);
158 157 this.r = worldsettings_enumgamemode;
159 -@@ -265,7 +332,7 @@
158 +@@ -265,7 +331,7 @@
160 159 System.exit(0);
161 160 }
162 161
163 162 - protected void B() {
164 163 + public void B() { // CraftBukkit - fix decompile error
165 164 super.B();
166 165 this.aO();
167 166 }
168 -@@ -296,7 +363,14 @@
167 +@@ -296,7 +362,14 @@
169 168 while (!this.l.isEmpty()) {
170 169 ServerCommand servercommand = (ServerCommand) this.l.remove(0);
171 170
172 171 - this.getCommandHandler().a(servercommand.source, servercommand.command);
173 172 + // CraftBukkit start - ServerCommand for preprocessing
174 173 + ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command);
175 174 + server.getPluginManager().callEvent(event);
176 175 + servercommand = new ServerCommand(event.getCommand(), servercommand.source);
177 176 +
178 177 + // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
179 178 + server.dispatchServerCommand(console, servercommand);
180 179 + // CraftBukkit end
181 180 }
182 181
183 182 }
184 -@@ -491,13 +565,57 @@
183 +@@ -491,13 +564,57 @@
185 184 }
186 185
187 186 public String getPlugins() {
188 187 - return "";
189 188 - }
190 189 + // CraftBukkit start - Whole method
191 190 + StringBuilder result = new StringBuilder();
192 191 + org.bukkit.plugin.Plugin[] plugins = server.getPluginManager().getPlugins();
193 192 +
194 193 + result.append(server.getName());

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut