[ci skip] Add more patch identifying comments

This commit is contained in:
Nassim Jahnke
2024-01-13 16:35:59 +01:00
parent 0fb2a8eea3
commit 2307466a54
8 changed files with 63 additions and 63 deletions

View File

@@ -24,11 +24,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.random.nextFloat() < f) {
- player.getCooldowns().addCooldown(Items.SHIELD, 100);
+ // Paper start
+ // Paper start - Add PlayerShieldDisableEvent
+ final io.papermc.paper.event.player.PlayerShieldDisableEvent shieldDisableEvent = new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) player.getBukkitEntity(), getBukkitEntity(), 100);
+ if (!shieldDisableEvent.callEvent()) return;
+ player.getCooldowns().addCooldown(Items.SHIELD, shieldDisableEvent.getCooldown());
+ // Paper end
+ // Paper end - Add PlayerShieldDisableEvent
this.level().broadcastEntityEvent(player, (byte) 30);
}
}
@@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super.blockUsingShield(attacker);
if (attacker.canDisableShield()) {
- this.disableShield(true);
+ this.disableShield(true, attacker); // Paper
+ this.disableShield(true, attacker); // Paper - Add PlayerShieldDisableEvent
}
}
@@ -49,14 +49,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.attack(target);
}
+ @io.papermc.paper.annotation.DoNotUse // Paper - add player shield disable event
+ @io.papermc.paper.annotation.DoNotUse // Paper - Add PlayerShieldDisableEvent
public void disableShield(boolean sprinting) {
+ // Paper start - add player shield disable event
+ // Paper start - Add PlayerShieldDisableEvent
+ disableShield(sprinting, null);
+ }
+
+ public void disableShield(boolean sprinting, @Nullable LivingEntity attacker) {
+ // Paper end - add player shield disable event
+ // Paper end - Add PlayerShieldDisableEvent
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
if (sprinting) {
@@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.random.nextFloat() < f) {
- this.getCooldowns().addCooldown(Items.SHIELD, 100);
+ // Paper start - add player shield disable event
+ // Paper start - Add PlayerShieldDisableEvent
+ final org.bukkit.entity.Entity finalAttacker = attacker != null ? attacker.getBukkitEntity() : null;
+ if (finalAttacker != null) {
+ final io.papermc.paper.event.player.PlayerShieldDisableEvent shieldDisableEvent = new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) getBukkitEntity(), finalAttacker, 100);
@@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } else {
+ this.getCooldowns().addCooldown(Items.SHIELD, 100);
+ }
+ // Paper end - add player shield disable event
+ // Paper end - Add PlayerShieldDisableEvent
this.stopUsingItem();
this.level().broadcastEntityEvent(this, (byte) 30);
}