aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0176-Toggleable-player-crits-helps-mitigate-hacked-client.patch
blob: e0f1b8355fe2c074be66ead3d3a6767f06a95a11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@benndorf.dev>
Date: Sat, 10 Mar 2018 00:50:24 +0100
Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients.


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2c92d3d924fa132937576c24da26e2a8f72f601e..207bef30c34e368066f4058dd28dd12fdbac5d34 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -238,6 +238,11 @@ public class PaperWorldConfig {
         disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false);
     }
 
+    public boolean disablePlayerCrits;
+    private void disablePlayerCrits() {
+        disablePlayerCrits = getBoolean("game-mechanics.disable-player-crits", false);
+    }
+
     public boolean allChunksAreSlimeChunks;
     private void allChunksAreSlimeChunks() {
         allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 653dbaafb9247653a6d8f549b57f0a5d62b05265..8978f3b53ce478d8aa078ac7a16784985f4a2744 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1199,6 +1199,7 @@ public abstract class Player extends LivingEntity {
 
                     boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity;
 
+                    flag2 = flag2 && !level.paperConfig.disablePlayerCrits; // Paper
                     flag2 = flag2 && !this.isSprinting();
                     if (flag2) {
                         f *= 1.5F;