Compare commits

...

8 commits

Author SHA1 Message Date
sulu5890
6f03c0a529
Update Log4J (1.14.4) (#7156)
* Update Log4j

* update log4j (again)
2021-12-19 16:10:33 -08:00
Andrew Mollenkamp
a168ecf0fd Fix items vanishing through end portal (Resolves #2681) (#2894) 2020-01-23 15:33:28 +00:00
Andrew Mollenkamp
4866cb95ca Backport Fix items not falling correctly (Resolves #2835) (#2884) 2020-01-21 11:03:58 +00:00
Zach Brown
b568f49164
Backport missing portions of SPIGOT-5428 fix to 1.14
Fixes GH-2747 for 1.14
2020-01-18 20:32:21 -06:00
Zach Brown
2f5414ac35
[CI-SKIP] Update artifact version on README 2020-01-18 20:17:02 -06:00
Mark Vainomaa
0a8414c404 Fix dupe with Eigencraft redstone implementation (#2866) 2020-01-16 20:10:57 -06:00
Zach Brown
2ecb1c6483
Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.

You can override this functionality at your own peril.
2020-01-12 17:05:27 -06:00
Shane Freeder
84048a8a36
remove burtned TNT blocks (Fixes #2808) 2019-12-30 12:46:31 +00:00
9 changed files with 321 additions and 13 deletions

View file

@ -36,7 +36,7 @@ How To (Plugin Developers)
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.14.2-R0.1-SNAPSHOT</version>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
```

View file

@ -1,11 +1,11 @@
From e866f25ed159540cac7277d5ccd1a3785f7263a0 Mon Sep 17 00:00:00 2001
From 7a83f596de224fc38d7b89ba59f1a7f59922c723 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Mon, 16 Jul 2018 00:05:05 +0300
Subject: [PATCH] Add TNTPrimeEvent
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index 37e6a91520..135c6ae47e 100644
index 37e6a91520..accdf0da4b 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
@ -25,7 +25,7 @@ index 37e6a91520..135c6ae47e 100644
}
Block block = iblockdata.getBlock();
@@ -245,6 +246,12 @@ public class BlockFire extends Block {
@@ -245,6 +246,13 @@ public class BlockFire extends Block {
if (block instanceof BlockTNT) {
BlockTNT blocktnt = (BlockTNT) block;
@ -34,6 +34,7 @@ index 37e6a91520..135c6ae47e 100644
+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.FIRE, null).callEvent()) {
+ return;
+ }
+ world.setAir(blockposition, false); // Paper
+ // Paper end
BlockTNT.a(world, blockposition);
}
@ -138,5 +139,5 @@ index 5fae347db2..c2f35f89d3 100644
this.world.a(blockposition, false);
--
2.22.0
2.24.1

View file

@ -1,4 +1,4 @@
From 0834959b160570b5a53a63d118ae4c460e857aed Mon Sep 17 00:00:00 2001
From 0eed64a22346b109b59a6ed9c885b2426f86bfb9 Mon Sep 17 00:00:00 2001
From: theosib <millerti@172.16.221.1>
Date: Thu, 27 Sep 2018 01:43:35 -0600
Subject: [PATCH] Optimize redstone algorithm
@ -19,7 +19,7 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index c7ff264cb..1ad6d6483 100644
index e26aadfb0..cf9470057 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -439,4 +439,14 @@ public class PaperWorldConfig {
@ -39,10 +39,10 @@ index c7ff264cb..1ad6d6483 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
new file mode 100644
index 000000000..cf5661f1c
index 000000000..b69803cbf
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
@@ -0,0 +1,912 @@
@@ -0,0 +1,915 @@
+package com.destroystokyo.paper.util;
+
+import java.util.List;
@ -938,8 +938,11 @@ index 000000000..cf5661f1c
+ // and set it in the world.
+ // Possible optimization: Don't commit state changes to the world until they
+ // need to be known by some nearby non-redstone-wire block.
+ state = state.set(BlockRedstoneWire.POWER, Integer.valueOf(j));
+ worldIn.setTypeAndData(upd.self, state, 2);
+ BlockPosition pos = new BlockPosition(upd.self.getX(), upd.self.getY(), upd.self.getZ());
+ if (wire.canPlace(null, worldIn, pos)) {
+ state = state.set(BlockRedstoneWire.POWER, Integer.valueOf(j));
+ worldIn.setTypeAndData(upd.self, state, 2);
+ }
+ }
+
+ return state;
@ -1144,5 +1147,5 @@ index dc0d89ee6..6189935bd 100644
int i = 0;
EnumDirection[] aenumdirection = World.a;
--
2.23.0
2.24.1

View file

@ -0,0 +1,53 @@
From 436002c12133ffec2180ad47f4b16609b6de4399 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Tue, 23 Jul 2019 20:44:47 -0500
Subject: [PATCH] Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.
You can override this functionality at your own peril.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 98cc4efc..f86d3aa2 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -43,9 +43,23 @@ public class ChunkRegionLoader {
return holder.protoChunk;
}
+ // Paper start
+ private static final int CURRENT_DATA_VERSION = SharedConstants.getGameVersion().getWorldVersion();
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion");
+ // Paper end
+
public static InProgressChunkHolder loadChunk(WorldServer worldserver, DefinedStructureManager definedstructuremanager, VillagePlace villageplace, ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound, boolean distinguish) {
ArrayDeque<Runnable> tasksToExecuteOnMain = new ArrayDeque<>();
// Paper end
+ // Paper start - Do NOT attempt to load chunks saved with newer versions
+ if (nbttagcompound.hasKeyOfType("DataVersion", 3)) {
+ int dataVersion = nbttagcompound.getInt("DataVersion");
+ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) {
+ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace();
+ System.exit(1);
+ }
+ }
+ // Paper end
ChunkGenerator<?> chunkgenerator = worldserver.getChunkProvider().getChunkGenerator();
WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager();
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level");
diff --git a/src/main/java/net/minecraft/server/SharedConstants.java b/src/main/java/net/minecraft/server/SharedConstants.java
index cd04322e..7befab85 100644
--- a/src/main/java/net/minecraft/server/SharedConstants.java
+++ b/src/main/java/net/minecraft/server/SharedConstants.java
@@ -33,6 +33,7 @@ public class SharedConstants {
return stringbuilder.toString();
}
+ public static GameVersion getGameVersion() { return a(); } // Paper - OBFHELPER
public static GameVersion a() {
if (SharedConstants.d == null) {
SharedConstants.d = MinecraftVersion.a();
--
2.24.1

View file

@ -0,0 +1,86 @@
From f83ec08d2c6bb9951b070d5a0f131588236388b0 Mon Sep 17 00:00:00 2001
From: Mathias <mail@mathias.is>
Date: Mon, 16 Dec 2019 19:11:10 +0200
Subject: [PATCH] Backport SPIGOT-5428: Better handling of some ItemMeta
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java
index 2f72f0ce5..ffc246340 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java
@@ -53,7 +53,14 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
NBTTagList patterns = entityTag.getList(PATTERNS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
for (int i = 0; i < Math.min(patterns.size(), 20); i++) {
NBTTagCompound p = patterns.getCompound(i);
- this.patterns.add(new Pattern(DyeColor.getByWoolData((byte) p.getInt(COLOR.NBT)), PatternType.getByIdentifier(p.getString(PATTERN.NBT))));
+ // Paper start - Backport SPIGOT-5428
+ DyeColor color = DyeColor.getByWoolData((byte) p.getInt(COLOR.NBT));
+ PatternType pattern = PatternType.getByIdentifier(p.getString(PATTERN.NBT));
+
+ if (color != null && pattern != null) {
+ this.patterns.add(new Pattern(color, pattern));
+ }
+ // Paper end
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java
index 62b3dcc23..2aab57db7 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java
@@ -33,7 +33,13 @@ class CraftMetaCharge extends CraftMetaItem implements FireworkEffectMeta {
super(tag);
if (tag.hasKey(EXPLOSION.NBT)) {
- effect = CraftMetaFirework.getEffect(tag.getCompound(EXPLOSION.NBT));
+ // Paper start - Backport SPIGOT-5428
+ try {
+ effect = CraftMetaFirework.getEffect(tag.getCompound(EXPLOSION.NBT));
+ } catch (IllegalArgumentException ex) {
+ // Ignore invalid effects
+ }
+ // Paper end
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
index 7489e63a1..114b70588 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
@@ -63,7 +63,13 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
}
if (display.hasKey(MAP_COLOR.NBT)) {
- color = Color.fromRGB(display.getInt(MAP_COLOR.NBT));
+ // Paper start - Backport SPIGOT-5428
+ try {
+ color = Color.fromRGB(display.getInt(MAP_COLOR.NBT));
+ } catch (IllegalArgumentException ex) {
+ // Invalid colour
+ }
+ // Paper end
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
index bb921c928..49c74f4b6 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
@@ -58,7 +58,13 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
type = CraftPotionUtil.toBukkit(tag.getString(DEFAULT_POTION.NBT));
}
if (tag.hasKey(POTION_COLOR.NBT)) {
- color = Color.fromRGB(tag.getInt(POTION_COLOR.NBT));
+ // Paper start - Backport SPIGOT-5428
+ try {
+ color = Color.fromRGB(tag.getInt(POTION_COLOR.NBT));
+ } catch (IllegalArgumentException ex) {
+ // Invalid colour
+ }
+ // Paper end
}
if (tag.hasKey(POTION_EFFECTS.NBT)) {
NBTTagList list = tag.getList(POTION_EFFECTS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
--
2.25.0

View file

@ -0,0 +1,32 @@
From 208d64fae2cd3292ad4e8f7e8ca00ada20ff5b9a Mon Sep 17 00:00:00 2001
From: AJMFactsheets <AJMFactsheets@gmail.com>
Date: Mon, 20 Jan 2020 17:05:05 -0600
Subject: [PATCH] Fix items not falling correctly
Since 1.14, Mojang has added an optimization which skips checking if
an item should fall every fourth tick.
However, Spigot's entity activation range class also has an
optimization which skips ticking active entities every fourth tick.
This can result in a state where an item will never properly fall
due to its move method never being called.
This patch resolves the conflict by offsetting checking an item's
move method from Spigot's entity activation range check.
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index df26cef6..4fe33aad 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -85,7 +85,7 @@ public class EntityItem extends Entity {
}
}
- if (!this.onGround || b(this.getMot()) > 9.999999747378752E-6D || (this.ticksLived + this.getId()) % 4 == 0) {
+ if (!this.onGround || b(this.getMot()) > 9.999999747378752E-6D || this.ticksLived % 4 == 3) { // Paper - Ensure checking item movement is always offset from Spigot's entity activation range check
this.move(EnumMoveType.SELF, this.getMot());
float f = 0.98F;
--
2.17.1

View file

@ -0,0 +1,33 @@
From e144e041f0047b0a0e867a0f793fe5ba8c8fd546 Mon Sep 17 00:00:00 2001
From: AJMFactsheets <AJMFactsheets@gmail.com>
Date: Wed, 22 Jan 2020 19:52:28 -0600
Subject: [PATCH] Fix items vanishing through end portal
If the Paper configuration option "keep-spawn-loaded" is set to false,
items entering the overworld from the end will spawn at Y = 0.
This is due to logic in the getHighestBlockYAt method in World.java
only searching the heightmap if the chunk is loaded.
Quickly loading the exact world spawn chunk before searching the
heightmap resolves the issue without having to load all spawn chunks.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e8def7f8..f65db8e2 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2591,6 +2591,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (blockposition == null) { // CraftBukkit
if (dimensionmanager1.getType() == DimensionManager.THE_END && dimensionmanager == DimensionManager.OVERWORLD) { // CraftBukkit
+ // Paper start - Ensure spawn chunk is always loaded before calculating Y coordinate
+ if (!worldserver1.isLoaded(worldserver1.getSpawn())) {
+ worldserver1.getChunkAtWorldCoords(worldserver1.getSpawn());
+ }
+ // Paper end
blockposition = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
} else if (dimensionmanager.getType() == DimensionManager.THE_END) { // CraftBukkit
blockposition = worldserver1.getDimensionSpawn();
--
2.17.1

View file

@ -0,0 +1,100 @@
From 1dfb687b8c1aa89424bfc697e6d85d0bef99d006 Mon Sep 17 00:00:00 2001
From: sulu5890 <sulu@sulu.me>
Date: Sat, 11 Dec 2021 12:27:27 -0600
Subject: [PATCH] Update Log4j
diff --git a/pom.xml b/pom.xml
index beda5dc8a..668f8646f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,25 +60,25 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
- <version>2.8.1</version>
+ <version>2.17.0</version> <!-- Paper - Update Log4j -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
- <version>2.8.1</version>
+ <version>2.17.0</version> <!-- Paper - Update Log4j -->
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-iostreams</artifactId>
- <version>2.8.1</version>
+ <version>2.17.0</version> <!-- Paper - Update Log4j -->
</dependency>
<!-- Paper - Async loggers -->
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
- <version>3.4.2</version>
+ <version>3.4.4</version> <!-- Paper - Update Log4j -->
<scope>runtime</scope>
</dependency>
<dependency>
@@ -179,6 +179,7 @@
<Specification-Title>Bukkit</Specification-Title>
<Specification-Version>${api.version}</Specification-Version>
<Specification-Vendor>Bukkit Team</Specification-Vendor>
+ <Multi-Release>true</Multi-Release> <!-- Paper - update log4j -->
</manifestEntries>
<manifestSections>
<manifestSection>
@@ -206,7 +207,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
- <version>3.1.1</version>
+ <version>3.2.4</version> <!-- Paper - Update Log4j -->
<executions>
<execution>
<phase>package</phase>
@@ -215,6 +216,16 @@
</goals>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> <!-- Paper -->
+ <!-- Paper start - Update Log4j -->
+ <filters>
+ <filter>
+ <artifact>org.spigotmc:minecraft-server:**</artifact>
+ <excludes>
+ <exclude>org/apache/logging/log4j/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <!-- Paper end - Update Log4j -->
<createSourcesJar>${shadeSourcesJar}</createSourcesJar>
<relocations>
<!-- Cannot be relocated as it breaks translation property keys -->
@@ -265,16 +276,18 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/java.sql.Driver</resource>
</transformer>
- <transformer implementation="com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer" />
+ <transformer implementation="io.github.edwgiz.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer" /> <!-- Paper - Update Log4j -->
</transformers>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
- <groupId>com.github.edwgiz</groupId>
- <artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
- <version>2.8.1</version>
+ <!-- paper start - update log4j -->
+ <groupId>io.github.edwgiz</groupId>
+ <artifactId>log4j-maven-shade-plugin-extensions</artifactId>
+ <version>2.17.0</version>
+ <!-- paper end - update log4j -->
</dependency>
</dependencies>
</plugin>
--
2.34.1

@ -1 +1 @@
Subproject commit c7bfd68a6d71e6c5a09970a4dd00def29a4cbc33
Subproject commit 2d4c7b3bbd322d8b7f3bbe2fe33ecf627251c828