From 871cc5653c6763daa0cff3672a0aefceab242975 Mon Sep 17 00:00:00 2001 From: allinkdev <44676012+allinkdev@users.noreply.github.com> Date: Sat, 17 Jun 2023 04:54:59 +0100 Subject: [PATCH] Clean up patches (#103) * Clean up command block event patch * Merge resource location patches * Merge map decoration patches * Merge Video's resource location patches * Merge large tag reset patches --- ...n-more-resource-location-validation.patch} | 50 ++- ... 0013-Change-version-fetcher-to-AMG.patch} | 2 +- ...en-more-resource-location-validation.patch | 54 --- ...s-with-invalid-namespaces-from-bein.patch} | 0 ...UIDs-during-the-CompoundTag-GamePro.patch} | 0 ...ry-player-data-in-the-nbt-component.patch} | 0 ...017-Limit-ListTags-to-1024-elements.patch} | 2 +- ...lling-potion-effects-and-certain-po.patch} | 2 +- ...ch => 0019-Fix-negative-death-times.patch} | 2 +- ...Add-custom-classes-used-by-Scissors.patch} | 0 ...tes-before-attempting-to-get-block-.patch} | 0 ...ners.patch => 0022-Reset-large-tags.patch} | 58 +++- ...ehicle-collision-checks-to-3-and-di.patch} | 0 patches/server/0023-Reset-large-tags.patch | 54 --- ...handling-of-invalid-JSON-components.patch} | 2 +- ...-oversized-components-from-updating.patch} | 0 ...ch => 0026-Add-MasterBlockFireEvent.patch} | 0 ...-Don-t-log-invalid-teams-to-console.patch} | 2 +- ...=> 0028-Block-server-side-chunkbans.patch} | 0 ...> 0029-Add-spectator-teleport-event.patch} | 0 ...30-Prevent-invalid-container-events.patch} | 0 ...te-block-entity-tag-query-positions.patch} | 2 +- ...-legacy-messages-over-1k-characters.patch} | 0 ...-bounds-HangingEntity-crash-exploit.patch} | 0 ...tch => 0034-Prevent-velocity-freeze.patch} | 2 +- ...Scissors-configuration-file-command.patch} | 0 ...ch-invalid-entity-rotation-log-spam.patch} | 2 +- ...Patch-large-selector-distance-crash.patch} | 0 ...mit-sculk-catalyst-cursor-positions.patch} | 0 ...patch => 0039-Limit-map-decorations.patch} | 19 +- ...layer-banning-using-duplicate-UUIDs.patch} | 2 +- ...on-t-warn-on-duplicate-entity-UUIDs.patch} | 0 .../0042-Limit-map-decoration-count.patch | 23 -- ...ayers-from-nbt-components-configura.patch} | 2 +- ...component-extra-empty-array-exploit.patch} | 0 ...pth-limit-to-Component-deserializer.patch} | 2 +- ...tch => 0045-Add-depth-limit-to-SNBT.patch} | 0 .../0046-Implement-command-block-events.patch | 90 +++++ ...ch => 0047-Limit-beacon-effectRange.patch} | 2 +- ...0048-Fix-invalid-armor-trim-exploit.patch} | 0 .../0049-Implement-command-block-events.patch | 315 ------------------ ...ove-validation-of-ResourceLocations.patch} | 18 +- ...ourceLocations-in-CraftNamespacedKey.patch | 18 - 43 files changed, 236 insertions(+), 489 deletions(-) rename patches/server/{0011-Even-more-ResourceLocation-validation-and-log-spam-f.patch => 0011-Even-more-resource-location-validation.patch} (61%) rename patches/server/{0014-Change-version-fetcher-to-AMG.patch => 0013-Change-version-fetcher-to-AMG.patch} (98%) delete mode 100644 patches/server/0013-Even-more-resource-location-validation.patch rename patches/server/{0015-Prevent-attributes-with-invalid-namespaces-from-bein.patch => 0014-Prevent-attributes-with-invalid-namespaces-from-bein.patch} (100%) rename patches/server/{0016-Validate-String-UUIDs-during-the-CompoundTag-GamePro.patch => 0015-Validate-String-UUIDs-during-the-CompoundTag-GamePro.patch} (100%) rename patches/server/{0017-Don-t-query-player-data-in-the-nbt-component.patch => 0016-Don-t-query-player-data-in-the-nbt-component.patch} (100%) rename patches/server/{0018-Limit-ListTags-to-1024-elements.patch => 0017-Limit-ListTags-to-1024-elements.patch} (88%) rename patches/server/{0019-Fixes-creative-killing-potion-effects-and-certain-po.patch => 0018-Fixes-creative-killing-potion-effects-and-certain-po.patch} (96%) rename patches/server/{0020-Fix-negative-death-times.patch => 0019-Fix-negative-death-times.patch} (90%) rename patches/server/{0021-Add-custom-classes-used-by-Scissors.patch => 0020-Add-custom-classes-used-by-Scissors.patch} (100%) rename patches/server/{0022-Validate-coordinates-before-attempting-to-get-block-.patch => 0021-Validate-coordinates-before-attempting-to-get-block-.patch} (100%) rename patches/server/{0024-Account-for-items-inside-containers.patch => 0022-Reset-large-tags.patch} (81%) rename patches/server/{0025-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch => 0023-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch} (100%) delete mode 100644 patches/server/0023-Reset-large-tags.patch rename patches/server/{0026-Better-handling-of-invalid-JSON-components.patch => 0024-Better-handling-of-invalid-JSON-components.patch} (99%) rename patches/server/{0027-Reject-oversized-components-from-updating.patch => 0025-Reject-oversized-components-from-updating.patch} (100%) rename patches/server/{0028-Add-MasterBlockFireEvent.patch => 0026-Add-MasterBlockFireEvent.patch} (100%) rename patches/server/{0029-Don-t-log-invalid-teams-to-console.patch => 0027-Don-t-log-invalid-teams-to-console.patch} (92%) rename patches/server/{0030-Block-server-side-chunkbans.patch => 0028-Block-server-side-chunkbans.patch} (100%) rename patches/server/{0031-Add-spectator-teleport-event.patch => 0029-Add-spectator-teleport-event.patch} (100%) rename patches/server/{0032-Prevent-invalid-container-events.patch => 0030-Prevent-invalid-container-events.patch} (100%) rename patches/server/{0033-Validate-block-entity-tag-query-positions.patch => 0031-Validate-block-entity-tag-query-positions.patch} (92%) rename patches/server/{0034-Refuse-to-convert-legacy-messages-over-1k-characters.patch => 0032-Refuse-to-convert-legacy-messages-over-1k-characters.patch} (100%) rename patches/server/{0035-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch => 0033-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch} (100%) rename patches/server/{0036-Prevent-velocity-freeze.patch => 0034-Prevent-velocity-freeze.patch} (97%) rename patches/server/{0037-Add-Scissors-configuration-file-command.patch => 0035-Add-Scissors-configuration-file-command.patch} (100%) rename patches/server/{0038-Patch-invalid-entity-rotation-log-spam.patch => 0036-Patch-invalid-entity-rotation-log-spam.patch} (93%) rename patches/server/{0039-Patch-large-selector-distance-crash.patch => 0037-Patch-large-selector-distance-crash.patch} (100%) rename patches/server/{0040-Limit-sculk-catalyst-cursor-positions.patch => 0038-Limit-sculk-catalyst-cursor-positions.patch} (100%) rename patches/server/{0041-Limit-map-decoration-text-length.patch => 0039-Limit-map-decorations.patch} (54%) rename patches/server/{0043-Prevent-player-banning-using-duplicate-UUIDs.patch => 0040-Prevent-player-banning-using-duplicate-UUIDs.patch} (92%) rename patches/server/{0044-Don-t-warn-on-duplicate-entity-UUIDs.patch => 0041-Don-t-warn-on-duplicate-entity-UUIDs.patch} (100%) delete mode 100644 patches/server/0042-Limit-map-decoration-count.patch rename patches/server/{0045-Make-excluding-players-from-nbt-components-configura.patch => 0042-Make-excluding-players-from-nbt-components-configura.patch} (96%) rename patches/server/{0046-Fix-component-extra-empty-array-exploit.patch => 0043-Fix-component-extra-empty-array-exploit.patch} (100%) rename patches/server/{0047-Add-depth-limit-to-Component-deserializer.patch => 0044-Add-depth-limit-to-Component-deserializer.patch} (98%) rename patches/server/{0048-Add-depth-limit-to-SNBT.patch => 0045-Add-depth-limit-to-SNBT.patch} (100%) create mode 100644 patches/server/0046-Implement-command-block-events.patch rename patches/server/{0050-Limit-beacon-effectRange.patch => 0047-Limit-beacon-effectRange.patch} (92%) rename patches/server/{0051-Fix-invalid-armor-trim-exploit.patch => 0048-Fix-invalid-armor-trim-exploit.patch} (100%) delete mode 100644 patches/server/0049-Implement-command-block-events.patch rename patches/server/{0053-Some-more-ResourceLocation-validation.patch => 0049-Improve-validation-of-ResourceLocations.patch} (67%) delete mode 100644 patches/server/0052-Catch-null-ResourceLocations-in-CraftNamespacedKey.patch diff --git a/patches/server/0011-Even-more-ResourceLocation-validation-and-log-spam-f.patch b/patches/server/0011-Even-more-resource-location-validation.patch similarity index 61% rename from patches/server/0011-Even-more-ResourceLocation-validation-and-log-spam-f.patch rename to patches/server/0011-Even-more-resource-location-validation.patch index 59de4f8..8429aff 100644 --- a/patches/server/0011-Even-more-ResourceLocation-validation-and-log-spam-f.patch +++ b/patches/server/0011-Even-more-resource-location-validation.patch @@ -1,13 +1,22 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 9 May 2022 23:40:59 -0500 -Subject: [PATCH] Even more ResourceLocation validation and log spam fixes +Subject: [PATCH] Even more resource location validation diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -index fa724cd34a7c469ca12068e64295cd00ad215a3c..168b60fda38a7172f4473017ccc42447b36faab2 100644 +index 91e0328f847a2464a1cf65134520244a4cec705f..77ae3bc5fd6cf34aae7bd3baa563f3e23e57de26 100644 --- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java +++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java +@@ -145,7 +145,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { + } + + public void setPotionType(String string) { +- this.setPotion(BuiltInRegistries.POTION.get(new ResourceLocation(string))); ++ this.setPotion(BuiltInRegistries.POTION.get(ResourceLocation.tryParse(string))); // Scissors - Validate resource locations + } + // CraftBukkit end + @@ -425,7 +425,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { try { this.setParticle(ParticleArgument.readParticle(new StringReader(nbt.getString("Particle")), (HolderLookup) BuiltInRegistries.PARTICLE_TYPE.asLookup())); @@ -17,6 +26,41 @@ index fa724cd34a7c469ca12068e64295cd00ad215a3c..168b60fda38a7172f4473017ccc42447 } } +diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java +index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..ffcb77755b28bcdb3eae981fc735e6dde664bb6e 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityType.java ++++ b/src/main/java/net/minecraft/world/entity/EntityType.java +@@ -588,7 +588,7 @@ public class EntityType implements FeatureElement, EntityTypeT + }), (entity) -> { + entity.load(nbt); + }, () -> { +- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); ++ /*EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));*/ // Scissors - Don't log invalid entities + }); + } + +@@ -607,7 +607,7 @@ public class EntityType implements FeatureElement, EntityTypeT + } + + public static Optional> by(CompoundTag nbt) { +- return BuiltInRegistries.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id"))); ++ return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id"))); + } + + @Nullable +diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java +index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..b0c953ad8275740679c847e348b311de93d64965 100644 +--- a/src/main/java/net/minecraft/world/entity/Mob.java ++++ b/src/main/java/net/minecraft/world/entity/Mob.java +@@ -618,7 +618,7 @@ public abstract class Mob extends LivingEntity implements Targeting { + + this.setLeftHanded(nbt.getBoolean("LeftHanded")); + if (nbt.contains("DeathLootTable", 8)) { +- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable")); ++ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable")); + this.lootTableSeed = nbt.getLong("DeathLootTableSeed"); + } + diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java index e49eece9bff3a53469673d03a7bbf8f9cf8776b8..a49f32e9649155b6af4b1f236e4e8142d730e7e8 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java @@ -60,7 +104,7 @@ index 0dd0ce9a9b3253e87eda12354249ec2fd2a33cf2..b6920f9432ca1736afbe775186fbbcf1 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -index 620d918e302a00d5a6640648e3096988d15535a0..ac6831248b7c4f25d48391432afb613f25d7e23a 100644 +index 18b9b0dc70f6872a9d71c120bcd2edca531b0ac4..fa0c023b3a88bd797f563e0e675d70966ff7dbd3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java @@ -80,8 +80,18 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { diff --git a/patches/server/0014-Change-version-fetcher-to-AMG.patch b/patches/server/0013-Change-version-fetcher-to-AMG.patch similarity index 98% rename from patches/server/0014-Change-version-fetcher-to-AMG.patch rename to patches/server/0013-Change-version-fetcher-to-AMG.patch index cd9a695..200654d 100644 --- a/patches/server/0014-Change-version-fetcher-to-AMG.patch +++ b/patches/server/0013-Change-version-fetcher-to-AMG.patch @@ -77,7 +77,7 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..0a8fda6939152d393f07e5d2812409ad switch (distance) { case -1: diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index bfa091f72d6f477bcaf63d364639a1b4df9b1987..1fe26cb620e8b550790c3e110e2a1180cf0838fd 100644 +index 717e292040ed7779eb4b6c5fa26665d3df9024e7..0fb3a648ee6bd6cb88515770bcfc70e368313527 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -292,7 +292,7 @@ public class Main { diff --git a/patches/server/0013-Even-more-resource-location-validation.patch b/patches/server/0013-Even-more-resource-location-validation.patch deleted file mode 100644 index 874c66a..0000000 --- a/patches/server/0013-Even-more-resource-location-validation.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Telesphoreo -Date: Sat, 10 Dec 2022 23:02:48 -0600 -Subject: [PATCH] Even more resource location validation - - -diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -index db3cddf8b227453c9b08e481b21101c5d2e0472d..77ae3bc5fd6cf34aae7bd3baa563f3e23e57de26 100644 ---- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -@@ -145,7 +145,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { - } - - public void setPotionType(String string) { -- this.setPotion(BuiltInRegistries.POTION.get(new ResourceLocation(string))); -+ this.setPotion(BuiltInRegistries.POTION.get(ResourceLocation.tryParse(string))); // Scissors - Validate resource locations - } - // CraftBukkit end - -diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..ffcb77755b28bcdb3eae981fc735e6dde664bb6e 100644 ---- a/src/main/java/net/minecraft/world/entity/EntityType.java -+++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -588,7 +588,7 @@ public class EntityType implements FeatureElement, EntityTypeT - }), (entity) -> { - entity.load(nbt); - }, () -> { -- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); -+ /*EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));*/ // Scissors - Don't log invalid entities - }); - } - -@@ -607,7 +607,7 @@ public class EntityType implements FeatureElement, EntityTypeT - } - - public static Optional> by(CompoundTag nbt) { -- return BuiltInRegistries.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id"))); -+ return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id"))); - } - - @Nullable -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..b0c953ad8275740679c847e348b311de93d64965 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -618,7 +618,7 @@ public abstract class Mob extends LivingEntity implements Targeting { - - this.setLeftHanded(nbt.getBoolean("LeftHanded")); - if (nbt.contains("DeathLootTable", 8)) { -- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable")); -+ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable")); - this.lootTableSeed = nbt.getLong("DeathLootTableSeed"); - } - diff --git a/patches/server/0015-Prevent-attributes-with-invalid-namespaces-from-bein.patch b/patches/server/0014-Prevent-attributes-with-invalid-namespaces-from-bein.patch similarity index 100% rename from patches/server/0015-Prevent-attributes-with-invalid-namespaces-from-bein.patch rename to patches/server/0014-Prevent-attributes-with-invalid-namespaces-from-bein.patch diff --git a/patches/server/0016-Validate-String-UUIDs-during-the-CompoundTag-GamePro.patch b/patches/server/0015-Validate-String-UUIDs-during-the-CompoundTag-GamePro.patch similarity index 100% rename from patches/server/0016-Validate-String-UUIDs-during-the-CompoundTag-GamePro.patch rename to patches/server/0015-Validate-String-UUIDs-during-the-CompoundTag-GamePro.patch diff --git a/patches/server/0017-Don-t-query-player-data-in-the-nbt-component.patch b/patches/server/0016-Don-t-query-player-data-in-the-nbt-component.patch similarity index 100% rename from patches/server/0017-Don-t-query-player-data-in-the-nbt-component.patch rename to patches/server/0016-Don-t-query-player-data-in-the-nbt-component.patch diff --git a/patches/server/0018-Limit-ListTags-to-1024-elements.patch b/patches/server/0017-Limit-ListTags-to-1024-elements.patch similarity index 88% rename from patches/server/0018-Limit-ListTags-to-1024-elements.patch rename to patches/server/0017-Limit-ListTags-to-1024-elements.patch index 72bb3e3..d8e90b7 100644 --- a/patches/server/0018-Limit-ListTags-to-1024-elements.patch +++ b/patches/server/0017-Limit-ListTags-to-1024-elements.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Limit ListTags to 1024 elements diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java -index 749d3e67a877d7d1ed47b5fef511a604ee6589b6..fe7a7fd77c7dd1750144fb57e181c51ccda26329 100644 +index b74b77ec2fd45c7a44e4f2696c4f57075c3d4080..c6ac2aff889ff157da47ee26fbfc1f83616d5b8f 100644 --- a/src/main/java/net/minecraft/nbt/ListTag.java +++ b/src/main/java/net/minecraft/nbt/ListTag.java @@ -31,6 +31,7 @@ public class ListTag extends CollectionTag { diff --git a/patches/server/0019-Fixes-creative-killing-potion-effects-and-certain-po.patch b/patches/server/0018-Fixes-creative-killing-potion-effects-and-certain-po.patch similarity index 96% rename from patches/server/0019-Fixes-creative-killing-potion-effects-and-certain-po.patch rename to patches/server/0018-Fixes-creative-killing-potion-effects-and-certain-po.patch index 4ee2dbe..0b2a2a2 100644 --- a/patches/server/0019-Fixes-creative-killing-potion-effects-and-certain-po.patch +++ b/patches/server/0018-Fixes-creative-killing-potion-effects-and-certain-po.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fixes creative-killing potion effects and certain potion diff --git a/src/main/java/net/minecraft/world/effect/MobEffect.java b/src/main/java/net/minecraft/world/effect/MobEffect.java -index 2cc714585fc3790b70a7ad1ab8034543462e2b3b..2d3706d8d0dbed3b3588066eaa6b9ce1b266294f 100644 +index bcce17f884b57e619749351b7b2047f0a5f9be71..65e245e02676077e481f8a1fcd9885c389f9666c 100644 --- a/src/main/java/net/minecraft/world/effect/MobEffect.java +++ b/src/main/java/net/minecraft/world/effect/MobEffect.java @@ -58,6 +58,7 @@ public class MobEffect { diff --git a/patches/server/0020-Fix-negative-death-times.patch b/patches/server/0019-Fix-negative-death-times.patch similarity index 90% rename from patches/server/0020-Fix-negative-death-times.patch rename to patches/server/0019-Fix-negative-death-times.patch index dfdcc3a..d7b36c4 100644 --- a/patches/server/0020-Fix-negative-death-times.patch +++ b/patches/server/0019-Fix-negative-death-times.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix negative death times diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 67627bbf84f5aab2872f636b1dcb6728c8494147..468f64afb7e9b3ef579205d3beea025deb31b460 100644 +index a189461330a4d427a7450d504ef13de3605497e3..79430aef1cbcad7d872435ebdec60321e2573bb3 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -630,7 +630,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0021-Add-custom-classes-used-by-Scissors.patch b/patches/server/0020-Add-custom-classes-used-by-Scissors.patch similarity index 100% rename from patches/server/0021-Add-custom-classes-used-by-Scissors.patch rename to patches/server/0020-Add-custom-classes-used-by-Scissors.patch diff --git a/patches/server/0022-Validate-coordinates-before-attempting-to-get-block-.patch b/patches/server/0021-Validate-coordinates-before-attempting-to-get-block-.patch similarity index 100% rename from patches/server/0022-Validate-coordinates-before-attempting-to-get-block-.patch rename to patches/server/0021-Validate-coordinates-before-attempting-to-get-block-.patch diff --git a/patches/server/0024-Account-for-items-inside-containers.patch b/patches/server/0022-Reset-large-tags.patch similarity index 81% rename from patches/server/0024-Account-for-items-inside-containers.patch rename to patches/server/0022-Reset-large-tags.patch index fcd5ed0..3d8781f 100644 --- a/patches/server/0024-Account-for-items-inside-containers.patch +++ b/patches/server/0022-Reset-large-tags.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Business Goose -Date: Sat, 11 Jun 2022 23:33:13 -0500 -Subject: [PATCH] Account for items inside containers +From: Telesphoreo +Date: Sat, 10 Dec 2022 23:38:53 -0600 +Subject: [PATCH] Reset large tags diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java @@ -58,8 +58,56 @@ index 4092c7a8c2b0d9d26e6f4d97386735236300d132..9e0ab51dd7a4f9fed8f9edde962d42d4 stacks.set(j, ItemStack.of(compoundTag)); } } +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index adb7220be617d6d9f2cdd7fbe4fa2dd24cc7d142..aabde31cd4c6a4f58855156272bc451b042cc315 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -21,6 +21,7 @@ import java.util.function.Predicate; + import java.util.stream.Collectors; + import java.util.stream.Stream; + import javax.annotation.Nullable; ++import me.totalfreedom.scissors.NbtUtility; + import net.minecraft.ChatFormatting; + import net.minecraft.Util; + import net.minecraft.advancements.CriteriaTriggers; +@@ -253,6 +254,12 @@ public final class ItemStack { + + // CraftBukkit - break into own method + private void load(CompoundTag nbttagcompound) { ++ // Scissors start - Reset large tags ++ if (NbtUtility.isTooLarge(nbttagcompound)) { ++ // Reset tag without destroying item ++ nbttagcompound = NbtUtility.Item.removeItemData(nbttagcompound); ++ } ++ // Scissors end + this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id"))); + this.count = nbttagcompound.getByte("Count"); + if (nbttagcompound.contains("tag", 10)) { +@@ -550,7 +557,11 @@ public final class ItemStack { + nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString()); + nbt.putByte("Count", (byte) this.count); + if (this.tag != null) { +- nbt.put("tag", this.tag.copy()); ++ // Scissors start - Don't save large tags ++ if (!NbtUtility.isTooLarge(this.tag)) { ++ nbt.put("tag", this.tag.copy()); ++ } ++ // Scissors end + } + + return nbt; +@@ -880,6 +891,9 @@ public final class ItemStack { + // Paper end + + public void setTag(@Nullable CompoundTag nbt) { ++ // Scissors start - Ignore large tags ++ if (NbtUtility.isTooLarge(nbt)) return; ++ // Scissors end + this.tag = nbt; + this.processEnchantOrder(this.tag); // Paper + if (this.getItem().canBeDepleted()) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index 2a786c9fd29dc2139cf487fa645cd43345d60167..dbdc66620ae4284cfe96f633b1f4db46866b597b 100644 +index 448fa4f4f200430d6ce3051763c7ceb697696146..430810b9cc554dfb3bb0972c103c8a36e8db67ef 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java @@ -9,6 +9,7 @@ import java.util.Iterator; @@ -201,7 +249,7 @@ index 881379681c39230a00b3a1f11cd87498984396c7..1be5d600573f7632e6630224530dd765 } diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 789e5458f4a137694563a22612455506807de51b..84c721da46b7786857677b56f439c2b9448ba4b8 100644 +index a8a26a0a37a08b6bbeb5a1fde417d6f448d3c79f..2502c38640fa39552efc02b59733bd0d7330e13a 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -6,6 +6,7 @@ import java.util.function.BooleanSupplier; diff --git a/patches/server/0025-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch b/patches/server/0023-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch similarity index 100% rename from patches/server/0025-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch rename to patches/server/0023-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch diff --git a/patches/server/0023-Reset-large-tags.patch b/patches/server/0023-Reset-large-tags.patch deleted file mode 100644 index da6f151..0000000 --- a/patches/server/0023-Reset-large-tags.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Telesphoreo -Date: Sat, 10 Dec 2022 23:38:53 -0600 -Subject: [PATCH] Reset large tags - - -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index b367ec1feaccbd67e9e28c0d0515e163f37135fe..d1547b9ba36baec925751b9bb0498c8a8cac12f8 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -21,6 +21,7 @@ import java.util.function.Predicate; - import java.util.stream.Collectors; - import java.util.stream.Stream; - import javax.annotation.Nullable; -+import me.totalfreedom.scissors.NbtUtility; - import net.minecraft.ChatFormatting; - import net.minecraft.Util; - import net.minecraft.advancements.CriteriaTriggers; -@@ -253,6 +254,12 @@ public final class ItemStack { - - // CraftBukkit - break into own method - private void load(CompoundTag nbttagcompound) { -+ // Scissors start - Reset large tags -+ if (NbtUtility.isTooLarge(nbttagcompound)) { -+ // Reset tag without destroying item -+ nbttagcompound = NbtUtility.Item.removeItemData(nbttagcompound); -+ } -+ // Scissors end - this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id"))); - this.count = nbttagcompound.getByte("Count"); - if (nbttagcompound.contains("tag", 10)) { -@@ -550,7 +557,11 @@ public final class ItemStack { - nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString()); - nbt.putByte("Count", (byte) this.count); - if (this.tag != null) { -- nbt.put("tag", this.tag.copy()); -+ // Scissors start - Don't save large tags -+ if (!NbtUtility.isTooLarge(this.tag)) { -+ nbt.put("tag", this.tag.copy()); -+ } -+ // Scissors end - } - - return nbt; -@@ -880,6 +891,9 @@ public final class ItemStack { - // Paper end - - public void setTag(@Nullable CompoundTag nbt) { -+ // Scissors start - Ignore large tags -+ if (NbtUtility.isTooLarge(nbt)) return; -+ // Scissors end - this.tag = nbt; - this.processEnchantOrder(this.tag); // Paper - if (this.getItem().canBeDepleted()) { diff --git a/patches/server/0026-Better-handling-of-invalid-JSON-components.patch b/patches/server/0024-Better-handling-of-invalid-JSON-components.patch similarity index 99% rename from patches/server/0026-Better-handling-of-invalid-JSON-components.patch rename to patches/server/0024-Better-handling-of-invalid-JSON-components.patch index 02dfd6e..4b98e76 100644 --- a/patches/server/0026-Better-handling-of-invalid-JSON-components.patch +++ b/patches/server/0024-Better-handling-of-invalid-JSON-components.patch @@ -110,7 +110,7 @@ index 97a2657bc98d41c3c1e376b266d2c85f685acc88..7b6476455e095eed15c92797ce3a3e11 } }).reduce((accumulator, current) -> { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 92202262eff01ae3bbeff0e6ebdcf26ad613c169..38c027c0fbddf58136b7d67eb7156403a79de4d1 100644 +index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..bcd9565c8e09b44ca4cac372bea1b1e9ec343871 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2473,12 +2473,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0027-Reject-oversized-components-from-updating.patch b/patches/server/0025-Reject-oversized-components-from-updating.patch similarity index 100% rename from patches/server/0027-Reject-oversized-components-from-updating.patch rename to patches/server/0025-Reject-oversized-components-from-updating.patch diff --git a/patches/server/0028-Add-MasterBlockFireEvent.patch b/patches/server/0026-Add-MasterBlockFireEvent.patch similarity index 100% rename from patches/server/0028-Add-MasterBlockFireEvent.patch rename to patches/server/0026-Add-MasterBlockFireEvent.patch diff --git a/patches/server/0029-Don-t-log-invalid-teams-to-console.patch b/patches/server/0027-Don-t-log-invalid-teams-to-console.patch similarity index 92% rename from patches/server/0029-Don-t-log-invalid-teams-to-console.patch rename to patches/server/0027-Don-t-log-invalid-teams-to-console.patch index 7d908ad..73687fb 100644 --- a/patches/server/0029-Don-t-log-invalid-teams-to-console.patch +++ b/patches/server/0027-Don-t-log-invalid-teams-to-console.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't log invalid teams to console diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 468f64afb7e9b3ef579205d3beea025deb31b460..71a32f8dfdf043f55f092225a13884ae8935e67c 100644 +index 79430aef1cbcad7d872435ebdec60321e2573bb3..ee1744ca00fe14b052b9d164d2bbe9dc93201bde 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -862,7 +862,9 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0030-Block-server-side-chunkbans.patch b/patches/server/0028-Block-server-side-chunkbans.patch similarity index 100% rename from patches/server/0030-Block-server-side-chunkbans.patch rename to patches/server/0028-Block-server-side-chunkbans.patch diff --git a/patches/server/0031-Add-spectator-teleport-event.patch b/patches/server/0029-Add-spectator-teleport-event.patch similarity index 100% rename from patches/server/0031-Add-spectator-teleport-event.patch rename to patches/server/0029-Add-spectator-teleport-event.patch diff --git a/patches/server/0032-Prevent-invalid-container-events.patch b/patches/server/0030-Prevent-invalid-container-events.patch similarity index 100% rename from patches/server/0032-Prevent-invalid-container-events.patch rename to patches/server/0030-Prevent-invalid-container-events.patch diff --git a/patches/server/0033-Validate-block-entity-tag-query-positions.patch b/patches/server/0031-Validate-block-entity-tag-query-positions.patch similarity index 92% rename from patches/server/0033-Validate-block-entity-tag-query-positions.patch rename to patches/server/0031-Validate-block-entity-tag-query-positions.patch index b357139..5b52834 100644 --- a/patches/server/0033-Validate-block-entity-tag-query-positions.patch +++ b/patches/server/0031-Validate-block-entity-tag-query-positions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Validate block entity tag query positions diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 37fcbdcddaa6cbfd6ae37d70cffab957c90f4e07..01f88bf2f4872884a9c4c2d1d5f1369c61fb0ebf 100644 +index afc17ec86d12cefc30c2aabd86a04131f7dffdb6..27c48014605d34d9716ea3029ac84b2eb4907a4e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1375,7 +1375,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic diff --git a/patches/server/0034-Refuse-to-convert-legacy-messages-over-1k-characters.patch b/patches/server/0032-Refuse-to-convert-legacy-messages-over-1k-characters.patch similarity index 100% rename from patches/server/0034-Refuse-to-convert-legacy-messages-over-1k-characters.patch rename to patches/server/0032-Refuse-to-convert-legacy-messages-over-1k-characters.patch diff --git a/patches/server/0035-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch b/patches/server/0033-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch similarity index 100% rename from patches/server/0035-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch rename to patches/server/0033-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch diff --git a/patches/server/0036-Prevent-velocity-freeze.patch b/patches/server/0034-Prevent-velocity-freeze.patch similarity index 97% rename from patches/server/0036-Prevent-velocity-freeze.patch rename to patches/server/0034-Prevent-velocity-freeze.patch index 5c807b4..3c05314 100644 --- a/patches/server/0036-Prevent-velocity-freeze.patch +++ b/patches/server/0034-Prevent-velocity-freeze.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent velocity freeze diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java -index 2096e8a0bdbcfc865f175f3a01ab688542481531..15d375221c253dc4ca1b598eb80b4638eba6f8d0 100644 +index 6c9a8f062f989db022154155e8a05b334a0510da..68c80eab60680c647094b4465ee1377c9e13d5ff 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0037-Add-Scissors-configuration-file-command.patch b/patches/server/0035-Add-Scissors-configuration-file-command.patch similarity index 100% rename from patches/server/0037-Add-Scissors-configuration-file-command.patch rename to patches/server/0035-Add-Scissors-configuration-file-command.patch diff --git a/patches/server/0038-Patch-invalid-entity-rotation-log-spam.patch b/patches/server/0036-Patch-invalid-entity-rotation-log-spam.patch similarity index 93% rename from patches/server/0038-Patch-invalid-entity-rotation-log-spam.patch rename to patches/server/0036-Patch-invalid-entity-rotation-log-spam.patch index b284815..919692d 100644 --- a/patches/server/0038-Patch-invalid-entity-rotation-log-spam.patch +++ b/patches/server/0036-Patch-invalid-entity-rotation-log-spam.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Patch invalid entity rotation log spam diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 38c027c0fbddf58136b7d67eb7156403a79de4d1..ff3940a0d552140cae820fbed16bfb5e69507822 100644 +index bcd9565c8e09b44ca4cac372bea1b1e9ec343871..71e64ecf217b77371b5be32f93c66be042f124f2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -4615,7 +4615,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { diff --git a/patches/server/0039-Patch-large-selector-distance-crash.patch b/patches/server/0037-Patch-large-selector-distance-crash.patch similarity index 100% rename from patches/server/0039-Patch-large-selector-distance-crash.patch rename to patches/server/0037-Patch-large-selector-distance-crash.patch diff --git a/patches/server/0040-Limit-sculk-catalyst-cursor-positions.patch b/patches/server/0038-Limit-sculk-catalyst-cursor-positions.patch similarity index 100% rename from patches/server/0040-Limit-sculk-catalyst-cursor-positions.patch rename to patches/server/0038-Limit-sculk-catalyst-cursor-positions.patch diff --git a/patches/server/0041-Limit-map-decoration-text-length.patch b/patches/server/0039-Limit-map-decorations.patch similarity index 54% rename from patches/server/0041-Limit-map-decoration-text-length.patch rename to patches/server/0039-Limit-map-decorations.patch index b979d3f..1457972 100644 --- a/patches/server/0041-Limit-map-decoration-text-length.patch +++ b/patches/server/0039-Limit-map-decorations.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Luna Date: Fri, 28 Apr 2023 16:29:23 -0300 -Subject: [PATCH] Limit map decoration text length +Subject: [PATCH] Limit map decorations diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java @@ -29,3 +29,20 @@ index 347d2914f9560a3ee8cea59444bc0dfbb7cf3456..b225f770869832775c9a8a79ffaf89e9 this.type = type; this.x = x; this.y = z; +diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +index 3b12030b49b1c539684d75ca3896eb498400ef99..a1f042e5329343489cf30e436a8f553d39e5a6e4 100644 +--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java ++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +@@ -354,6 +354,12 @@ public class MapItemSavedData extends SavedData { + } + + private void addDecoration(MapDecoration.Type type, @Nullable LevelAccessor world, String key, double x, double z, double rotation, @Nullable Component text) { ++ // Scissors start - Limit decoration count ++ if (this.decorations.size() > 32) { ++ return; ++ } ++ // Scissors end ++ + int i = 1 << this.scale; + float f = (float) (x - (double) this.centerX) / (float) i; + float f1 = (float) (z - (double) this.centerZ) / (float) i; diff --git a/patches/server/0043-Prevent-player-banning-using-duplicate-UUIDs.patch b/patches/server/0040-Prevent-player-banning-using-duplicate-UUIDs.patch similarity index 92% rename from patches/server/0043-Prevent-player-banning-using-duplicate-UUIDs.patch rename to patches/server/0040-Prevent-player-banning-using-duplicate-UUIDs.patch index 049979c..443f2ee 100644 --- a/patches/server/0043-Prevent-player-banning-using-duplicate-UUIDs.patch +++ b/patches/server/0040-Prevent-player-banning-using-duplicate-UUIDs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent player banning using duplicate UUIDs diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 2ac23779222369ace69f1e3f7fb12184865b7a43..05c8e4e30b2dce565e84f4c09b3f27244f8c0451 100644 +index 18aac3da3c88f33b1a71a5920a8daa27e9723913..f5b59d0ab82472e1c992ffb6a8b7fbb687a2b70f 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1610,7 +1610,14 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0044-Don-t-warn-on-duplicate-entity-UUIDs.patch b/patches/server/0041-Don-t-warn-on-duplicate-entity-UUIDs.patch similarity index 100% rename from patches/server/0044-Don-t-warn-on-duplicate-entity-UUIDs.patch rename to patches/server/0041-Don-t-warn-on-duplicate-entity-UUIDs.patch diff --git a/patches/server/0042-Limit-map-decoration-count.patch b/patches/server/0042-Limit-map-decoration-count.patch deleted file mode 100644 index db74dae..0000000 --- a/patches/server/0042-Limit-map-decoration-count.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Luna -Date: Fri, 28 Apr 2023 16:34:15 -0300 -Subject: [PATCH] Limit map decoration count - - -diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 3b12030b49b1c539684d75ca3896eb498400ef99..a1f042e5329343489cf30e436a8f553d39e5a6e4 100644 ---- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -354,6 +354,12 @@ public class MapItemSavedData extends SavedData { - } - - private void addDecoration(MapDecoration.Type type, @Nullable LevelAccessor world, String key, double x, double z, double rotation, @Nullable Component text) { -+ // Scissors start - Limit decoration count -+ if (this.decorations.size() > 32) { -+ return; -+ } -+ // Scissors end -+ - int i = 1 << this.scale; - float f = (float) (x - (double) this.centerX) / (float) i; - float f1 = (float) (z - (double) this.centerZ) / (float) i; diff --git a/patches/server/0045-Make-excluding-players-from-nbt-components-configura.patch b/patches/server/0042-Make-excluding-players-from-nbt-components-configura.patch similarity index 96% rename from patches/server/0045-Make-excluding-players-from-nbt-components-configura.patch rename to patches/server/0042-Make-excluding-players-from-nbt-components-configura.patch index 427a4f3..c4e6299 100644 --- a/patches/server/0045-Make-excluding-players-from-nbt-components-configura.patch +++ b/patches/server/0042-Make-excluding-players-from-nbt-components-configura.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make excluding players from nbt components configurable diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java -index 9f2a51fddb692f5152c32dcbe1f5a6ba150634e4..39b56ca496ed7369ead21805d476c2b813fcdd1d 100644 +index ec93980fefcab57b7bac78d2fc4a217b376b7eca..44920c46aa75bcdc450e192d8c8ca0bf7ad0b7d5 100644 --- a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java +++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java @@ -87,8 +87,8 @@ public class ScissorsConfig diff --git a/patches/server/0046-Fix-component-extra-empty-array-exploit.patch b/patches/server/0043-Fix-component-extra-empty-array-exploit.patch similarity index 100% rename from patches/server/0046-Fix-component-extra-empty-array-exploit.patch rename to patches/server/0043-Fix-component-extra-empty-array-exploit.patch diff --git a/patches/server/0047-Add-depth-limit-to-Component-deserializer.patch b/patches/server/0044-Add-depth-limit-to-Component-deserializer.patch similarity index 98% rename from patches/server/0047-Add-depth-limit-to-Component-deserializer.patch rename to patches/server/0044-Add-depth-limit-to-Component-deserializer.patch index c017ffd..e72e6ff 100644 --- a/patches/server/0047-Add-depth-limit-to-Component-deserializer.patch +++ b/patches/server/0044-Add-depth-limit-to-Component-deserializer.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add depth limit to Component deserializer diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java -index 39b56ca496ed7369ead21805d476c2b813fcdd1d..9659cff6412584190ff0c32e01f602de4ff7d3b3 100644 +index 44920c46aa75bcdc450e192d8c8ca0bf7ad0b7d5..56aa12b57d893b0be9ff7a18df87645dae2c8a19 100644 --- a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java +++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java @@ -87,8 +87,8 @@ public class ScissorsConfig diff --git a/patches/server/0048-Add-depth-limit-to-SNBT.patch b/patches/server/0045-Add-depth-limit-to-SNBT.patch similarity index 100% rename from patches/server/0048-Add-depth-limit-to-SNBT.patch rename to patches/server/0045-Add-depth-limit-to-SNBT.patch diff --git a/patches/server/0046-Implement-command-block-events.patch b/patches/server/0046-Implement-command-block-events.patch new file mode 100644 index 0000000..844a34b --- /dev/null +++ b/patches/server/0046-Implement-command-block-events.patch @@ -0,0 +1,90 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Allink +Date: Fri, 2 Jun 2023 20:55:18 +0100 +Subject: [PATCH] Implement command block events + + +diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java +index c99fc118013cb3d4043638e2001a8297e79ddf9c..cdaa81e1f2167b29ec01cc25e51a8400deb533d2 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java +@@ -9,7 +9,7 @@ import net.minecraft.world.level.BaseCommandBlock; + import net.minecraft.world.level.Level; + + public class ServerboundSetCommandMinecartPacket implements Packet { +- private final int entity; ++ public final int entity; // Scissors - private -> public + private final String command; + private final boolean trackOutput; + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 26bf05922698c734302fa80076e7a1eadbfe1d8d..dcb8058380bea82bae1b02de4fdcbd0463d3a4f3 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -1,6 +1,8 @@ + package net.minecraft.server.network; + + import me.totalfreedom.scissors.ScissorsConfig; ++import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent; ++import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent; + import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; + import com.google.common.collect.Lists; + import com.google.common.primitives.Floats; +@@ -160,6 +162,7 @@ import net.minecraft.world.entity.player.Inventory; + import net.minecraft.world.entity.player.ProfilePublicKey; + import net.minecraft.world.entity.projectile.AbstractArrow; + import net.minecraft.world.entity.vehicle.Boat; ++import net.minecraft.world.entity.vehicle.MinecartCommandBlock; + import net.minecraft.world.item.BlockItem; + import net.minecraft.world.item.BucketItem; + import net.minecraft.world.item.Item; +@@ -188,6 +191,8 @@ import net.minecraft.world.phys.Vec3; + import net.minecraft.world.phys.shapes.BooleanOp; + import net.minecraft.world.phys.shapes.Shapes; + import net.minecraft.world.phys.shapes.VoxelShape; ++import org.bukkit.craftbukkit.block.CraftCommandBlock; ++import org.bukkit.craftbukkit.entity.CraftMinecartCommand; + import org.slf4j.Logger; + + // CraftBukkit start +@@ -1001,6 +1006,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity); + } + ++ CommandBlockPlayerEditEvent event = new CommandBlockPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), s, new CraftCommandBlock(this.player.level().getWorld(), tileentitycommand)); ++ ++ if (!event.callEvent()) { ++ return; ++ } ++ ++ s = event.getNewCommand(); ++ ++ ++ // Scissors end ++ + commandblocklistenerabstract.setCommand(s); + commandblocklistenerabstract.setTrackOutput(flag); + if (!flag) { +@@ -1032,7 +1048,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level()); + + if (commandblocklistenerabstract != null) { +- commandblocklistenerabstract.setCommand(packet.getCommand()); ++ // Scissors start - Implement command block events ++ String command = packet.getCommand(); ++ CommandMinecartPlayerEditEvent event = new CommandMinecartPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), command, new CraftMinecartCommand(this.cserver, (MinecartCommandBlock) this.player.level().getEntity(packet.entity))); ++ ++ if (!event.callEvent()) { ++ return; ++ } ++ ++ command = event.getNewCommand(); ++ commandblocklistenerabstract.setCommand(command); ++ ++ // commandblocklistenerabstract.setCommand(packet.getCommand()); ++ ++ // Scissors end ++ + commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput()); + if (!packet.isTrackOutput()) { + commandblocklistenerabstract.setLastOutput((Component) null); diff --git a/patches/server/0050-Limit-beacon-effectRange.patch b/patches/server/0047-Limit-beacon-effectRange.patch similarity index 92% rename from patches/server/0050-Limit-beacon-effectRange.patch rename to patches/server/0047-Limit-beacon-effectRange.patch index 1dd041e..60ff631 100644 --- a/patches/server/0050-Limit-beacon-effectRange.patch +++ b/patches/server/0047-Limit-beacon-effectRange.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Limit beacon effectRange diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -index f2325c0c475bb465f5275f78c71949648a860d0c..4ec228ce026ee39eebd17d180fb5caea1b74e6e2 100644 +index 5005a0ad5f703727ea9c618ae4b769a77d5655b5..8645ebb37dfab4e76b238a3660816a59018d3dde 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java @@ -83,7 +83,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name diff --git a/patches/server/0051-Fix-invalid-armor-trim-exploit.patch b/patches/server/0048-Fix-invalid-armor-trim-exploit.patch similarity index 100% rename from patches/server/0051-Fix-invalid-armor-trim-exploit.patch rename to patches/server/0048-Fix-invalid-armor-trim-exploit.patch diff --git a/patches/server/0049-Implement-command-block-events.patch b/patches/server/0049-Implement-command-block-events.patch deleted file mode 100644 index b7d86dc..0000000 --- a/patches/server/0049-Implement-command-block-events.patch +++ /dev/null @@ -1,315 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Allink -Date: Fri, 2 Jun 2023 20:55:18 +0100 -Subject: [PATCH] Implement command block events - - -diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java -index c99fc118013cb3d4043638e2001a8297e79ddf9c..cdaa81e1f2167b29ec01cc25e51a8400deb533d2 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java -@@ -9,7 +9,7 @@ import net.minecraft.world.level.BaseCommandBlock; - import net.minecraft.world.level.Level; - - public class ServerboundSetCommandMinecartPacket implements Packet { -- private final int entity; -+ public final int entity; // Scissors - private -> public - private final String command; - private final boolean trackOutput; - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 26bf05922698c734302fa80076e7a1eadbfe1d8d..5422eb931d83f65d40be5fcca49b6d9e57eec735 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1,6 +1,8 @@ - package net.minecraft.server.network; - - import me.totalfreedom.scissors.ScissorsConfig; -+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent; -+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent; - import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; - import com.google.common.collect.Lists; - import com.google.common.primitives.Floats; -@@ -160,6 +162,7 @@ import net.minecraft.world.entity.player.Inventory; - import net.minecraft.world.entity.player.ProfilePublicKey; - import net.minecraft.world.entity.projectile.AbstractArrow; - import net.minecraft.world.entity.vehicle.Boat; -+import net.minecraft.world.entity.vehicle.MinecartCommandBlock; - import net.minecraft.world.item.BlockItem; - import net.minecraft.world.item.BucketItem; - import net.minecraft.world.item.Item; -@@ -188,6 +191,10 @@ import net.minecraft.world.phys.Vec3; - import net.minecraft.world.phys.shapes.BooleanOp; - import net.minecraft.world.phys.shapes.Shapes; - import net.minecraft.world.phys.shapes.VoxelShape; -+import org.bukkit.craftbukkit.block.CraftBlockStates; -+import org.bukkit.craftbukkit.block.CraftCommandBlock; -+import org.bukkit.craftbukkit.entity.CraftMinecartCommand; -+import org.bukkit.entity.minecart.CommandMinecart; - import org.slf4j.Logger; - - // CraftBukkit start -@@ -651,14 +658,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && ( - !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position()))) || - !worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position()))) -- )) { -+ )) { - this.connection.send(new ClientboundMoveVehiclePacket(entity)); - return; - } - // Paper end - - if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { -- // CraftBukkit end -+ // CraftBukkit end - ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); - this.connection.send(new ClientboundMoveVehiclePacket(entity)); - return; -@@ -905,11 +912,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - // Paper end - Don't suggest if tab-complete is disabled - // Paper start - async tab completion - TAB_COMPLETE_EXECUTOR.execute(() -> { -- StringReader stringreader = new StringReader(packet.getCommand()); -+ StringReader stringreader = new StringReader(packet.getCommand()); - -- if (stringreader.canRead() && stringreader.peek() == '/') { -- stringreader.skip(); -- } -+ if (stringreader.canRead() && stringreader.peek() == '/') { -+ stringreader.skip(); -+ } - final String command = packet.getCommand(); - final com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), command, true, null); - event.callEvent(); -@@ -1001,6 +1008,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity); - } - -+ CommandBlockPlayerEditEvent event = new CommandBlockPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), s, new CraftCommandBlock(this.player.level().getWorld(), tileentitycommand)); -+ -+ if (!event.callEvent()) { -+ return; -+ } -+ -+ s = event.getNewCommand(); -+ -+ -+ // Scissors end -+ - commandblocklistenerabstract.setCommand(s); - commandblocklistenerabstract.setTrackOutput(flag); - if (!flag) { -@@ -1032,7 +1050,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level()); - - if (commandblocklistenerabstract != null) { -- commandblocklistenerabstract.setCommand(packet.getCommand()); -+ // Scissors start - Implement command block events -+ String command = packet.getCommand(); -+ CommandMinecartPlayerEditEvent event = new CommandMinecartPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), command, new CraftMinecartCommand(this.cserver, (MinecartCommandBlock) this.player.level().getEntity(packet.entity))); -+ -+ if (!event.callEvent()) { -+ return; -+ } -+ -+ command = event.getNewCommand(); -+ commandblocklistenerabstract.setCommand(command); -+ -+ // commandblocklistenerabstract.setCommand(packet.getCommand()); -+ -+ // Scissors end -+ - commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput()); - if (!packet.isTrackOutput()) { - commandblocklistenerabstract.setLastOutput((Component) null); -@@ -1484,7 +1516,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - float f2 = this.player.isFallFlying() ? 300.0F : 100.0F; - - if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { -- // CraftBukkit end -+ // CraftBukkit end - ServerGamePacketListenerImpl.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8}); - this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot()); - return; -@@ -1979,7 +2011,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED); - - this.player.sendSystemMessage(ichatmutablecomponent, true); -- } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper -+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper - this.player.swing(enumhand, true); - } - } -@@ -2230,32 +2262,32 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - // CraftBukkit end - if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { - this.server.scheduleOnMain(() -> { // Paper - push to main for event firing -- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause -+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause - }); // Paper - push to main for event firing - } else { - Optional optional = this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages()); - - if (optional.isPresent()) { - // this.server.submit(() -> { // CraftBukkit - async chat -- PlayerChatMessage playerchatmessage; -+ PlayerChatMessage playerchatmessage; - -- try { -- playerchatmessage = this.getSignedMessage(packet, (LastSeenMessages) optional.get()); -- } catch (SignedMessageChain.DecodeException signedmessagechain_a) { -- this.handleMessageDecodeFailure(signedmessagechain_a); -- return; -- } -+ try { -+ playerchatmessage = this.getSignedMessage(packet, (LastSeenMessages) optional.get()); -+ } catch (SignedMessageChain.DecodeException signedmessagechain_a) { -+ this.handleMessageDecodeFailure(signedmessagechain_a); -+ return; -+ } - -- CompletableFuture completablefuture = this.filterTextPacket(playerchatmessage.signedContent()); -- CompletableFuture completablefuture1 = this.server.getChatDecorator().decorate(this.player, null, playerchatmessage.decoratedContent()); // Paper -+ CompletableFuture completablefuture = this.filterTextPacket(playerchatmessage.signedContent()); -+ CompletableFuture completablefuture1 = this.server.getChatDecorator().decorate(this.player, null, playerchatmessage.decoratedContent()); // Paper - -- this.chatMessageChain.append((executor) -> { -- return CompletableFuture.allOf(completablefuture, completablefuture1).thenAcceptAsync((ovoid) -> { -- PlayerChatMessage playerchatmessage1 = playerchatmessage.filter(((FilteredText) completablefuture.join()).mask()).withResult(completablefuture1.join()); // Paper -+ this.chatMessageChain.append((executor) -> { -+ return CompletableFuture.allOf(completablefuture, completablefuture1).thenAcceptAsync((ovoid) -> { -+ PlayerChatMessage playerchatmessage1 = playerchatmessage.filter(((FilteredText) completablefuture.join()).mask()).withResult(completablefuture1.join()); // Paper - -- this.broadcastChatMessage(playerchatmessage1); -- }, this.server.chatExecutor); // CraftBukkit - async chat -- }); -+ this.broadcastChatMessage(playerchatmessage1); -+ }, this.server.chatExecutor); // CraftBukkit - async chat -+ }); - // }); // CraftBukkit - async chat - } - -@@ -2266,7 +2298,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - public void handleChatCommand(ServerboundChatCommandPacket packet) { - if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { - this.server.scheduleOnMain(() -> { // Paper - push to main for event firing -- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper -+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - }); // Paper - push to main for event firing - } else { - Optional optional = this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages()); -@@ -2291,7 +2323,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - // CraftBukkit start - String command = "/" + packet.command(); - if (org.spigotmc.SpigotConfig.logCommands) { // Paper -- ServerGamePacketListenerImpl.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command); -+ ServerGamePacketListenerImpl.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command); - } // Paper - - PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command, new LazyPlayerSet(this.server)); -@@ -2356,7 +2388,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - if (!this.updateChatOrder(timestamp)) { - ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper - this.server.scheduleOnMain(() -> { // Paper - push to main -- this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event ca -+ this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event ca - }); // Paper - push to main - return Optional.empty(); - } else { -@@ -2427,7 +2459,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - this.handleCommand(s); - } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { - // Do nothing, this is coming from a plugin -- // Paper start -+ // Paper start - } else if (true) { - final ChatProcessor cp = new ChatProcessor(this.server, this.player, original, async); - cp.process(); -@@ -2538,7 +2570,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - // Paper End - co.aikar.timings.MinecraftTimings.playerCommandTimer.startTiming(); // Paper - if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot -- this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); -+ this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); - - CraftPlayer player = this.getCraftPlayer(); - -@@ -2617,16 +2649,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - @Override - public void handleChatAck(ServerboundChatAckPacket packet) { - LastSeenMessagesValidator lastseenmessagesvalidator = this.lastSeenMessages; -- if (!this.lastSeenMessages.applyOffset(packet.offset())) { -- synchronized (this.lastSeenMessages) { -- // Scissors start - Add configuration option to disable chat signatures -- if (!ScissorsConfig.chatSignaturesEnabled) -- { -- return; -- } -- // Scissors end -- ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); -- this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes -+ if (!this.lastSeenMessages.applyOffset(packet.offset())) { -+ synchronized (this.lastSeenMessages) { -+ // Scissors start - Add configuration option to disable chat signatures -+ if (!ScissorsConfig.chatSignaturesEnabled) -+ { -+ return; -+ } -+ // Scissors end -+ ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); -+ this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes - } - - } -@@ -2865,7 +2897,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } - - if (event.isCancelled()) { -- ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote(); // Paper - Refresh player inventory -+ ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote(); // Paper - Refresh player inventory - return; - } - // CraftBukkit end -@@ -3439,19 +3471,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - itemstack = CraftItemStack.asNMSCopy(event.getCursor()); - - switch (event.getResult()) { -- case ALLOW: -- // Plugin cleared the id / stacksize checks -- flag2 = true; -- break; -- case DEFAULT: -- break; -- case DENY: -- // Reset the slot -- if (packet.getSlotNum() >= 0) { -- this.player.connection.send(new ClientboundContainerSetSlotPacket(this.player.inventoryMenu.containerId, this.player.inventoryMenu.incrementStateId(), packet.getSlotNum(), this.player.inventoryMenu.getSlot(packet.getSlotNum()).getItem())); -- this.player.connection.send(new ClientboundContainerSetSlotPacket(-1, this.player.inventoryMenu.incrementStateId(), -1, ItemStack.EMPTY)); -- } -- return; -+ case ALLOW: -+ // Plugin cleared the id / stacksize checks -+ flag2 = true; -+ break; -+ case DEFAULT: -+ break; -+ case DENY: -+ // Reset the slot -+ if (packet.getSlotNum() >= 0) { -+ this.player.connection.send(new ClientboundContainerSetSlotPacket(this.player.inventoryMenu.containerId, this.player.inventoryMenu.incrementStateId(), packet.getSlotNum(), this.player.inventoryMenu.getSlot(packet.getSlotNum()).getItem())); -+ this.player.connection.send(new ClientboundContainerSetSlotPacket(-1, this.player.inventoryMenu.incrementStateId(), -1, ItemStack.EMPTY)); -+ } -+ return; - } - } - // CraftBukkit end -@@ -3519,7 +3551,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } else if (!this.isSingleplayerOwner()) { - // Paper start - This needs to be handled on the main thread for plugins - server.submit(() -> { -- this.disconnect(Component.translatable("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause -+ this.disconnect(Component.translatable("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause - }); - // Paper end - } diff --git a/patches/server/0053-Some-more-ResourceLocation-validation.patch b/patches/server/0049-Improve-validation-of-ResourceLocations.patch similarity index 67% rename from patches/server/0053-Some-more-ResourceLocation-validation.patch rename to patches/server/0049-Improve-validation-of-ResourceLocations.patch index d44be25..27f9ffd 100644 --- a/patches/server/0053-Some-more-ResourceLocation-validation.patch +++ b/patches/server/0049-Improve-validation-of-ResourceLocations.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Luna -Date: Tue, 13 Jun 2023 18:37:56 -0300 -Subject: [PATCH] Some more ResourceLocation validation +Date: Tue, 13 Jun 2023 18:29:18 -0300 +Subject: [PATCH] Improve validation of ResourceLocations diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java @@ -23,7 +23,7 @@ index 430810b9cc554dfb3bb0972c103c8a36e8db67ef..b2832c75beab2a1fa077b0317392b6aa // Paper start - cook speed API diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java -index 14ddb953176b02e7ac68401c5c03120f920739a1..c04d24930f03d91f341fb45bed3b8356890dce83 100644 +index 7a3ac883be4015d41a4c7582341a424b4bd6bbf4..6a6d34831a3c9a1a0fd47dbfd3a497c0b7923ce5 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java @@ -199,7 +199,7 @@ public class BrushableBlockEntity extends BlockEntity { @@ -35,3 +35,15 @@ index 14ddb953176b02e7ac68401c5c03120f920739a1..c04d24930f03d91f341fb45bed3b8356 this.lootTableSeed = nbt.getLong("LootTableSeed"); return true; } else { +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java +index 5014192edb9616ce725fc1592832034789527b6f..64da1b0afd51720803aba0d9e86d0b1743bdb0da 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java +@@ -21,6 +21,7 @@ public final class CraftNamespacedKey { + } + + public static NamespacedKey fromMinecraft(ResourceLocation minecraft) { ++ if (minecraft == null) throw new IllegalArgumentException("Null ResourceLocation provided"); // Scissors + return new NamespacedKey(minecraft.getNamespace(), minecraft.getPath()); + } + diff --git a/patches/server/0052-Catch-null-ResourceLocations-in-CraftNamespacedKey.patch b/patches/server/0052-Catch-null-ResourceLocations-in-CraftNamespacedKey.patch deleted file mode 100644 index 2aaf1ba..0000000 --- a/patches/server/0052-Catch-null-ResourceLocations-in-CraftNamespacedKey.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Luna -Date: Tue, 13 Jun 2023 18:29:18 -0300 -Subject: [PATCH] Catch null ResourceLocations in CraftNamespacedKey - - -diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java -index 5014192edb9616ce725fc1592832034789527b6f..64da1b0afd51720803aba0d9e86d0b1743bdb0da 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java -@@ -21,6 +21,7 @@ public final class CraftNamespacedKey { - } - - public static NamespacedKey fromMinecraft(ResourceLocation minecraft) { -+ if (minecraft == null) throw new IllegalArgumentException("Null ResourceLocation provided"); // Scissors - return new NamespacedKey(minecraft.getNamespace(), minecraft.getPath()); - } -