Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 13:30:05 +01:00
SPIGOT-5799: InventoryCloseEvent fires after PlayerQuitEvent
Dieser Commit ist enthalten in:
Ursprung
26c0084f0a
Commit
833da9c47d
@ -265,13 +265,13 @@
|
|||||||
entityplayer.a(StatisticList.LEAVE_GAME);
|
entityplayer.a(StatisticList.LEAVE_GAME);
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
|
+ // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleInventoryCloseEvent(entityplayer);
|
+ entityplayer.closeInventory();
|
||||||
+
|
+
|
||||||
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
|
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
|
||||||
+ cserver.getPluginManager().callEvent(playerQuitEvent);
|
+ cserver.getPluginManager().callEvent(playerQuitEvent);
|
||||||
+ entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
|
+ entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
|
||||||
+
|
+
|
||||||
+ entityplayer.playerTick();// SPIGOT-924
|
+ entityplayer.playerTick(); // SPIGOT-924
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
this.savePlayerFile(entityplayer);
|
this.savePlayerFile(entityplayer);
|
||||||
|
@ -1236,6 +1236,10 @@ public class CraftEventFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void handleInventoryCloseEvent(EntityHuman human) {
|
public static void handleInventoryCloseEvent(EntityHuman human) {
|
||||||
|
// SPIGOT-5799 - no need to fire for when no inventory open
|
||||||
|
if (human.activeContainer == human.defaultContainer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView());
|
InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView());
|
||||||
human.world.getServer().getPluginManager().callEvent(event);
|
human.world.getServer().getPluginManager().callEvent(event);
|
||||||
human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity());
|
human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren