Update patches to 1.16.5
This commit is contained in:
@@ -6,7 +6,7 @@ Subject: [PATCH] POM Changes
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index a2387a667efba33135197d40efe879fc9f635d2f..13d0bb7355a8f6c1a33feb3be60f61aa60dd5f9c 100644
|
||||
index 821df3413345c613eccff158f8081cf9ba848a14..ea2fecb9a8bbc5fbd6c2fec6fbdf4a630ed828aa 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -3,18 +3,18 @@
|
||||
@@ -23,7 +23,7 @@ index a2387a667efba33135197d40efe879fc9f635d2f..13d0bb7355a8f6c1a33feb3be60f61aa
|
||||
|
||||
- <artifactId>tuinity-api</artifactId>
|
||||
+ <artifactId>akarin-api</artifactId>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
- <name>Tuinity-API</name>
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Add server configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index cf20e75419b011e819c63fc8453f250b849cb2c7..c90456e198afdacc21b6980c415c3048fdc7f7a2 100644
|
||||
index b3e7b2a8eaa3980e34bc74a846320b7871dc6e4b..216148af0c136a5243ac7e5f10133df59651e9fe 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1404,6 +1404,14 @@ public interface Server extends PluginMessageRecipient {
|
||||
@@ -1603,6 +1603,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
}
|
||||
// Tuinity end - add config to timings report
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Remove Streams using IntelliJ IDEA
|
||||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java b/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
index bf3e059fe06aae361b2ded451914ed19b5e970c5..8c49d67e2656dcac0758c0908897736b49435bf8 100644
|
||||
index ecd149157d4fb80444f34bf5633d74bcdb63dec5..966287589d7cbf4d626dcdf162ed8cea53cb0b34 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsReportListener.java
|
||||
@@ -58,7 +58,9 @@ public class TimingsReportListener implements MessageCommandSender {
|
||||
@@ -60,7 +60,9 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull String message) {
|
||||
@@ -20,11 +20,94 @@ index bf3e059fe06aae361b2ded451914ed19b5e970c5..8c49d67e2656dcac0758c0908897736b
|
||||
}
|
||||
|
||||
public void addConsoleIfNeeded() {
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java.orig b/src/main/java/co/aikar/timings/TimingsReportListener.java.orig
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ef58a6c00f444bd498a2d8fc4e457236f393954f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsReportListener.java.orig
|
||||
@@ -0,0 +1,77 @@
|
||||
+package co.aikar.timings;
|
||||
+
|
||||
+import com.google.common.collect.Lists;
|
||||
+import org.apache.commons.lang.Validate;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.command.ConsoleCommandSender;
|
||||
+import org.bukkit.command.MessageCommandSender;
|
||||
+import org.bukkit.command.RemoteConsoleCommandSender;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+@SuppressWarnings("WeakerAccess")
|
||||
+public class TimingsReportListener implements MessageCommandSender {
|
||||
+ private final List<CommandSender> senders;
|
||||
+ private final Runnable onDone;
|
||||
+ private String timingsURL;
|
||||
+
|
||||
+ public TimingsReportListener(@NotNull CommandSender senders) {
|
||||
+ this(senders, null);
|
||||
+ }
|
||||
+ public TimingsReportListener(@NotNull CommandSender sender, @Nullable Runnable onDone) {
|
||||
+ this(Lists.newArrayList(sender), onDone);
|
||||
+ }
|
||||
+ public TimingsReportListener(@NotNull List<CommandSender> senders) {
|
||||
+ this(senders, null);
|
||||
+ }
|
||||
+ public TimingsReportListener(@NotNull List<CommandSender> senders, @Nullable Runnable onDone) {
|
||||
+ Validate.notNull(senders);
|
||||
+ Validate.notEmpty(senders);
|
||||
+
|
||||
+ this.senders = Lists.newArrayList(senders);
|
||||
+ this.onDone = onDone;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public String getTimingsURL() {
|
||||
+ return timingsURL;
|
||||
+ }
|
||||
+
|
||||
+ public void done() {
|
||||
+ done(null);
|
||||
+ }
|
||||
+
|
||||
+ public void done(@Nullable String url) {
|
||||
+ this.timingsURL = url;
|
||||
+ if (onDone != null) {
|
||||
+ onDone.run();
|
||||
+ }
|
||||
+ for (CommandSender sender : senders) {
|
||||
+ if (sender instanceof TimingsReportListener) {
|
||||
+ ((TimingsReportListener) sender).done();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendMessage(@NotNull String message) {
|
||||
+ senders.forEach((sender) -> sender.sendMessage(message));
|
||||
+ }
|
||||
+
|
||||
+ public void addConsoleIfNeeded() {
|
||||
+ boolean hasConsole = false;
|
||||
+ for (CommandSender sender : this.senders) {
|
||||
+ if (sender instanceof ConsoleCommandSender || sender instanceof RemoteConsoleCommandSender) {
|
||||
+ hasConsole = true;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!hasConsole) {
|
||||
+ this.senders.add(Bukkit.getConsoleSender());
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/MaterialSetTag.java b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java
|
||||
index c91ea2a0679a7f3a5627b5a008e0b39df3332889..53c36e30e8f500c9bf58e6b12585d44cc5c9e9e2 100644
|
||||
index a02a02aa0c87e0f0ed9e509e4dcab01565b3d92a..0c3fef0b4fd7f0ba4e37600e5acc886838e1db13 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/MaterialSetTag.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java
|
||||
@@ -14,7 +14,9 @@ import org.bukkit.block.BlockState;
|
||||
@@ -13,7 +13,9 @@ import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -34,54 +117,69 @@ index c91ea2a0679a7f3a5627b5a008e0b39df3332889..53c36e30e8f500c9bf58e6b12585d44c
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -115,7 +117,16 @@ public class MaterialSetTag implements Tag<Material> {
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/tag/BaseTag.java b/src/main/java/io/papermc/paper/tag/BaseTag.java
|
||||
index 4b8552e4e4c07b197fa9431fa911535b0222561e..09276e7fd18c4d82c77d19550ace1c6000f21cb7 100644
|
||||
--- a/src/main/java/io/papermc/paper/tag/BaseTag.java
|
||||
+++ b/src/main/java/io/papermc/paper/tag/BaseTag.java
|
||||
@@ -2,6 +2,7 @@ package io.papermc.paper.tag;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.Keyed;
|
||||
+import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Tag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -84,7 +85,17 @@ public abstract class BaseTag<T extends Keyed, C extends BaseTag<T, C>> implemen
|
||||
|
||||
@NotNull
|
||||
public MaterialSetTag add(@NotNull Predicate<Material> filter) {
|
||||
- add(Stream.of(Material.values()).filter(((Predicate<Material>) Material::isLegacy).negate()).filter(filter).collect(Collectors.toList()));
|
||||
+ List<Material> list = new ArrayList<>();
|
||||
+ Predicate<Material> predicate = ((Predicate<Material>) Material::isLegacy).negate();
|
||||
+ for (Material material : Material.values()) {
|
||||
+ if (predicate.test(material)) {
|
||||
+ if (filter.test(material)) {
|
||||
+ list.add(material);
|
||||
public C add(@NotNull Predicate<T> filter) {
|
||||
- return add(getAllPossibleValues().stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).filter(filter).collect(Collectors.toSet()));
|
||||
+ Set<T> set = new HashSet<>();
|
||||
+ for (T material : getAllPossibleValues()) {
|
||||
+ for(Predicate<T> tPredicate : globalPredicates) {
|
||||
+ if (tPredicate.test(material)) {
|
||||
+ if (filter.test(material)) {
|
||||
+ set.add(material);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ add(list);
|
||||
return this;
|
||||
+ return add(set);
|
||||
}
|
||||
|
||||
@@ -139,7 +150,16 @@ public class MaterialSetTag implements Tag<Material> {
|
||||
@NotNull
|
||||
@@ -124,7 +135,17 @@ public abstract class BaseTag<T extends Keyed, C extends BaseTag<T, C>> implemen
|
||||
|
||||
@NotNull
|
||||
public MaterialSetTag not(@NotNull Predicate<Material> filter) {
|
||||
- not(Stream.of(Material.values()).filter(((Predicate<Material>) Material::isLegacy).negate()).filter(filter).collect(Collectors.toList()));
|
||||
+ List<Material> list = new ArrayList<>();
|
||||
+ Predicate<Material> predicate = ((Predicate<Material>) Material::isLegacy).negate();
|
||||
+ for (Material material : Material.values()) {
|
||||
+ if (predicate.test(material)) {
|
||||
+ if (filter.test(material)) {
|
||||
+ list.add(material);
|
||||
public C not(@NotNull Predicate<T> filter) {
|
||||
- not(getAllPossibleValues().stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).filter(filter).collect(Collectors.toSet()));
|
||||
+ Set<T> set = new HashSet<>();
|
||||
+ for (T material : getAllPossibleValues()) {
|
||||
+ for(Predicate<T> tPredicate : globalPredicates) {
|
||||
+ if (tPredicate.test(material)) {
|
||||
+ if (filter.test(material)) {
|
||||
+ set.add(material);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ not(list);
|
||||
return this;
|
||||
+ not(set);
|
||||
return (C) this;
|
||||
}
|
||||
|
||||
@@ -181,7 +201,13 @@ public class MaterialSetTag implements Tag<Material> {
|
||||
@@ -145,7 +166,14 @@ public abstract class BaseTag<T extends Keyed, C extends BaseTag<T, C>> implemen
|
||||
|
||||
@NotNull
|
||||
public MaterialSetTag ensureSize(@NotNull String label, int size) {
|
||||
- long actual = this.materials.stream().filter(((Predicate<Material>) Material::isLegacy).negate()).count();
|
||||
public C ensureSize(@NotNull String label, int size) {
|
||||
- long actual = this.tagged.stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).count();
|
||||
+ long actual = 0L;
|
||||
+ Predicate<Material> predicate = ((Predicate<Material>) Material::isLegacy).negate();
|
||||
+ for (Material material : this.materials) {
|
||||
+ if (predicate.test(material)) {
|
||||
+ actual++;
|
||||
+ for (T material : this.tagged) {
|
||||
+ for(Predicate<T> tPredicate : globalPredicates) {
|
||||
+ if (tPredicate.test(material)) {
|
||||
+ actual++;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
if (size != actual) {
|
||||
throw new IllegalStateException(label + " - Expected " + size + " materials, got " + actual);
|
||||
throw new IllegalStateException(key.toString() + ": " + label + " - Expected " + size + " values, got " + actual);
|
||||
}
|
||||
|
||||
@@ -6,25 +6,25 @@ Subject: [PATCH] Akarin POM changes
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 66517f30fc00b86d1e3539e700f8c643aaada85e..5c2fc340f281297f6dc9e01d084d21f565008e6f 100644
|
||||
index e83e4241a56fe131a75fe21cc1518992c089da2c..65ba3e9312323848f8058c3bd3debc3b231462b1 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,11 +1,11 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
- <artifactId>tuinity</artifactId>
|
||||
+ <artifactId>akarin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
- <name>Tuinity-Server</name>
|
||||
- <url>https://github.com/Spottedleaf/Tuinity</url>
|
||||
+ <name>Akarin-Server</name>
|
||||
+ <url>https://github.com/Akarin-project/Akarin</url>
|
||||
|
||||
<properties>
|
||||
<!-- <skipTests>true</skipTests> Paper - This [was] not going to end well -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -17,16 +17,16 @@
|
||||
@@ -19,16 +19,16 @@
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
@@ -45,7 +45,7 @@ index 66517f30fc00b86d1e3539e700f8c643aaada85e..5c2fc340f281297f6dc9e01d084d21f5
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@@ -163,7 +163,7 @@
|
||||
@@ -183,7 +183,7 @@
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
<build>
|
||||
@@ -54,7 +54,7 @@ index 66517f30fc00b86d1e3539e700f8c643aaada85e..5c2fc340f281297f6dc9e01d084d21f5
|
||||
<defaultGoal>install</defaultGoal> <!-- Paper -->
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -171,7 +171,7 @@
|
||||
@@ -191,7 +191,7 @@
|
||||
<artifactId>gitdescribe-maven-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<configuration>
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Akarin configuration
|
||||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
index b09981e9bd2d24a0f0e291fabfbbbf0b3887a80b..501dacb4584412dd84e36421e113a1f068693e47 100644
|
||||
index 5dfa0658838c4801cdf260eae8b98163f729e5af..841a8d2b392acdcef90592b841cbbcb2237c6901 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
@@ -231,6 +231,7 @@ public class TimingsExport extends Thread {
|
||||
@@ -207,50 +207,70 @@ index 0000000000000000000000000000000000000000..2ac8f02a97429f04f3e5c9206ec228ed
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
index 1f1243ae8371a3e76ebfdee91b327db832767c4a..201ce4a0411f9ddc775053130a7ca62f7412d5f3 100644
|
||||
index 2644b190813cc934914aeab78fbd6515d1a37c4a..1dc0f83847df72824af11a18b73906bc23e3d376 100644
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -195,6 +195,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
@@ -19,6 +19,8 @@ import java.util.Optional;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import io.akarin.server.Config;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -176,7 +178,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||
// Paper end
|
||||
com.tuinity.tuinity.config.TuinityConfig.init((File) options.valueOf("tuinity-settings")); // Tuinity - Server Config
|
||||
+ io.akarin.server.Config.init((File) options.valueOf("akarin-settings")); // Akarin - Server Config
|
||||
|
||||
this.setSpawnAnimals(dedicatedserverproperties.spawnAnimals);
|
||||
this.setSpawnNPCs(dedicatedserverproperties.spawnNpcs);
|
||||
com.tuinity.tuinity.config.TuinityConfig.init((java.io.File) options.valueOf("tuinity-settings")); // Tuinity - Server Config
|
||||
-
|
||||
+ Config.init((java.io.File) options.valueOf("akarin-settings")); // Akarin - Server Config
|
||||
+
|
||||
this.setPVP(dedicatedserverproperties.pvp);
|
||||
this.setAllowFlight(dedicatedserverproperties.allowFlight);
|
||||
this.setResourcePack(dedicatedserverproperties.resourcePack, this.ba());
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 6ae9ec627e0cf2b3b464a8d86e08a6deba713675..655e0b5e52e22a1ac1ff3718ad5ab3ab61ef7e41 100644
|
||||
index 970c1be5477a01ab9c6d79e84c519e22775564ff..4020533364aa6a2075b700a3f98385b55146ace3 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -89,6 +89,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
@@ -18,6 +18,8 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import io.akarin.server.Config;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -95,6 +97,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
public final ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
|
||||
public final com.tuinity.tuinity.config.TuinityConfig.WorldConfig tuinityConfig; // Tuinity - Server Config
|
||||
+ public final io.akarin.server.Config.WorldConfig akarinConfig; // Akarin - Server Config
|
||||
+ public final Config.WorldConfig akarinConfig; // Akarin - Server Config
|
||||
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
public static BlockPosition lastPhysicsProblem; // Spigot
|
||||
@@ -140,6 +141,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
|
||||
this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
|
||||
this.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(worlddata.getName()); // Tuinity - Server Config
|
||||
+ this.akarinConfig = new io.akarin.server.Config.WorldConfig(worlddata.getName()); // Akarin - Server Config
|
||||
@@ -187,6 +190,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper
|
||||
this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
|
||||
this.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Tuinity - Server Config
|
||||
+ this.akarinConfig = new Config.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Akarin - Server Config
|
||||
this.generator = gen;
|
||||
if (dimensionmanager.world == null) dimensionmanager.world = (WorldServer) this; // Paper
|
||||
this.world = new CraftWorld((WorldServer) this, gen, env);
|
||||
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 760752eaeb07af551cd3cfd36be064c048a05d5b..8863a778a8c34513bc02e42376ebce295d515393 100644
|
||||
index f994e99ebc8fe22e6f6b45f6379ec410a598789f..edaf09bb3fbcc1752f16e893a761cec1497acca2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -816,6 +816,7 @@ public final class CraftServer implements Server {
|
||||
@@ -865,6 +865,7 @@ public final class CraftServer implements Server {
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
|
||||
com.tuinity.tuinity.config.TuinityConfig.init((File) console.options.valueOf("tuinity-settings")); // Tuinity - Server Config
|
||||
+ io.akarin.server.Config.init((File) console.options.valueOf("akarin-settings")); // Akarin - Server Config
|
||||
for (WorldServer world : console.getWorlds()) {
|
||||
world.worldData.setDifficulty(config.difficulty);
|
||||
world.worldDataServer.setDifficulty(config.difficulty);
|
||||
world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals);
|
||||
@@ -845,6 +846,7 @@ public final class CraftServer implements Server {
|
||||
@@ -900,6 +901,7 @@ public final class CraftServer implements Server {
|
||||
world.spigotConfig.init(); // Spigot
|
||||
world.paperConfig.init(); // Paper
|
||||
world.tuinityConfig.init(); // Tuinity - Server Config
|
||||
@@ -258,7 +278,7 @@ index 760752eaeb07af551cd3cfd36be064c048a05d5b..8863a778a8c34513bc02e42376ebce29
|
||||
}
|
||||
|
||||
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
|
||||
@@ -2147,6 +2149,14 @@ public final class CraftServer implements Server {
|
||||
@@ -2357,6 +2359,14 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
// Tuinity end - add config to timings report
|
||||
|
||||
@@ -274,7 +294,7 @@ index 760752eaeb07af551cd3cfd36be064c048a05d5b..8863a778a8c34513bc02e42376ebce29
|
||||
public void restart() {
|
||||
org.spigotmc.RestartCommand.restart();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index cce21aaf3ba8c5049334e17b238aaf44d64db5fe..6464c181bbe35c4621b3b7eac6da47dc50de4e87 100644
|
||||
index 0f6cb508a170360b6479f9c34048412453fbb89d..86a7d9c33fc156d689b8966dd3f02d6ce015fc58 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -146,6 +146,14 @@ public class Main {
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Akarin brand changes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 3c9392077ca0deed8ee4ffa12fa9c615786d1aca..e71e00b087f9e20ab5d3758b2ea901636ebb7fec 100644
|
||||
index 7ac34a8959a797bf2af96f3f402fa65cffe3d666..48809d971d626d6a9cbfcfe9ea868c084dd55677 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1630,7 +1630,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@@ -1520,7 +1520,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
}
|
||||
|
||||
public String getServerModName() {
|
||||
@@ -19,10 +19,10 @@ index 3c9392077ca0deed8ee4ffa12fa9c615786d1aca..e71e00b087f9e20ab5d3758b2ea90163
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 8863a778a8c34513bc02e42376ebce295d515393..7f952a860c524aafea7094048a102478d8c2beec 100644
|
||||
index edaf09bb3fbcc1752f16e893a761cec1497acca2..49fb2625774f63fddf599423e8937fdc79b5b13a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -205,7 +205,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -232,7 +232,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
|
||||
@@ -6,14 +6,14 @@ Subject: [PATCH] Akarin Metrics
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index 24641501aeae0f2c2c5ce877775c7b971fb051bf..246696a0862c9a57329a7ea6a9eb7da00adb60b0 100644
|
||||
index 52c0ab1ce46e1f3233ef746d9bc699356fa9fae4..0bc9847c8a7ad894f82ed2f00aa18b62efffaecf 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
@@ -581,7 +581,7 @@ public class Metrics {
|
||||
@@ -593,7 +593,7 @@ public class Metrics {
|
||||
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
|
||||
// Only start Metrics, if it's enabled in the config
|
||||
if (config.getBoolean("enabled", true)) {
|
||||
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||
- Metrics metrics = new Metrics("Tuinity", serverUUID, logFailedRequests, Bukkit.getLogger()); // Tuinity - we have our own bstats page
|
||||
+ Metrics metrics = new Metrics("Torch", serverUUID, logFailedRequests, Bukkit.getLogger()); // Akarin
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Disable the Snooper
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index e71e00b087f9e20ab5d3758b2ea901636ebb7fec..2cb12e02e836f34ed80e93d4426bd994146e26c8 100644
|
||||
index 48809d971d626d6a9cbfcfe9ea868c084dd55677..22516d0244044660fb9af8d70898687cb42d91f9 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1275,6 +1275,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@@ -1314,6 +1314,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
//} // Paper
|
||||
|
||||
this.methodProfiler.enter("snooper");
|
||||
@@ -17,7 +17,7 @@ index e71e00b087f9e20ab5d3758b2ea901636ebb7fec..2cb12e02e836f34ed80e93d4426bd994
|
||||
if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot
|
||||
this.snooper.a();
|
||||
}
|
||||
@@ -1282,6 +1284,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@@ -1321,6 +1323,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && this.ticks % 6000 == 0) { // Spigot
|
||||
this.snooper.b();
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Avoid double I/O operation on load player file
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
index 350ac42d6b45a1023f6254de7706818775b7957b..65cc7b2052fcb6f349dad9177ba975d75d720462 100644
|
||||
index b5cf60495b85c6ae6c32ee8a1c65d80e59fdce3d..1f77b251d7e7b0f023793cbf0876fc067caa75c1 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||
@@ -165,7 +165,8 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||
@@ -49,7 +49,8 @@ public class WorldNBTStorage {
|
||||
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
|
||||
// Spigot Start
|
||||
boolean usingWrongFile = false;
|
||||
@@ -17,14 +17,14 @@ index 350ac42d6b45a1023f6254de7706818775b7957b..65cc7b2052fcb6f349dad9177ba975d7
|
||||
+ boolean normalFile = file.exists() && file.isFile(); // Akarin - ensures normal file
|
||||
+ if ( org.bukkit.Bukkit.getOnlineMode() && !normalFile ) // Paper - Check online mode first // Akarin - ensures normal file
|
||||
{
|
||||
file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
|
||||
file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
|
||||
if ( file.exists() )
|
||||
@@ -176,7 +177,7 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||
@@ -60,7 +61,7 @@ public class WorldNBTStorage {
|
||||
}
|
||||
// Spigot End
|
||||
|
||||
- if (file.exists() && file.isFile()) {
|
||||
+ if (normalFile) { // Akarin - avoid double I/O operation
|
||||
nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file)));
|
||||
nbttagcompound = NBTCompressedStreamTools.a(file);
|
||||
}
|
||||
// Spigot Start
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Don't trigger Lootable Refresh for non player interaction
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java
|
||||
index 3b394c2726e0fbe595641a022e59c8967d525f82..aa5300b0fae4728c15c431147ad28b39968fb160 100644
|
||||
index c6df2318762dc6542e73f18ed9a3172ee31d96ee..f276080edd1f425467f5c6ce10231402d9f88001 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityLootable.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java
|
||||
@@ -49,6 +49,7 @@ public abstract class TileEntityLootable extends TileEntityContainer {
|
||||
@@ -50,6 +50,7 @@ public abstract class TileEntityLootable extends TileEntityContainer {
|
||||
}
|
||||
|
||||
public void d(@Nullable EntityHuman entityhuman) {
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Never drop items on command "/give"
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/CommandGive.java b/src/main/java/net/minecraft/server/CommandGive.java
|
||||
index 81b26bb4d094f8aede9d5432671936ab3ee42c84..1f3097c9450b5903c35d3b36fd642ddd131786d7 100644
|
||||
index 1d22c45af884a917e77e02c272fcbae74794200c..7c55c48610c5629c2cfd2ca537c4de82cd3c8137 100644
|
||||
--- a/src/main/java/net/minecraft/server/CommandGive.java
|
||||
+++ b/src/main/java/net/minecraft/server/CommandGive.java
|
||||
@@ -36,6 +36,7 @@ public class CommandGive {
|
||||
@@ -35,6 +35,7 @@ public class CommandGive {
|
||||
boolean flag = entityplayer.inventory.pickup(itemstack);
|
||||
EntityItem entityitem;
|
||||
|
||||
|
||||
@@ -6,29 +6,40 @@ Subject: [PATCH] Save Json list asynchronously
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
|
||||
index c97be42dd7b4c6ea2cadcc97f47185c7f02e2cce..370841cad06121651d0c981c23f3a5e268dc3f59 100644
|
||||
index 8da5f976109accc84b26ec4045776aa8a9799f3d..8d00a54ed22dd974dadc7159c7c3d7265ec42649 100644
|
||||
--- a/src/main/java/net/minecraft/server/JsonList.java
|
||||
+++ b/src/main/java/net/minecraft/server/JsonList.java
|
||||
@@ -168,6 +168,7 @@ public class JsonList<K, V extends JsonListEntry<K>> {
|
||||
@@ -146,6 +146,7 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
|
||||
}
|
||||
|
||||
public void save() throws IOException {
|
||||
+ Runnable runnable = () -> { // Akarin - Save json list async
|
||||
this.removeStaleEntries(); // Paper - remove expired values before saving
|
||||
Collection<V> collection = this.d.values();
|
||||
String s = this.b.toJson(collection);
|
||||
@@ -176,10 +177,13 @@ public class JsonList<K, V extends JsonListEntry<K>> {
|
||||
JsonArray jsonarray = new JsonArray();
|
||||
|
||||
@@ -155,11 +156,13 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
|
||||
jsonlistentry.getClass();
|
||||
return (JsonObject) SystemUtils.a(jsonobject, jsonlistentry::a); // CraftBukkit - decompile error
|
||||
}).forEach(jsonarray::add);
|
||||
+ try {
|
||||
BufferedWriter bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
|
||||
Throwable throwable = null;
|
||||
|
||||
try {
|
||||
bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
|
||||
bufferedwriter.write(s);
|
||||
JsonList.b.toJson(jsonarray, bufferedwriter);
|
||||
+
|
||||
} catch (Throwable throwable1) {
|
||||
throwable = throwable1;
|
||||
throw throwable1;
|
||||
@@ -177,6 +180,11 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
|
||||
}
|
||||
|
||||
}
|
||||
+ } catch (IOException e) { // Akarin - Save json list async
|
||||
+ JsonList.LOGGER.warn("Failed to save " + this.c, e); // Akarin - Save json list async
|
||||
} finally {
|
||||
IOUtils.closeQuietly(bufferedwriter);
|
||||
}
|
||||
-
|
||||
+ }
|
||||
+ }; // Akarin - Save json list async
|
||||
+ MCUtil.scheduleAsyncTask(runnable); // Akarin - Save json list async
|
||||
|
||||
}
|
||||
|
||||
public void load() throws FileNotFoundException {
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Swaps the predicate order of collision
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 5c9d5682100a627f1e494449bc0cdb884d136494..f5b8ada739afc9f8c0246e98947fe188b1231438 100644
|
||||
index 2ec48858be8eb2c522c9685b43bd36b3b581cf8b..da9761e2cf0b1d77758f023824768c2279ec5983 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1641,8 +1641,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -1618,8 +1618,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
public void pickup(EntityHuman entityhuman) {}
|
||||
|
||||
public void collide(Entity entity) {
|
||||
@@ -17,6 +17,6 @@ index 5c9d5682100a627f1e494449bc0cdb884d136494..f5b8ada739afc9f8c0246e98947fe188
|
||||
if (!this.isSameVehicle(entity)) {
|
||||
- if (!entity.noclip && !this.noclip) {
|
||||
+ if (true || !entity.noclip && !this.noclip) { // Akarin - Moved up
|
||||
if (this.world.paperConfig.onlyPlayersCollide && !(entity instanceof EntityPlayer || this instanceof EntityPlayer)) return; // Paper
|
||||
double d0 = entity.locX() - this.locX();
|
||||
double d1 = entity.locZ() - this.locZ();
|
||||
double d2 = MathHelper.a(d0, d1);
|
||||
89
patches/server/0012-Remove-stream-for-ender-teleport.patch
Normal file
89
patches/server/0012-Remove-stream-for-ender-teleport.patch
Normal file
@@ -0,0 +1,89 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sotr <i@omc.hk>
|
||||
Date: Wed, 15 Apr 2020 04:16:44 +0700
|
||||
Subject: [PATCH] Remove stream for ender teleport
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/akarin/server/IndexedBlockPosition.java b/src/main/java/io/akarin/server/IndexedBlockPosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..83bf1d4cab653a9edcc8352609433a8fd12bd1b3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/akarin/server/IndexedBlockPosition.java
|
||||
@@ -0,0 +1,35 @@
|
||||
+package io.akarin.server;
|
||||
+
|
||||
+import net.minecraft.server.BlockPosition;
|
||||
+
|
||||
+public class IndexedBlockPosition {
|
||||
+ private final int index;
|
||||
+ private final BlockPosition position;
|
||||
+
|
||||
+ public IndexedBlockPosition(int index, BlockPosition position) {
|
||||
+ this.index = index;
|
||||
+ this.position = position;
|
||||
+ }
|
||||
+
|
||||
+ public static IndexedBlockPosition of(int index, BlockPosition position) {
|
||||
+ return new IndexedBlockPosition(index, position);
|
||||
+ }
|
||||
+
|
||||
+ public int index() {
|
||||
+ return index;
|
||||
+ }
|
||||
+
|
||||
+ public BlockPosition get() {
|
||||
+ return position;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return position.hashCode();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(Object obj) {
|
||||
+ return position.equals(obj);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
||||
index 685351f11497a33ef4ba99055fa7da3a8de18af2..979c75e5b91a9e4f3f85664a60cc0aa82314a136 100644
|
||||
--- a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
||||
+++ b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
||||
@@ -1,7 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
+import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
+import io.akarin.server.IndexedBlockPosition;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index da9761e2cf0b1d77758f023824768c2279ec5983..94b44a44ca71c43215953d4ac8ca49733959246b 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -3095,7 +3095,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
WorldServer worldserver = (WorldServer) this.world;
|
||||
|
||||
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
|
||||
- this.recursiveStream().forEach((entity) -> {
|
||||
+ this.collectPassengers().forEach((entity) -> {
|
||||
worldserver.chunkCheck(entity);
|
||||
entity.az = true;
|
||||
Iterator iterator = new java.util.ArrayList<>(entity.passengers).iterator(); // Tuinity - copy list to guard against CME
|
||||
@@ -3342,6 +3342,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
public Stream<Entity> recursiveStream() {
|
||||
return Stream.concat(Stream.of(this), com.google.common.collect.ImmutableList.copyOf(this.passengers).stream().flatMap(Entity::recursiveStream)); // Paper
|
||||
}
|
||||
+ // Akarin start - non-stream version
|
||||
+ public List<Entity> collectPassengers() {
|
||||
+ List<Entity> result = Lists.newArrayList(this);
|
||||
+ for (Entity passenger : this.passengers)
|
||||
+ result.addAll(passenger.collectPassengers());
|
||||
+ return result;
|
||||
+ }
|
||||
+ // Akarin end
|
||||
|
||||
public boolean hasSinglePlayerPassenger() {
|
||||
Set<Entity> set = Sets.newHashSet();
|
||||
118
patches/server/0013-Cache-hashcode-for-BlockPosition.patch
Normal file
118
patches/server/0013-Cache-hashcode-for-BlockPosition.patch
Normal file
@@ -0,0 +1,118 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sotr <i@omc.hk>
|
||||
Date: Wed, 15 Apr 2020 04:28:25 +0700
|
||||
Subject: [PATCH] Cache hashcode for BlockPosition
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
index e811295b4d6afcd920f60e0ce5440e43300d9085..5b39fca67855e9d7b266ef496330c2d16c1caced 100644
|
||||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
@@ -2,8 +2,9 @@ package net.minecraft.server;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.mojang.serialization.Codec;
|
||||
-import java.util.stream.IntStream;
|
||||
+
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
+import java.util.stream.IntStream;
|
||||
|
||||
@Immutable
|
||||
public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
@@ -28,6 +29,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
return b < 0 || b >= 256;
|
||||
}
|
||||
// Paper end
|
||||
+ protected int hash; // Akarin - cache hashcode
|
||||
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
this.a = i;
|
||||
@@ -52,8 +54,20 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
}
|
||||
|
||||
public final int hashCode() { // Paper
|
||||
- return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||
+ // Akarin start - cache hashcode
|
||||
+ int result = hash; // Make the situation not too bad when it is modified by multiple threads
|
||||
+ if (result == 0) {
|
||||
+ result = (this.getY() + this.getZ() * 31) * 31 + this.getX(); // Paper
|
||||
+ hash = result;
|
||||
+ }
|
||||
+ return result;
|
||||
+ // return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||
+ }
|
||||
+
|
||||
+ public final void recalcHashCode() {
|
||||
+ hash = 0;
|
||||
}
|
||||
+ // Akarin end
|
||||
|
||||
public int compareTo(BaseBlockPosition baseblockposition) {
|
||||
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 2291135eaef64c403183724cb6e413cd7e472672..c1bd8e558963169d0adc3c0a7d6cfec19e1d1c98 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -453,6 +453,7 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
((BaseBlockPosition)this).a = i; // Tuinity - force inline
|
||||
((BaseBlockPosition)this).b = j; // Tuinity - force inline
|
||||
((BaseBlockPosition)this).e = k; // Tuinity - force inline
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -466,6 +467,7 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
((BaseBlockPosition)this).a = baseblockposition.a; // Tuinity - force inline
|
||||
((BaseBlockPosition)this).b = baseblockposition.b; // Tuinity - force inline
|
||||
((BaseBlockPosition)this).e = baseblockposition.e; // Tuinity - force inline
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -473,6 +475,7 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
((BaseBlockPosition)this).a = (int)(i >> 38); // Tuinity - force inline
|
||||
((BaseBlockPosition)this).b = (int)((i << 52) >> 52); // Tuinity - force inline
|
||||
((BaseBlockPosition)this).e = (int)((i << 26) >> 38); // Tuinity - force inline
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -492,6 +495,7 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
((BaseBlockPosition)this).a += enumdirection.getAdjacentX(); // Tuinity - force inline
|
||||
((BaseBlockPosition)this).b += enumdirection.getAdjacentY(); // Tuinity - force inline
|
||||
((BaseBlockPosition)this).e += enumdirection.getAdjacentZ(); // Tuinity - force inline
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -524,24 +528,30 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
// only expose set on the mutable blockpos
|
||||
public final void setX(int value) {
|
||||
((BaseBlockPosition)this).a = value;
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
}
|
||||
public final void setY(int value) {
|
||||
((BaseBlockPosition)this).b = value;
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
}
|
||||
public final void setZ(int value) {
|
||||
((BaseBlockPosition)this).e = value;
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
}
|
||||
|
||||
public final void o(int i) {
|
||||
((BaseBlockPosition)this).a = i; // need cast thanks to name conflict
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
}
|
||||
|
||||
public final void p(int i) {
|
||||
((BaseBlockPosition)this).b = i;
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
}
|
||||
|
||||
public final void q(int i) {
|
||||
((BaseBlockPosition)this).e = i;
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
}
|
||||
// Tuinity end
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sotr <i@omc.hk>
|
||||
Date: Wed, 15 Apr 2020 03:51:50 +0700
|
||||
Subject: [PATCH] Optimize door interact with pathfinding
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/akarin/server/IndexedBlockPosition.java b/src/main/java/io/akarin/server/IndexedBlockPosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..83bf1d4cab653a9edcc8352609433a8fd12bd1b3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/akarin/server/IndexedBlockPosition.java
|
||||
@@ -0,0 +1,35 @@
|
||||
+package io.akarin.server;
|
||||
+
|
||||
+import net.minecraft.server.BlockPosition;
|
||||
+
|
||||
+public class IndexedBlockPosition {
|
||||
+ private final int index;
|
||||
+ private final BlockPosition position;
|
||||
+
|
||||
+ public IndexedBlockPosition(int index, BlockPosition position) {
|
||||
+ this.index = index;
|
||||
+ this.position = position;
|
||||
+ }
|
||||
+
|
||||
+ public static IndexedBlockPosition of(int index, BlockPosition position) {
|
||||
+ return new IndexedBlockPosition(index, position);
|
||||
+ }
|
||||
+
|
||||
+ public int index() {
|
||||
+ return index;
|
||||
+ }
|
||||
+
|
||||
+ public BlockPosition get() {
|
||||
+ return position;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return position.hashCode();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(Object obj) {
|
||||
+ return position.equals(obj);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
||||
index 01d9c2d92c580c9fabbb8bb4e8c93f3cc511ccf9..3db22c5f4df6fe68474839c3889ffbe5440f54dc 100644
|
||||
--- a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
||||
+++ b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
||||
@@ -1,7 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
+import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
+import io.akarin.server.IndexedBlockPosition;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -19,32 +21,63 @@ public class BehaviorInteractDoor extends Behavior<EntityLiving> {
|
||||
BehaviorController<?> behaviorcontroller = entityliving.getBehaviorController();
|
||||
PathEntity pathentity = (PathEntity) behaviorcontroller.getMemory(MemoryModuleType.PATH).get();
|
||||
List<GlobalPos> list = (List) behaviorcontroller.getMemory(MemoryModuleType.INTERACTABLE_DOORS).get();
|
||||
+ // Akarin start - remove stream
|
||||
+ /*
|
||||
List<BlockPosition> list1 = (List) pathentity.d().stream().map((pathpoint) -> {
|
||||
return new BlockPosition(pathpoint.a, pathpoint.b, pathpoint.c);
|
||||
}).collect(Collectors.toList());
|
||||
- Set<BlockPosition> set = this.a(worldserver, list, list1);
|
||||
+ */
|
||||
+
|
||||
+ List<PathPoint> points = pathentity.getPoints();
|
||||
+ java.util.Map<BlockPosition, Integer> list1 = new java.util.HashMap<BlockPosition, Integer>(points.size());
|
||||
+ for (int index = 0; index < points.size(); index++) {
|
||||
+ PathPoint point = points.get(index);
|
||||
+ list1.put(new BlockPosition(point.a, point.b, point.c), index);
|
||||
+ }
|
||||
+
|
||||
+ // Akarin end
|
||||
+ Set<io.akarin.server.IndexedBlockPosition> set = this.a(worldserver, list, list1); // Akarin - IndexedBlockPosition
|
||||
int j = pathentity.f() - 1;
|
||||
|
||||
this.a(worldserver, list1, set, j, entityliving, behaviorcontroller);
|
||||
}
|
||||
|
||||
- private Set<BlockPosition> a(WorldServer worldserver, List<GlobalPos> list, List<BlockPosition> list1) {
|
||||
+ private Set<io.akarin.server.IndexedBlockPosition> a(WorldServer worldserver, List<GlobalPos> list, java.util.Map<BlockPosition, Integer> list1) { // Akarin - List -> Map, IndexedBlockPosition
|
||||
+ // Akarin start - remove stream
|
||||
+ /*
|
||||
Stream stream = list.stream().filter((globalpos) -> {
|
||||
return globalpos.getDimensionManager() == worldserver.getWorldProvider().getDimensionManager();
|
||||
}).map(GlobalPos::getBlockPosition);
|
||||
|
||||
list1.getClass();
|
||||
return (Set) stream.filter(list1::contains).collect(Collectors.toSet());
|
||||
+ */
|
||||
+
|
||||
+ Set<io.akarin.server.IndexedBlockPosition> set = Sets.newHashSet();
|
||||
+ DimensionManager manager = worldserver.getWorldProvider().getDimensionManager();
|
||||
+
|
||||
+ for (GlobalPos globalPos : list) {
|
||||
+ if (globalPos.getDimensionManager() == manager) {
|
||||
+ BlockPosition position = globalPos.getBlockPosition();
|
||||
+ Integer index = list1.get(position);
|
||||
+ if (index != null) // contains
|
||||
+ set.add(IndexedBlockPosition.of(index, position));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return set;
|
||||
+ // Akarin end
|
||||
}
|
||||
|
||||
- private void a(WorldServer worldserver, List<BlockPosition> list, Set<BlockPosition> set, int i, EntityLiving entityliving, BehaviorController<?> behaviorcontroller) {
|
||||
- set.forEach((blockposition) -> {
|
||||
- int j = list.indexOf(blockposition);
|
||||
+ private void a(WorldServer worldserver, java.util.Map<BlockPosition, Integer> list, Set<io.akarin.server.IndexedBlockPosition> set, int i, EntityLiving entityliving, BehaviorController<?> behaviorcontroller) { // Akarin - List -> Map, IndexedBlockPosition
|
||||
+ set.forEach((indexedblockposition) -> { // Akarin - IndexedBlockPosition
|
||||
+ BlockPosition blockposition = indexedblockposition.get(); // Akarin - IndexedBlockPosition
|
||||
+ // int j = list.indexOf(blockposition); // Akarin - IndexedBlockPosition
|
||||
IBlockData iblockdata = worldserver.getType(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (TagsBlock.WOODEN_DOORS.isTagged(block) && block instanceof BlockDoor) {
|
||||
- boolean flag = j >= i;
|
||||
+ boolean flag = indexedblockposition.index() >= i; // Akarin - IndexedBlockPosition
|
||||
|
||||
// CraftBukkit start - entities opening doors
|
||||
org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.world, blockposition));
|
||||
@@ -74,14 +107,14 @@ public class BehaviorInteractDoor extends Behavior<EntityLiving> {
|
||||
a(worldserver, list, i, entityliving, behaviorcontroller);
|
||||
}
|
||||
|
||||
- public static void a(WorldServer worldserver, List<BlockPosition> list, int i, EntityLiving entityliving, BehaviorController<?> behaviorcontroller) {
|
||||
+ public static void a(WorldServer worldserver, java.util.Map<BlockPosition, Integer> list, int i, EntityLiving entityliving, BehaviorController<?> behaviorcontroller) { // Akarin - List -> Map
|
||||
behaviorcontroller.getMemory(MemoryModuleType.OPENED_DOORS).ifPresent((set) -> {
|
||||
Iterator iterator = set.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
GlobalPos globalpos = (GlobalPos) iterator.next();
|
||||
BlockPosition blockposition = globalpos.getBlockPosition();
|
||||
- int j = list.indexOf(blockposition);
|
||||
+ int j = list.getOrDefault(blockposition, -1); // Akarin - List -> Map
|
||||
|
||||
if (worldserver.getWorldProvider().getDimensionManager() != globalpos.getDimensionManager()) {
|
||||
iterator.remove();
|
||||
diff --git a/src/main/java/net/minecraft/server/BehaviorSleep.java b/src/main/java/net/minecraft/server/BehaviorSleep.java
|
||||
index dfe0f66500ab2ea733fd5ef84d7d80f32e2dfaab..46eb633084a2eb48cb0a42c5df2b69b9e93b22e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/BehaviorSleep.java
|
||||
+++ b/src/main/java/net/minecraft/server/BehaviorSleep.java
|
||||
@@ -57,7 +57,7 @@ public class BehaviorSleep extends Behavior<EntityLiving> {
|
||||
protected void a(WorldServer worldserver, EntityLiving entityliving, long i) {
|
||||
if (i > this.a) {
|
||||
entityliving.getBehaviorController().getMemory(MemoryModuleType.OPENED_DOORS).ifPresent((set) -> {
|
||||
- BehaviorInteractDoor.a(worldserver, (List) ImmutableList.of(), 0, entityliving, entityliving.getBehaviorController());
|
||||
+ BehaviorInteractDoor.a(worldserver, com.google.common.collect.ImmutableMap.of(), 0, entityliving, entityliving.getBehaviorController()); // Akarin - List -> Map
|
||||
});
|
||||
entityliving.entitySleep(((GlobalPos) entityliving.getBehaviorController().getMemory(MemoryModuleType.HOME).get()).getBlockPosition());
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Remove a few more streams
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
index e0378f486c5d191d55114701d4d519e0d0af5726..e70f4928f81a06d3c15862fc7bdc43dc5fba928e 100644
|
||||
index 7f3887b0894aca0f972922f434382646a6ad6174..4f74922bf0b364bf1ab84460f2a01302a1ea596c 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
||||
@@ -188,9 +188,15 @@ public abstract class ChunkMapDistance {
|
||||
@@ -192,9 +192,15 @@ public abstract class ChunkMapDistance {
|
||||
while (longiterator.hasNext()) {
|
||||
long j = longiterator.nextLong();
|
||||
|
||||
@@ -24,7 +24,7 @@ index e0378f486c5d191d55114701d4d519e0d0af5726..e70f4928f81a06d3c15862fc7bdc43dc
|
||||
PlayerChunk playerchunk = playerchunkmap.getUpdatingChunk(j);
|
||||
|
||||
if (playerchunk == null) {
|
||||
@@ -206,6 +212,22 @@ public abstract class ChunkMapDistance {
|
||||
@@ -210,6 +216,22 @@ public abstract class ChunkMapDistance {
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -48,10 +48,10 @@ index e0378f486c5d191d55114701d4d519e0d0af5726..e70f4928f81a06d3c15862fc7bdc43dc
|
||||
|
||||
this.l.clear();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 9c31edade247baac6811ef3ec98e88a332bcffba..eb3f45d8b707002ebeca20a6857ed41473cdeb3e 100644
|
||||
index 6e77dc89f5441f0f483571fee9aa9f34b6d1dd1c..33097f23326a033bc82a64315e296c8990b28b7f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -92,12 +92,23 @@ public class EntityTNTPrimed extends Entity {
|
||||
@@ -93,12 +93,23 @@ public class EntityTNTPrimed extends Entity {
|
||||
PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this);
|
||||
PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
@@ -76,10 +76,10 @@ index 9c31edade247baac6811ef3ec98e88a332bcffba..eb3f45d8b707002ebeca20a6857ed414
|
||||
}
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
index b5ee8da43ccb7630c8b333824d7ca24788b45322..a904434211ac6c4645b996294e5018945d266a1f 100644
|
||||
index bf9732058c7e55e8f1ed38b3b5e8831e6b21706c..ab6dcc3a19f4a1de86fe36802c13fc484cbb2e88 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
@@ -562,11 +562,20 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
@@ -589,11 +589,20 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
if (optional.isPresent()) {
|
||||
WorldServer worldserver = (WorldServer) this.world;
|
||||
|
||||
508
patches/server/0015-Modify-default-configs.patch
Normal file
508
patches/server/0015-Modify-default-configs.patch
Normal file
@@ -0,0 +1,508 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
|
||||
<tsao-chi@the-lingo.org>
|
||||
Date: Sun, 31 May 2020 12:11:09 +0800
|
||||
Subject: [PATCH] Modify default configs
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index c56e7fb18f9a56c8025eb70a524f028b5942da37..4163fcf06f0c4bb448dd186d0756e02e96b66a8e 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -201,7 +201,7 @@ public class PaperConfig {
|
||||
|
||||
public static String timingsServerName;
|
||||
private static void timings() {
|
||||
- boolean timings = getBoolean("timings.enabled", true);
|
||||
+ boolean timings = getBoolean("timings.enabled", false); // Akarin don't profile by default
|
||||
boolean verboseTimings = getBoolean("timings.verbose", true);
|
||||
TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
|
||||
TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses", "settings.velocity-support.secret"));
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java.orig b/src/main/java/com/destroystokyo/paper/PaperConfig.java.orig
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c56e7fb18f9a56c8025eb70a524f028b5942da37
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java.orig
|
||||
@@ -0,0 +1,482 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import com.destroystokyo.paper.io.chunk.ChunkTaskManager;
|
||||
+import com.google.common.base.Strings;
|
||||
+import com.google.common.base.Throwables;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.nio.charset.StandardCharsets;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+import java.util.logging.Level;
|
||||
+import java.util.regex.Pattern;
|
||||
+
|
||||
+import com.google.common.collect.Lists;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+import co.aikar.timings.Timings;
|
||||
+import co.aikar.timings.TimingsManager;
|
||||
+import org.spigotmc.SpigotConfig;
|
||||
+import org.spigotmc.WatchdogThread;
|
||||
+
|
||||
+public class PaperConfig {
|
||||
+
|
||||
+ private static File CONFIG_FILE;
|
||||
+ private static final String HEADER = "This is the main configuration file for Paper.\n"
|
||||
+ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n"
|
||||
+ + "with caution, and make sure you know what each option does before configuring.\n"
|
||||
+ + "\n"
|
||||
+ + "If you need help with the configuration or have any questions related to Paper,\n"
|
||||
+ + "join us in our Discord or IRC channel.\n"
|
||||
+ + "\n"
|
||||
+ + "Discord: https://discord.gg/papermc\n"
|
||||
+ + "IRC: #paper @ irc.esper.net ( https://webchat.esper.net/?channels=paper ) \n"
|
||||
+ + "Website: https://papermc.io/ \n"
|
||||
+ + "Docs: https://paper.readthedocs.org/ \n";
|
||||
+ /*========================================================================*/
|
||||
+ public static YamlConfiguration config;
|
||||
+ static int version;
|
||||
+ static Map<String, Command> commands;
|
||||
+ private static boolean verbose;
|
||||
+ private static boolean fatalError;
|
||||
+ /*========================================================================*/
|
||||
+ private static boolean metricsStarted;
|
||||
+
|
||||
+ public static void init(File configFile) {
|
||||
+ CONFIG_FILE = configFile;
|
||||
+ config = new YamlConfiguration();
|
||||
+ try {
|
||||
+ config.load(CONFIG_FILE);
|
||||
+ } catch (IOException ex) {
|
||||
+ } catch (InvalidConfigurationException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load paper.yml, please correct your syntax errors", ex);
|
||||
+ throw Throwables.propagate(ex);
|
||||
+ }
|
||||
+ config.options().header(HEADER);
|
||||
+ config.options().copyDefaults(true);
|
||||
+ verbose = getBoolean("verbose", false);
|
||||
+
|
||||
+ commands = new HashMap<String, Command>();
|
||||
+ commands.put("paper", new PaperCommand("paper"));
|
||||
+ commands.put("mspt", new MSPTCommand("mspt"));
|
||||
+
|
||||
+ version = getInt("config-version", 20);
|
||||
+ set("config-version", 20);
|
||||
+ readConfig(PaperConfig.class, null);
|
||||
+ }
|
||||
+
|
||||
+ protected static void logError(String s) {
|
||||
+ Bukkit.getLogger().severe(s);
|
||||
+ }
|
||||
+
|
||||
+ protected static void fatal(String s) {
|
||||
+ fatalError = true;
|
||||
+ throw new RuntimeException("Fatal paper.yml config error: " + s);
|
||||
+ }
|
||||
+
|
||||
+ protected static void log(String s) {
|
||||
+ if (verbose) {
|
||||
+ Bukkit.getLogger().info(s);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void registerCommands() {
|
||||
+ for (Map.Entry<String, Command> entry : commands.entrySet()) {
|
||||
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue());
|
||||
+ }
|
||||
+
|
||||
+ if (!metricsStarted) {
|
||||
+ Metrics.PaperMetrics.startMetrics();
|
||||
+ metricsStarted = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static void readConfig(Class<?> clazz, Object instance) {
|
||||
+ for (Method method : clazz.getDeclaredMethods()) {
|
||||
+ if (Modifier.isPrivate(method.getModifiers())) {
|
||||
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
|
||||
+ try {
|
||||
+ method.setAccessible(true);
|
||||
+ method.invoke(instance);
|
||||
+ } catch (InvocationTargetException ex) {
|
||||
+ throw Throwables.propagate(ex.getCause());
|
||||
+ } catch (Exception ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ config.save(CONFIG_FILE);
|
||||
+ } catch (IOException ex) {
|
||||
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static final Pattern SPACE = Pattern.compile(" ");
|
||||
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
||||
+ public static int getSeconds(String str) {
|
||||
+ str = SPACE.matcher(str).replaceAll("");
|
||||
+ final char unit = str.charAt(str.length() - 1);
|
||||
+ str = NOT_NUMERIC.matcher(str).replaceAll("");
|
||||
+ double num;
|
||||
+ try {
|
||||
+ num = Double.parseDouble(str);
|
||||
+ } catch (Exception e) {
|
||||
+ num = 0D;
|
||||
+ }
|
||||
+ switch (unit) {
|
||||
+ case 'd': num *= (double) 60*60*24; break;
|
||||
+ case 'h': num *= (double) 60*60; break;
|
||||
+ case 'm': num *= (double) 60; break;
|
||||
+ default: case 's': break;
|
||||
+ }
|
||||
+ return (int) num;
|
||||
+ }
|
||||
+
|
||||
+ protected static String timeSummary(int seconds) {
|
||||
+ String time = "";
|
||||
+
|
||||
+ if (seconds > 60 * 60 * 24) {
|
||||
+ time += TimeUnit.SECONDS.toDays(seconds) + "d";
|
||||
+ seconds %= 60 * 60 * 24;
|
||||
+ }
|
||||
+
|
||||
+ if (seconds > 60 * 60) {
|
||||
+ time += TimeUnit.SECONDS.toHours(seconds) + "h";
|
||||
+ seconds %= 60 * 60;
|
||||
+ }
|
||||
+
|
||||
+ if (seconds > 0) {
|
||||
+ time += TimeUnit.SECONDS.toMinutes(seconds) + "m";
|
||||
+ }
|
||||
+ return time;
|
||||
+ }
|
||||
+
|
||||
+ private static void set(String path, Object val) {
|
||||
+ config.set(path, val);
|
||||
+ }
|
||||
+
|
||||
+ private static boolean getBoolean(String path, boolean def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getBoolean(path, config.getBoolean(path));
|
||||
+ }
|
||||
+
|
||||
+ private static double getDouble(String path, double def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getDouble(path, config.getDouble(path));
|
||||
+ }
|
||||
+
|
||||
+ private static float getFloat(String path, float def) {
|
||||
+ // TODO: Figure out why getFloat() always returns the default value.
|
||||
+ return (float) getDouble(path, (double) def);
|
||||
+ }
|
||||
+
|
||||
+ private static int getInt(String path, int def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getInt(path, config.getInt(path));
|
||||
+ }
|
||||
+
|
||||
+ private static <T> List getList(String path, T def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return (List<T>) config.getList(path, config.getList(path));
|
||||
+ }
|
||||
+
|
||||
+ private static String getString(String path, String def) {
|
||||
+ config.addDefault(path, def);
|
||||
+ return config.getString(path, config.getString(path));
|
||||
+ }
|
||||
+
|
||||
+ public static String timingsServerName;
|
||||
+ private static void timings() {
|
||||
+ boolean timings = getBoolean("timings.enabled", true);
|
||||
+ boolean verboseTimings = getBoolean("timings.verbose", true);
|
||||
+ TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
|
||||
+ TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses", "settings.velocity-support.secret"));
|
||||
+ if (!TimingsManager.hiddenConfigs.contains("settings.velocity-support.secret")) {
|
||||
+ TimingsManager.hiddenConfigs.add("settings.velocity-support.secret");
|
||||
+ }
|
||||
+ int timingHistoryInterval = getInt("timings.history-interval", 300);
|
||||
+ int timingHistoryLength = getInt("timings.history-length", 3600);
|
||||
+ timingsServerName = getString("timings.server-name", "Unknown Server");
|
||||
+
|
||||
+
|
||||
+ Timings.setVerboseTimingsEnabled(verboseTimings);
|
||||
+ Timings.setTimingsEnabled(timings);
|
||||
+ Timings.setHistoryInterval(timingHistoryInterval * 20);
|
||||
+ Timings.setHistoryLength(timingHistoryLength * 20);
|
||||
+
|
||||
+ log("Timings: " + timings +
|
||||
+ " - Verbose: " + verboseTimings +
|
||||
+ " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) +
|
||||
+ " - Length: " + timeSummary(Timings.getHistoryLength() / 20) +
|
||||
+ " - Server Name: " + timingsServerName);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean useDisplayNameInQuit = false;
|
||||
+ private static void useDisplayNameInQuit() {
|
||||
+ useDisplayNameInQuit = getBoolean("use-display-name-in-quit-message", useDisplayNameInQuit);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean loadPermsBeforePlugins = true;
|
||||
+ private static void loadPermsBeforePlugins() {
|
||||
+ loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true);
|
||||
+ }
|
||||
+
|
||||
+ public static int regionFileCacheSize = 256;
|
||||
+ private static void regionFileCacheSize() {
|
||||
+ regionFileCacheSize = Math.max(getInt("settings.region-file-cache-size", 256), 4);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean enablePlayerCollisions = true;
|
||||
+ private static void enablePlayerCollisions() {
|
||||
+ enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean saveEmptyScoreboardTeams = false;
|
||||
+ private static void saveEmptyScoreboardTeams() {
|
||||
+ saveEmptyScoreboardTeams = getBoolean("settings.save-empty-scoreboard-teams", false);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean bungeeOnlineMode = true;
|
||||
+ private static void bungeeOnlineMode() {
|
||||
+ bungeeOnlineMode = getBoolean("settings.bungee-online-mode", true);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isProxyOnlineMode() {
|
||||
+ return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode) || (velocitySupport && velocityOnlineMode);
|
||||
+ }
|
||||
+
|
||||
+ public static int packetInSpamThreshold = 300;
|
||||
+ private static void packetInSpamThreshold() {
|
||||
+ if (version < 11) {
|
||||
+ int oldValue = getInt("settings.play-in-use-item-spam-threshold", 300);
|
||||
+ set("settings.incoming-packet-spam-threshold", oldValue);
|
||||
+ }
|
||||
+ packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300);
|
||||
+ }
|
||||
+
|
||||
+ public static String flyingKickPlayerMessage = "Flying is not enabled on this server";
|
||||
+ public static String flyingKickVehicleMessage = "Flying is not enabled on this server";
|
||||
+ private static void flyingKickMessages() {
|
||||
+ flyingKickPlayerMessage = getString("messages.kick.flying-player", flyingKickPlayerMessage);
|
||||
+ flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean suggestPlayersWhenNullTabCompletions = true;
|
||||
+ private static void suggestPlayersWhenNull() {
|
||||
+ suggestPlayersWhenNullTabCompletions = getBoolean("settings.suggest-player-names-when-null-tab-completions", suggestPlayersWhenNullTabCompletions);
|
||||
+ }
|
||||
+
|
||||
+ public static String authenticationServersDownKickMessage = ""; // empty = use translatable message
|
||||
+ private static void authenticationServersDownKickMessage() {
|
||||
+ authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage));
|
||||
+ }
|
||||
+
|
||||
+ public static String connectionThrottleKickMessage = "Connection throttled! Please wait before reconnecting.";
|
||||
+ private static void connectionThrottleKickMessage() {
|
||||
+ connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage);
|
||||
+ }
|
||||
+
|
||||
+ public static String noPermissionMessage = "&cI'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.";
|
||||
+ private static void noPermissionMessage() {
|
||||
+ noPermissionMessage = ChatColor.translateAlternateColorCodes('&', getString("messages.no-permission", noPermissionMessage));
|
||||
+ }
|
||||
+
|
||||
+ private static void savePlayerData() {
|
||||
+ Object val = config.get("settings.save-player-data");
|
||||
+ if (val instanceof Boolean) {
|
||||
+ SpigotConfig.disablePlayerDataSaving = !(Boolean) val;
|
||||
+ SpigotConfig.config.set("players.disable-saving", SpigotConfig.disableAdvancementSaving);
|
||||
+ SpigotConfig.save();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean useAlternativeLuckFormula = false;
|
||||
+ private static void useAlternativeLuckFormula() {
|
||||
+ useAlternativeLuckFormula = getBoolean("settings.use-alternative-luck-formula", false);
|
||||
+ if (useAlternativeLuckFormula) {
|
||||
+ Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static int watchdogPrintEarlyWarningEvery = 5000;
|
||||
+ public static int watchdogPrintEarlyWarningDelay = 10000;
|
||||
+ private static void watchdogEarlyWarning() {
|
||||
+ watchdogPrintEarlyWarningEvery = getInt("settings.watchdog.early-warning-every", 5000);
|
||||
+ watchdogPrintEarlyWarningDelay = getInt("settings.watchdog.early-warning-delay", 10000);
|
||||
+ WatchdogThread.doStart(SpigotConfig.timeoutTime, SpigotConfig.restartOnCrash );
|
||||
+ }
|
||||
+
|
||||
+ public static int tabSpamIncrement = 1;
|
||||
+ public static int tabSpamLimit = 500;
|
||||
+ private static void tabSpamLimiters() {
|
||||
+ tabSpamIncrement = getInt("settings.spam-limiter.tab-spam-increment", tabSpamIncrement);
|
||||
+ // Older versions used a smaller limit, which is too low for 1.13, we'll bump this up if default
|
||||
+ if (version < 14) {
|
||||
+ if (tabSpamIncrement == 10) {
|
||||
+ set("settings.spam-limiter.tab-spam-increment", 2);
|
||||
+ tabSpamIncrement = 2;
|
||||
+ }
|
||||
+ }
|
||||
+ tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
|
||||
+ }
|
||||
+
|
||||
+ public static int autoRecipeIncrement = 1;
|
||||
+ public static int autoRecipeLimit = 20;
|
||||
+ private static void autoRecipieLimiters() {
|
||||
+ autoRecipeIncrement = getInt("settings.spam-limiter.recipe-spam-increment", autoRecipeIncrement);
|
||||
+ autoRecipeLimit = getInt("settings.spam-limiter.recipe-spam-limit", autoRecipeLimit);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean velocitySupport;
|
||||
+ public static boolean velocityOnlineMode;
|
||||
+ public static byte[] velocitySecretKey;
|
||||
+ private static void velocitySupport() {
|
||||
+ velocitySupport = getBoolean("settings.velocity-support.enabled", false);
|
||||
+ velocityOnlineMode = getBoolean("settings.velocity-support.online-mode", false);
|
||||
+ String secret = getString("settings.velocity-support.secret", "");
|
||||
+ if (velocitySupport && secret.isEmpty()) {
|
||||
+ fatal("Velocity support is enabled, but no secret key was specified. A secret key is required!");
|
||||
+ } else {
|
||||
+ velocitySecretKey = secret.getBytes(StandardCharsets.UTF_8);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static int maxBookPageSize = 2560;
|
||||
+ public static double maxBookTotalSizeMultiplier = 0.98D;
|
||||
+ private static void maxBookSize() {
|
||||
+ maxBookPageSize = getInt("settings.book-size.page-max", maxBookPageSize);
|
||||
+ maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean useOptimizedTickList = true;
|
||||
+ private static void useOptimizedTickList() {
|
||||
+ if (config.contains("settings.use-optimized-ticklist")) { // don't add default, hopefully temporary config
|
||||
+ useOptimizedTickList = config.getBoolean("settings.use-optimized-ticklist");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean asyncChunks = false;
|
||||
+ private static void asyncChunks() {
|
||||
+ ConfigurationSection section;
|
||||
+ if (version < 15) {
|
||||
+ section = config.createSection("settings.async-chunks");
|
||||
+ section.set("threads", -1);
|
||||
+ } else {
|
||||
+ section = config.getConfigurationSection("settings.async-chunks");
|
||||
+ if (section == null) {
|
||||
+ section = config.createSection("settings.async-chunks");
|
||||
+ }
|
||||
+ }
|
||||
+ // Clean up old configs
|
||||
+ if (section.contains("load-threads")) {
|
||||
+ if (!section.contains("threads")) {
|
||||
+ section.set("threads", section.get("load-threads"));
|
||||
+ }
|
||||
+ section.set("load-threads", null);
|
||||
+ }
|
||||
+ section.set("generation", null);
|
||||
+ section.set("enabled", null);
|
||||
+ section.set("thread-per-world-generation", null);
|
||||
+
|
||||
+ int threads = getInt("settings.async-chunks.threads", -1);
|
||||
+ int cpus = Runtime.getRuntime().availableProcessors();
|
||||
+ if (threads <= 0) {
|
||||
+ threads = (int) Math.min(Integer.getInteger("paper.maxChunkThreads", 8), Math.max(1, cpus - 1));
|
||||
+ }
|
||||
+ if (cpus == 1 && !Boolean.getBoolean("Paper.allowAsyncChunksSingleCore")) {
|
||||
+ asyncChunks = false;
|
||||
+ } else {
|
||||
+ asyncChunks = true;
|
||||
+ }
|
||||
+
|
||||
+ // Let Shared Host set some limits
|
||||
+ String sharedHostThreads = System.getenv("PAPER_ASYNC_CHUNKS_SHARED_HOST_THREADS");
|
||||
+ if (sharedHostThreads != null) {
|
||||
+ try {
|
||||
+ threads = Math.max(1, Math.min(threads, Integer.parseInt(sharedHostThreads)));
|
||||
+ } catch (NumberFormatException ignored) {}
|
||||
+ }
|
||||
+
|
||||
+ if (!asyncChunks) {
|
||||
+ log("Async Chunks: Disabled - Chunks will be managed synchronously, and will cause tremendous lag.");
|
||||
+ } else {
|
||||
+ ChunkTaskManager.initGlobalLoadThreads(threads);
|
||||
+ log("Async Chunks: Enabled - Chunks will be loaded much faster, without lag.");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static int midTickChunkTasks = 1000;
|
||||
+ private static void midTickChunkTasks() {
|
||||
+ midTickChunkTasks = getInt("settings.chunk-tasks-per-tick", midTickChunkTasks);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean allowBlockPermanentBreakingExploits = false;
|
||||
+ private static void allowBlockPermanentBreakingExploits() {
|
||||
+ if (config.contains("allow-perm-block-break-exploits")) {
|
||||
+ allowBlockPermanentBreakingExploits = config.getBoolean("allow-perm-block-break-exploits", false);
|
||||
+ config.set("allow-perm-block-break-exploits", null);
|
||||
+ }
|
||||
+
|
||||
+ config.set("settings.unsupported-settings.allow-permanent-block-break-exploits-readme", "This setting controls if players should be able to break bedrock, end portals and other intended to be permanent blocks.");
|
||||
+ allowBlockPermanentBreakingExploits = getBoolean("settings.unsupported-settings.allow-permanent-block-break-exploits", allowBlockPermanentBreakingExploits);
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ public static boolean consoleHasAllPermissions = false;
|
||||
+ private static void consoleHasAllPermissions() {
|
||||
+ consoleHasAllPermissions = getBoolean("settings.console-has-all-permissions", consoleHasAllPermissions);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean allowPistonDuplication;
|
||||
+ private static void allowPistonDuplication() {
|
||||
+ config.set("settings.unsupported-settings.allow-piston-duplication-readme", "This setting controls if player should be able to use TNT duplication, but this also allows duplicating carpet, rails and potentially other items");
|
||||
+ allowPistonDuplication = getBoolean("settings.unsupported-settings.allow-piston-duplication", config.getBoolean("settings.unsupported-settings.allow-tnt-duplication", false));
|
||||
+ set("settings.unsupported-settings.allow-tnt-duplication", null);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean allowHeadlessPistons;
|
||||
+ private static void allowHeadlessPistons() {
|
||||
+ config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons.");
|
||||
+ allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false);
|
||||
+ }
|
||||
+
|
||||
+ public static int playerAutoSaveRate = -1;
|
||||
+ public static int maxPlayerAutoSavePerTick = 10;
|
||||
+ private static void playerAutoSaveRate() {
|
||||
+ playerAutoSaveRate = getInt("settings.player-auto-save-rate", -1);
|
||||
+ maxPlayerAutoSavePerTick = getInt("settings.max-player-auto-save-per-tick", -1);
|
||||
+ if (maxPlayerAutoSavePerTick == -1) { // -1 Automatic / "Recommended"
|
||||
+ // 10 should be safe for everyone unless you mass spamming player auto save
|
||||
+ maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static int maxJoinsPerTick;
|
||||
+ private static void maxJoinsPerTick() {
|
||||
+ maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean trackPluginScoreboards;
|
||||
+ private static void trackPluginScoreboards() {
|
||||
+ trackPluginScoreboards = getBoolean("settings.track-plugin-scoreboards", false);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean fixEntityPositionDesync = true;
|
||||
+ private static void fixEntityPositionDesync() {
|
||||
+ fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync);
|
||||
+ }
|
||||
+}
|
||||
@@ -1,34 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sotr <i@omc.hk>
|
||||
Date: Wed, 15 Apr 2020 04:16:44 +0700
|
||||
Subject: [PATCH] Remove stream for ender teleport
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index f5b8ada739afc9f8c0246e98947fe188b1231438..33b456d4348c503cc94557d623c537a8aed8f9ec 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -3092,7 +3092,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
WorldServer worldserver = (WorldServer) this.world;
|
||||
|
||||
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
|
||||
- this.cg().forEach((entity) -> {
|
||||
+ this.collectPassengers().forEach((entity) -> { // Akarin - remove stream
|
||||
worldserver.chunkCheck(entity);
|
||||
entity.aF = true;
|
||||
entity.a(Entity::teleportAndSync);
|
||||
@@ -3342,6 +3342,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
public Stream<Entity> cg() {
|
||||
return Stream.concat(Stream.of(this), this.passengers.stream().flatMap(Entity::cg));
|
||||
}
|
||||
+ // Akarin start - non-stream version
|
||||
+ public List<Entity> collectPassengers() {
|
||||
+ List<Entity> result = Lists.newArrayList(this);
|
||||
+ for (Entity passenger : this.passengers)
|
||||
+ result.addAll(passenger.collectPassengers());
|
||||
+ return result;
|
||||
+ }
|
||||
+ // Akarin end
|
||||
|
||||
public boolean hasSinglePlayerPassenger() {
|
||||
Set<Entity> set = Sets.newHashSet();
|
||||
@@ -1,72 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sotr <i@omc.hk>
|
||||
Date: Wed, 15 Apr 2020 04:28:25 +0700
|
||||
Subject: [PATCH] Cache hashcode for BlockPosition
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
index a0450a7ddf21659c5636b3f298e6bf4f0a93fc4d..c4227ff056f906c6ea1fec0330d2db84409a6482 100644
|
||||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
@@ -19,6 +19,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
return y < 0 || y >= 256;
|
||||
}
|
||||
// Paper end
|
||||
+ protected int hash; // Akarin - cache hashcode
|
||||
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
this.x = i;
|
||||
@@ -43,8 +44,20 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
}
|
||||
|
||||
public final int hashCode() { // Paper
|
||||
- return (this.y + this.z * 31) * 31 + this.x; // Paper
|
||||
+ // Akarin start - cache hashcode
|
||||
+ int result = hash; // Make the situation not too bad when it is modified by multiple threads
|
||||
+ if (result == 0) {
|
||||
+ result = (this.y + this.z * 31) * 31 + this.x; // Paper
|
||||
+ hash = result;
|
||||
+ }
|
||||
+ return result;
|
||||
+ // return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||
+ }
|
||||
+
|
||||
+ public final void recalcHashCode() {
|
||||
+ hash = 0;
|
||||
}
|
||||
+ // Akarin end
|
||||
|
||||
public int compareTo(BaseBlockPosition baseblockposition) {
|
||||
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 7e69f9fb7a1865003c1d09a7ee05c17e1e5d4445..fccd966e627e3d706b4ed12fc101545ac4d13266 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -443,6 +443,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
this.y = j;
|
||||
this.z = k;
|
||||
// Paper end
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -483,16 +484,19 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
|
||||
public final void setX(final int x) { this.o(x); } // Paper - OBFHELPER
|
||||
public void o(int i) {
|
||||
this.x = i; // Paper change to x
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
}
|
||||
|
||||
public final void setY(final int y) { this.p(y); } // Paper - OBFHELPER
|
||||
public void p(int i) {
|
||||
this.y = i; // Paper change to y
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
}
|
||||
|
||||
public final void setZ(final int z) { this.q(z); } // Paper - OBFHELPER
|
||||
public void q(int i) {
|
||||
this.z = i; // Paper change to z
|
||||
+ this.recalcHashCode(); // Akarin - cache hashcode
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
|
||||
<tsao-chi@the-lingo.org>
|
||||
Date: Sun, 31 May 2020 12:11:09 +0800
|
||||
Subject: [PATCH] Modify default configs
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 8444819f071b13e98ba07032520016a664b7b9bc..a349f56548ece94ec591933e13f77ed3b9f20fb7 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -202,7 +202,7 @@ public class PaperConfig {
|
||||
|
||||
public static String timingsServerName;
|
||||
private static void timings() {
|
||||
- boolean timings = getBoolean("timings.enabled", true);
|
||||
+ boolean timings = getBoolean("timings.enabled", false); // Akarin don't profile by default
|
||||
boolean verboseTimings = getBoolean("timings.verbose", true);
|
||||
TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
|
||||
TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses"));
|
||||
Reference in New Issue
Block a user