Reduce PlayerNaturallySpawnCreaturesEvent calls

This commit is contained in:
Shane Freeder
2020-02-29 23:39:00 +00:00
parent c0f4b24e3a
commit 4df3dad85d
16 changed files with 153 additions and 115 deletions

View File

@@ -1,4 +1,4 @@
From abf6cb2c774d700e46442b8db37af7fcda2800ef Mon Sep 17 00:00:00 2001
From 395926f7e3d53453169ffd333e788356c979edf5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 3 Jul 2018 21:56:23 -0400
Subject: [PATCH] InventoryCloseEvent Reason API
@@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 4721c288b..36748ccb7 100644
index 4721c288ba..36748ccb73 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -164,7 +164,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -34,10 +34,10 @@ index 4721c288b..36748ccb7 100644
this.activeContainer = this.defaultContainer;
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 1296eb04f..a9a16eace 100644
index 625b684287..f849dba215 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -366,7 +366,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -368,7 +368,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
// Paper end
if (!this.world.isClientSide && !this.activeContainer.canUse(this)) {
@@ -46,7 +46,7 @@ index 1296eb04f..a9a16eace 100644
this.activeContainer = this.defaultContainer;
}
@@ -540,7 +540,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -542,7 +542,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// SPIGOT-943 - only call if they have an inventory open
if (this.activeContainer != this.defaultContainer) {
@@ -55,7 +55,7 @@ index 1296eb04f..a9a16eace 100644
}
String deathMessage = event.getDeathMessage();
@@ -1060,7 +1060,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1062,7 +1062,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return OptionalInt.empty();
} else {
if (this.activeContainer != this.defaultContainer) {
@@ -64,7 +64,7 @@ index 1296eb04f..a9a16eace 100644
}
this.nextContainerCounter();
@@ -1120,7 +1120,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1122,7 +1122,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
// CraftBukkit end
if (this.activeContainer != this.defaultContainer) {
@@ -73,7 +73,7 @@ index 1296eb04f..a9a16eace 100644
}
// this.nextContainerCounter(); // CraftBukkit - moved up
@@ -1184,7 +1184,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1186,7 +1186,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@Override
public void closeInventory() {
@@ -88,7 +88,7 @@ index 1296eb04f..a9a16eace 100644
this.m();
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 4a0a84794..8eb12e89e 100644
index 4a0a847944..8eb12e89ea 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2040,7 +2040,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -101,7 +101,7 @@ index 4a0a84794..8eb12e89e 100644
this.player.m();
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 002f7e844..fd0f5c6f2 100644
index 002f7e844a..fd0f5c6f29 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -403,7 +403,7 @@ public abstract class PlayerList {
@@ -114,7 +114,7 @@ index 002f7e844..fd0f5c6f2 100644
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
cserver.getPluginManager().callEvent(playerQuitEvent);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index c773314cf..bad4e6f7f 100644
index c773314cff..bad4e6f7fc 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1047,7 +1047,7 @@ public class WorldServer extends World {
@@ -136,7 +136,7 @@ index c773314cf..bad4e6f7f 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index cd8ad2704..e169679c8 100644
index cd8ad27047..e169679c88 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -619,8 +619,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -155,7 +155,7 @@ index cd8ad2704..e169679c8 100644
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f4affa693..c1f392716 100644
index 52640237ae..d7d86a8b24 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -786,7 +786,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -168,7 +168,7 @@ index f4affa693..c1f392716 100644
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index caf277439..f931fa48b 100644
index caf277439a..f931fa48b4 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1293,8 +1293,19 @@ public class CraftEventFactory {