diff options
Diffstat (limited to 'patches/server')
10 files changed, 421 insertions, 0 deletions
diff --git a/patches/server/0811-Refresh-ProjectileSource-for-projectiles.patch b/patches/server/0811-Refresh-ProjectileSource-for-projectiles.patch new file mode 100644 index 0000000000..7bc80ccda2 --- /dev/null +++ b/patches/server/0811-Refresh-ProjectileSource-for-projectiles.patch @@ -0,0 +1,81 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Tue, 30 May 2023 12:59:10 -0700 +Subject: [PATCH] Refresh ProjectileSource for projectiles + +Makes sure the value returned by Projectile#getShooter in +the API matches the owner UUID specified in the entity nbt. +Previously, after the entity reloaded, Projectile#getShooter +would return null, while the entity still had an owner. + +Also fixes setting the shooter/owner to null actually +clearing the owner. + +Co-authored-by: Warrior <[email protected]> + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 2c959a99376ed479415354c481801643c5f6b1a1..8cdef637f6343119fc77f87e7478ee23e9b8efab 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -393,6 +393,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + public boolean inWorld = false; + public boolean generation; + public int maxAirTicks = this.getDefaultMaxAirSupply(); // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir() ++ @Nullable // Paper - Refresh ProjectileSource for projectiles + public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only + public boolean lastDamageCancelled; // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Keep track if the event was canceled + public boolean persistentInvisibility = false; +diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +index 4d487090a622d280bdfacc18978929c61f74f147..3982b32cf69250ebd138eff225b65313f75286ea 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +@@ -63,17 +63,35 @@ public abstract class Projectile extends Entity implements TraceableEntity { + this.ownerUUID = entity.getUUID(); + this.cachedOwner = entity; + } +- this.projectileSource = (entity != null && entity.getBukkitEntity() instanceof ProjectileSource) ? (ProjectileSource) entity.getBukkitEntity() : null; // CraftBukkit +- ++ // Paper start - Refresh ProjectileSource for projectiles ++ else { ++ this.ownerUUID = null; ++ this.cachedOwner = null; ++ this.projectileSource = null; ++ } ++ // Paper end - Refresh ProjectileSource for projectiles ++ this.refreshProjectileSource(false); // Paper ++ } ++ // Paper start - Refresh ProjectileSource for projectiles ++ public void refreshProjectileSource(boolean fillCache) { ++ if (fillCache) { ++ this.getOwner(); ++ } ++ if (this.cachedOwner != null && !this.cachedOwner.isRemoved() && this.projectileSource == null && this.cachedOwner.getBukkitEntity() instanceof ProjectileSource projSource) { ++ this.projectileSource = projSource; ++ } + } ++ // Paper end - Refresh ProjectileSource for projectiles + + @Nullable + @Override + public Entity getOwner() { + if (this.cachedOwner != null && !this.cachedOwner.isRemoved()) { ++ this.refreshProjectileSource(false); // Paper - Refresh ProjectileSource for projectiles + return this.cachedOwner; + } else if (this.ownerUUID != null) { + this.cachedOwner = this.findOwner(this.ownerUUID); ++ this.refreshProjectileSource(false); // Paper - Refresh ProjectileSource for projectiles + return this.cachedOwner; + } else { + return null; +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java +index de4fb2654c7895cfd83ad694455ee56cb708c2f2..591af9d0d2fdc9953415979fc97a4a00afd85885 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java +@@ -60,6 +60,7 @@ public abstract class AbstractProjectile extends CraftEntity implements Projecti + + @Override + public final org.bukkit.projectiles.ProjectileSource getShooter() { ++ this.getHandle().refreshProjectileSource(true); // Paper - Refresh ProjectileSource for projectiles + return this.getHandle().projectileSource; + } + diff --git a/patches/server/0812-Add-transient-modifier-API.patch b/patches/server/0812-Add-transient-modifier-API.patch new file mode 100644 index 0000000000..36cc0a030a --- /dev/null +++ b/patches/server/0812-Add-transient-modifier-API.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Malfrador <[email protected]> +Date: Wed, 31 May 2023 23:30:00 +0200 +Subject: [PATCH] Add transient modifier API + + +diff --git a/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeInstance.java b/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeInstance.java +index 12135ffeacd648f6bc4d7d327059ea1a7e8c79c4..52439f4b959c74027eb191a3af960c70beb978e8 100644 +--- a/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeInstance.java ++++ b/src/main/java/io/papermc/paper/attribute/UnmodifiableAttributeInstance.java +@@ -23,6 +23,11 @@ public class UnmodifiableAttributeInstance extends CraftAttributeInstance { + throw new UnsupportedOperationException("Cannot modify default attributes"); + } + ++ @Override ++ public void addTransientModifier(AttributeModifier modifier) { ++ throw new UnsupportedOperationException("Cannot modify default attributes"); ++ } ++ + @Override + public void removeModifier(AttributeModifier modifier) { + throw new UnsupportedOperationException("Cannot modify default attributes"); +diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java +index 3b171a08bd0bedfe224905feb5838d2540199bce..cd6a492f56b3dee5985c068e20009b6c833e143b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java ++++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java +@@ -51,6 +51,14 @@ public class CraftAttributeInstance implements AttributeInstance { + this.handle.addPermanentModifier(CraftAttributeInstance.convert(modifier)); + } + ++ // Paper start - Transient modifier API ++ @Override ++ public void addTransientModifier(AttributeModifier modifier) { ++ Preconditions.checkArgument(modifier != null, "modifier"); ++ this.handle.addTransientModifier(CraftAttributeInstance.convert(modifier)); ++ } ++ // Paper end ++ + @Override + public void removeModifier(AttributeModifier modifier) { + Preconditions.checkArgument(modifier != null, "modifier"); diff --git a/patches/server/0813-Fix-block-place-logic.patch b/patches/server/0813-Fix-block-place-logic.patch new file mode 100644 index 0000000000..6f5dfc260e --- /dev/null +++ b/patches/server/0813-Fix-block-place-logic.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <[email protected]> +Date: Mon, 3 Apr 2023 18:46:49 +0200 +Subject: [PATCH] Fix block place logic + +Fix several issues when a player interact with a block: +* the place sound isn't played for the dispensed shulker block +* desync of the jukebox blocks between bukkit handler and the vanilla interaction +* poi can desync when the BlockPhysicsEvent is cancelled + +diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java +index 44cc12a3338b5f0448c88192c8674cd36531db34..d59120f0304823361cc4112f5583323945df4229 100644 +--- a/src/main/java/net/minecraft/world/item/BlockItem.java ++++ b/src/main/java/net/minecraft/world/item/BlockItem.java +@@ -122,7 +122,7 @@ public class BlockItem extends Item { + + SoundType soundeffecttype = iblockdata1.getSoundType(); + +- // world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); ++ if (entityhuman == null) world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), net.minecraft.sounds.SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); // Paper - Fix block place logic; reintroduce this for the dispenser (i.e the shulker) + world.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.Context.of(entityhuman, iblockdata1)); + itemstack.consume(1, entityhuman); + return InteractionResult.SUCCESS; +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index a6f538372830f3f80740ef503733736e0561d1bd..d048d0e4b16459b5bad44ebfa3c6a8f336f6762b 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -552,17 +552,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + // CraftBukkit start + iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam + CraftWorld world = ((ServerLevel) this).getWorld(); ++ boolean cancelledUpdates = false; // Paper - Fix block place logic + if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper - BlockPhysicsEvent + BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); + this.getCraftServer().getPluginManager().callEvent(event); + +- if (event.isCancelled()) { +- return; +- } ++ cancelledUpdates = event.isCancelled(); // Paper - Fix block place logic + } + // CraftBukkit end ++ if (!cancelledUpdates) { // Paper - Fix block place logic + iblockdata.updateNeighbourShapes(this, blockposition, k, j - 1); + iblockdata.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); ++ } // Paper - Fix block place logic + } + + // CraftBukkit start - SPIGOT-5710 diff --git a/patches/server/0814-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch b/patches/server/0814-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch new file mode 100644 index 0000000000..45955c4fa8 --- /dev/null +++ b/patches/server/0814-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <[email protected]> +Date: Thu, 8 Jun 2023 20:23:13 -0400 +Subject: [PATCH] Fix spigot sound playing for BlockItem ItemStacks + + +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index d8dc3228f3cd8c9efc8359162edac601a87bf762..5867a0e3e2ce9be7514771549ad318947e387470 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -577,7 +577,11 @@ public final class ItemStack implements DataComponentHolder { + + // SPIGOT-1288 - play sound stripped from ItemBlock + if (this.item instanceof BlockItem) { +- SoundType soundeffecttype = ((BlockItem) this.item).getBlock().defaultBlockState().getSoundType(); // TODO: not strictly correct, however currently only affects decorated pots ++ // Paper start - Fix spigot sound playing for BlockItem ItemStacks ++ BlockPos position = new net.minecraft.world.item.context.BlockPlaceContext(context).getClickedPos(); ++ net.minecraft.world.level.block.state.BlockState blockData = world.getBlockState(position); ++ SoundType soundeffecttype = blockData.getSoundType(); ++ // Paper end - Fix spigot sound playing for BlockItem ItemStacks + world.playSound(entityhuman, blockposition, soundeffecttype.getPlaceSound(), SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); + } + diff --git a/patches/server/0815-Call-BlockGrowEvent-for-missing-blocks.patch b/patches/server/0815-Call-BlockGrowEvent-for-missing-blocks.patch new file mode 100644 index 0000000000..d48638c261 --- /dev/null +++ b/patches/server/0815-Call-BlockGrowEvent-for-missing-blocks.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <[email protected]> +Date: Fri, 9 Jun 2023 13:04:42 +0200 +Subject: [PATCH] Call BlockGrowEvent for missing blocks + +Call the event for pitcher crops and sniffer egg + +diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java +index ea6135edc76c06b7cd55930b620dfb05f939e4f6..640e439524cc1e5960ba99f8bd555c7dee8edbf5 100644 +--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java +@@ -142,7 +142,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl + int i = Math.min(state.getValue(AGE) + amount, 4); + if (this.canGrow(world, pos, state, i)) { + BlockState blockState = state.setValue(AGE, Integer.valueOf(i)); +- world.setBlock(pos, blockState, 2); ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, pos, blockState, 2)) return; // Paper + if (isDouble(i)) { + world.setBlock(pos.above(), blockState.setValue(HALF, DoubleBlockHalf.UPPER), 3); + } +diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +index 2df28caefff893f319924ae5fd376c8aeb0a2158..c6b7cfd78bc0c4cb64eada507876c293541890f4 100644 +--- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +@@ -72,8 +72,13 @@ public class SnifferEggBlock extends Block { + @Override + public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (!this.isReadyToHatch(state)) { ++ // Paper start ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, pos, state.setValue(HATCH, Integer.valueOf(this.getHatchLevel(state) + 1)), 2)) { ++ this.rescheduleTick(world, pos); ++ return; ++ } ++ // Paper end + world.playSound(null, pos, SoundEvents.SNIFFER_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); +- world.setBlock(pos, state.setValue(HATCH, Integer.valueOf(this.getHatchLevel(state) + 1)), 2); + } else { + // Paper start - Call BlockFadeEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, state.getFluidState().createLegacyBlock()).isCancelled()) { diff --git a/patches/server/0816-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch b/patches/server/0816-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch new file mode 100644 index 0000000000..cf58a3ec85 --- /dev/null +++ b/patches/server/0816-Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TheMeinerLP <[email protected]> +Date: Tue, 13 Jun 2023 16:10:59 +0200 +Subject: [PATCH] Don't enforce icanhasbukkit default if alias block exists + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index f89cbdb157cb56b1b3e0658d80de48695734138d..f85e8ec660bf588f694aa96e6e2ade478a9696b7 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -358,7 +358,11 @@ public final class CraftServer implements Server { + } + this.commandsConfiguration = YamlConfiguration.loadConfiguration(this.getCommandsConfigFile()); + this.commandsConfiguration.options().copyDefaults(true); +- this.commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8))); ++ // Paper start - don't enforce icanhasbukkit default if alias block exists ++ final YamlConfiguration commandsDefaults = YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8)); ++ if (this.commandsConfiguration.contains("aliases")) commandsDefaults.set("aliases", null); ++ this.commandsConfiguration.setDefaults(commandsDefaults); ++ // Paper end - don't enforce icanhasbukkit default if alias block exists + this.saveCommandsConfig(); + + // Migrate aliases from old file and add previously implicit $1- to pass all arguments diff --git a/patches/server/0817-fix-MapLike-spam-for-missing-key-selector.patch b/patches/server/0817-fix-MapLike-spam-for-missing-key-selector.patch new file mode 100644 index 0000000000..2bd3b889f1 --- /dev/null +++ b/patches/server/0817-fix-MapLike-spam-for-missing-key-selector.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Wed, 14 Jun 2023 13:17:40 -0700 +Subject: [PATCH] fix MapLike spam for missing key 'selector' + + +diff --git a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java +index 8c8c16ce53f5bdf88274cb80767decf0a2612637..0efe935e1f0a25bff95cdb849117b222ae8c603e 100644 +--- a/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java ++++ b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java +@@ -353,7 +353,7 @@ public interface VibrationSystem { + public static Codec<VibrationSystem.Data> CODEC = RecordCodecBuilder.create((instance) -> { + return instance.group(VibrationInfo.CODEC.lenientOptionalFieldOf("event").forGetter((vibrationsystem_a) -> { + return Optional.ofNullable(vibrationsystem_a.currentVibration); +- }), VibrationSelector.CODEC.fieldOf("selector").forGetter(VibrationSystem.Data::getSelectionStrategy), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("event_delay").orElse(0).forGetter(VibrationSystem.Data::getTravelTimeInTicks)).apply(instance, (optional, vibrationselector, integer) -> { ++ }), VibrationSelector.CODEC.optionalFieldOf("selector").xmap(o -> o.orElseGet(VibrationSelector::new), Optional::of).forGetter(VibrationSystem.Data::getSelectionStrategy), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("event_delay").orElse(0).forGetter(VibrationSystem.Data::getTravelTimeInTicks)).apply(instance, (optional, vibrationselector, integer) -> { // Paper - fix MapLike spam for missing "selector" in 1.19.2 + return new VibrationSystem.Data((VibrationInfo) optional.orElse(null), vibrationselector, integer, true); // CraftBukkit - decompile error + }); + }); diff --git a/patches/server/0818-Fix-sniffer-removeExploredLocation.patch b/patches/server/0818-Fix-sniffer-removeExploredLocation.patch new file mode 100644 index 0000000000..e8b1703090 --- /dev/null +++ b/patches/server/0818-Fix-sniffer-removeExploredLocation.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <[email protected]> +Date: Sun, 11 Jun 2023 19:02:46 +0200 +Subject: [PATCH] Fix sniffer removeExploredLocation + +Add support to remove explored location in different world + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSniffer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSniffer.java +index 60251107371ef876d29fc9aa578835250715c4bc..555337018fe218ac5a296a5e6a1d82720fee05e1 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSniffer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSniffer.java +@@ -34,12 +34,13 @@ public class CraftSniffer extends CraftAnimals implements Sniffer { + @Override + public void removeExploredLocation(Location location) { + Preconditions.checkArgument(location != null, "location cannot be null"); +- if (location.getWorld() != this.getWorld()) { +- return; +- } + + BlockPos blockPosition = CraftLocation.toBlockPosition(location); +- this.getHandle().getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, this.getHandle().getExploredPositions().filter(blockPositionExplored -> !blockPositionExplored.equals(blockPosition)).collect(Collectors.toList())); ++ // Paper start ++ net.minecraft.world.level.Level level = location.getWorld() != null ? ((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle() : this.getHandle().level(); ++ net.minecraft.core.GlobalPos globalPos = net.minecraft.core.GlobalPos.of(level.dimension(), blockPosition); ++ this.getHandle().getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, this.getHandle().getExploredPositions().filter(blockPositionExplored -> !blockPositionExplored.equals(globalPos)).collect(Collectors.toList())); ++ // Paper end + } + + @Override diff --git a/patches/server/0819-Add-method-to-remove-all-active-potion-effects.patch b/patches/server/0819-Add-method-to-remove-all-active-potion-effects.patch new file mode 100644 index 0000000000..e730bcf1d4 --- /dev/null +++ b/patches/server/0819-Add-method-to-remove-all-active-potion-effects.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Sat, 17 Jun 2023 13:17:25 -0700 +Subject: [PATCH] Add method to remove all active potion effects + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index 203e06fdff824ba67dce0e026f7ea5b746d7f258..a62d17b72c675120b447e625cb3dc437681bdf20 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -573,6 +573,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + return effects; + } + ++ // Paper start - LivingEntity#clearActivePotionEffects(); ++ @Override ++ public boolean clearActivePotionEffects() { ++ return this.getHandle().removeAllEffects(EntityPotionEffectEvent.Cause.PLUGIN); ++ } ++ // Paper end ++ + @Override + public <T extends Projectile> T launchProjectile(Class<? extends T> projectile) { + return this.launchProjectile(projectile, null); diff --git a/patches/server/0820-Add-event-for-player-editing-sign.patch b/patches/server/0820-Add-event-for-player-editing-sign.patch new file mode 100644 index 0000000000..9ea10f8448 --- /dev/null +++ b/patches/server/0820-Add-event-for-player-editing-sign.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: by77er <[email protected]> +Date: Mon, 12 Jun 2023 12:56:46 -0400 +Subject: [PATCH] Add event for player editing sign + + +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 5867a0e3e2ce9be7514771549ad318947e387470..612eb27b471a9ebfdea29a58e5a32931f869bfb6 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -556,7 +556,7 @@ public final class ItemStack implements DataComponentHolder { + try { + if (world.getBlockEntity(SignItem.openSign) instanceof SignBlockEntity tileentitysign) { + if (world.getBlockState(SignItem.openSign).getBlock() instanceof SignBlock blocksign) { +- blocksign.openTextEdit(entityhuman, tileentitysign, true, org.bukkit.event.player.PlayerSignOpenEvent.Cause.PLACE); // Craftbukkit ++ blocksign.openTextEdit(entityhuman, tileentitysign, true, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.PLACE); // Craftbukkit // Paper - Add PlayerOpenSignEvent + } + } + } finally { +diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java +index 725a207f80651939c1d793f8aa4ba27e8e4da568..b212fe323f048dab40c0ccbb9327c9fc73b9e03a 100644 +--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java +@@ -140,7 +140,7 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo + } else if (flag1) { + return InteractionResult.SUCCESS_SERVER; + } else if (!this.otherPlayerIsEditingSign(player, tileentitysign) && player.mayBuild() && this.hasEditableText(player, tileentitysign, flag)) { +- this.openTextEdit(player, tileentitysign, flag, org.bukkit.event.player.PlayerSignOpenEvent.Cause.INTERACT); // CraftBukkit ++ this.openTextEdit(player, tileentitysign, flag, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.INTERACT); // Paper - Add PlayerOpenSignEvent + return InteractionResult.SUCCESS_SERVER; + } else { + return InteractionResult.PASS; +@@ -185,16 +185,33 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo + return blockpropertywood; + } + ++ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper - Add PlayerOpenSignEvent + public void openTextEdit(Player player, SignBlockEntity blockEntity, boolean front) { +- // Craftbukkit start +- this.openTextEdit(player, blockEntity, front, org.bukkit.event.player.PlayerSignOpenEvent.Cause.UNKNOWN); +- } +- +- public void openTextEdit(Player entityhuman, SignBlockEntity tileentitysign, boolean flag, org.bukkit.event.player.PlayerSignOpenEvent.Cause cause) { +- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerSignOpenEvent(entityhuman, tileentitysign, flag, cause)) { ++ // Paper start - Add PlayerOpenSignEvent ++ this.openTextEdit(player, blockEntity, front, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.UNKNOWN); ++ } ++ public void openTextEdit(Player entityhuman, SignBlockEntity tileentitysign, boolean flag, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause cause) { ++ org.bukkit.entity.Player bukkitPlayer = (org.bukkit.entity.Player) entityhuman.getBukkitEntity(); ++ org.bukkit.block.Block bukkitBlock = org.bukkit.craftbukkit.block.CraftBlock.at(tileentitysign.getLevel(), tileentitysign.getBlockPos()); ++ org.bukkit.craftbukkit.block.CraftSign<?> bukkitSign = (org.bukkit.craftbukkit.block.CraftSign<?>) org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(bukkitBlock); ++ io.papermc.paper.event.player.PlayerOpenSignEvent event = new io.papermc.paper.event.player.PlayerOpenSignEvent( ++ bukkitPlayer, ++ bukkitSign, ++ flag ? org.bukkit.block.sign.Side.FRONT : org.bukkit.block.sign.Side.BACK, ++ cause); ++ if (!event.callEvent()) return; ++ if (org.bukkit.event.player.PlayerSignOpenEvent.getHandlerList().getRegisteredListeners().length > 0) { ++ final org.bukkit.event.player.PlayerSignOpenEvent.Cause legacyCause = switch (cause) { ++ case PLACE -> org.bukkit.event.player.PlayerSignOpenEvent.Cause.PLACE; ++ case PLUGIN -> org.bukkit.event.player.PlayerSignOpenEvent.Cause.PLUGIN; ++ case INTERACT -> org.bukkit.event.player.PlayerSignOpenEvent.Cause.INTERACT; ++ case UNKNOWN -> org.bukkit.event.player.PlayerSignOpenEvent.Cause.UNKNOWN; ++ }; ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerSignOpenEvent(entityhuman, tileentitysign, flag, legacyCause)) { ++ // Paper end - Add PlayerOpenSignEvent + return; + } +- // Craftbukkit end ++ } // Paper - Add PlayerOpenSignEvent + tileentitysign.setAllowedPlayerEditor(entityhuman.getUUID()); + entityhuman.openTextEdit(tileentitysign, flag); + } +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +index a12702cdf36c75572e661b5b5758270f5058c181..8303343ecca91076839f4436d6b3a3bf4739c2fd 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +@@ -168,9 +168,15 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState< + Preconditions.checkArgument(sign.isPlaced(), "Sign must be placed"); + Preconditions.checkArgument(sign.getWorld() == player.getWorld(), "Sign must be in same world as Player"); + ++ // Paper start - Add PlayerOpenSignEvent ++ io.papermc.paper.event.player.PlayerOpenSignEvent event = new io.papermc.paper.event.player.PlayerOpenSignEvent((Player) player, sign, side, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.PLUGIN); ++ if (!event.callEvent()) return; ++ if (PlayerSignOpenEvent.getHandlerList().getRegisteredListeners().length > 0) { ++ // Paper end - Add PlayerOpenSignEvent + if (!CraftEventFactory.callPlayerSignOpenEvent(player, sign, side, PlayerSignOpenEvent.Cause.PLUGIN)) { + return; + } ++ } // Paper - Add PlayerOpenSignEvent + + SignBlockEntity handle = ((CraftSign<?>) sign).getTileEntity(); + handle.setAllowedPlayerEditor(player.getUniqueId()); |