mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-06-28 08:16:41 +00:00
These cleanly went in
This commit is contained in:
@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Fri, 10 Jun 2022 22:55:01 -0500
|
||||
Subject: [PATCH] Fixes invalid LootTables causing problems when applied to
|
||||
Minecart entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||
index d4a8c1bbb8fef27ac42bdf27dde495b4c649e6cb..865c61accf211d28be3c82dcf158fec9778b50c1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||
@@ -17,7 +17,7 @@ public class PaperContainerEntityLootableInventory implements PaperLootableEntit
|
||||
|
||||
@Override
|
||||
public org.bukkit.loot.LootTable getLootTable() {
|
||||
- return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null;
|
||||
+ return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() && entity.getLootTable().toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null; // Scissors - Validate length of loot tables before even trying
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||
index 94dc68182ec5f6dc1294ad15523427836228086a..07075cea760562c901d4469a7f88271c3ffa30bb 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||
@@ -15,7 +15,7 @@ public class PaperTileEntityLootableInventory implements PaperLootableBlockInven
|
||||
|
||||
@Override
|
||||
public org.bukkit.loot.LootTable getLootTable() {
|
||||
- return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null;
|
||||
+ return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() && tileEntityLootable.lootTable.toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null; // Scissors - Validate length of loot tables before even trying
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
index d559f93a9a09bac414dd5d58afccad42c127f09b..8ac4e76bf9acf2f99539c4f874ac5c8605573604 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||
@@ -45,7 +45,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
||||
protected boolean tryLoadLootTable(CompoundTag nbt) {
|
||||
this.lootableData.loadNbt(nbt); // Paper
|
||||
if (nbt.contains("LootTable", 8)) {
|
||||
- this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
|
||||
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("LootTable")); // Scissors - Validate loot tables
|
||||
try { org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(this.lootTable); } catch (IllegalArgumentException ex) { this.lootTable = null; } // Paper - validate
|
||||
this.lootTableSeed = nbt.getLong("LootTableSeed");
|
||||
return false; // Paper - always load the items, table may still remain
|
@ -1,32 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 06:10:22 -0600
|
||||
Subject: [PATCH] Fixes log spam caused by invalid entities in beehives
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
index 41c9f074203915c31c1ae7a160ce509c13383f84..79a7fff759f062b783a540079cb43f2942799715 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
@@ -370,6 +371,13 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
|
||||
for (int i = 0; i < nbttaglist.size(); ++i) {
|
||||
CompoundTag nbttagcompound1 = nbttaglist.getCompound(i);
|
||||
+
|
||||
+ // Scissors start - Do not allow invalid entities from being used for bees
|
||||
+ if (!nbttagcompound1.contains("id") || !ResourceLocation.isValidResourceLocation(nbttagcompound1.getString("id")) || EntityType.byString(nbttagcompound1.getString("id")).isEmpty()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Scissor end
|
||||
+
|
||||
BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData"), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks"));
|
||||
|
||||
this.stored.add(tileentitybeehive_hivebee);
|
@ -1,31 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Fri, 22 Apr 2022 00:59:00 -0500
|
||||
Subject: [PATCH] Fixes the Blank SkullOwner exploit
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
index 92b56f16b4d8107ccf206be6b81a98dc58986c10..e6d0cd263aa5769805426825df7e49724aa05809 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
@@ -9,6 +9,9 @@ import java.util.UUID;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
||||
+// Scissors start
|
||||
+import org.apache.commons.lang3.StringUtils;
|
||||
+// Scissors end
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -61,7 +64,9 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
|
||||
if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
||||
this.setProfile(NbtUtils.readGameProfile(tag.getCompound(SKULL_OWNER.NBT)));
|
||||
- } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !tag.getString(SKULL_OWNER.NBT).isEmpty()) {
|
||||
+ // Scissors start
|
||||
+ } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !StringUtils.isBlank(tag.getString(SKULL_OWNER.NBT))) {
|
||||
+ // Scissors end
|
||||
this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT)));
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Fri, 10 Jun 2022 23:26:03 -0500
|
||||
Subject: [PATCH] Removes useless spammy error logging
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 3c4dadd0012c11191c873fe25a7625193563915d..d8eb84f28761dce95330afc32e4c011a4ab89b18 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -1792,8 +1792,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
resource = CraftNamespacedKey.fromMinecraft(key);
|
||||
}
|
||||
} catch (IllegalArgumentException ex) {
|
||||
- org.bukkit.Bukkit.getLogger().warning("Namespaced resource does not validate: " + key.toString());
|
||||
- ex.printStackTrace();
|
||||
+ // Scissors - Don't log errors thrown by invalid namespaces when an error is thrown
|
||||
}
|
||||
|
||||
return resource;
|
@ -1,25 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 08:14:44 -0600
|
||||
Subject: [PATCH] Ignore errors thrown when trying to remove minecart entities
|
||||
with content in them
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
index b8fb7b5a347298ada16bc8b818edf1863e3f6040..7ec912bfec20d6b5d91f23341c4e9e3188d1236b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
@@ -139,7 +139,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
if (!this.level.isClientSide && reason.shouldDestroy()) {
|
||||
- Containers.dropContents(this.level, (Entity) this, (Container) this);
|
||||
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
|
||||
+ try {
|
||||
+ Containers.dropContents(this.level, (Entity) this, (Container) this);
|
||||
+ } catch (Exception ignored) {
|
||||
+ }
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
super.remove(reason);
|
Reference in New Issue
Block a user