Remove unnecessary AsyncCatcher callers

The AsyncCatcher will check threads and cost extra performance, and since it only works for bad plugins, just removed unnecessary callers that won't save data to disk to save these performance.
This commit is contained in:
Sotr
2019-03-22 00:40:48 +08:00
parent 398eac9e15
commit 3d74804bea
9 changed files with 19 additions and 19 deletions

View File

@@ -406,12 +406,12 @@ public class Block implements IMaterial {
@Deprecated
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1) {
org.spigotmc.AsyncCatcher.catchOp( "block onPlace"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "block onPlace"); // Spigot // Akarin
}
@Deprecated
public void remove(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
org.spigotmc.AsyncCatcher.catchOp( "block remove"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "block remove"); // Spigot // Akarin
}
public int a(IBlockData iblockdata, Random random) {

View File

@@ -750,7 +750,7 @@ public abstract class EntityLiving extends Entity {
}
public boolean addEffect(MobEffect mobeffect, EntityPotionEffectEvent.Cause cause) {
org.spigotmc.AsyncCatcher.catchOp( "effect add"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "effect add"); // Spigot // Akarin
if (isTickingEffects) {
effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
return true;

View File

@@ -105,7 +105,7 @@ public class EntityTracker {
}
public void addEntity(Entity entity, int originalRange, int j, boolean flag) { // Spigot
org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "entity track"); // Spigot // Akarin
int i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, originalRange); // Spigot
try {
if (this.trackedEntities.b(entity.getId())) {
@@ -144,7 +144,7 @@ public class EntityTracker {
}
public void untrackEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp( "entity untrack"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "entity untrack"); // Spigot // Akarin
if (entity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entity;
Iterator iterator = this.c.iterator();

View File

@@ -356,7 +356,7 @@ public class EntityTrackerEntry {
}
public void updatePlayer(EntityPlayer entityplayer) {
org.spigotmc.AsyncCatcher.catchOp( "player tracker update"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "player tracker update"); // Spigot // Akarin
if (entityplayer != this.tracker) {
if (this.c(entityplayer)) {
if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) {
@@ -642,7 +642,7 @@ public class EntityTrackerEntry {
}
public void clear(EntityPlayer entityplayer) {
org.spigotmc.AsyncCatcher.catchOp( "player tracker clear"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "player tracker clear"); // Spigot // Akarin
if (this.trackedPlayers.contains(entityplayer)) {
this.trackedPlayers.remove(entityplayer);
this.tracker.c(entityplayer);

View File

@@ -118,7 +118,7 @@ public final class MCUtil {
* @return
*/
public static void ensureMain(String reason, Runnable run) {
if (AsyncCatcher.enabled && !ThreadAssertion.isMainThread() && Thread.currentThread() != MinecraftServer.getServer().primaryThread) { // Akarin
if (/*AsyncCatcher.enabled*/ && !ThreadAssertion.isMainThread() && Thread.currentThread() != MinecraftServer.getServer().primaryThread) { // Akarin
if (reason != null) {
new IllegalStateException("Asynchronous " + reason + "!").printStackTrace();
}
@@ -143,7 +143,7 @@ public final class MCUtil {
* @return
*/
public static <T> T ensureMain(String reason, Supplier<T> run) {
if (AsyncCatcher.enabled && !ThreadAssertion.isMainThread() && Thread.currentThread() != MinecraftServer.getServer().primaryThread) { // Akarin
if (/*AsyncCatcher.enabled &&*/ !ThreadAssertion.isMainThread() && Thread.currentThread() != MinecraftServer.getServer().primaryThread) { // Akarin
if (reason != null) {
new IllegalStateException("Asynchronous " + reason + "! Blocking thread until it returns ").printStackTrace();
}

View File

@@ -1088,7 +1088,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return regionLimited.addEntity(entity, spawnReason);
}
// Paper end
org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot // Akarin
if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper
if (!CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
return false;
@@ -1149,7 +1149,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public void kill(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp( "entity kill"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "entity kill"); // Spigot // Akarin
if (entity.isVehicle()) {
entity.ejectPassengers();
}
@@ -1190,7 +1190,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public void removeEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp( "entity remove"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "entity remove"); // Spigot // Akarin
entity.b(false);
entity.die();
if (entity instanceof EntityHuman) {
@@ -2542,7 +2542,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
public void addChunkEntities(Stream<Entity> collection) { a(collection); } // Paper - OBFHELPER
public void a(Stream<Entity> stream) {
org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "entity world add"); // Spigot // Akarin
stream.forEach((entity) -> {
if (entity == null || entity.dead || entity.valid) { // Paper - prevent adding already added or dead entities
return;

View File

@@ -707,7 +707,7 @@ public final class CraftServer implements Server {
public boolean dispatchCommand(CommandSender sender, String commandLine) {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(commandLine, "CommandLine cannot be null");
org.spigotmc.AsyncCatcher.catchOp( "command dispatch" ); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "command dispatch" ); // Spigot // Akarin
// Paper Start
if (!org.spigotmc.AsyncCatcher.shuttingDown && !ThreadAssertion.isMainThread() && !Bukkit.isPrimaryThread()) { // Akarin

View File

@@ -223,7 +223,7 @@ public class CraftWorld implements World {
}
public boolean unloadChunkRequest(int x, int z, boolean safe) {
org.spigotmc.AsyncCatcher.catchOp( "chunk unload"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "chunk unload"); // Spigot // Akarin
if (safe && isChunkInUse(x, z)) {
return false;
}
@@ -237,7 +237,7 @@ public class CraftWorld implements World {
}
public boolean unloadChunk(int x, int z, boolean save, boolean safe) {
org.spigotmc.AsyncCatcher.catchOp( "chunk unload" ); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "chunk unload" ); // Spigot // Akarin
if (isChunkInUse(x, z)) {
return false;
}
@@ -258,7 +258,7 @@ public class CraftWorld implements World {
}
public boolean regenerateChunk(int x, int z) {
org.spigotmc.AsyncCatcher.catchOp( "chunk regenerate" ); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "chunk regenerate" ); // Spigot // Akarin
if (!unloadChunk0(x, z, false)) {
return false;
}
@@ -304,7 +304,7 @@ public class CraftWorld implements World {
}
public boolean loadChunk(int x, int z, boolean generate) {
org.spigotmc.AsyncCatcher.catchOp( "chunk load"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "chunk load"); // Spigot // Akarin
chunkLoadCount++;
return world.getChunkProvider().getChunkAt(x, z, true, generate || isChunkGenerated(x, z)) != null; // Paper
}

View File

@@ -43,7 +43,7 @@ public final class CraftScoreboardManager implements ScoreboardManager {
}
public CraftScoreboard getNewScoreboard() {
org.spigotmc.AsyncCatcher.catchOp( "scoreboard creation"); // Spigot
//org.spigotmc.AsyncCatcher.catchOp( "scoreboard creation"); // Spigot // Akarin
CraftScoreboard scoreboard = new CraftScoreboard(new ScoreboardServer(server));
scoreboards.add(scoreboard);
return scoreboard;