mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 06:25:15 +01:00
Remove fully dropped patches
This commit is contained in:
parent
dc684c60d1
commit
c84a3b541c
11 changed files with 0 additions and 282 deletions
|
@ -1,30 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sudzzy <originmc@outlook.com>
|
|
||||||
Date: Thu, 3 Mar 2016 02:50:31 -0600
|
|
||||||
Subject: [PATCH] Configurable inter-world teleportation safety
|
|
||||||
|
|
||||||
People are able to abuse the way Bukkit handles teleportation across worlds since it provides a built in teleportation
|
|
||||||
safety check.
|
|
||||||
|
|
||||||
To abuse the safety check, players are required to get into a location deemed unsafe by Bukkit e.g. be within a chest
|
|
||||||
or door block. While they are in this block, they accept a teleport request from a player within a different world. Once
|
|
||||||
the player teleports, Minecraft will recursively search upwards for a safe location, this could eventually land within a
|
|
||||||
player's skybase.
|
|
||||||
|
|
||||||
Example setup to perform the glitch: http://puu.sh/ng3PC/cf072dcbdb.png
|
|
||||||
The wanted destination was on top of the emerald block however the player ended on top of the diamond block.
|
|
||||||
This only is the case if the player is teleporting between worlds.
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
||||||
index cb0990c5479773c7448984b79d9b4d8fe45bef7a..f4b4e115a1f39524c2bd307c0e1aaf3c140df7c6 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
||||||
@@ -1235,7 +1235,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
||||||
entity.connection.teleport(to);
|
|
||||||
} else {
|
|
||||||
// The respawn reason should never be used if the passed location is non null.
|
|
||||||
- this.server.getHandle().respawn(entity, toWorld, true, to, true, null);
|
|
||||||
+ this.server.getHandle().respawn(entity, toWorld, true, to, !toWorld.paperConfig().environment.disableTeleportationSuffocationCheck, null); // Paper
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
|
||||||
Date: Tue, 17 Nov 2020 19:13:09 +0200
|
|
||||||
Subject: [PATCH] Expose world spawn angle
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
||||||
index 8b0b9ef372c595340c43c5882ad71587833d86bc..c020f18f356f537a1557a3367dd801f9bbabacdc 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
||||||
@@ -847,7 +847,7 @@ public abstract class PlayerList {
|
|
||||||
if (location == null) {
|
|
||||||
worldserver1 = this.server.getLevel(Level.OVERWORLD);
|
|
||||||
blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
|
||||||
- location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld()).add(0.5F, 0.1F, 0.5F);
|
|
||||||
+ location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld(), worldserver1.levelData.getSpawnAngle(), 0.0F).add(0.5F, 0.1F, 0.5F); // Paper - Expose world spawn angle
|
|
||||||
}
|
|
||||||
|
|
||||||
Player respawnPlayer = entityplayer1.getBukkitEntity();
|
|
|
@ -1,23 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
||||||
Date: Thu, 23 Dec 2021 23:59:12 -0500
|
|
||||||
Subject: [PATCH] Fix Entity Position Desync
|
|
||||||
|
|
||||||
If entities were teleported in the first tick it would not be send to the client.
|
|
||||||
|
|
||||||
This excludes hanging entities, as this fix caused problematic behavior due to them having their own
|
|
||||||
position field.
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
||||||
index 19a7d0ab2ee5494149dfb0503b7c69784b7bee8b..f355dd986bf861da3edb90d7e05f901e19686fef 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
||||||
@@ -171,7 +171,7 @@ public class ServerEntity {
|
|
||||||
boolean flag4 = false;
|
|
||||||
boolean flag5 = false;
|
|
||||||
|
|
||||||
- if (this.tickCount > 0 || this.entity instanceof AbstractArrow) {
|
|
||||||
+ if (!(this.entity instanceof net.minecraft.world.entity.decoration.HangingEntity) || this.tickCount > 0 || this.entity instanceof AbstractArrow) { // Paper - Always update position to fix first-tick teleports
|
|
||||||
long k = this.positionCodec.encodeX(vec3d);
|
|
||||||
long l = this.positionCodec.encodeY(vec3d);
|
|
||||||
long i1 = this.positionCodec.encodeZ(vec3d);
|
|
|
@ -1,64 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Hugo Manrique <hugmanrique@gmail.com>
|
|
||||||
Date: Thu, 26 Jul 2018 14:10:23 +0200
|
|
||||||
Subject: [PATCH] Don't call getItemMeta on hasItemMeta
|
|
||||||
|
|
||||||
Spigot 1.13 checks if any field (which are manually copied from the ItemStack's "tag" NBT tag) on the ItemMeta class of an ItemStack is set.
|
|
||||||
|
|
||||||
We could just check if the "tag" NBT tag is empty, albeit that would break some plugins. The only general tag added on 1.13 is "Damage", and we can just check if the "tag" NBT tag contains any other tag that's not "Damage" (https://minecraft.wiki/wiki/Player.dat_format#Item_structure) making the `hasItemStack` method behave as before.
|
|
||||||
|
|
||||||
Returns true if getDamage() == 0 or has damage tag or other tag is set.
|
|
||||||
Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves.
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|
||||||
index a58e865a047550cc4508d0515cc6f2fc639f9b3d..13e6fc9f42d63fdbd659462070dc7f0767fbb1d9 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|
||||||
@@ -681,7 +681,7 @@ public final class CraftItemStack extends ItemStack {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasItemMeta() {
|
|
||||||
- return CraftItemStack.hasItemMeta(this.handle) && !CraftItemFactory.instance().equals(this.getItemMeta(), null);
|
|
||||||
+ return CraftItemStack.hasItemMeta(this.handle) && (this.handle.getDamageValue() != 0 || (this.handle.getTag() != null && this.handle.getTag().tags.size() >= (this.handle.getTag().contains(CraftMetaItem.DAMAGE.NBT) ? 2 : 1))); // Paper - keep 1.12 CraftBukkit behavior without calling getItemMeta
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean hasItemMeta(net.minecraft.world.item.ItemStack item) {
|
|
||||||
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
|
||||||
index cf436c9e62a11b8c6cbf7638de0e5635c67459ac..7237e24686885c754c87e7eec53c6400fd0b47bf 100644
|
|
||||||
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
|
||||||
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
|
|
||||||
@@ -106,6 +106,34 @@ public class ItemMetaTest extends AbstractTestingBase {
|
|
||||||
assertThat(itemMeta.hasConflictingEnchant(null), is(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Paper start
|
|
||||||
+ private void testItemMeta(ItemStack stack) {
|
|
||||||
+ assertThat(stack.hasItemMeta(), is(false), "Should not have ItemMeta");
|
|
||||||
+
|
|
||||||
+ stack.setDurability((short) 0);
|
|
||||||
+ assertThat(stack.hasItemMeta(), is(false), "ItemStack with zero durability should not have ItemMeta");
|
|
||||||
+
|
|
||||||
+ stack.setDurability((short) 2);
|
|
||||||
+ assertThat(stack.hasItemMeta(), is(true), "ItemStack with non-zero durability should have ItemMeta");
|
|
||||||
+
|
|
||||||
+ stack.setLore(java.util.Collections.singletonList("Lore"));
|
|
||||||
+ assertThat(stack.hasItemMeta(), is(true), "ItemStack with lore and durability should have ItemMeta");
|
|
||||||
+
|
|
||||||
+ stack.setDurability((short) 0);
|
|
||||||
+ assertThat(stack.hasItemMeta(), is(true), "ItemStack with lore should have ItemMeta");
|
|
||||||
+
|
|
||||||
+ stack.setLore(null);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Test
|
|
||||||
+ public void testHasItemMeta() {
|
|
||||||
+ ItemStack itemStack = new ItemStack(Material.SHEARS);
|
|
||||||
+
|
|
||||||
+ testItemMeta(itemStack);
|
|
||||||
+ testItemMeta(CraftItemStack.asCraftCopy(itemStack));
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
+
|
|
||||||
@Test
|
|
||||||
public void testConflictingStoredEnchantment() {
|
|
||||||
EnchantmentStorageMeta itemMeta = (EnchantmentStorageMeta) Bukkit.getItemFactory().getItemMeta(Material.ENCHANTED_BOOK);
|
|
|
@ -1,63 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
||||||
Date: Wed, 1 Jul 2020 11:57:40 -0500
|
|
||||||
Subject: [PATCH] Update itemstack legacy name and lore
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
index 0a3fec9b82a4d744f9046aebe30f80bb6e56c500..4a6e128c62c890c34b62f826d586ae6a424e7f01 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
@@ -196,6 +196,44 @@ public final class ItemStack {
|
|
||||||
list.sort((java.util.Comparator<? super net.minecraft.nbt.Tag>) enchantSorter); // Paper
|
|
||||||
} catch (Exception ignored) {}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ private void processText() {
|
|
||||||
+ CompoundTag display = getTagElement("display");
|
|
||||||
+ if (display != null) {
|
|
||||||
+ if (display.contains("Name", net.minecraft.nbt.Tag.TAG_STRING)) {
|
|
||||||
+ String json = display.getString("Name");
|
|
||||||
+ if (json != null && json.contains("\u00A7")) {
|
|
||||||
+ try {
|
|
||||||
+ display.put("Name", convert(json));
|
|
||||||
+ } catch (com.google.gson.JsonParseException jsonparseexception) {
|
|
||||||
+ display.remove("Name");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (display.contains("Lore", net.minecraft.nbt.Tag.TAG_LIST)) {
|
|
||||||
+ ListTag list = display.getList("Lore", net.minecraft.nbt.Tag.TAG_STRING);
|
|
||||||
+ for (int index = 0; index < list.size(); index++) {
|
|
||||||
+ String json = list.getString(index);
|
|
||||||
+ if (json != null && json.contains("\u00A7")) { // Only try if it has legacy in the unparsed json
|
|
||||||
+ try {
|
|
||||||
+ list.set(index, convert(json));
|
|
||||||
+ } catch (com.google.gson.JsonParseException e) {
|
|
||||||
+ list.set(index, net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(net.minecraft.network.chat.Component.literal(""))));
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private net.minecraft.nbt.StringTag convert(String json) {
|
|
||||||
+ Component component = Component.Serializer.fromJson(json);
|
|
||||||
+ if (component.getContents() instanceof final net.minecraft.network.chat.contents.PlainTextContents plainTextContents && plainTextContents.text().contains("\u00A7") && component.getSiblings().isEmpty()) {
|
|
||||||
+ // Only convert if the root component is a single comp with legacy in it, don't convert already normal components
|
|
||||||
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(plainTextContents.text())[0];
|
|
||||||
+ }
|
|
||||||
+ return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
|
|
||||||
+ }
|
|
||||||
// Paper end
|
|
||||||
|
|
||||||
public ItemStack(ItemLike item) {
|
|
||||||
@@ -245,6 +283,7 @@ public final class ItemStack {
|
|
||||||
if (nbttagcompound.contains("tag", 10)) {
|
|
||||||
this.tag = nbttagcompound.getCompound("tag").copy();
|
|
||||||
this.processEnchantOrder(this.tag); // Paper
|
|
||||||
+ this.processText(); // Paper - Update itemstack legacy name and lore
|
|
||||||
this.getItem().verifyTagAfterLoad(this.tag);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
||||||
Date: Sat, 25 Apr 2020 17:10:55 -0700
|
|
||||||
Subject: [PATCH] Reduce blockpos allocation from pathfinding
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
|
||||||
index b125b9903454891e22a15a0a794d67be67fdb083..1cd7f0f1c7d62552e6609997c83f3df8dae13316 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
|
||||||
@@ -483,7 +483,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
|
||||||
return BlockPathTypes.DANGER_FIRE;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (world.getFluidState(pos).is(FluidTags.WATER)) {
|
|
||||||
+ if (blockState.getFluidState().is(FluidTags.WATER)) { // Paper - Perf: Reduce blockpos allocation from pathfinding
|
|
||||||
return BlockPathTypes.WATER_BORDER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -516,7 +516,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
|
||||||
} else if (blockState.is(Blocks.COCOA)) {
|
|
||||||
return BlockPathTypes.COCOA;
|
|
||||||
} else if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(Blocks.POINTED_DRIPSTONE)) {
|
|
||||||
- FluidState fluidState = world.getFluidState(pos);
|
|
||||||
+ FluidState fluidState = blockState.getFluidState(); // Paper - Perf: Reduce blockpos allocation from pathfinding
|
|
||||||
if (fluidState.is(FluidTags.LAVA)) {
|
|
||||||
return BlockPathTypes.LAVA;
|
|
||||||
} else if (isBurningBlock(blockState)) {
|
|
|
@ -1,55 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
||||||
Date: Fri, 4 Jun 2021 12:12:35 -0700
|
|
||||||
Subject: [PATCH] Make item validations configurable
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
|
||||||
index e0d4798e244add64cbe43201604ad9d57701515f..c5d1ba7a1be3f102edcdfdc05fc50b30ef1f775b 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
|
||||||
@@ -89,11 +89,11 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
||||||
super(tag);
|
|
||||||
|
|
||||||
if (tag.contains(CraftMetaBook.BOOK_TITLE.NBT)) {
|
|
||||||
- this.title = limit( tag.getString(CraftMetaBook.BOOK_TITLE.NBT), 8192 ); // Spigot
|
|
||||||
+ this.title = limit( tag.getString(CraftMetaBook.BOOK_TITLE.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.title); // Spigot // Paper - make configurable
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tag.contains(CraftMetaBook.BOOK_AUTHOR.NBT)) {
|
|
||||||
- this.author = limit( tag.getString(CraftMetaBook.BOOK_AUTHOR.NBT), 8192 ); // Spigot
|
|
||||||
+ this.author = limit( tag.getString(CraftMetaBook.BOOK_AUTHOR.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.author ); // Spigot // Paper - make configurable
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tag.contains(CraftMetaBook.RESOLVED.NBT)) {
|
|
||||||
@@ -121,7 +121,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
||||||
} else {
|
|
||||||
page = this.validatePage(page);
|
|
||||||
}
|
|
||||||
- this.pages.add( limit( page, 16384 ) ); // Spigot
|
|
||||||
+ this.pages.add( limit( page, io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.page ) ); // Spigot // Paper - make configurable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
||||||
index 27be5da67801be6fd99c91576064e4be0b3f0d6c..7d3d32679bdfe373d89a28c3616da5069640d1bb 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
||||||
@@ -362,7 +362,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
||||||
CompoundTag display = tag.getCompound(CraftMetaItem.DISPLAY.NBT);
|
|
||||||
|
|
||||||
if (display.contains(CraftMetaItem.NAME.NBT)) {
|
|
||||||
- this.displayName = limit( display.getString(CraftMetaItem.NAME.NBT), 8192 ); // Spigot
|
|
||||||
+ this.displayName = limit( display.getString(CraftMetaItem.NAME.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.displayName ); // Spigot // Paper - make configurable
|
|
||||||
}
|
|
||||||
|
|
||||||
if (display.contains(CraftMetaItem.LOCNAME.NBT)) {
|
|
||||||
@@ -373,7 +373,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
||||||
ListTag list = display.getList(CraftMetaItem.LORE.NBT, CraftMagicNumbers.NBT.TAG_STRING);
|
|
||||||
this.lore = new ArrayList<String>(list.size());
|
|
||||||
for (int index = 0; index < list.size(); index++) {
|
|
||||||
- String line = limit( list.getString(index), 8192 ); // Spigot
|
|
||||||
+ String line = limit( list.getString(index), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.loreLine ); // Spigot // Paper - make configurable
|
|
||||||
this.lore.add(line);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue