Files
Purpur/patches/server/0173-Dont-run-with-scissors.patch
BillyGalbreath 296267da93 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
eb11845f8 Fix creating worlds with "invalid" names (Fixes #5331)
e4d8a6279 Implement Keyed on World
bcb63dab7 [CI-SKIP] [Auto] Rebuild Patches
48342b06c Allow signs that are inside of the spawn protection to be right clicked to use their run_command tag
c229f90c1 Add Block#isValidTool
20e709c1d Add recipe to cook events
2dcf8bff4 legacy formatting will be the death of me
f597fea0d legacy formatting is worse than walking around in wet socks
7f72c4675 Use implementation-provided legacy serializer for events
27a8d99ec Adventure 4.7.0
e65bd35a1 Respect teams in legacy chat name if configured (#5321)
b31089a92 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5325)
a52b30814 Fix title swapping fadeIn and stay
54ec85949 Prevent grindstones from overstacking items
d7795080c Fix NPE for AIR in meta operations in ItemStack
2e70796c7 [CI-SKIP] Improve documentation of PreCreatureSpawnEvent (#5244)
7bb92e750 [CI-SKIP] Add JavaDoc links to Tag class pointing to custom Paper tags (#5285)
28cd686bf fix per-world difficulty command (#5306)
be7cde2c7 [CI-SKIP] Always check PATH for JDK (#5315)
2021-03-09 17:52:38 -06:00

46 lines
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JustDoom <justdoomdev@gmail.com>
Date: Fri, 5 Mar 2021 14:23:16 -0500
Subject: [PATCH] Dont run with scissors!
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index f7a031920c68d5d5d505d86ab1b513ac53f5bf84..100ab4ae37a0d71a0d9bc3202802f705e1260ee1 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1388,6 +1388,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.player.fallDistance = 0.0F;
}
+ // Purpur Start
+ if (this.player.isSprinting() && this.player.getWorldServer().purpurConfig.dontRunWithScissors && (this.player.getItemInHand(EnumHand.MAIN_HAND).getItem() == Items.SHEARS || this.player.getItemInHand(EnumHand.OFF_HAND).getItem() == Items.SHEARS) && (int) (Math.random() * 10) == 0) {
+ this.player.damageEntity(net.minecraft.server.DamageSource.MAGIC, (float) this.player.getWorldServer().purpurConfig.scissorsRunningDamage);
+ }
+ // Purpur End
+
this.player.checkMovement(this.player.locX() - d0, this.player.locY() - d1, this.player.locZ() - d2);
this.o = this.player.locX();
this.p = this.player.locY();
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 958b0ee8af21e4176e9d35af88294919c509a2c1..5f14c6c0e62ce5bece342b850e201357314061b2 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -168,6 +168,8 @@ public class PurpurWorldConfig {
public List<Item> itemImmuneToCactus = new ArrayList<>();
public List<Item> itemImmuneToExplosion = new ArrayList<>();
public List<Item> itemImmuneToFire = new ArrayList<>();
+ public boolean dontRunWithScissors = false;
+ public double scissorsRunningDamage = 1D;
private void itemSettings() {
itemImmuneToCactus.clear();
getList("gameplay-mechanics.item.immune.cactus", new ArrayList<>()).forEach(key -> {
@@ -196,6 +198,8 @@ public class PurpurWorldConfig {
Item item = IRegistry.ITEM.get(new MinecraftKey(key.toString()));
if (item != Items.AIR) itemImmuneToFire.add(item);
});
+ dontRunWithScissors = getBoolean("gameplay-mechanics.item.shears.damage-if-sprinting", dontRunWithScissors);
+ scissorsRunningDamage = getDouble("gameplay-mechanics.item.shears.sprinting-damage", scissorsRunningDamage);
}
public boolean idleTimeoutKick = true;