mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Don't apply cramming damage to players
It does not make a lot of sense to damage players if they get crammed, especially as the usecase of teleporting lots of players to the same location isn't too uncommon and killing all those players isn't really what one would expect to happen. For those who really want it a config option is provided.
This commit is contained in:
parent
818a84cfbe
commit
e7de2be721
1 changed files with 23 additions and 15 deletions
|
@ -187,8 +187,8 @@
|
|||
+ this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper
|
||||
+ this.bukkitPickUpLoot = true;
|
||||
+ this.maxHealthCache = this.getMaxHealth();
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // Use method to resend items in hands in case of client desync, because the item use got cancelled.
|
||||
+ // For example, when cancelling the leash event
|
||||
+ public void resendItemInHands() {
|
||||
|
@ -234,9 +234,9 @@
|
|||
+ }
|
||||
+
|
||||
+ return blockposition;
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
@Override
|
||||
public BlockPos adjustSpawnLocation(ServerLevel world, BlockPos basePos) {
|
||||
AABB axisalignedbb = this.getDimensions(Pose.STANDING).makeBoundingBox(Vec3.ZERO);
|
||||
|
@ -526,8 +526,8 @@
|
|||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(criterion, this, (scoreaccess) -> {
|
||||
scoreaccess.set(score);
|
||||
});
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - PlayerDeathEvent#getItemsToKeep
|
||||
+ private static void processKeep(org.bukkit.event.entity.PlayerDeathEvent event, NonNullList<ItemStack> inv) {
|
||||
+ List<org.bukkit.inventory.ItemStack> itemsToKeep = event.getItemsToKeep();
|
||||
|
@ -565,9 +565,9 @@
|
|||
+ inv.set(i, ItemStack.EMPTY);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ // Paper end - PlayerDeathEvent#getItemsToKeep
|
||||
+
|
||||
|
||||
@Override
|
||||
public void die(DamageSource damageSource) {
|
||||
- this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
|
@ -1094,6 +1094,15 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1341,7 +1805,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isInvulnerableTo(ServerLevel world, DamageSource source) {
|
||||
- return super.isInvulnerableTo(world, source) || this.isChangingDimension() && !source.is(DamageTypes.ENDER_PEARL) || !this.hasClientLoaded();
|
||||
+ return (super.isInvulnerableTo(world, source) || this.isChangingDimension() && !source.is(DamageTypes.ENDER_PEARL) || !this.hasClientLoaded()) || (!this.level().paperConfig().collisions.allowPlayerCrammingDamage && source.is(DamageTypes.CRAMMING)); // Paper - disable player cramming
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1387,8 +1851,9 @@
|
||||
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), front));
|
||||
}
|
||||
|
@ -1622,7 +1631,7 @@
|
|||
if (entity instanceof LivingEntity entityliving) {
|
||||
Iterator iterator = entityliving.getActiveEffects().iterator();
|
||||
|
||||
@@ -2375,16 +3020,161 @@
|
||||
@@ -2375,10 +3020,12 @@
|
||||
return TicketType.ENDER_PEARL.timeout();
|
||||
}
|
||||
|
||||
|
@ -1638,11 +1647,10 @@
|
|||
}
|
||||
|
||||
private static float calculateLookAtYaw(Vec3 respawnPos, BlockPos currentPos) {
|
||||
Vec3 vec3d1 = Vec3.atBottomCenterOf(currentPos).subtract(respawnPos).normalize();
|
||||
|
||||
@@ -2387,4 +3034,147 @@
|
||||
return (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Add per-player time and weather.
|
||||
+ public long timeOffset = 0;
|
||||
|
@ -1667,7 +1675,7 @@
|
|||
+ public void setPlayerWeather(WeatherType type, boolean plugin) {
|
||||
+ if (!plugin && this.weather != null) {
|
||||
+ return;
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ if (plugin) {
|
||||
+ this.weather = type;
|
||||
|
@ -1678,7 +1686,7 @@
|
|||
+ } else {
|
||||
+ this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.START_RAINING, 0));
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ private float pluginRainPosition;
|
||||
+ private float pluginRainPositionPrevious;
|
||||
|
|
Loading…
Reference in a new issue