From e2b1514daf678d8ea95a71af8bbb2a9b8efb3440 Mon Sep 17 00:00:00 2001 From: Wesley Wolfe Date: Sun, 9 Sep 2012 23:19:28 -0500 Subject: Bulk pending cleanup. --- .../net/minecraft/server/ConsoleLogManager.java | 6 +- src/main/java/net/minecraft/server/Entity.java | 12 ++-- .../java/net/minecraft/server/EntityCreature.java | 12 ++-- .../java/net/minecraft/server/EntityLiving.java | 72 +++++++++++----------- .../java/net/minecraft/server/MethodProfiler.java | 2 + .../java/net/minecraft/server/MinecraftServer.java | 42 ++++++------- .../java/net/minecraft/server/NetLoginHandler.java | 8 +++ .../net/minecraft/server/NetServerHandler.java | 17 ++--- .../java/net/minecraft/server/NetworkManager.java | 6 ++ .../minecraft/server/PathfinderGoalSelector.java | 28 ++++----- .../net/minecraft/server/ThreadLoginVerifier.java | 8 ++- src/main/java/net/minecraft/server/World.java | 64 +++++++++---------- .../java/net/minecraft/server/WorldServer.java | 26 ++++---- 13 files changed, 158 insertions(+), 145 deletions(-) (limited to 'src/main/java/net') diff --git a/src/main/java/net/minecraft/server/ConsoleLogManager.java b/src/main/java/net/minecraft/server/ConsoleLogManager.java index 7afc1a4b..3301ec1f 100644 --- a/src/main/java/net/minecraft/server/ConsoleLogManager.java +++ b/src/main/java/net/minecraft/server/ConsoleLogManager.java @@ -86,9 +86,9 @@ public class ConsoleLogManager { parent.mkdirs(); } - int limit = ((Integer) server.options.valueOf("log-limit")).intValue(); - int count = ((Integer) server.options.valueOf("log-count")).intValue(); - boolean append = ((Boolean) server.options.valueOf("log-append")).booleanValue(); + int limit = (Integer) server.options.valueOf("log-limit"); + int count = (Integer) server.options.valueOf("log-count"); + boolean append = (Boolean) server.options.valueOf("log-append"); FileHandler filehandler = new FileHandler(pattern, limit, count, append); // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index f786464a..8b02cf3a 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -217,7 +217,7 @@ public abstract class Entity { } public void z() { - // this.world.methodProfiler.a("entityBaseTick"); // CraftBukkit - not in production code + this.world.methodProfiler.a("entityBaseTick"); if (this.vehicle != null && this.vehicle.dead) { this.vehicle = null; } @@ -321,7 +321,7 @@ public abstract class Entity { } this.justCreated = false; - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); } protected void A() { @@ -393,7 +393,7 @@ public abstract class Entity { this.locY = this.boundingBox.b + (double) this.height - (double) this.V; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; } else { - // this.world.methodProfiler.a("move"); // CraftBukkit - not in production code + this.world.methodProfiler.a("move"); this.V *= 0.4F; double d3 = this.locX; double d4 = this.locZ; @@ -581,8 +581,8 @@ public abstract class Entity { } } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("rest"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("rest"); this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locY = this.boundingBox.b + (double) this.height - (double) this.V; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; @@ -673,7 +673,7 @@ public abstract class Entity { this.fireTicks = -this.maxFireTicks; } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); } } diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java index d7cb6bf2..a91e55c9 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -21,7 +21,7 @@ public abstract class EntityCreature extends EntityLiving { } protected void be() { - // this.world.methodProfiler.a("ai"); // CraftBukkit - not in production code + this.world.methodProfiler.a("ai"); if (this.c > 0) { --this.c; } @@ -70,7 +70,7 @@ public abstract class EntityCreature extends EntityLiving { // CraftBukkit end } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); if (!this.b && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) { this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true); } else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bq < 100) { @@ -83,7 +83,7 @@ public abstract class EntityCreature extends EntityLiving { this.pitch = 0.0F; if (this.pathEntity != null && this.random.nextInt(100) != 0) { - // this.world.methodProfiler.a("followpath"); // CraftBukkit - not in production code + this.world.methodProfiler.a("followpath"); Vec3D vec3d = this.pathEntity.a((Entity) this); double d0 = (double) (this.width * 2.0F); @@ -144,7 +144,7 @@ public abstract class EntityCreature extends EntityLiving { this.bu = true; } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); } else { super.be(); this.pathEntity = null; @@ -152,7 +152,7 @@ public abstract class EntityCreature extends EntityLiving { } protected void j() { - // this.world.methodProfiler.a("stroll"); // CraftBukkit - not in production code + this.world.methodProfiler.a("stroll"); boolean flag = false; int i = -1; int j = -1; @@ -178,7 +178,7 @@ public abstract class EntityCreature extends EntityLiving { this.pathEntity = this.world.a(this, i, j, k, 10.0F, true, false, false, true); } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); } protected void a(Entity entity, float f) {} diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index a62c98fc..826ab5ea 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -261,7 +261,7 @@ public abstract class EntityLiving extends Entity { public void z() { this.aI = this.aJ; super.z(); - // this.world.methodProfiler.a("mobBaseTick"); // CraftBukkit - not in production code + this.world.methodProfiler.a("mobBaseTick"); if (this.isAlive() && this.random.nextInt(1000) < this.a++) { this.a = -this.aG(); this.aH(); @@ -359,7 +359,7 @@ public abstract class EntityLiving extends Entity { this.at = this.as; this.lastYaw = this.yaw; this.lastPitch = this.pitch; - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); } // CraftBukkit start @@ -470,7 +470,7 @@ public abstract class EntityLiving extends Entity { } this.av += (f3 - this.av) * 0.3F; - // this.world.methodProfiler.a("headTurn"); // CraftBukkit - not in production code + this.world.methodProfiler.a("headTurn"); if (this.aV()) { this.senses.a(); } else { @@ -498,8 +498,8 @@ public abstract class EntityLiving extends Entity { } } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("rangeChecks"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("rangeChecks"); while (this.yaw - this.lastYaw < -180.0F) { this.lastYaw -= 360.0F; @@ -533,7 +533,7 @@ public abstract class EntityLiving extends Entity { this.at += 360.0F; } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); this.aw += f2; } @@ -1079,7 +1079,7 @@ public abstract class EntityLiving extends Entity { this.motZ = 0.0D; } - // this.world.methodProfiler.a("ai"); // CraftBukkit - not in production code + this.world.methodProfiler.a("ai"); if (this.aX()) { this.bu = false; this.br = 0.0F; @@ -1087,19 +1087,19 @@ public abstract class EntityLiving extends Entity { this.bt = 0.0F; } else if (this.aW()) { if (this.aV()) { - // this.world.methodProfiler.a("newAi"); // CraftBukkit - not in production code + this.world.methodProfiler.a("newAi"); this.bc(); - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); } else { - // this.world.methodProfiler.a("oldAi"); // CraftBukkit - not in production code + this.world.methodProfiler.a("oldAi"); this.be(); - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); this.as = this.yaw; } } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("jump"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("jump"); if (this.bu) { if (!this.H() && !this.J()) { if (this.onGround && this.bE == 0) { @@ -1113,8 +1113,8 @@ public abstract class EntityLiving extends Entity { this.bE = 0; } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("travel"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("travel"); this.br *= 0.98F; this.bs *= 0.98F; this.bt *= 0.9F; @@ -1123,8 +1123,8 @@ public abstract class EntityLiving extends Entity { this.aG *= this.bs(); this.e(this.br, this.bs); this.aG = f; - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("push"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("push"); if (!this.world.isStatic) { List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); @@ -1141,7 +1141,7 @@ public abstract class EntityLiving extends Entity { } } - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); } protected boolean aV() { @@ -1203,33 +1203,33 @@ public abstract class EntityLiving extends Entity { protected void bc() { ++this.bq; - // this.world.methodProfiler.a("checkDespawn"); // CraftBukkit - not in production code + this.world.methodProfiler.a("checkDespawn"); this.bb(); - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("sensing"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("sensing"); this.bA.a(); - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("targetSelector"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("targetSelector"); this.targetSelector.a(); - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("goalSelector"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("goalSelector"); this.goalSelector.a(); - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("navigation"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("navigation"); this.navigation.e(); - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("mob tick"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("mob tick"); this.bd(); - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.a("controls"); // CraftBukkit - not in production code - // this.world.methodProfiler.a("move"); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.a("controls"); + this.world.methodProfiler.a("move"); this.moveController.c(); - // this.world.methodProfiler.c("look"); // CraftBukkit - not in production code + this.world.methodProfiler.c("look"); this.lookController.a(); - // this.world.methodProfiler.c("jump"); // CraftBukkit - not in production code + this.world.methodProfiler.c("jump"); this.jumpController.b(); - // this.world.methodProfiler.b(); // CraftBukkit - not in production code - // this.world.methodProfiler.b(); // CraftBukkit - not in production code + this.world.methodProfiler.b(); + this.world.methodProfiler.b(); } protected void bd() {} diff --git a/src/main/java/net/minecraft/server/MethodProfiler.java b/src/main/java/net/minecraft/server/MethodProfiler.java index fb5072fa..0dfdfa7b 100644 --- a/src/main/java/net/minecraft/server/MethodProfiler.java +++ b/src/main/java/net/minecraft/server/MethodProfiler.java @@ -9,6 +9,8 @@ import java.util.Map; // CraftBukkit start - strip down to empty public class MethodProfiler { + public boolean a = false; + public final void a() { } public final void a(String s) { } public final void b() { } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 6529ff80..7ee37487 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -466,20 +466,20 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC ++this.ticks; if (this.T) { this.T = false; - // this.methodProfiler.a = true; // CraftBukkit - not in production code - // this.methodProfiler.a(); // CraftBukkit - not in production code + this.methodProfiler.a = true; + this.methodProfiler.a(); } - // this.methodProfiler.a("root"); // CraftBukkit - not in production code + this.methodProfiler.a("root"); this.q(); if (this.ticks % 900 == 0) { - // this.methodProfiler.a("save"); // CraftBukkit - not in production code + this.methodProfiler.a("save"); this.t.savePlayers(); this.saveChunks(true); - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); } - // this.methodProfiler.a("tallying"); // CraftBukkit - not in production code + this.methodProfiler.a("tallying"); this.j[this.ticks % 100] = System.nanoTime() - i; this.f[this.ticks % 100] = Packet.p - this.E; this.E = Packet.p; @@ -489,8 +489,8 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC this.G = Packet.n; this.i[this.ticks % 100] = Packet.o - this.H; this.H = Packet.o; - // this.methodProfiler.b(); // CraftBukkit - not in production code - // this.methodProfiler.a("snooper"); // CraftBukkit - not in production code + this.methodProfiler.b(); + this.methodProfiler.a("snooper"); if (!this.n.d() && this.ticks > 100) { this.n.a(); } @@ -499,12 +499,12 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC this.n.b(); } - // this.methodProfiler.b(); // CraftBukkit - not in production code - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); + this.methodProfiler.b(); } public void q() { - // this.methodProfiler.a("levels"); // CraftBukkit - not in production code + this.methodProfiler.a("levels"); // CraftBukkit start - only send timeupdates to the people in that world this.server.getScheduler().mainThreadHeartbeat(this.ticks); @@ -554,18 +554,18 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC } // CraftBukkit end */ - // this.methodProfiler.a("tick"); // CraftBukkit - not in production code + this.methodProfiler.a("tick"); worldserver.doTick(); - // this.methodProfiler.c("lights"); // CraftBukkit - not in production code + this.methodProfiler.c("lights"); while (true) { if (!worldserver.updateLights()) { - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); worldserver.tickEntities(); - // this.methodProfiler.a("tracker"); // CraftBukkit - not in production code + this.methodProfiler.a("tracker"); worldserver.getTracker().updatePlayers(); - // this.methodProfiler.b(); // CraftBukkit - not in production code - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); + this.methodProfiler.b(); break; } } @@ -574,11 +574,11 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC // this.k[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit } - // this.methodProfiler.c("connection"); // CraftBukkit - not in production code + this.methodProfiler.c("connection"); this.ac().b(); - // this.methodProfiler.c("players"); // CraftBukkit - not in production code + this.methodProfiler.c("players"); this.t.tick(); - // this.methodProfiler.c("tickables"); // CraftBukkit - not in production code + this.methodProfiler.c("tickables"); Iterator iterator = this.p.iterator(); while (iterator.hasNext()) { @@ -587,7 +587,7 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC iupdateplayerlistbox.a(); } - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); } public boolean getAllowNether() { diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java index 7c201a84..2d8d25f2 100644 --- a/src/main/java/net/minecraft/server/NetLoginHandler.java +++ b/src/main/java/net/minecraft/server/NetLoginHandler.java @@ -23,6 +23,7 @@ public class NetLoginHandler extends NetHandler { private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix private SecretKey k = null; public String hostname = ""; // CraftBukkit - add field + private boolean login = false; // CraftBukkit public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException this.server = minecraftserver; @@ -98,6 +99,13 @@ public class NetLoginHandler extends NetHandler { public void a(Packet205ClientCommand packet205clientcommand) { if (packet205clientcommand.a == 0) { if (this.server.getOnlineMode()) { + // CraftBukkit start + if (this.login) { + this.disconnect("Duplicate login"); + return; + } + this.login = true; + // CraftBukkit end (new ThreadLoginVerifier(this, server.server)).start(); // CraftBukkit - add CraftServer } else { this.i = true; diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index f11d2b27..41e77727 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -105,16 +105,9 @@ public class NetServerHandler extends NetHandler { public void d() { this.h = false; ++this.f; - // this.minecraftServer.methodProfiler.a("packetflow"); // CraftBukkit - not in production code - // CraftBukkit start - try { - this.networkManager.b(); - } catch (Exception ex) { - logger.log(Level.WARNING, "Exception from " + this.player.name, ex); - this.disconnect(ex.getClass().getName()); - } - // CraftBukkit end - // this.minecraftServer.methodProfiler.c("keepAlive"); // CraftBukkit - not in production code + this.minecraftServer.methodProfiler.a("packetflow"); + this.networkManager.b(); + this.minecraftServer.methodProfiler.c("keepAlive"); if ((long) this.f - this.l > 20L) { this.l = (long) this.f; this.j = System.nanoTime() / 1000000L; @@ -130,7 +123,7 @@ public class NetServerHandler extends NetHandler { --this.x; } - // this.minecraftServer.methodProfiler.c("playerTick"); // CraftBukkit - not in production code + this.minecraftServer.methodProfiler.c("playerTick"); if (!this.h && !this.player.viewingCredits) { this.player.g(); if (this.player.vehicle == null) { @@ -138,7 +131,7 @@ public class NetServerHandler extends NetHandler { } } - // this.minecraftServer.methodProfiler.b(); // CraftBukkit - not in production code + this.minecraftServer.methodProfiler.b(); } public void disconnect(String s) { diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java index fed8a225..a3f2841a 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -273,6 +273,12 @@ public class NetworkManager implements INetworkManager { while (!this.inboundQueue.isEmpty() && i-- >= 0) { Packet packet = (Packet) this.inboundQueue.poll(); // CraftBukkit - remove -> poll + // CraftBukkit start + if (this.packetListener instanceof NetLoginHandler ? ((NetLoginHandler) this.packetListener).c : ((NetServerHandler) this.packetListener).disconnected) { + continue; + } + // CraftBukkit end + packet.handle(this.packetListener); } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java index 38f53522..cf4cce0a 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java @@ -65,42 +65,42 @@ public class PathfinderGoalSelector { } } - // this.c.a("goalStart"); // CraftBukkit - not in production code + this.c.a("goalStart"); // CraftBukkit start - removed usage of arraylist /*iterator = arraylist.iterator(); while (iterator.hasNext()) { pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next(); - // this.c.a(pathfindergoalselectoritem.a.getClass().getSimpleName()); // CraftBukkit - not in production code + this.c.a(pathfindergoalselectoritem.a.getClass().getSimpleName()); pathfindergoalselectoritem.a.e(); - // this.c.b(); // CraftBukkit - not in production code + this.c.b(); }*/ // CraftBukkit end - // this.c.b(); // CraftBukkit - not in production code - // this.c.a("goalTick"); // CraftBukkit - not in production code + this.c.b(); + this.c.a("goalTick"); iterator = this.b.iterator(); while (iterator.hasNext()) { pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next(); - // this.c.a(pathfindergoalselectoritem.a.getClass().getSimpleName()); // CraftBukkit - not in production code + // this.c.a(pathfindergoalselectoritem.a.getClass().getSimpleName()); // CraftBukkit - getSimpleName is expensive pathfindergoalselectoritem.a.d(); - // this.c.b(); // CraftBukkit - not in production code + // this.c.b(); // CraftBukkit - paired with above comment } - // this.c.b(); // CraftBukkit - not in production code + this.c.b(); } private boolean a(PathfinderGoalSelectorItem pathfindergoalselectoritem) { - // this.c.a("canContinue"); // CraftBukkit - not in production code + this.c.a("canContinue"); boolean flag = pathfindergoalselectoritem.a.b(); - // this.c.b(); // CraftBukkit - not in production code + this.c.b(); return flag; } private boolean b(PathfinderGoalSelectorItem pathfindergoalselectoritem) { - // this.c.a("canUse"); // CraftBukkit - not in production code + this.c.a("canUse"); Iterator iterator = this.a.iterator(); while (iterator.hasNext()) { @@ -110,20 +110,20 @@ public class PathfinderGoalSelector { if (pathfindergoalselectoritem.b >= pathfindergoalselectoritem1.b) { // CraftBukkit - switch order if (!this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1) && this.b.contains(pathfindergoalselectoritem1)) { - // this.c.b(); // CraftBukkit - not in production code + this.c.b(); ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse return false; } // CraftBukkit - switch order } else if (!pathfindergoalselectoritem1.a.g() && this.b.contains(pathfindergoalselectoritem1)) { - // this.c.b(); // CraftBukkit - not in production code + this.c.b(); ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse return false; } } } - // this.c.b(); // CraftBukkit - not in production code + this.c.b(); return true; } diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java index fc198b26..dba7d42a 100644 --- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java +++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java @@ -59,9 +59,13 @@ class ThreadLoginVerifier extends Thread { // CraftBukkit end NetLoginHandler.a(this.netLoginHandler, true); + // CraftBukkit start + } catch (java.io.IOException exception) { + this.netLoginHandler.disconnect("Failed to verify username, session authentication server unavailable!"); } catch (Exception exception) { - this.netLoginHandler.disconnect("Failed to verify username! [internal error " + exception + "]"); - exception.printStackTrace(); + this.netLoginHandler.disconnect("Failed to verify username!"); + server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + NetLoginHandler.d(this.netLoginHandler), exception); + // CraftBukkit end } } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index d9874412..cee4d42c 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -247,9 +247,9 @@ public abstract class World implements IBlockAccess { Chunk chunk = this.getChunkAt(i >> 4, k >> 4); boolean flag1 = chunk.a(i & 15, j, k & 15, l, i1); - // this.methodProfiler.a("checkLight"); // CraftBukkit - not in production code + this.methodProfiler.a("checkLight"); this.x(i, j, k); - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); if (flag && flag1 && (this.isStatic || chunk.seenByPlayer)) { this.notify(i, j, k); } @@ -271,9 +271,9 @@ public abstract class World implements IBlockAccess { Chunk chunk = this.getChunkAt(i >> 4, k >> 4); boolean flag = chunk.a(i & 15, j, k & 15, l); - // this.methodProfiler.a("checkLight"); // CraftBukkit - not in production code + this.methodProfiler.a("checkLight"); this.x(i, j, k); - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); if (flag && (this.isStatic || chunk.seenByPlayer)) { this.notify(i, j, k); } @@ -1051,8 +1051,8 @@ public abstract class World implements IBlockAccess { public void b(int i, int j, int k, int l, int i1) {} public void tickEntities() { - // this.methodProfiler.a("entities"); // CraftBukkit - not in production code - // this.methodProfiler.a("global"); // CraftBukkit - not in production code + this.methodProfiler.a("entities"); + this.methodProfiler.a("global"); int i; Entity entity; @@ -1075,7 +1075,7 @@ public abstract class World implements IBlockAccess { } } - // this.methodProfiler.c("remove"); // CraftBukkit - not in production code + this.methodProfiler.c("remove"); this.entityList.removeAll(this.g); Iterator iterator = this.g.iterator(); @@ -1099,7 +1099,7 @@ public abstract class World implements IBlockAccess { } this.g.clear(); - // this.methodProfiler.c("regular"); // CraftBukkit - not in production code + this.methodProfiler.c("regular"); for (i = 0; i < this.entityList.size(); ++i) { entity = (Entity) this.entityList.get(i); @@ -1120,13 +1120,13 @@ public abstract class World implements IBlockAccess { entity.vehicle = null; } - // this.methodProfiler.a("tick"); // CraftBukkit - not in production code + this.methodProfiler.a("tick"); if (!entity.dead) { this.playerJoinedWorld(entity); } - // this.methodProfiler.b(); // CraftBukkit - not in production code - // this.methodProfiler.a("remove"); // CraftBukkit - not in production code + this.methodProfiler.b(); + this.methodProfiler.a("remove"); if (entity.dead) { j = entity.ah; k = entity.aj; @@ -1138,10 +1138,10 @@ public abstract class World implements IBlockAccess { this.b(entity); } - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); } - // this.methodProfiler.c("tileEntities"); // CraftBukkit - not in production code + this.methodProfiler.c("tileEntities"); this.L = true; iterator = this.tileEntityList.iterator(); @@ -1177,7 +1177,7 @@ public abstract class World implements IBlockAccess { this.b.clear(); } - // this.methodProfiler.c("pendingTileEntities"); // CraftBukkit - not in production code + this.methodProfiler.c("pendingTileEntities"); if (!this.a.isEmpty()) { Iterator iterator1 = this.a.iterator(); @@ -1211,8 +1211,8 @@ public abstract class World implements IBlockAccess { this.a.clear(); } - // this.methodProfiler.b(); // CraftBukkit - not in production code - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); + this.methodProfiler.b(); } public void a(Collection collection) { @@ -1246,7 +1246,7 @@ public abstract class World implements IBlockAccess { } } - // this.methodProfiler.a("chunkCheck"); // CraftBukkit - not in production code + this.methodProfiler.a("chunkCheck"); if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) { entity.locX = entity.S; } @@ -1284,7 +1284,7 @@ public abstract class World implements IBlockAccess { } } - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); if (flag && entity.ag && entity.passenger != null) { if (!entity.passenger.dead && entity.passenger.vehicle == entity) { this.playerJoinedWorld(entity.passenger); @@ -1805,7 +1805,7 @@ public abstract class World implements IBlockAccess { protected void x() { // this.chunkTickList.clear(); // CraftBukkit - removed - // this.methodProfiler.a("buildList"); // CraftBukkit - not in production code + this.methodProfiler.a("buildList"); int i; EntityHuman entityhuman; @@ -1832,12 +1832,12 @@ public abstract class World implements IBlockAccess { } } - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); if (this.M > 0) { --this.M; } - // this.methodProfiler.a("playerCheckLight"); // CraftBukkit - not in production code + this.methodProfiler.a("playerCheckLight"); if (!this.players.isEmpty()) { i = this.random.nextInt(this.players.size()); entityhuman = (EntityHuman) this.players.get(i); @@ -1848,11 +1848,11 @@ public abstract class World implements IBlockAccess { this.x(j, k, j1); } - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); } protected void a(int i, int j, Chunk chunk) { - // this.methodProfiler.c("moodSound"); // CraftBukkit - not in production code + this.methodProfiler.c("moodSound"); if (this.M == 0) { this.l = this.l * 3 + 1013904223; int k = this.l >> 2; @@ -1873,7 +1873,7 @@ public abstract class World implements IBlockAccess { } } - // this.methodProfiler.c("checkLight"); // CraftBukkit - not in production code + this.methodProfiler.c("checkLight"); chunk.o(); } @@ -2046,7 +2046,7 @@ public abstract class World implements IBlockAccess { int l = 0; int i1 = 0; - // this.methodProfiler.a("getBrightness"); // CraftBukkit - not in production code + this.methodProfiler.a("getBrightness"); int j1 = this.b(enumskyblock, i, j, k); boolean flag = false; int k1 = this.getTypeId(i, j, k); @@ -2134,8 +2134,8 @@ public abstract class World implements IBlockAccess { l = 0; } - // this.methodProfiler.b(); // CraftBukkit - not in production code - // this.methodProfiler.a("tcp < tcc"); // CraftBukkit - not in production code + this.methodProfiler.b(); + this.methodProfiler.a("tcp < tcc"); while (l < i1) { k1 = this.J[l++]; @@ -2204,7 +2204,7 @@ public abstract class World implements IBlockAccess { } } - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); } } @@ -2343,7 +2343,7 @@ public abstract class World implements IBlockAccess { } public PathEntity findPath(Entity entity, Entity entity1, float f, boolean flag, boolean flag1, boolean flag2, boolean flag3) { - // this.methodProfiler.a("pathfind"); // CraftBukkit - not in production code + this.methodProfiler.a("pathfind"); int i = MathHelper.floor(entity.locX); int j = MathHelper.floor(entity.locY + 1.0D); int k = MathHelper.floor(entity.locZ); @@ -2357,12 +2357,12 @@ public abstract class World implements IBlockAccess { ChunkCache chunkcache = new ChunkCache(this, i1, j1, k1, l1, i2, j2); PathEntity pathentity = (new Pathfinder(chunkcache, flag, flag1, flag2, flag3)).a(entity, entity1, f); - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); return pathentity; } public PathEntity a(Entity entity, int i, int j, int k, float f, boolean flag, boolean flag1, boolean flag2, boolean flag3) { - // this.methodProfiler.a("pathfind"); // CraftBukkit - not in production code + this.methodProfiler.a("pathfind"); int l = MathHelper.floor(entity.locX); int i1 = MathHelper.floor(entity.locY); int j1 = MathHelper.floor(entity.locZ); @@ -2376,7 +2376,7 @@ public abstract class World implements IBlockAccess { ChunkCache chunkcache = new ChunkCache(this, l1, i2, j2, k2, l2, i3); PathEntity pathentity = (new Pathfinder(chunkcache, flag, flag1, flag2, flag3)).a(entity, i, j, k, f); - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); return pathentity; } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 340fe900..aad73324 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -148,14 +148,14 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } } - // this.methodProfiler.a("mobSpawner"); // CraftBukkit - not in production code + this.methodProfiler.a("mobSpawner"); // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals long time = this.worldData.getTime(); if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) { SpawnerCreature.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L)); } // CraftBukkit end - // this.methodProfiler.c("chunkSource"); // CraftBukkit - not in production code + this.methodProfiler.c("chunkSource"); this.chunkProvider.unloadChunks(); int j = this.a(1.0F); @@ -165,16 +165,16 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate this.Q(); this.worldData.b(this.worldData.getTime() + 1L); - // this.methodProfiler.c("tickPending"); // CraftBukkit - not in production code + this.methodProfiler.c("tickPending"); this.a(false); - // this.methodProfiler.c("tickTiles"); // CraftBukkit - not in production code + this.methodProfiler.c("tickTiles"); this.g(); - // this.methodProfiler.c("chunkMap"); // CraftBukkit - not in production code + this.methodProfiler.c("chunkMap"); this.manager.flush(); - // this.methodProfiler.c("village"); // CraftBukkit - not in production code + this.methodProfiler.c("village"); this.villages.tick(); this.siegeManager.a(); - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); this.Q(); } @@ -273,14 +273,14 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate int k = chunkX * 16; int l = chunkZ * 16; - // this.methodProfiler.a("getChunk"); // CraftBukkit - not in production code + this.methodProfiler.a("getChunk"); Chunk chunk = this.getChunkAt(chunkX, chunkZ); // CraftBukkit end this.a(k, l, chunk); - // this.methodProfiler.c("tickChunk"); // CraftBukkit - not in production code + this.methodProfiler.c("tickChunk"); chunk.k(); - // this.methodProfiler.c("thunder"); // CraftBukkit - not in production code + this.methodProfiler.c("thunder"); int i1; int j1; int k1; @@ -298,7 +298,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } } - // this.methodProfiler.c("iceandsnow"); // CraftBukkit - not in production code + this.methodProfiler.c("iceandsnow"); int i2; if (this.random.nextInt(16) == 0) { @@ -345,7 +345,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } } - // this.methodProfiler.c("tickTiles"); // CraftBukkit - not in production code + this.methodProfiler.c("tickTiles"); ChunkSection[] achunksection = chunk.i(); j1 = achunksection.length; @@ -373,7 +373,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } } - // this.methodProfiler.b(); // CraftBukkit - not in production code + this.methodProfiler.b(); } } -- cgit v1.2.3