Commits

Erik Broes authored c49239fa8c5
Moved from jd-gui to jad
No tags

src/net/minecraft/server/MinecraftServer.java

Modified
1 1 package net.minecraft.server;
2 2
3 -import java.awt.GraphicsEnvironment;
3 +
4 4 import java.io.File;
5 5 import java.io.IOException;
6 6 import java.io.PrintStream;
7 7 import java.net.InetAddress;
8 8 import java.net.UnknownHostException;
9 9 import java.util.ArrayList;
10 10 import java.util.Collections;
11 11 import java.util.HashMap;
12 +import java.util.Iterator;
12 13 import java.util.List;
14 +import java.util.Set;
13 15 import java.util.logging.Level;
14 16 import java.util.logging.Logger;
17 +
15 18 import org.bukkit.craftbukkit.CraftServer;
16 19
20 +
17 21 public class MinecraftServer
18 22 implements ICommandListener, Runnable {
19 23
20 24 public static Logger a = Logger.getLogger("Minecraft");
21 - public static HashMap<String, Integer> b = new HashMap<String, Integer>();
25 + public static HashMap b = new HashMap();
22 26 public NetworkListenThread c;
23 27 public PropertyManager d;
24 28 public WorldServer e;
25 29 public ServerConfigurationManager f;
26 - private boolean o = true;
27 - public boolean g = false;
28 - int h = 0;
30 + private boolean o;
31 + public boolean g;
32 + int h;
29 33 public String i;
30 34 public int j;
31 - private List p = new ArrayList();
32 - private List q = Collections.synchronizedList(new ArrayList());
35 + private List p;
36 + private List q;
33 37 public EntityTracker k;
34 38 public boolean l;
35 39 public boolean m;
36 40 public boolean n;
41 +
37 42 public CraftServer server; // CraftBukkit
38 43
39 44 public MinecraftServer() {
45 + o = true;
46 + g = false;
47 + h = 0;
48 + p = new ArrayList();
49 + q = Collections.synchronizedList(new ArrayList());
40 50 new ThreadSleepForever(this);
41 51 }
42 52
43 - // CraftBukkit: Decompiler might miss this method, your IDE won't complain but you
44 - // can't run without it!
45 - public static boolean a(MinecraftServer minecraftserver)
46 - {
47 - return minecraftserver.o;
48 - }
49 -
53 + // CraftBukkit: added throws UnknownHostException
50 54 private boolean d() throws UnknownHostException {
51 - ThreadCommandReader localThreadCommandReader = new ThreadCommandReader(this);
52 -
53 - localThreadCommandReader.setDaemon(true);
54 - localThreadCommandReader.start();
55 + ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
55 56
57 + threadcommandreader.setDaemon(true);
58 + threadcommandreader.start();
56 59 ConsoleLogManager.a();
57 60 a.info("Starting minecraft server version Beta 1.1_02");
58 -
59 61 if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
60 62 a.warning("**** NOT ENOUGH RAM!");
61 63 a.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
62 64 }
63 -
64 65 a.info("Loading properties");
65 - this.d = new PropertyManager(new File("server.properties"));
66 - String str1 = this.d.a("server-ip", "");
66 + d = new PropertyManager(new File("server.properties"));
67 + String s = d.a("server-ip", "");
67 68
68 - this.l = this.d.a("online-mode", true);
69 - this.m = this.d.a("spawn-animals", true);
70 - this.n = this.d.a("pvp", true);
69 + l = d.a("online-mode", true);
70 + m = d.a("spawn-animals", true);
71 + n = d.a("pvp", true);
72 + InetAddress inetaddress = null;
71 73
72 - InetAddress localInetAddress = null;
73 - if (str1.length() > 0) {
74 - localInetAddress = InetAddress.getByName(str1);
74 + if (s.length() > 0) {
75 + inetaddress = InetAddress.getByName(s);
75 76 }
76 - int i1 = this.d.a("server-port", 25565);
77 + int i1 = d.a("server-port", 25565);
77 78
78 - a.info("Starting Minecraft server on " + (str1.length() == 0 ? "*" : str1) + ":" + i1);
79 + a.info((new StringBuilder()).append("Starting Minecraft server on ").append(s.length() != 0 ? s : "*").append(":").append(i1).toString());
79 80 try {
80 - this.c = new NetworkListenThread(this, localInetAddress, i1);
81 - } catch (Throwable localIOException) {
81 + c = new NetworkListenThread(this, inetaddress, i1);
82 + // CraftBukkit: Be more generic; IOException -> Throwable
83 + } catch (Throwable ioexception) {
82 84 a.warning("**** FAILED TO BIND TO PORT!");
83 - a.log(Level.WARNING, "The exception was: " + localIOException.toString());
85 + a.log(Level.WARNING, (new StringBuilder()).append("The exception was: ").append(ioexception.toString()).toString());
84 86 a.warning("Perhaps a server is already running on that port?");
85 87 return false;
86 88 }
87 -
88 - if (!this.l) {
89 + if (!l) {
89 90 a.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
90 91 a.warning("The server will make no attempt to authenticate usernames. Beware.");
91 92 a.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
92 93 a.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file.");
93 94 }
94 95
95 96 server = new CraftServer(this, "1.1"); // CraftBukkit
96 97
97 - this.f = new ServerConfigurationManager(this);
98 - this.k = new EntityTracker(this);
98 + f = new ServerConfigurationManager(this);
99 + k = new EntityTracker(this);
100 + String s1 = d.a("level-name", "world");
99 101
100 - String str2 = this.d.a("level-name", "world");
101 - a.info("Preparing level \"" + str2 + "\"");
102 - c(str2);
102 + a.info((new StringBuilder()).append("Preparing level \"").append(s1).append("\"").toString());
103 + c(s1);
103 104 a.info("Done! For help, type \"help\" or \"?\"");
104 -
105 105 return true;
106 106 }
107 107
108 - private void c(String paramString) {
108 + private void c(String s) {
109 109 a.info("Preparing start region");
110 - this.e = new WorldServer(this, new File("."), paramString, this.d.a("hellworld", false) ? -1 : 0);
111 - this.e.a(new WorldManager(this));
112 - this.e.k = (this.d.a("spawn-monsters", true) ? 1 : 0);
113 - this.f.a(this.e);
114 - int i1 = 10;
115 - for (int i2 = -i1; i2 <= i1; i2++) {
116 - a("Preparing spawn area", (i2 + i1) * 100 / (i1 + i1 + 1));
117 - for (int i3 = -i1; i3 <= i1; i3++) {
118 - if (!this.o) {
110 + e = new WorldServer(this, new File("."), s, d.a("hellworld", false) ? -1 : 0);
111 + e.a(new WorldManager(this));
112 + e.k = d.a("spawn-monsters", true) ? 1 : 0;
113 + f.a(e);
114 + byte byte0 = 10;
115 +
116 + for (int i1 = -byte0; i1 <= byte0; i1++) {
117 + a("Preparing spawn area", ((i1 + byte0) * 100) / (byte0 + byte0 + 1));
118 + for (int j1 = -byte0; j1 <= byte0; j1++) {
119 + if (!o) {
119 120 return;
120 121 }
121 - this.e.A.d((this.e.m >> 4) + i2, (this.e.o >> 4) + i3);
122 + e.A.d((e.m >> 4) + i1, (e.o >> 4) + j1);
122 123 }
124 +
123 125 }
126 +
124 127 e();
125 128 }
126 129
127 - private void a(String paramString, int paramInt) {
128 - this.i = paramString;
129 - this.j = paramInt;
130 - System.out.println(paramString + ": " + paramInt + "%");
130 + private void a(String s, int i1) {
131 + i = s;
132 + j = i1;
133 + System.out.println((new StringBuilder()).append(s).append(": ").append(i1).append("%").toString());
131 134 }
132 135
133 136 private void e() {
134 - this.i = null;
135 - this.j = 0;
137 + i = null;
138 + j = 0;
136 139 }
137 140
138 141 private void f() {
139 142 a.info("Saving chunks");
140 - this.e.a(true, null);
143 + e.a(true, null);
141 144 }
142 145
143 146 private void g() {
144 147 a.info("Stopping server");
145 - if (this.f != null) {
146 - this.f.d();
148 + if (f != null) {
149 + f.d();
147 150 }
148 - if (this.e != null) {
151 + if (e != null) {
149 152 f();
150 153 }
151 154 }
152 155
153 156 public void a() {
154 - this.o = false;
157 + o = false;
155 158 }
156 159
157 160 public void run() {
158 161 try {
159 162 if (d()) {
160 163 long l1 = System.currentTimeMillis();
161 164 long l2 = 0L;
162 - while (this.o) {
165 +
166 + while (o) {
163 167 long l3 = System.currentTimeMillis();
164 168 long l4 = l3 - l1;
169 +
165 170 if (l4 > 2000L) {
166 171 a.warning("Can't keep up! Did the system time change, or is the server overloaded?");
167 172 l4 = 2000L;
168 173 }
169 174 if (l4 < 0L) {
170 175 a.warning("Time ran backwards! Did the system time change?");
171 176 l4 = 0L;
172 177 }
173 178 l2 += l4;
174 179 l1 = l3;
175 -
176 180 while (l2 > 50L) {
177 181 l2 -= 50L;
178 182 h();
179 183 }
180 -
181 184 Thread.sleep(1L);
182 185 }
183 186 } else {
184 - while (this.o) {
187 + while (o) {
185 188 b();
186 189 try {
187 190 Thread.sleep(10L);
188 - } catch (InterruptedException localInterruptedException1) {
189 - localInterruptedException1.printStackTrace();
191 + } catch (InterruptedException interruptedexception) {
192 + interruptedexception.printStackTrace();
190 193 }
191 194 }
192 195 }
193 - } catch (Exception localException) {
194 - localException.printStackTrace();
195 - a.log(Level.SEVERE, "Unexpected exception", localException);
196 - while (this.o) {
196 + } catch (Exception exception) {
197 + exception.printStackTrace();
198 + a.log(Level.SEVERE, "Unexpected exception", exception);
199 + while (o) {
197 200 b();
198 201 try {
199 202 Thread.sleep(10L);
200 - } catch (InterruptedException localInterruptedException2) {
201 - localInterruptedException2.printStackTrace();
203 + } catch (InterruptedException interruptedexception1) {
204 + interruptedexception1.printStackTrace();
202 205 }
203 206 }
204 207 } finally {
205 208 g();
206 - this.g = true;
209 + g = true;
207 210 System.exit(0);
208 211 }
209 212 }
210 213
211 214 private void h() {
212 - ArrayList localArrayList = new ArrayList();
213 - for (String str : b.keySet()) {
214 - int i2 = ((Integer) b.get(str)).intValue();
215 - if (i2 > 0) {
216 - b.put(str, Integer.valueOf(i2 - 1));
215 + ArrayList arraylist = new ArrayList();
216 +
217 + for (Iterator iterator = b.keySet().iterator(); iterator.hasNext();) {
218 + String s = (String) iterator.next();
219 + int k1 = ((Integer) b.get(s)).intValue();
220 +
221 + if (k1 > 0) {
222 + b.put(s, Integer.valueOf(k1 - 1));
217 223 } else {
218 - localArrayList.add(str);
224 + arraylist.add(s);
219 225 }
220 226 }
221 - for (int i1 = 0; i1 < localArrayList.size(); i1++) {
222 - b.remove(localArrayList.get(i1));
227 +
228 + for (int i1 = 0; i1 < arraylist.size(); i1++) {
229 + b.remove(arraylist.get(i1));
223 230 }
224 231
225 232 AxisAlignedBB.a();
226 233 Vec3D.a();
227 - this.h += 1;
228 -
229 - if (this.h % 20 == 0) {
230 - this.f.a(new Packet4UpdateTime(this.e.e));
234 + h++;
235 + if (h % 20 == 0) {
236 + f.a(new Packet4UpdateTime(e.e));
231 237 }
232 -
233 - this.e.f();
234 - while (this.e.d());
235 - this.e.c();
236 - this.c.a();
237 - this.f.b();
238 - this.k.a();
239 -
240 - for (int i1 = 0; i1 < this.p.size(); i1++) {
241 - ((IUpdatePlayerListBox) this.p.get(i1)).a();
238 + e.f();
239 + while (e.d()) {
240 + ;
242 241 }
242 + e.c();
243 + c.a();
244 + f.b();
245 + k.a();
246 + for (int j1 = 0; j1 < p.size(); j1++) {
247 + ((IUpdatePlayerListBox) p.get(j1)).a();
248 + }
249 +
243 250 try {
244 251 b();
245 - } catch (Exception localException) {
246 - a.log(Level.WARNING, "Unexpected exception while parsing console command", localException);
252 + } catch (Exception exception) {
253 + a.log(Level.WARNING, "Unexpected exception while parsing console command", exception);
247 254 }
248 255 }
249 256
250 - public void a(String paramString, ICommandListener paramICommandListener) {
251 - this.q.add(new ServerCommand(paramString, paramICommandListener));
257 + public void a(String s, ICommandListener icommandlistener) {
258 + q.add(new ServerCommand(s, icommandlistener));
252 259 }
253 260
254 261 public void b() {
255 - while (this.q.size() > 0) {
256 - ServerCommand localServerCommand = (ServerCommand) this.q.remove(0);
257 - String str1 = localServerCommand.a;
258 - ICommandListener localICommandListener = localServerCommand.b;
259 - String str2 = localICommandListener.c();
260 - if ((str1.toLowerCase().startsWith("help")) || (str1.toLowerCase().startsWith("?"))) {
261 - localICommandListener.b("To run the server without a gui, start it like this:");
262 - localICommandListener.b(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui");
263 - localICommandListener.b("Console commands:");
264 - localICommandListener.b(" help or ? shows this message");
265 - localICommandListener.b(" kick <player> removes a player from the server");
266 - localICommandListener.b(" ban <player> bans a player from the server");
267 - localICommandListener.b(" pardon <player> pardons a banned player so that they can connect again");
268 - localICommandListener.b(" ban-ip <ip> bans an IP address from the server");
269 - localICommandListener.b(" pardon-ip <ip> pardons a banned IP address so that they can connect again");
270 - localICommandListener.b(" op <player> turns a player into an op");
271 - localICommandListener.b(" deop <player> removes op status from a player");
272 - localICommandListener.b(" tp <player1> <player2> moves one player to the same location as another player");
273 - localICommandListener.b(" give <player> <id> [num] gives a player a resource");
274 - localICommandListener.b(" tell <player> <message> sends a private message to a player");
275 - localICommandListener.b(" stop gracefully stops the server");
276 - localICommandListener.b(" save-all forces a server-wide level save");
277 - localICommandListener.b(" save-off disables terrain saving (useful for backup scripts)");
278 - localICommandListener.b(" save-on re-enables terrain saving");
279 - localICommandListener.b(" list lists all currently connected players");
280 - localICommandListener.b(" say <message> broadcasts a message to all players");
281 - } else if (str1.toLowerCase().startsWith("list")) {
282 - localICommandListener.b("Connected players: " + this.f.c());
283 - } else if (str1.toLowerCase().startsWith("stop")) {
284 - a(str2, "Stopping the server..");
285 - this.o = false;
286 - } else if (str1.toLowerCase().startsWith("save-all")) {
287 - a(str2, "Forcing save..");
288 - this.e.a(true, null);
289 - a(str2, "Save complete.");
290 - } else if (str1.toLowerCase().startsWith("save-off")) {
291 - a(str2, "Disabling level saving..");
292 - this.e.C = true;
293 - } else if (str1.toLowerCase().startsWith("save-on")) {
294 - a(str2, "Enabling level saving..");
295 - this.e.C = false;
296 - } else {
297 - Object localObject1;
298 - if (str1.toLowerCase().startsWith("op ")) {
299 - localObject1 = str1.substring(str1.indexOf(" ")).trim();
300 - this.f.e((String) localObject1);
301 - a(str2, "Opping " + (String) localObject1);
302 - this.f.a((String) localObject1, "§eYou are now op!");
303 - } else if (str1.toLowerCase().startsWith("deop ")) {
304 - localObject1 = str1.substring(str1.indexOf(" ")).trim();
305 - this.f.f((String) localObject1);
306 - this.f.a((String) localObject1, "§eYou are no longer op!");
307 - a(str2, "De-opping " + (String) localObject1);
308 - } else if (str1.toLowerCase().startsWith("ban-ip ")) {
309 - localObject1 = str1.substring(str1.indexOf(" ")).trim();
310 - this.f.c((String) localObject1);
311 - a(str2, "Banning ip " + (String) localObject1);
312 - } else if (str1.toLowerCase().startsWith("pardon-ip ")) {
313 - localObject1 = str1.substring(str1.indexOf(" ")).trim();
314 - this.f.d((String) localObject1);
315 - a(str2, "Pardoning ip " + (String) localObject1);
316 - } else {
317 - Object localObject2;
318 - if (str1.toLowerCase().startsWith("ban ")) {
319 - localObject1 = str1.substring(str1.indexOf(" ")).trim();
320 - this.f.a((String) localObject1);
321 - a(str2, "Banning " + (String) localObject1);
262 + do {
263 + if (q.size() <= 0) {
264 + break;
265 + }
266 + ServerCommand servercommand = (ServerCommand) q.remove(0);
267 + String s = servercommand.a;
268 + ICommandListener icommandlistener = servercommand.b;
269 + String s1 = icommandlistener.c();
270 +
271 + if (s.toLowerCase().startsWith("help") || s.toLowerCase().startsWith("?")) {
272 + icommandlistener.b("To run the server without a gui, start it like this:");
273 + icommandlistener.b(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui");
274 + icommandlistener.b("Console commands:");
275 + icommandlistener.b(" help or ? shows this message");
276 + icommandlistener.b(" kick <player> removes a player from the server");
277 + icommandlistener.b(" ban <player> bans a player from the server");
278 + icommandlistener.b(" pardon <player> pardons a banned player so that they can connect again");
279 + icommandlistener.b(" ban-ip <ip> bans an IP address from the server");
280 + icommandlistener.b(" pardon-ip <ip> pardons a banned IP address so that they can connect again");
281 + icommandlistener.b(" op <player> turns a player into an op");
282 + icommandlistener.b(" deop <player> removes op status from a player");
283 + icommandlistener.b(" tp <player1> <player2> moves one player to the same location as another player");
284 + icommandlistener.b(" give <player> <id> [num] gives a player a resource");
285 + icommandlistener.b(" tell <player> <message> sends a private message to a player");
286 + icommandlistener.b(" stop gracefully stops the server");
287 + icommandlistener.b(" save-all forces a server-wide level save");
288 + icommandlistener.b(" save-off disables terrain saving (useful for backup scripts)");
289 + icommandlistener.b(" save-on re-enables terrain saving");
290 + icommandlistener.b(" list lists all currently connected players");
291 + icommandlistener.b(" say <message> broadcasts a message to all players");
292 + } else if (s.toLowerCase().startsWith("list")) {
293 + icommandlistener.b((new StringBuilder()).append("Connected players: ").append(f.c()).toString());
294 + } else if (s.toLowerCase().startsWith("stop")) {
295 + a(s1, "Stopping the server..");
296 + o = false;
297 + } else if (s.toLowerCase().startsWith("save-all")) {
298 + a(s1, "Forcing save..");
299 + e.a(true, null);
300 + a(s1, "Save complete.");
301 + } else if (s.toLowerCase().startsWith("save-off")) {
302 + a(s1, "Disabling level saving..");
303 + e.C = true;
304 + } else if (s.toLowerCase().startsWith("save-on")) {
305 + a(s1, "Enabling level saving..");
306 + e.C = false;
307 + } else if (s.toLowerCase().startsWith("op ")) {
308 + String s2 = s.substring(s.indexOf(" ")).trim();
309 +
310 + f.e(s2);
311 + a(s1, (new StringBuilder()).append("Opping ").append(s2).toString());
312 + f.a(s2, "\247eYou are now op!");
313 + } else if (s.toLowerCase().startsWith("deop ")) {
314 + String s3 = s.substring(s.indexOf(" ")).trim();
315 +
316 + f.f(s3);
317 + f.a(s3, "\247eYou are no longer op!");
318 + a(s1, (new StringBuilder()).append("De-opping ").append(s3).toString());
319 + } else if (s.toLowerCase().startsWith("ban-ip ")) {
320 + String s4 = s.substring(s.indexOf(" ")).trim();
321 +
322 + f.c(s4);
323 + a(s1, (new StringBuilder()).append("Banning ip ").append(s4).toString());
324 + } else if (s.toLowerCase().startsWith("pardon-ip ")) {
325 + String s5 = s.substring(s.indexOf(" ")).trim();
326 +
327 + f.d(s5);
328 + a(s1, (new StringBuilder()).append("Pardoning ip ").append(s5).toString());
329 + } else if (s.toLowerCase().startsWith("ban ")) {
330 + String s6 = s.substring(s.indexOf(" ")).trim();
331 +
332 + f.a(s6);
333 + a(s1, (new StringBuilder()).append("Banning ").append(s6).toString());
334 + EntityPlayerMP entityplayermp = f.h(s6);
335 +
336 + if (entityplayermp != null) {
337 + entityplayermp.a.a("Banned by admin");
338 + }
339 + } else if (s.toLowerCase().startsWith("pardon ")) {
340 + String s7 = s.substring(s.indexOf(" ")).trim();
322 341
323 - localObject2 = this.f.h((String) localObject1);
342 + f.b(s7);
343 + a(s1, (new StringBuilder()).append("Pardoning ").append(s7).toString());
344 + } else if (s.toLowerCase().startsWith("kick ")) {
345 + String s8 = s.substring(s.indexOf(" ")).trim();
346 + EntityPlayerMP entityplayermp1 = null;
324 347
325 - if (localObject2 != null) {
326 - ((EntityPlayerMP) localObject2).a.a("Banned by admin");
327 - }
348 + for (int i1 = 0; i1 < f.b.size(); i1++) {
349 + EntityPlayerMP entityplayermp5 = (EntityPlayerMP) f.b.get(i1);
328 350
329 - } else if (str1.toLowerCase().startsWith("pardon ")) {
330 - localObject1 = str1.substring(str1.indexOf(" ")).trim();
331 - this.f.b((String) localObject1);
332 - a(str2, "Pardoning " + (String) localObject1);
333 - } else if (str1.toLowerCase().startsWith("kick ")) {
334 - localObject1 = str1.substring(str1.indexOf(" ")).trim();
335 - localObject2 = null;
336 - for (int i1 = 0; i1 < this.f.b.size(); i1++) {
337 - EntityPlayerMP localEntityPlayerMP2 = (EntityPlayerMP) this.f.b.get(i1);
338 - if (localEntityPlayerMP2.aw.equalsIgnoreCase((String) localObject1)) {
339 - localObject2 = localEntityPlayerMP2;
340 - }
341 - }
351 + if (entityplayermp5.aw.equalsIgnoreCase(s8)) {
352 + entityplayermp1 = entityplayermp5;
353 + }
354 + }
342 355
343 - if (localObject2 != null) {
344 - ((EntityPlayerMP) localObject2).a.a("Kicked by admin");
345 - a(str2, "Kicking " + ((EntityPlayerMP) localObject2).aw);
346 - } else {
347 - localICommandListener.b("Can't find user " + (String) localObject1 + ". No kick.");
348 - }
356 + if (entityplayermp1 != null) {
357 + entityplayermp1.a.a("Kicked by admin");
358 + a(s1, (new StringBuilder()).append("Kicking ").append(entityplayermp1.aw).toString());
359 + } else {
360 + icommandlistener.b((new StringBuilder()).append("Can't find user ").append(s8).append(". No kick.").toString());
361 + }
362 + } else if (s.toLowerCase().startsWith("tp ")) {
363 + String as[] = s.split(" ");
364 +
365 + if (as.length == 3) {
366 + EntityPlayerMP entityplayermp2 = f.h(as[1]);
367 + EntityPlayerMP entityplayermp3 = f.h(as[2]);
368 +
369 + if (entityplayermp2 == null) {
370 + icommandlistener.b((new StringBuilder()).append("Can't find user ").append(as[1]).append(". No tp.").toString());
371 + } else if (entityplayermp3 == null) {
372 + icommandlistener.b((new StringBuilder()).append("Can't find user ").append(as[2]).append(". No tp.").toString());
349 373 } else {
350 - EntityPlayerMP localEntityPlayerMP1;
351 - if (str1.toLowerCase().startsWith("tp ")) {
352 - String[] split = str1.split(" ");
353 - if (split.length == 3) {
354 - localObject2 = this.f.h(split[1]);
355 - localEntityPlayerMP1 = this.f.h(split[2]);
356 -
357 - if (localObject2 == null) {
358 - localICommandListener.b("Can't find user " + split[1] + ". No tp.");
359 - } else if (localEntityPlayerMP1 == null) {
360 - localICommandListener.b("Can't find user " + split[2] + ". No tp.");
361 - } else {
362 - ((EntityPlayerMP) localObject2).a.a(localEntityPlayerMP1.p, localEntityPlayerMP1.q, localEntityPlayerMP1.r, localEntityPlayerMP1.v, localEntityPlayerMP1.w);
363 - a(str2, "Teleporting " + split[1] + " to " + split[2] + ".");
364 - }
365 - } else {
366 - localICommandListener.b("Syntax error, please provice a source and a target.");
367 - }
368 - } else if (str1.toLowerCase().startsWith("give ")) {
369 - String[] split = str1.split(" ");
370 - if ((split.length != 3) && (split.length != 4)) {
371 - return;
372 - }
374 + entityplayermp2.a.a(entityplayermp3.p, entityplayermp3.q, entityplayermp3.r, entityplayermp3.v, entityplayermp3.w);
375 + a(s1, (new StringBuilder()).append("Teleporting ").append(as[1]).append(" to ").append(as[2]).append(".").toString());
376 + }
377 + } else {
378 + icommandlistener.b("Syntax error, please provice a source and a target.");
379 + }
380 + } else if (s.toLowerCase().startsWith("give ")) {
381 + String as1[] = s.split(" ");
382 +
383 + if (as1.length != 3 && as1.length != 4) {
384 + return;
385 + }
386 + String s9 = as1[1];
387 + EntityPlayerMP entityplayermp4 = f.h(s9);
388 +
389 + if (entityplayermp4 != null) {
390 + try {
391 + int j1 = Integer.parseInt(as1[2]);
392 +
393 + if (Item.c[j1] != null) {
394 + a(s1, (new StringBuilder()).append("Giving ").append(entityplayermp4.aw).append(" some ").append(j1).toString());
395 + int k1 = 1;
373 396
374 - localObject2 = split[1];
375 - localEntityPlayerMP1 = this.f.h((String) localObject2);
376 -
377 - if (localEntityPlayerMP1 != null) {
378 - try {
379 - int i2 = Integer.parseInt(split[2]);
380 - if (Item.c[i2] != null) {
381 - a(str2, "Giving " + localEntityPlayerMP1.aw + " some " + i2);
382 - int i3 = 1;
383 - if (split.length > 3) {
384 - i3 = b(split[3], 1);
385 - }
386 - if (i3 < 1) {
387 - i3 = 1;
388 - }
389 - if (i3 > 64) {
390 - i3 = 64;
391 - }
392 - localEntityPlayerMP1.b(new ItemStack(i2, i3));
393 - } else {
394 - localICommandListener.b("There's no item with id " + i2);
395 - }
396 - } catch (NumberFormatException localNumberFormatException) {
397 - localICommandListener.b("There's no item with id " + split[2]);
398 - }
399 - } else {
400 - localICommandListener.b("Can't find user " + (String) localObject2);
397 + if (as1.length > 3) {
398 + k1 = b(as1[3], 1);
401 399 }
402 - } else if (str1.toLowerCase().startsWith("say ")) {
403 - str1 = str1.substring(str1.indexOf(" ")).trim();
404 - a.info("[" + str2 + "] " + str1);
405 - this.f.a(new Packet3Chat("§d[Server] " + str1));
406 - } else if (str1.toLowerCase().startsWith("tell ")) {
407 - String[] split = str1.split(" ");
408 - if (split.length >= 3) {
409 - str1 = str1.substring(str1.indexOf(" ")).trim();
410 - str1 = str1.substring(str1.indexOf(" ")).trim();
411 -
412 - a.info("[" + str2 + "->" + split[1] + "] " + str1);
413 - str1 = "§7" + str2 + " whispers " + str1;
414 - a.info(str1);
415 - if (!this.f.a(split[1], new Packet3Chat(str1))) {
416 - localICommandListener.b("There's no player by that name online.");
417 - }
400 + if (k1 < 1) {
401 + k1 = 1;
418 402 }
403 + if (k1 > 64) {
404 + k1 = 64;
405 + }
406 + entityplayermp4.b(new ItemStack(j1, k1));
419 407 } else {
420 - a.info("Unknown console command. Type \"help\" for help.");
408 + icommandlistener.b((new StringBuilder()).append("There's no item with id ").append(j1).toString());
421 409 }
410 + } catch (NumberFormatException numberformatexception) {
411 + icommandlistener.b((new StringBuilder()).append("There's no item with id ").append(as1[2]).toString());
412 + }
413 + } else {
414 + icommandlistener.b((new StringBuilder()).append("Can't find user ").append(s9).toString());
415 + }
416 + } else if (s.toLowerCase().startsWith("say ")) {
417 + s = s.substring(s.indexOf(" ")).trim();
418 + a.info((new StringBuilder()).append("[").append(s1).append("] ").append(s).toString());
419 + f.a(new Packet3Chat((new StringBuilder()).append("\247d[Server] ").append(s).toString()));
420 + } else if (s.toLowerCase().startsWith("tell ")) {
421 + String as2[] = s.split(" ");
422 +
423 + if (as2.length >= 3) {
424 + s = s.substring(s.indexOf(" ")).trim();
425 + s = s.substring(s.indexOf(" ")).trim();
426 + a.info((new StringBuilder()).append("[").append(s1).append("->").append(as2[1]).append("] ").append(s).toString());
427 + s = (new StringBuilder()).append("\2477").append(s1).append(" whispers ").append(s).toString();
428 + a.info(s);
429 + if (!f.a(as2[1], new Packet3Chat(s))) {
430 + icommandlistener.b("There's no player by that name online.");
422 431 }
423 432 }
433 + } else {
434 + a.info("Unknown console command. Type \"help\" for help.");
424 435 }
425 - }
436 + } while (true);
426 437 }
427 438
428 - private void a(String paramString1, String paramString2) {
429 - String str = paramString1 + ": " + paramString2;
430 - this.f.i("§7(" + str + ")");
431 - a.info(str);
439 + private void a(String s, String s1) {
440 + String s2 = (new StringBuilder()).append(s).append(": ").append(s1).toString();
441 +
442 + f.i((new StringBuilder()).append("\2477(").append(s2).append(")").toString());
443 + a.info(s2);
432 444 }
433 445
434 - private int b(String paramString, int paramInt) {
446 + private int b(String s, int i1) {
435 447 try {
436 - return Integer.parseInt(paramString);
437 - } catch (NumberFormatException localNumberFormatException) {
448 + return Integer.parseInt(s);
449 + } catch (NumberFormatException numberformatexception) {
450 + return i1;
438 451 }
439 - return paramInt;
440 452 }
441 453
442 - public void a(IUpdatePlayerListBox paramIUpdatePlayerListBox) {
443 - this.p.add(paramIUpdatePlayerListBox);
454 + public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
455 + p.add(iupdateplayerlistbox);
444 456 }
445 457
446 - public static void main(String[] paramArrayOfString) {
458 + public static void main(String args[]) {
447 459 try {
448 - MinecraftServer localMinecraftServer = new MinecraftServer();
460 + MinecraftServer minecraftserver = new MinecraftServer();
449 461
450 - if ((!GraphicsEnvironment.isHeadless()) && ((paramArrayOfString.length <= 0) || (!paramArrayOfString[0].equals("nogui")))) {
451 - ServerGUI.a(localMinecraftServer);
462 + if (!java.awt.GraphicsEnvironment.isHeadless() && (args.length <= 0 || !args[0].equals("nogui"))) {
463 + ServerGUI.a(minecraftserver);
452 464 }
453 -
454 - new ThreadServerApplication("Server thread", localMinecraftServer).start();
455 - } catch (Exception localException) {
456 - a.log(Level.SEVERE, "Failed to start the minecraft server", localException);
465 + (new ThreadServerApplication("Server thread", minecraftserver)).start();
466 + } catch (Exception exception) {
467 + a.log(Level.SEVERE, "Failed to start the minecraft server", exception);
457 468 }
458 469 }
459 470
460 - public File a(String paramString) {
461 - return new File(paramString);
471 + public File a(String s) {
472 + return new File(s);
462 473 }
463 474
464 - public void b(String paramString) {
465 - a.info(paramString);
475 + public void b(String s) {
476 + a.info(s);
466 477 }
467 478
468 479 public String c() {
469 480 return "CONSOLE";
470 481 }
471 -}
482 +
483 + public static boolean a(MinecraftServer minecraftserver) {
484 + return minecraftserver.o;
485 + }
486 +
487 +}

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

Add shortcut