From b69631ba217650d2dfa70da535923e0e9d52f770 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 15 Dec 2024 14:29:01 +0100 Subject: [PATCH] Readd dropped ServerScoreboard hunk --- .../server/ServerScoreboard.java.patch | 27 +++++++++++++++---- .../ai/behavior/InteractWithDoor.java.patch | 15 +++++------ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/server/ServerScoreboard.java.patch b/paper-server/patches/sources/net/minecraft/server/ServerScoreboard.java.patch index 32654cff45..5b73435f3a 100644 --- a/paper-server/patches/sources/net/minecraft/server/ServerScoreboard.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/ServerScoreboard.java.patch @@ -47,10 +47,27 @@ } else { this.startTrackingObjective(objective); } -@@ -114,14 +_,42 @@ - } - } - +@@ -104,24 +_,50 @@ + @Override + public boolean addPlayerToTeam(String playerName, PlayerTeam team) { + if (super.addPlayerToTeam(playerName, team)) { +- this.server +- .getPlayerList() +- .broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD)); +- this.setDirty(); +- return true; +- } else { +- return false; +- } +- } ++ this.broadcastAll(ClientboundSetPlayerTeamPacket.createPlayerPacket(team, playerName, ClientboundSetPlayerTeamPacket.Action.ADD)); // CraftBukkit ++ this.setDirty(); ++ return true; ++ } else { ++ return false; ++ } ++ } ++ + // Paper start - Multiple Entries with Scoreboards + public boolean addPlayersToTeam(java.util.Collection players, PlayerTeam team) { + boolean anyAdded = false; @@ -69,7 +86,7 @@ + } + } + // Paper end - Multiple Entries with Scoreboards -+ + @Override public void removePlayerFromTeam(String username, PlayerTeam playerTeam) { super.removePlayerFromTeam(username, playerTeam); diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java.patch index a5139c9b02..8f8cc15760 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java.patch @@ -1,16 +1,15 @@ --- a/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java +++ b/net/minecraft/world/entity/ai/behavior/InteractWithDoor.java -@@ -58,6 +_,13 @@ +@@ -58,6 +_,12 @@ if (blockState.is(BlockTags.MOB_INTERACTABLE_DOORS, state -> state.getBlock() instanceof DoorBlock)) { DoorBlock doorBlock = (DoorBlock)blockState.getBlock(); if (!doorBlock.isOpen(blockState)) { -+ // CraftBukkit start - entities opening doors -+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entity.level(), blockPos)); -+ entity.level().getCraftServer().getPluginManager().callEvent(event); -+ if (event.isCancelled()) { -+ return false; -+ } -+ // CraftBukkit end ++ // CraftBukkit start - entities opening doors ++ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entity.level(), blockPos)); ++ if (!event.callEvent()) { ++ return false; ++ } ++ // CraftBukkit end doorBlock.setOpen(entity, level, blockState, blockPos, true); }