Archiviert
13
0

Bulk pending cleanup.

Dieser Commit ist enthalten in:
Wesley Wolfe 2012-09-09 23:19:28 -05:00
Ursprung b1f6d16bfa
Commit e2b1514daf
37 geänderte Dateien mit 203 neuen und 197 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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();
}
}

Datei anzeigen

@ -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) {}

Datei anzeigen

@ -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() {}

Datei anzeigen

@ -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() { }

Datei anzeigen

@ -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() {

Datei anzeigen

@ -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;

Datei anzeigen

@ -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) {

Datei anzeigen

@ -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);
}

Datei anzeigen

@ -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;
}

Datei anzeigen

@ -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
}
}
}

Datei anzeigen

@ -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;
}

Datei anzeigen

@ -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();
}
}

Datei anzeigen

@ -67,7 +67,7 @@ public class CraftArt {
return null;
}
{
static {
assert (EnumArt.values().length == 25);
assert (Art.values().length == 25);
}

Datei anzeigen

@ -20,9 +20,9 @@ import org.bukkit.ChunkSnapshot;
public class CraftChunk implements Chunk {
private WeakReference<net.minecraft.server.Chunk> weakChunk;
private WorldServer worldServer;
private int x;
private int z;
private final WorldServer worldServer;
private final int x;
private final int z;
private static final byte[] emptyData = new byte[2048];
private static final short[] emptyBlockIDs = new short[4096];
private static final byte[] emptySkyLight = new byte[2048];

Datei anzeigen

@ -144,7 +144,7 @@ public final class CraftServer implements Server {
private YamlConfiguration configuration;
private final Yaml yaml = new Yaml(new SafeConstructor());
private final Map<String, OfflinePlayer> offlinePlayers = new MapMaker().softValues().makeMap();
private AutoUpdater updater;
private final AutoUpdater updater;
private final EntityMetadataStore entityMetadata = new EntityMetadataStore();
private final PlayerMetadataStore playerMetadata = new PlayerMetadataStore();
private final WorldMetadataStore worldMetadata = new WorldMetadataStore();
@ -353,7 +353,7 @@ public final class CraftServer implements Server {
matchedPlayers.add(iterPlayer);
break;
}
if (iterPlayerName.toLowerCase().indexOf(partialName.toLowerCase()) != -1) {
if (iterPlayerName.toLowerCase().contains(partialName.toLowerCase())) {
// Partial match
matchedPlayers.add(iterPlayer);
}
@ -911,7 +911,7 @@ public final class CraftServer implements Server {
commands = ImmutableList.<String>of(section.getString(key));
}
result.put(key, commands.toArray(new String[0]));
result.put(key, commands.toArray(new String[commands.size()]));
}
}
@ -1146,8 +1146,8 @@ public final class CraftServer implements Server {
String[] files = storage.getPlayerDir().list(new DatFileFilter());
Set<OfflinePlayer> players = new HashSet<OfflinePlayer>();
for (int i = 0; i < files.length; i++) {
players.add(getOfflinePlayer(files[i].substring(0, files[i].length() - 4)));
for (String file : files) {
players.add(getOfflinePlayer(file.substring(0, file.length() - 4)));
}
players.addAll(Arrays.asList(getOnlinePlayers()));

Datei anzeigen

@ -437,7 +437,7 @@ public class CraftWorld implements World {
}
public boolean createExplosion(double x, double y, double z, float power, boolean setFire) {
return world.createExplosion(null, x, y, z, power, setFire).wasCanceled ? false : true;
return !world.createExplosion(null, x, y, z, power, setFire).wasCanceled;
}
public boolean createExplosion(Location loc, float power) {

Datei anzeigen

@ -10,8 +10,7 @@ public class TextWrapper {
String[] lines = text.split("\n");
String lastColor = null;
for (int i = 0; i < lines.length; i++) {
String line = lines[i];
for (String line : lines) {
if (lastColor != null) {
line = lastColor + line;
}
@ -22,4 +21,4 @@ public class TextWrapper {
return output;
}
}
}

Datei anzeigen

@ -22,7 +22,7 @@ public class CraftBlockState implements BlockState {
private final int z;
protected int type;
protected MaterialData data;
protected byte light;
protected final byte light;
public CraftBlockState(final Block block) {
this.world = (CraftWorld) block.getWorld();

Datei anzeigen

@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.conversations.ConversationTracker;
*/
public class CraftConsoleCommandSender extends ServerCommandSender implements ConsoleCommandSender {
protected ConversationTracker conversationTracker = new ConversationTracker();
protected final ConversationTracker conversationTracker = new ConversationTracker();
protected CraftConsoleCommandSender() {
super();

Datei anzeigen

@ -16,8 +16,7 @@ public class CraftCreature extends CraftLivingEntity implements Creature {
if (target == null) {
entity.target = null;
} else if (target instanceof CraftLivingEntity) {
EntityLiving victim = ((CraftLivingEntity) target).getHandle();
entity.target = victim;
entity.target = ((CraftLivingEntity) target).getHandle();
entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F, true, false, false, true);
}
}

Datei anzeigen

@ -36,7 +36,7 @@ import org.bukkit.plugin.Plugin;
public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
private CraftInventoryPlayer inventory;
private CraftInventory enderChest;
private final CraftInventory enderChest;
protected final PermissibleBase perm = new PermissibleBase(this);
private boolean op;
private GameMode mode;

Datei anzeigen

@ -10,7 +10,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.CraftServer;
public class CraftItem extends CraftEntity implements Item {
private EntityItem item;
private final EntityItem item;
public CraftItem(CraftServer server, Entity entity, EntityItem item) {
super(server, entity);

Datei anzeigen

@ -31,8 +31,7 @@ public class CraftPainting extends CraftEntity implements Painting {
public boolean setArt(Art art, boolean force) {
EntityPainting painting = this.getHandle();
EnumArt oldArt = painting.art;
EnumArt newArt = CraftArt.BukkitToNotch(art);
painting.art = newArt;
painting.art = CraftArt.BukkitToNotch(art);
painting.setDirection(painting.direction);
if (!force && !painting.survives()) {
// Revert painting since it doesn't fit

Datei anzeigen

@ -53,9 +53,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private long firstPlayed = 0;
private long lastPlayed = 0;
private boolean hasPlayedBefore = false;
private ConversationTracker conversationTracker = new ConversationTracker();
private Set<String> channels = new HashSet<String>();
private Map<String, Player> hiddenPlayers = new MapMaker().softValues().makeMap();
private final ConversationTracker conversationTracker = new ConversationTracker();
private final Set<String> channels = new HashSet<String>();
private final Map<String, Player> hiddenPlayers = new MapMaker().softValues().makeMap();
private int hash = 0;
public CraftPlayer(CraftServer server, EntityPlayer entity) {

Datei anzeigen

@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.StorageMinecart;
public class CraftStorageMinecart extends CraftMinecart implements StorageMinecart {
private CraftInventory inventory;
private final CraftInventory inventory;
public CraftStorageMinecart(CraftServer server, EntityMinecart entity) {
super(server, entity);

Datei anzeigen

@ -9,7 +9,7 @@ import org.bukkit.help.HelpTopic;
*/
public class CustomHelpTopic extends HelpTopic {
private String permissionNode;
private final String permissionNode;
public CustomHelpTopic(String name, String shortText, String fullText, String permissionNode) {
this.permissionNode = permissionNode;

Datei anzeigen

@ -13,7 +13,7 @@ import java.util.List;
*/
public class CustomIndexHelpTopic extends IndexHelpTopic {
private List<String> futureTopics;
private HelpMap helpMap;
private final HelpMap helpMap;
public CustomIndexHelpTopic(HelpMap helpMap, String name, String shortText, String permission, List<String> futureTopics, String preamble) {
super(name, shortText, permission, new HashSet<HelpTopic>(), preamble);

Datei anzeigen

@ -3,7 +3,6 @@ package org.bukkit.craftbukkit.help;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
import org.bukkit.ChatColor;
import org.bukkit.command.*;
import org.bukkit.command.defaults.BukkitCommand;
import org.bukkit.command.defaults.VanillaCommand;
@ -107,7 +106,7 @@ public class SimpleHelpMap implements HelpMap {
// Initialize help topics from the server's command map
outer: for (Command command : server.getCommandMap().getCommands()) {
if (commandInIgnoredPlugin(command, ignoredPlugins)) {
continue outer;
continue;
}
// Register a topic

Datei anzeigen

@ -13,10 +13,10 @@ import net.minecraft.server.Packet100OpenWindow;
import net.minecraft.server.Slot;
public class CraftContainer extends Container {
private InventoryView view;
private final InventoryView view;
private InventoryType cachedType;
private String cachedTitle;
private int cachedSize;
private final int cachedSize;
public CraftContainer(InventoryView view, int id) {
this.view = view;

Datei anzeigen

@ -10,7 +10,7 @@ import org.bukkit.inventory.Recipe;
import org.bukkit.util.Java15Compat;
public class CraftInventoryCrafting extends CraftInventory implements CraftingInventory {
private IInventory resultInventory;
private final IInventory resultInventory;
public CraftInventoryCrafting(InventoryCrafting inventory, IInventory resultInventory) {
super(inventory);
@ -135,4 +135,4 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn
IRecipe recipe = ((InventoryCrafting)getInventory()).currentRecipe;
return recipe == null ? null : recipe.toBukkitRecipe();
}
}
}

Datei anzeigen

@ -26,12 +26,12 @@ public class CraftInventoryCustom extends CraftInventory {
}
static class MinecraftInventory implements IInventory {
private ItemStack[] items;
private final ItemStack[] items;
private int maxStack = MAX_STACK;
private List<HumanEntity> viewers;
private String title;
private final List<HumanEntity> viewers;
private final String title;
private InventoryType type;
private InventoryHolder owner;
private final InventoryHolder owner;
public MinecraftInventory(InventoryHolder owner, InventoryType type) {
this(owner, type.getDefaultSize(), type.getDefaultTitle());

Datei anzeigen

@ -8,7 +8,8 @@ import org.bukkit.inventory.ItemStack;
import net.minecraft.server.InventoryLargeChest;
public class CraftInventoryDoubleChest extends CraftInventory implements DoubleChestInventory {
private CraftInventory left, right;
private final CraftInventory left;
private final CraftInventory right;
public CraftInventoryDoubleChest(CraftInventory left, CraftInventory right) {
super(new InventoryLargeChest("Large chest", left.getInventory(), right.getInventory()));

Datei anzeigen

@ -12,9 +12,9 @@ import org.bukkit.inventory.ItemStack;
import net.minecraft.server.Container;
public class CraftInventoryView extends InventoryView {
private Container container;
private CraftHumanEntity player;
private CraftInventory viewing;
private final Container container;
private final CraftHumanEntity player;
private final CraftInventory viewing;
public CraftInventoryView(HumanEntity player, Inventory viewing, Container container) {
// TODO: Should we make sure it really IS a CraftHumanEntity first? And a CraftInventory?

Datei anzeigen

@ -286,9 +286,7 @@ public class CraftScheduler implements BukkitScheduler {
}
final ArrayList<BukkitTask> pending = new ArrayList<BukkitTask>();
final Iterator<CraftTask> it = runners.values().iterator();
while (it.hasNext()) {
final CraftTask task = it.next();
for (CraftTask task : runners.values()) {
if (task.getPeriod() >= -1l) {
pending.add(task);
}

Datei anzeigen

@ -39,7 +39,7 @@ public class BukkitDLUpdaterService {
return "CraftBukkit/" + BukkitDLUpdaterService.class.getPackage().getImplementationVersion() + "/" + System.getProperty("java.version");
}
public ArtifactDetails fetchArtifact(String slug) throws UnsupportedEncodingException, IOException {
public ArtifactDetails fetchArtifact(String slug) throws IOException {
URL url = new URL("http", host, API_PREFIX_ARTIFACT + slug + "/");
InputStreamReader reader = null;
@ -48,9 +48,7 @@ public class BukkitDLUpdaterService {
connection.setRequestProperty("User-Agent", getUserAgent());
reader = new InputStreamReader(connection.getInputStream());
Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, dateDeserializer).setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
ArtifactDetails fromJson = gson.fromJson(reader, ArtifactDetails.class);
return fromJson;
return gson.fromJson(reader, ArtifactDetails.class);
} finally {
if (reader != null) {
reader.close();
@ -70,7 +68,7 @@ public class BukkitDLUpdaterService {
return null;
}
public ArtifactDetails.ChannelDetails fetchChannel(String slug) throws UnsupportedEncodingException, IOException {
public ArtifactDetails.ChannelDetails fetchChannel(String slug) throws IOException {
URL url = new URL("http", host, API_PREFIX_CHANNEL + slug + "/");
InputStreamReader reader = null;

Datei anzeigen

@ -11,21 +11,21 @@ import org.junit.Test;
@Ignore ("useful tests, but not necessary to run on each compile")
public class BukkitDLUpdaterServiceTest {
@Test(expected=IOException.class)
public void testHostNotFound() throws UnsupportedEncodingException, IOException {
public void testHostNotFound() throws IOException {
BukkitDLUpdaterService service = new BukkitDLUpdaterService("404.example.org");
service.fetchArtifact("rb");
}
@Test(expected=FileNotFoundException.class)
public void testArtifactNotFound() throws UnsupportedEncodingException, IOException {
public void testArtifactNotFound() throws IOException {
BukkitDLUpdaterService service = new BukkitDLUpdaterService("dl.bukkit.org");
service.fetchArtifact("meep");
}
@Test
public void testArtifactExists() throws UnsupportedEncodingException, IOException {
public void testArtifactExists() throws IOException {
BukkitDLUpdaterService service = new BukkitDLUpdaterService("dl.bukkit.org");
assertNotNull(service.fetchArtifact("latest-dev"));