mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 11:42:55 +01:00
c5a10665b8
Spigot still maintains some partial implementation of "tick skipping", a practice in which the MinecraftServer.currentTick field is updated not by an increment of one per actual tick, but instead set to System.currentTimeMillis() / 50. This behaviour means that the tracked tick may "skip" a tick value in case a previous tick took more than the expected 50ms. To compensate for this in important paths, spigot/craftbukkit implements "wall-time". Instead of incrementing/decrementing ticks on block entities/entities by one for each call to their tick() method, they instead increment/decrement important values, like an ItemEntity's age or pickupDelay, by the difference of `currentTick - lastTick`, where `lastTick` is the value of `currentTick` during the last tick() call. These "fixes" however do not play nicely with minecraft's simulation distance as entities/block entities implementing the above behaviour would "catch up" their values when moving from a non-ticking chunk to a ticking one as their `lastTick` value remains stuck on the last tick in a ticking chunk and hence lead to a large "catch up" once ticked again. Paper completely removes the "tick skipping" behaviour (See patch "Further-improve-server-tick-loop"), making the above precautions completely unnecessary, which also rids paper of the previous described incompatibility with non-ticking chunks.
27 lines
1.7 KiB
Diff
27 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: mbax <matt@phozop.net>
|
|
Date: Mon, 17 Aug 2020 12:17:37 -0400
|
|
Subject: [PATCH] Fix regex mistake in CB NBT int deserialization
|
|
|
|
The existing regex is too open and allows for the absence of any actual
|
|
number data, detecting an NBT entry of just the letter "i" in upper or
|
|
lower case. This causes a single-character NBT entry to be processed as
|
|
an integer ending in "i", passing an empty String to to Integer.parseInt,
|
|
triggering an exception in loading the item.
|
|
|
|
This commit forces numbers to be present prior to the ending "i"
|
|
letter.
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java
|
|
index be9686a4240acf24a9ee022cff6ba848524b4498..1d282b1f3cf968364474ce5700bc95ebc46b9f1c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java
|
|
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
|
public class CraftNBTTagConfigSerializer {
|
|
|
|
private static final Pattern ARRAY = Pattern.compile("^\\[.*]");
|
|
- private static final Pattern INTEGER = Pattern.compile("[-+]?(?:0|[1-9][0-9]*)?i", Pattern.CASE_INSENSITIVE);
|
|
+ private static final Pattern INTEGER = Pattern.compile("[-+]?(?:0|[1-9][0-9]*)i", Pattern.CASE_INSENSITIVE); // Paper - fix regex
|
|
private static final Pattern DOUBLE = Pattern.compile("[-+]?(?:[0-9]+[.]?|[0-9]*[.][0-9]+)(?:e[-+]?[0-9]+)?d", Pattern.CASE_INSENSITIVE);
|
|
private static final TagParser MOJANGSON_PARSER = new TagParser(new StringReader(""));
|
|
|