diff options
author | Pokechu22 <Pokechu022@gmail.com> | 2017-01-18 17:42:35 -0800 |
---|---|---|
committer | Pokechu22 <Pokechu022@gmail.com> | 2017-01-18 17:42:35 -0800 |
commit | 4d3bf2015504897fc69af2a209d4c8bbe217394d (patch) | |
tree | 06e9d3e385c7810bd877d389e825be810e61f4b0 /nms-patches/PlayerList.patch | |
parent | 7fdc749bf17b8a80b931f58ad4ac101d4b20676e (diff) | |
download | craftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.tar craftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.tar.gz craftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.tar.lz craftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.tar.xz craftbukkit-4d3bf2015504897fc69af2a209d4c8bbe217394d.zip |
Re-enable the vanilla debug MethodProfiler and /debug command
This is highly useful for profiling vanilla code, and in some cases plugin code. It is somewhat expensive, though, which is why it was initially disabled.
I chose to use a system property instead of a configuration setting because 1) the MethodProfiler is exclusive to CraftBukkit and not part of the general API (the timings system is the general API equivalent), and 2) using a static final boolean property _may_ allow the JITter to optimize out the methods when disabled (though I'm not sure of it).
There are several changes to fix cases where the profiler code was broken slightly by other craftbukkit changes. All of cases have been fixed, except for the block entity ticking one, due to the cost of the getSimpleName call. For that, a ticking entry is used instead, so that time spent actually ticking the block entities can be compared with time processing the list.
This (effectively) reverts 7dde6cc5663e1f6b84f549c54a47bc623b49fdf1.
Diffstat (limited to 'nms-patches/PlayerList.patch')
-rw-r--r-- | nms-patches/PlayerList.patch | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index 5750faaf..e8f9af17 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -340,13 +340,13 @@ + if (this.players.size() >= this.maxPlayers && !this.f(gameprofile)) { + event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full"); + } - } ++ } + + cserver.getPluginManager().callEvent(event); + if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) { + loginlistener.disconnect(event.getKickMessage()); + return null; -+ } + } + return entity; } @@ -427,13 +427,13 @@ + entityplayer1.setRespawnPosition(null, true); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0.0F)); + } -+ } + } + + if (location == null) { + cworld = (CraftWorld) this.server.server.getWorlds().get(0); + blockposition = cworld.getHandle().getSpawn(); + location = new Location(cworld, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F)); - } ++ } + + Player respawnPlayer = cserver.getPlayer(entityplayer1); + PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn); @@ -597,9 +597,9 @@ + double d1 = entity.locZ; + double d2 = 8.0D; + float f = entity.yaw; ++ */ + + worldserver.methodProfiler.a("moving"); -+ */ + if (worldserver1.dimension == -1) { + d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b()+ 16.0D, worldserver1.getWorldBorder().d() - 16.0D); + d1 = MathHelper.a(d1 / d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D); @@ -640,7 +640,7 @@ + */ + } + -+ // worldserver.methodProfiler.b(); ++ worldserver.methodProfiler.b(); + if (i != 1) { + worldserver.methodProfiler.a("placing"); + d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872); @@ -652,9 +652,9 @@ + worldserver1.addEntity(entity); + worldserver1.entityJoinedWorld(entity, false); + } ++ */ + + worldserver.methodProfiler.b(); -+ */ + } + + // entity.spawnIn(worldserver1); @@ -672,9 +672,9 @@ double d1 = entity.locZ; double d2 = 8.0D; float f = entity.yaw; ++ */ worldserver.methodProfiler.a("moving"); -+ */ + entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); + if (entity.isAlive()) { + worldserver.entityJoinedWorld(entity, false); |