Akarin ports
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Mon, 6 May 2024 20:43:37 +0900
|
||||
Subject: [PATCH] Various API Tweaks
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
||||
index 679f78e07a3a2de745fa237165d0a8db5e086f29..ac24a288fda957546e2832f375bd1c958db8852b 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
||||
@@ -591,6 +591,15 @@ public class MaterialTags {
|
||||
.add(material -> material.name().startsWith("DEEPSLATE_") && material.name().endsWith("_ORE"))
|
||||
.ensureSize("DEEPSLATE_ORES", 8).lock();
|
||||
|
||||
+ // Plazma start - Various API Tweaks
|
||||
+ /**
|
||||
+ * Covers the variants of stone ores.
|
||||
+ */
|
||||
+ public static final MaterialSetTag STONE_ORES = new MaterialSetTag(keyFor("stone_ores"))
|
||||
+ .add(material -> !material.name().startsWith("DEEPSLATE_") && !material.name().startsWith("NETHER_") && material.name().endsWith("_ORE"))
|
||||
+ .ensureSize("STONE_ORES", 8).lock();
|
||||
+ // Plazma end - Various API Tweaks
|
||||
+
|
||||
/**
|
||||
* Covers the variants of raw ore blocks.
|
||||
*/
|
||||
@@ -1,91 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Sun, 5 Nov 2023 10:40:49 +0900
|
||||
Subject: [PATCH] Tweak console logging
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 14fd0ff2b4dc226f2890e538587226cdb60d37c2..32ebee3620b5ec1ff57b92a581fb2d7f5dfe17cf 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -194,16 +194,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
||||
}
|
||||
|
||||
- // Paper start - detect running as root
|
||||
- if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
|
||||
- DedicatedServer.LOGGER.warn("****************************");
|
||||
- DedicatedServer.LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
|
||||
- DedicatedServer.LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
|
||||
- DedicatedServer.LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
|
||||
- DedicatedServer.LOGGER.warn("****************************");
|
||||
- }
|
||||
- // Paper end - detect running as root
|
||||
-
|
||||
DedicatedServer.LOGGER.info("Loading properties");
|
||||
DedicatedServerProperties dedicatedserverproperties = this.settings.getProperties();
|
||||
|
||||
@@ -235,6 +225,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||
this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||
// Paper end - initialize global and world-defaults configuration
|
||||
+ // Paper start - detect running as root // Plazma - Tweak console logging (moved down)
|
||||
+ if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
|
||||
+ DedicatedServer.LOGGER.warn("****************************");
|
||||
+ DedicatedServer.LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
|
||||
+ DedicatedServer.LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
|
||||
+ DedicatedServer.LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
|
||||
+ DedicatedServer.LOGGER.warn("****************************");
|
||||
+ }
|
||||
+ // Paper end - detect running as root
|
||||
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||
if (this.convertOldUsers()) {
|
||||
@@ -344,6 +343,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
|
||||
String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
|
||||
// Paper end - Add Velocity IP Forwarding Support
|
||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.offlineWarnings && !(io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.onlineMode)) // Plazma - Tweak console logging
|
||||
if (!this.usesAuthentication()) {
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
@@ -357,7 +357,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
}
|
||||
// Spigot end
|
||||
- DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
|
||||
+ DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file or set \"console-logs.offline-warnings\" to \"false\" in the config/plazma-global.yml file."); // Plazma - Tweak console logging
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 5b1705794a8c3914cb11fdd35f75c8e0c128ecd0..459eea7dae68afdf7e1443f29f6f8d0c68668b74 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1426,6 +1426,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
||||
+ if (!org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.notSecurePrefix) return true; // Plazma - Tweak console logging
|
||||
return message.hasSignature() && !message.hasExpiredServer(Instant.now());
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index e89534b6e2b91483d7eddfcb3441e9addf9bccc7..3a9fa2ac6dc5eaa153deb06a005be51c59786bbe 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -85,4 +85,14 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
+
|
||||
+ public ConsoleLogs consoleLogs;
|
||||
+ public class ConsoleLogs extends ConfigurationPart {
|
||||
+
|
||||
+ public boolean offlineWarnings = true;
|
||||
+ public boolean rootUserWarnings = true;
|
||||
+ public boolean notSecurePrefix = true;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Wed, 27 Sep 2023 22:11:15 +0900
|
||||
Subject: [PATCH] Apply various optimizations
|
||||
|
||||
[REFERENCE PATCHES]
|
||||
Akarin - Swaps the predicate order of collision
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 305a569f8cd83f3c67a4d4377f2881d36961dacd..8001ae563ac06d8ba9fd1de0b4111a3c8241de8c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2332,8 +2332,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public void playerTouch(Player player) {}
|
||||
|
||||
public void push(Entity entity) {
|
||||
+ if (entity.noPhysics || this.noPhysics) return; // Plazma - Swaps the predicate order of collision
|
||||
if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
- if (!entity.noPhysics && !this.noPhysics) {
|
||||
+ //if (!entity.noPhysics && !this.noPhysics) { // Plazma - Swaps the predicate order of collision
|
||||
if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
|
||||
double d0 = entity.getX() - this.getX();
|
||||
double d1 = entity.getZ() - this.getZ();
|
||||
@@ -2361,8 +2362,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
entity.push(d0, 0.0D, d1);
|
||||
}
|
||||
}
|
||||
-
|
||||
- }
|
||||
+ //} // Plazma - Swaps the predicate order of collision
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Mon, 4 Dec 2023 23:17:15 +0900
|
||||
Subject: [PATCH] Skip event if no listeners
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..23594fb7eb4b2f33146592866608c2858ef23937 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
@@ -36,15 +36,16 @@ class PaperEventManager {
|
||||
|
||||
// SimplePluginManager
|
||||
public void callEvent(@NotNull Event event) {
|
||||
+ // Plazma start - Skip event if no listeners
|
||||
+ RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
|
||||
+ if (listeners.length == 0) return;
|
||||
+ // Plazma end
|
||||
if (event.isAsynchronous() && this.server.isPrimaryThread()) {
|
||||
throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
|
||||
} else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) {
|
||||
throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
|
||||
}
|
||||
|
||||
- HandlerList handlers = event.getHandlers();
|
||||
- RegisteredListener[] listeners = handlers.getRegisteredListeners();
|
||||
-
|
||||
for (RegisteredListener registration : listeners) {
|
||||
if (!registration.getPlugin().isEnabled()) {
|
||||
continue;
|
||||
@@ -1,37 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Thu, 31 Oct 2024 22:53:16 +0900
|
||||
Subject: [PATCH] Cleanup logs
|
||||
|
||||
|
||||
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
|
||||
index a056aa167887abef9e6d531a9edd2cda433567d2..dbd822604471e7405e350586ea0e294e0234cf06 100644
|
||||
--- a/src/main/resources/log4j2.xml
|
||||
+++ b/src/main/resources/log4j2.xml
|
||||
@@ -7,7 +7,7 @@
|
||||
<LoggerNamePatternSelector defaultPattern="%highlightGUIError{[%d{HH:mm:ss} %level]: [%logger] %stripAnsi{%msg}%n%xEx{full}}">
|
||||
<!-- Log root, Minecraft, Mojang and Bukkit loggers without prefix -->
|
||||
<!-- Disable prefix for various plugins that bypass the plugin logger -->
|
||||
- <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE"
|
||||
+ <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE,ca.spottedleaf."
|
||||
pattern="%highlightGUIError{[%d{HH:mm:ss} %level]: %stripAnsi{%msg}%n%xEx{full}}" />
|
||||
</LoggerNamePatternSelector>
|
||||
</PatternLayout>
|
||||
@@ -18,7 +18,7 @@
|
||||
<LoggerNamePatternSelector defaultPattern="%highlightError{[%d{HH:mm:ss} %level]: [%logger] %msg%n%xEx{full}}">
|
||||
<!-- Log root, Minecraft, Mojang and Bukkit loggers without prefix -->
|
||||
<!-- Disable prefix for various plugins that bypass the plugin logger -->
|
||||
- <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE"
|
||||
+ <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE,ca.spottedleaf."
|
||||
pattern="%highlightError{[%d{HH:mm:ss} %level]: %msg%n%xEx{full}}" />
|
||||
</LoggerNamePatternSelector>
|
||||
</PatternLayout>
|
||||
@@ -28,7 +28,7 @@
|
||||
<LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss}] [%t/%level]: [%logger] %stripAnsi{%msg}%n%xEx{full}">
|
||||
<!-- Log root, Minecraft, Mojang and Bukkit loggers without prefix -->
|
||||
<!-- Disable prefix for various plugins that bypass the plugin logger -->
|
||||
- <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE"
|
||||
+ <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE,ca.spottedleaf."
|
||||
pattern="[%d{HH:mm:ss}] [%t/%level]: %stripAnsi{%msg}%n%xEx{full}" />
|
||||
</LoggerNamePatternSelector>
|
||||
</PatternLayout>
|
||||
@@ -0,0 +1,59 @@
|
||||
--- a/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
||||
@@ -37,10 +_,16 @@
|
||||
@SuppressWarnings({"NonFinalUtilityClass", "unused", "WeakerAccess"})
|
||||
public class MaterialTags {
|
||||
|
||||
- private static NamespacedKey keyFor(String key) {
|
||||
- //noinspection deprecation
|
||||
+ @org.jetbrains.annotations.Contract("_ -> new") // Plazma
|
||||
+ private static @org.jspecify.annotations.NonNull NamespacedKey keyFor(final @org.jspecify.annotations.NonNull String key) { // Plazma
|
||||
return new NamespacedKey("paper", key + "_settag");
|
||||
}
|
||||
+
|
||||
+ // Plazma start - Add missing docs
|
||||
+ /**
|
||||
+ * Covers all variants of arrows.
|
||||
+ */
|
||||
+ // Plazma end - Add missing docs
|
||||
public static final MaterialSetTag ARROWS = new MaterialSetTag(keyFor("arrows"))
|
||||
.endsWith("ARROW")
|
||||
.ensureSize("ARROWS", 3).lock();
|
||||
@@ -591,6 +_,22 @@
|
||||
.add(material -> material.name().startsWith("DEEPSLATE_") && material.name().endsWith("_ORE"))
|
||||
.ensureSize("DEEPSLATE_ORES", 8).lock();
|
||||
|
||||
+ // Plazma start - Add more ores entries
|
||||
+ /**
|
||||
+ * Covers the variants of stone ores.
|
||||
+ */
|
||||
+ public static final MaterialSetTag STONE_ORES = new MaterialSetTag(keyFor("stone_ores"))
|
||||
+ .add(material -> material.name().endsWith("_ORE") && !material.name().startsWith("DEEPSLATE_") && !material.name().startsWith("NETHER_"))
|
||||
+ .ensureSize("STONE_ORES", 8).lock();
|
||||
+
|
||||
+ /**
|
||||
+ * Covers the variants of nether ores.
|
||||
+ */
|
||||
+ public static final MaterialSetTag NETHER_ORES = new MaterialSetTag(keyFor("nether_ores"))
|
||||
+ .add(material -> material.name().startsWith("NETHER_") && material.name().endsWith("_ORE"))
|
||||
+ .ensureSize("NETHER_ORES", 2).lock();
|
||||
+ // Plazma end - Add more ores entries
|
||||
+
|
||||
/**
|
||||
* Covers the variants of raw ore blocks.
|
||||
*/
|
||||
@@ -720,5 +_,14 @@
|
||||
public static final MaterialSetTag NETHERITE_TOOLS = new MaterialSetTag(keyFor("netherite_tools"))
|
||||
.add(Material.NETHERITE_AXE, Material.NETHERITE_HOE, Material.NETHERITE_PICKAXE, Material.NETHERITE_SHOVEL, Material.NETHERITE_SWORD)
|
||||
.ensureSize("NETHERITE_TOOLS", 5).lock();
|
||||
+
|
||||
+ // Plazma start - Add amethyst
|
||||
+ /**
|
||||
+ * Covers all amethyst buds/cluster.
|
||||
+ */
|
||||
+ public static final MaterialSetTag AMETHYST_BUDS = new MaterialSetTag(keyFor("amethyst_buds"))
|
||||
+ .add(Material.AMETHYST_CLUSTER).add(material -> material.name().endsWith("_AMETHYST_BUD"))
|
||||
+ .ensureSize("AMETHYST_BUDS", 4).lock();
|
||||
+ // Plazma end - Add amethyst
|
||||
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Remove demo feature
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
|
||||
index 57a3bc6c47468b40bb448a41cb6bb3d5eaecb5af..abfcde5bd61bd031ab555e70ce10f8d0df6e9bcd 100644
|
||||
index 42a2c150acf154d2184e0b422d3d97618c60a72c..6c54e929f87dd873e0713f5178c05e9c25eaa4c3 100644
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -271,25 +271,25 @@ public class Main {
|
||||
@@ -294,25 +294,25 @@ public class Main {
|
||||
LevelSettings levelSettings;
|
||||
WorldOptions worldOptions;
|
||||
WorldDimensions worldDimensions;
|
||||
@@ -50,16 +50,16 @@ index 57a3bc6c47468b40bb448a41cb6bb3d5eaecb5af..abfcde5bd61bd031ab555e70ce10f8d0
|
||||
WorldDimensions.Complete complete = worldDimensions.bake(registry);
|
||||
Lifecycle lifecycle = complete.lifecycle().add(context.datapackWorldgen().allRegistriesLifecycle());
|
||||
return new WorldLoader.DataLoadOutput<>(
|
||||
@@ -322,7 +322,6 @@ public class Main {
|
||||
if (optionSet.has("serverId")) {
|
||||
dedicatedServer1.setId((String) optionSet.valueOf("serverId"));
|
||||
}
|
||||
- dedicatedServer1.setDemo(optionSet.has("demo"));
|
||||
// Paper end
|
||||
boolean flag = !optionSet.has("nogui") && !optionSet.nonOptionArguments().contains("nogui");
|
||||
if (flag && !GraphicsEnvironment.isHeadless()) {
|
||||
@@ -348,7 +348,6 @@ public class Main {
|
||||
if (optionSet.has("serverId")) {
|
||||
server.setId((String) optionSet.valueOf("serverId"));
|
||||
}
|
||||
- dedicatedServer1.setDemo(optionSet.has("demo"));
|
||||
// Paper end
|
||||
|
||||
if (!optionSet.has("nogui") && !optionSet.nonOptionArguments().contains("nogui") && !GraphicsEnvironment.isHeadless()) {
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 74203ebce0f370a05014a7cf19e23be3a878b44d..4c3d5fab206a923dab0d8956bf74eae1f7e60625 100644
|
||||
index 83873873e3db91e178d2bddad7543494a7fc393e..ef5f1131e594036e318e2e1bdb0bf3d0abf8c0ab 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -603,24 +603,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@@ -354,7 +354,7 @@ index 626e9feb6a6e7a2cbc7c63e30ba4fb6b923e85c7..22050e61506e1f3c2f4998ac1e3de4a3
|
||||
return item;
|
||||
}
|
||||
diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java
|
||||
index 97a70f372756e283810921ad39f4d0a7ba840afc..eb2316e5915e973675c75b4358d20f5ef4124503 100644
|
||||
index 6c54e929f87dd873e0713f5178c05e9c25eaa4c3..2012a1be002fadbbbc2ba75e184a8bdce56649a1 100644
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -41,7 +41,7 @@ import net.minecraft.server.packs.repository.PackRepository;
|
||||
@@ -700,7 +700,7 @@ index ff49fdcddb43ee479a377aa219eb18fcaefeffca..b62f4bd8d2cd61a3bad7169cc7ed476d
|
||||
|
||||
record TransformationInterpolator(Transformation previous, Transformation current) implements Display.GenericInterpolator<Transformation> {
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb15703734a8b2ff 100644
|
||||
index 68c00479b02168281b4455c5fcf018aa4696d058..51ae9e838ba836b57c49d76dd95a08caa72539dc 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -533,7 +533,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -757,7 +757,7 @@ index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb157037
|
||||
this.playEntityOnFireExtinguishedSound();
|
||||
}
|
||||
|
||||
@@ -2962,7 +2962,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2972,7 +2972,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == player) {
|
||||
@@ -766,7 +766,7 @@ index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb157037
|
||||
if (hand == InteractionHand.OFF_HAND && (level().purpurConfig.villagerCanBeLeashed || level().purpurConfig.wanderingTraderCanBeLeashed) && this instanceof net.minecraft.world.entity.npc.AbstractVillager) return InteractionResult.CONSUME; // Purpur - Allow leashing villagers
|
||||
// CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
// Paper start - Expand EntityUnleashEvent
|
||||
@@ -2980,14 +2980,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2990,14 +2990,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, player);
|
||||
@@ -783,7 +783,7 @@ index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb157037
|
||||
// CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) {
|
||||
((ServerPlayer) player).connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket(this, leashable.getLeashHolder()));
|
||||
@@ -2996,7 +2996,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3006,7 +3006,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
// CraftBukkit end
|
||||
leashable.setLeashedTo(player, true);
|
||||
@@ -792,7 +792,7 @@ index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb157037
|
||||
|
||||
itemInHand.shrink(1);
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -3072,7 +3072,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3082,7 +3082,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return false;
|
||||
} else if (!vehicle.couldAcceptPassenger()) {
|
||||
return false;
|
||||
@@ -801,7 +801,7 @@ index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb157037
|
||||
return false;
|
||||
} else {
|
||||
for (Entity entity = vehicle; entity.vehicle != null; entity = entity.vehicle) {
|
||||
@@ -3161,7 +3161,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3171,7 +3171,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.passengers = ImmutableList.of(passenger);
|
||||
} else {
|
||||
List<Entity> list = Lists.newArrayList(this.passengers);
|
||||
@@ -810,7 +810,7 @@ index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb157037
|
||||
list.add(0, passenger);
|
||||
} else {
|
||||
list.add(passenger);
|
||||
@@ -3358,18 +3358,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3368,18 +3368,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public void handleEntityEvent(byte id) {
|
||||
@@ -832,7 +832,7 @@ index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb157037
|
||||
}
|
||||
|
||||
public boolean isPassenger() {
|
||||
@@ -3457,7 +3458,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3467,7 +3468,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public boolean isCurrentlyGlowing() {
|
||||
@@ -841,7 +841,7 @@ index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb157037
|
||||
}
|
||||
|
||||
public boolean isInvisible() {
|
||||
@@ -4192,8 +4193,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4202,8 +4203,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.eyeHeight = dimensions.eyeHeight();
|
||||
this.reapplyPosition();
|
||||
boolean flag = dimensions.width() <= 4.0F && dimensions.height() <= 4.0F;
|
||||
@@ -851,7 +851,7 @@ index ef32cca12f11c4a25bdf852f756e2e5a92e532a1..bd24ef83f9366806961b185ceb157037
|
||||
&& !this.noPhysics
|
||||
&& flag
|
||||
&& (dimensions.width() > entityDimensions.width() || dimensions.height() > entityDimensions.height())
|
||||
@@ -4458,7 +4458,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4468,7 +4468,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public boolean isEffectiveAi() {
|
||||
|
||||
@@ -147,7 +147,7 @@ index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..8b8ed964767177d9bda01a9ba1bec51d
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 4c3d5fab206a923dab0d8956bf74eae1f7e60625..2d056c041e454fd2f724c6e42f21d435d527ba4f 100644
|
||||
index ef5f1131e594036e318e2e1bdb0bf3d0abf8c0ab..ba99735ce201330a7402e88a0fb2ea2b6327f20b 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -114,19 +114,19 @@ import net.minecraft.util.TimeUtil;
|
||||
@@ -720,10 +720,10 @@ index a3192400b37274620977e5a40d4283bfec3ab9b3..a936031e38f8a1f40e484b55dcf0ac84
|
||||
- }
|
||||
}
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 300e5b09b78089c8ea1e18e046012fae93a4f110..8e56b80201892238a43a90eb5b91ce6fc62f000a 100644
|
||||
index a1fdae645d1c7a8716690546c360b4dfa01c7c47..23a9e8936e39766f3d4db1f13fc9d5b02dd87b4a 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -767,11 +767,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -766,11 +766,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
return this.settings.getProperties().serverResourcePackInfo;
|
||||
}
|
||||
|
||||
@@ -3739,7 +3739,7 @@ index 39a604c9a53930b53d959b1d2eb504aa964e9a58..e1366b8f3565800c8a90b7effe80b29f
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index bd24ef83f9366806961b185ceb15703734a8b2ff..6b6a19a90ca7958a8ac864b9d6e61be589c32682 100644
|
||||
index 51ae9e838ba836b57c49d76dd95a08caa72539dc..68b072b5ca2163fb164041151a5d134beef5a51d 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -78,8 +78,8 @@ import net.minecraft.tags.FluidTags;
|
||||
@@ -3822,7 +3822,7 @@ index bd24ef83f9366806961b185ceb15703734a8b2ff..6b6a19a90ca7958a8ac864b9d6e61be5
|
||||
}
|
||||
}
|
||||
// Paper start - detailed watchdog information
|
||||
@@ -3325,8 +3325,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3335,8 +3335,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.processPortalCooldown();
|
||||
if (this.portalProcess != null) {
|
||||
if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) {
|
||||
@@ -3833,7 +3833,7 @@ index bd24ef83f9366806961b185ceb15703734a8b2ff..6b6a19a90ca7958a8ac864b9d6e61be5
|
||||
this.setPortalCooldown();
|
||||
TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this);
|
||||
if (portalDestination != null) {
|
||||
@@ -3337,7 +3337,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3347,7 +3347,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3842,7 +3842,7 @@ index bd24ef83f9366806961b185ceb15703734a8b2ff..6b6a19a90ca7958a8ac864b9d6e61be5
|
||||
} else if (this.portalProcess.hasExpired()) {
|
||||
this.portalProcess = null;
|
||||
}
|
||||
@@ -3858,15 +3858,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3868,15 +3868,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
entity.teleport(this.calculatePassengerTransition(teleportTransition, entity));
|
||||
}
|
||||
|
||||
@@ -3861,7 +3861,7 @@ index bd24ef83f9366806961b185ceb15703734a8b2ff..6b6a19a90ca7958a8ac864b9d6e61be5
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -3882,11 +3882,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3892,11 +3892,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3876,7 +3876,7 @@ index bd24ef83f9366806961b185ceb15703734a8b2ff..6b6a19a90ca7958a8ac864b9d6e61be5
|
||||
return null;
|
||||
} else {
|
||||
// Paper start - Fix item duplication and teleport issues
|
||||
@@ -3909,7 +3909,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3919,7 +3919,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
level.resetEmptyTime();
|
||||
teleportTransition.postTeleportTransition().onTransition(entityx);
|
||||
|
||||
@@ -65,9 +65,135 @@
|
||||
|
||||
Path path = (Path) optionSet.valueOf("pidFile"); // CraftBukkit
|
||||
if (path != null) {
|
||||
@@ -243,12 +_,12 @@
|
||||
@@ -118,16 +_,20 @@
|
||||
Bootstrap.bootStrap();
|
||||
Bootstrap.validate();
|
||||
Util.startTimerHackThread();
|
||||
- Path path1 = Paths.get("server.properties");
|
||||
+
|
||||
+ Path serverProperties = Paths.get("server.properties"); // Plazma
|
||||
DedicatedServerSettings dedicatedServerSettings = new DedicatedServerSettings(optionSet); // CraftBukkit - CLI argument support
|
||||
dedicatedServerSettings.forceSave();
|
||||
RegionFileVersion.configure(dedicatedServerSettings.getProperties().regionFileComression);
|
||||
- Path path2 = Paths.get("eula.txt");
|
||||
- Eula eula = new Eula(path2);
|
||||
+
|
||||
+ Path eulaTxt = Paths.get("eula.txt"); // Plazma
|
||||
+ Eula eula = new Eula(eulaTxt); // Plazma
|
||||
+
|
||||
// Paper start - load config files early for access below if needed
|
||||
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionSet.valueOf("bukkit-settings"));
|
||||
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionSet.valueOf("spigot-settings"));
|
||||
// Paper end - load config files early for access below if needed
|
||||
+
|
||||
if (optionSet.has("initSettings")) { // CraftBukkit
|
||||
// CraftBukkit start - SPIGOT-5761: Create bukkit.yml and commands.yml if not present
|
||||
File configFile = (File) optionSet.valueOf("bukkit-settings");
|
||||
@@ -142,7 +_,7 @@
|
||||
commandsConfiguration.setDefaults(org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(new java.io.InputStreamReader(Main.class.getClassLoader().getResourceAsStream("configurations/commands.yml"), com.google.common.base.Charsets.UTF_8)));
|
||||
commandsConfiguration.save(commandFile);
|
||||
// CraftBukkit end
|
||||
- LOGGER.info("Initialized '{}' and '{}'", path1.toAbsolutePath(), path2.toAbsolutePath());
|
||||
+ LOGGER.info("Initialized '{}' and '{}'", serverProperties.toAbsolutePath(), eulaTxt.toAbsolutePath()); // Plazma
|
||||
return;
|
||||
}
|
||||
File mcMeta = new File(bukkitDataPackFolder, "pack.mcmeta");
|
||||
|
||||
@@ -152,8 +_,7 @@
|
||||
LOGGER.error("You have used the Spigot command line EULA agreement flag.");
|
||||
LOGGER.error("By using this setting you are indicating your agreement to Mojang's EULA (https://aka.ms/MinecraftEULA).");
|
||||
LOGGER.error("If you do not agree to the above EULA please stop your server and remove this flag immediately.");
|
||||
- }
|
||||
- if (!eula.hasAgreedToEULA() && !eulaAgreed) {
|
||||
+ } else if (!eula.hasAgreedToEULA()) { // Plazma
|
||||
// Spigot end
|
||||
LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
|
||||
return;
|
||||
@@ -171,27 +_,43 @@
|
||||
}
|
||||
// Paper end - Detect headless JRE
|
||||
|
||||
- org.spigotmc.SpigotConfig.disabledAdvancements = spigotConfiguration.getStringList("advancements.disabled"); // Paper - fix SPIGOT-5885, must be set early in init
|
||||
-
|
||||
// Paper start - fix SPIGOT-5824
|
||||
- File file;
|
||||
- File userCacheFile = new File(Services.USERID_CACHE_FILE);
|
||||
+ final File worldDir; // Plazma
|
||||
if (optionSet.has("universe")) {
|
||||
- file = (File) optionSet.valueOf("universe"); // CraftBukkit
|
||||
- userCacheFile = new File(file, Services.USERID_CACHE_FILE);
|
||||
+ worldDir = (File) optionSet.valueOf("universe"); // CraftBukkit // Plazma
|
||||
} else {
|
||||
- file = new File(bukkitConfiguration.getString("settings.world-container", "."));
|
||||
+ worldDir = new File(bukkitConfiguration.getString("settings.world-container", ".")); // Plazma
|
||||
}
|
||||
// Paper end - fix SPIGOT-5824
|
||||
- Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionSet); // Paper - pass OptionSet to load paper config files; override authentication service; fix world-container
|
||||
- // CraftBukkit start
|
||||
- String string = Optional.ofNullable((String) optionSet.valueOf("world")).orElse(dedicatedServerSettings.getProperties().levelName);
|
||||
- LevelStorageSource levelStorageSource = LevelStorageSource.createDefault(file.toPath());
|
||||
- LevelStorageSource.LevelStorageAccess levelStorageAccess = levelStorageSource.validateAndCreateAccess(string, LevelStem.OVERWORLD);
|
||||
- // CraftBukkit end
|
||||
- Dynamic<?> dataTag;
|
||||
+
|
||||
+ // Plazma start - Configurable usercache.json file path
|
||||
+ final File userCacheFile; // Plazma - Moved down
|
||||
+ if (optionSet.has("usercache")) {
|
||||
+ userCacheFile = (File) optionSet.valueOf("usercache");
|
||||
+ } else {
|
||||
+ final @Nullable String bukkit = bukkitConfiguration.getString("settings.user-cache");
|
||||
+ if (bukkit != null && !bukkit.isBlank()) {
|
||||
+ userCacheFile = new File(bukkit);
|
||||
+ } else {
|
||||
+ userCacheFile = new File(worldDir, Services.USERID_CACHE_FILE);
|
||||
+ }
|
||||
+ }
|
||||
+ // Plazma end - Configurable usercache.json file path
|
||||
+
|
||||
+ org.spigotmc.SpigotConfig.disabledAdvancements = spigotConfiguration.getStringList("advancements.disabled"); // Paper - fix SPIGOT-5885, must be set early in init // Plazma - moved down
|
||||
+ final Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), worldDir, userCacheFile, optionSet); // Paper - pass OptionSet to load paper config files; override authentication service; fix world-container // Plazma
|
||||
+
|
||||
+ // CraftBukkit start // Plazma start - Improve variable name
|
||||
+ final String levelPrefix = Optional.ofNullable((String) optionSet.valueOf("world")).orElse(dedicatedServerSettings.getProperties().levelName);
|
||||
+ final LevelStorageSource levelStorageSource = LevelStorageSource.createDefault(worldDir.toPath());
|
||||
+ final LevelStorageSource.LevelStorageAccess levelStorageAccess = levelStorageSource.validateAndCreateAccess(levelPrefix, LevelStem.OVERWORLD);
|
||||
+ // CraftBukkit end // Plazma end - Improve variable name
|
||||
+
|
||||
+ final Dynamic<?> dynamic; // Plazma - Moved up
|
||||
if (levelStorageAccess.hasWorldData()) {
|
||||
+ Dynamic<?> dataTag; // Plazma
|
||||
LevelSummary summary;
|
||||
+
|
||||
try {
|
||||
dataTag = levelStorageAccess.getDataTag();
|
||||
summary = levelStorageAccess.getSummary(dataTag);
|
||||
@@ -225,163 +_,130 @@
|
||||
LOGGER.info("This world was created by an incompatible version.");
|
||||
return;
|
||||
}
|
||||
+
|
||||
+ dynamic = dataTag; // Plazma
|
||||
} else {
|
||||
- dataTag = null;
|
||||
+ dynamic = null; // Plazma
|
||||
}
|
||||
|
||||
- Dynamic<?> dynamic = dataTag;
|
||||
- boolean hasOptionSpec = optionSet.has("safeMode"); // CraftBukkit
|
||||
- if (hasOptionSpec) {
|
||||
+ final PackRepository packRepository = ServerPacksSource.createPackRepository(levelStorageAccess); // Plazma - moved up
|
||||
+ final boolean safeMode = optionSet.has("safeMode"); // CraftBukkit // Plazma
|
||||
+ if (safeMode) { // Plazma
|
||||
LOGGER.warn("Safe mode active, only vanilla datapack will be loaded");
|
||||
}
|
||||
|
||||
- PackRepository packRepository = ServerPacksSource.createPackRepository(levelStorageAccess);
|
||||
- // CraftBukkit start
|
||||
- File bukkitDataPackFolder = new File(levelStorageAccess.getLevelPath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR).toFile(), "bukkit");
|
||||
- if (!bukkitDataPackFolder.exists()) {
|
||||
- bukkitDataPackFolder.mkdirs();
|
||||
- }
|
||||
- File mcMeta = new File(bukkitDataPackFolder, "pack.mcmeta");
|
||||
+ // CraftBukkit start // Plazma start - Improve code quality
|
||||
try {
|
||||
- com.google.common.io.Files.write("{\n"
|
||||
- + " \"pack\": {\n"
|
||||
@@ -75,19 +201,32 @@
|
||||
- + " \"pack_format\": " + SharedConstants.getCurrentVersion().getPackVersion(net.minecraft.server.packs.PackType.SERVER_DATA) + "\n"
|
||||
- + " }\n"
|
||||
- + "}\n", mcMeta, com.google.common.base.Charsets.UTF_8);
|
||||
+ com.google.common.io.Files.asCharSink(mcMeta, com.google.common.base.Charsets.UTF_8).write("{\n"
|
||||
+ + " \"pack\": {\n"
|
||||
+ + " \"description\": \"Data pack for resources provided by Bukkit plugins\",\n"
|
||||
+ + " \"pack_format\": " + SharedConstants.getCurrentVersion().getPackVersion(net.minecraft.server.packs.PackType.SERVER_DATA) + "\n"
|
||||
+ + " }\n"
|
||||
+ + "}\n");
|
||||
+ final File packDir = new File(levelStorageAccess.getLevelPath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR).toFile(), "bukkit"); // Plazma
|
||||
+ if (!packDir.exists() && !packDir.mkdirs()) {
|
||||
+ throw new IOException("Unable to create Bukkit datapack folder");
|
||||
+ }
|
||||
+
|
||||
+ final File mcMeta = new File(packDir, "pack.mcmeta");
|
||||
+ com.google.common.io.Files.asCharSink(mcMeta, com.google.common.base.Charsets.UTF_8).write(String.format("""
|
||||
+ {
|
||||
+ "pack": {
|
||||
+ "description": "Data pack for resources provided by Bukkit plugins",
|
||||
+ "pack_format": %s
|
||||
+ }
|
||||
+ }
|
||||
+ """, SharedConstants.getCurrentVersion().getPackVersion(net.minecraft.server.packs.PackType.SERVER_DATA)));
|
||||
} catch (java.io.IOException ex) {
|
||||
throw new RuntimeException("Could not initialize Bukkit datapack", ex);
|
||||
}
|
||||
@@ -258,75 +_,53 @@
|
||||
WorldStem worldStem;
|
||||
- java.util.concurrent.atomic.AtomicReference<WorldLoader.DataLoadContext> worldLoader = new java.util.concurrent.atomic.AtomicReference<>();
|
||||
- // CraftBukkit end
|
||||
+ // CraftBukkit end // Plazma end - Improve code quality
|
||||
|
||||
- WorldStem worldStem;
|
||||
+ final WorldStem worldStem; // Plazma
|
||||
+ final java.util.concurrent.atomic.AtomicReference<WorldLoader.DataLoadContext> worldLoader = new java.util.concurrent.atomic.AtomicReference<>(); // Plazma - moved down
|
||||
try {
|
||||
WorldLoader.InitConfig initConfig = loadOrCreateConfig(dedicatedServerSettings.getProperties(), dynamic, hasOptionSpec, packRepository);
|
||||
- WorldLoader.InitConfig initConfig = loadOrCreateConfig(dedicatedServerSettings.getProperties(), dynamic, hasOptionSpec, packRepository);
|
||||
- worldStem = Util.<WorldStem>blockUntilDone(
|
||||
- executor -> WorldLoader.load(
|
||||
- initConfig,
|
||||
@@ -144,6 +283,35 @@
|
||||
- "Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode",
|
||||
- (Throwable)var39
|
||||
- );
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- RegistryAccess.Frozen frozen = worldStem.registries().compositeAccess();
|
||||
- boolean hasOptionSpec1 = optionSet.has(optionSpec6);
|
||||
- if (optionSet.has(optionSpec4) || hasOptionSpec1) {
|
||||
- forceUpgrade(levelStorageAccess, DataFixers.getDataFixer(), optionSet.has(optionSpec5), () -> true, frozen, hasOptionSpec1);
|
||||
- }
|
||||
-
|
||||
- WorldData worldData = worldStem.worldData();
|
||||
- levelStorageAccess.saveDataTag(frozen, worldData);
|
||||
- */
|
||||
- Class.forName(net.minecraft.world.entity.npc.VillagerTrades.class.getName()); // Paper - load this sync so it won't fail later async
|
||||
- final DedicatedServer dedicatedServer = MinecraftServer.spin(
|
||||
- thread1 -> {
|
||||
- DedicatedServer dedicatedServer1 = new DedicatedServer(
|
||||
- // CraftBukkit start
|
||||
- optionSet,
|
||||
- worldLoader.get(),
|
||||
- thread1,
|
||||
- levelStorageAccess,
|
||||
- packRepository,
|
||||
- worldStem,
|
||||
- dedicatedServerSettings,
|
||||
- DataFixers.getDataFixer(),
|
||||
- services,
|
||||
- LoggerChunkProgressListener::createFromGameruleRadius
|
||||
+ WorldLoader.InitConfig initConfig = loadOrCreateConfig(dedicatedServerSettings.getProperties(), dynamic, safeMode, packRepository); // Plazma
|
||||
+ worldStem = Util.blockUntilDone((executor) -> WorldLoader.load(initConfig, (context) -> {
|
||||
+ worldLoader.set(context); // CraftBukkit
|
||||
+ Registry<LevelStem> registry = context.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM);
|
||||
@@ -184,49 +352,34 @@
|
||||
+ return new WorldLoader.DataLoadOutput<>(
|
||||
+ new PrimaryLevelData(levelSettings, worldOptions, complete.specialWorldProperty(), lifecycle),
|
||||
+ complete.dimensionsRegistryAccess()
|
||||
+ );
|
||||
+ }, WorldStem::new, Util.backgroundExecutor(), executor)).get();
|
||||
+ } catch (final Exception e) { // Plazma
|
||||
+ LOGGER.warn("Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode", e); // Plazma
|
||||
return;
|
||||
}
|
||||
|
||||
- /*
|
||||
- RegistryAccess.Frozen frozen = worldStem.registries().compositeAccess();
|
||||
- boolean hasOptionSpec1 = optionSet.has(optionSpec6);
|
||||
- if (optionSet.has(optionSpec4) || hasOptionSpec1) {
|
||||
- forceUpgrade(levelStorageAccess, DataFixers.getDataFixer(), optionSet.has(optionSpec5), () -> true, frozen, hasOptionSpec1);
|
||||
- }
|
||||
-
|
||||
- WorldData worldData = worldStem.worldData();
|
||||
- levelStorageAccess.saveDataTag(frozen, worldData);
|
||||
- */
|
||||
Class.forName(net.minecraft.world.entity.npc.VillagerTrades.class.getName()); // Paper - load this sync so it won't fail later async
|
||||
final DedicatedServer dedicatedServer = MinecraftServer.spin(
|
||||
thread1 -> {
|
||||
@@ -343,18 +_,12 @@
|
||||
services,
|
||||
LoggerChunkProgressListener::createFromGameruleRadius
|
||||
);
|
||||
- /*
|
||||
- dedicatedServer1.setPort(optionSet.valueOf(optionSpec11));
|
||||
- */
|
||||
// Paper start
|
||||
if (optionSet.has("serverId")) {
|
||||
dedicatedServer1.setId((String) optionSet.valueOf("serverId"));
|
||||
}
|
||||
dedicatedServer1.setDemo(optionSet.has("demo"));
|
||||
// Paper end
|
||||
- // Paper start
|
||||
- if (optionSet.has("serverId")) {
|
||||
- dedicatedServer1.setId((String) optionSet.valueOf("serverId"));
|
||||
- }
|
||||
- dedicatedServer1.setDemo(optionSet.has("demo"));
|
||||
- // Paper end
|
||||
- /*
|
||||
- dedicatedServer1.setId(optionSet.valueOf(optionSpec12));
|
||||
- */
|
||||
boolean flag = !optionSet.has("nogui") && !optionSet.nonOptionArguments().contains("nogui");
|
||||
if (flag && !GraphicsEnvironment.isHeadless()) {
|
||||
dedicatedServer1.showGui();
|
||||
@@ -370,16 +_,6 @@
|
||||
return dedicatedServer1;
|
||||
}
|
||||
);
|
||||
- boolean flag = !optionSet.has("nogui") && !optionSet.nonOptionArguments().contains("nogui");
|
||||
- if (flag && !GraphicsEnvironment.isHeadless()) {
|
||||
- dedicatedServer1.showGui();
|
||||
- }
|
||||
-
|
||||
- if (optionSet.has("port")) {
|
||||
- int port = (Integer) optionSet.valueOf("port");
|
||||
- if (port > 0) {
|
||||
- dedicatedServer1.setPort(port);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return dedicatedServer1;
|
||||
- }
|
||||
- );
|
||||
- /* CraftBukkit start
|
||||
- Thread thread = new Thread("Server Shutdown Thread") {
|
||||
- @Override
|
||||
@@ -237,9 +390,56 @@
|
||||
- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
|
||||
- Runtime.getRuntime().addShutdownHook(thread);
|
||||
- */ // CraftBukkit end
|
||||
+ }, WorldStem::new, Util.backgroundExecutor(), executor)).get();
|
||||
+ } catch (final Exception e) { // Plazma
|
||||
+ LOGGER.warn("Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode", e); // Plazma
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ Class.forName(net.minecraft.world.entity.npc.VillagerTrades.class.getName()); // Paper - load this sync so it won't fail later async
|
||||
+
|
||||
+ // Plazma start - Improve code quality
|
||||
+ // noinspection resource
|
||||
+ MinecraftServer.spin(thread -> {
|
||||
+ final DedicatedServer server = new DedicatedServer(
|
||||
+ // CraftBukkit start
|
||||
+ optionSet,
|
||||
+ worldLoader.get(),
|
||||
+ thread,
|
||||
+ levelStorageAccess,
|
||||
+ packRepository,
|
||||
+ worldStem,
|
||||
+ dedicatedServerSettings,
|
||||
+ DataFixers.getDataFixer(),
|
||||
+ services,
|
||||
+ LoggerChunkProgressListener::createFromGameruleRadius
|
||||
+ );
|
||||
+
|
||||
+ // Paper start
|
||||
+ if (optionSet.has("serverId")) {
|
||||
+ server.setId((String) optionSet.valueOf("serverId"));
|
||||
+ }
|
||||
+ dedicatedServer1.setDemo(optionSet.has("demo"));
|
||||
+ // Paper end
|
||||
+
|
||||
+ if (!optionSet.has("nogui") && !optionSet.nonOptionArguments().contains("nogui") && !GraphicsEnvironment.isHeadless()) {
|
||||
+ server.showGui();
|
||||
+ }
|
||||
+
|
||||
+ if (optionSet.has("port")) {
|
||||
+ int port = (Integer) optionSet.valueOf("port");
|
||||
+ if (port > 0) server.setPort(port);
|
||||
+ }
|
||||
+
|
||||
+ return server;
|
||||
+ });
|
||||
+ // Plazma end - Improve code quality
|
||||
} catch (Exception var42) {
|
||||
LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", (Throwable)var42);
|
||||
- LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", (Throwable)var42);
|
||||
+ LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", var42); // Plazma - Remove unnecessary type casting
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,7 +_,7 @@
|
||||
} else {
|
||||
try {
|
||||
|
||||
@@ -696,3 +696,12 @@
|
||||
bufferedWriter.write(string);
|
||||
bufferedWriter.write("\n");
|
||||
}
|
||||
@@ -2768,7 +_,7 @@
|
||||
public void logChatMessage(Component content, ChatType.Bound boundChatType, @Nullable String header) {
|
||||
// Paper start
|
||||
net.kyori.adventure.text.Component string = io.papermc.paper.adventure.PaperAdventure.asAdventure(boundChatType.decorate(content));
|
||||
- if (header != null) {
|
||||
+ if (org.plazmamc.plazma.Options.global().consoleLogs.notSecurePrefix && header != null) {
|
||||
COMPONENT_LOGGER.info("[{}] {}", header, string);
|
||||
} else {
|
||||
COMPONENT_LOGGER.info("{}", string);
|
||||
|
||||
@@ -86,6 +86,23 @@
|
||||
|
||||
System.setOut(org.apache.logging.log4j.io.IoBuilder.forLogger(logger).setLevel(org.apache.logging.log4j.Level.INFO).buildPrintStream());
|
||||
System.setErr(org.apache.logging.log4j.io.IoBuilder.forLogger(logger).setLevel(org.apache.logging.log4j.Level.WARN).buildPrintStream());
|
||||
@@ -183,16 +_,6 @@
|
||||
LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
||||
}
|
||||
|
||||
- // Paper start - detect running as root
|
||||
- if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
|
||||
- LOGGER.warn("****************************");
|
||||
- LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
|
||||
- LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
|
||||
- LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
|
||||
- LOGGER.warn("****************************");
|
||||
- }
|
||||
- // Paper end - detect running as root
|
||||
-
|
||||
LOGGER.info("Loading properties");
|
||||
DedicatedServerProperties properties = this.settings.getProperties();
|
||||
if (this.isSingleplayer()) {
|
||||
@@ -208,6 +_,8 @@
|
||||
org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
|
||||
org.spigotmc.SpigotConfig.registerCommands();
|
||||
@@ -95,7 +112,7 @@
|
||||
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc.
|
||||
// Purpur start - Configurable void damage height and damage
|
||||
try {
|
||||
@@ -218,10 +_,17 @@
|
||||
@@ -218,10 +_,27 @@
|
||||
}
|
||||
org.purpurmc.purpur.PurpurConfig.registerCommands();
|
||||
// Purpur end - Configurable void damage height and damage
|
||||
@@ -109,6 +126,16 @@
|
||||
+ this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
||||
+ this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||||
+ // Plazma end - Configurable Plazma
|
||||
+
|
||||
+ // Paper start - detect running as root // Plazma start - Tweak console logging (moved down)
|
||||
+ if (org.plazmamc.plazma.Options.global().consoleLogs.rootUserWarning && io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
|
||||
+ LOGGER.warn("****************************");
|
||||
+ LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
|
||||
+ LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
|
||||
+ LOGGER.warn("FOR MORE INFORMATION, SEE https://madelinemiller.dev/blog/root-minecraft-server/");
|
||||
+ LOGGER.warn("****************************");
|
||||
+ }
|
||||
+ // Paper end - detect running as root // Plazma end - Tweak console logging (moved down)
|
||||
+
|
||||
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||
@@ -140,7 +167,7 @@
|
||||
}
|
||||
// Purpur start - UPnP Port Forwarding
|
||||
if (org.purpurmc.purpur.PurpurConfig.useUPnP) {
|
||||
@@ -316,7 +_,6 @@
|
||||
@@ -316,44 +_,33 @@
|
||||
// Purpur end - UPnP Port Forwarding
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -148,10 +175,38 @@
|
||||
this.server.loadPlugins();
|
||||
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
|
||||
// CraftBukkit end
|
||||
@@ -342,18 +_,9 @@
|
||||
LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
|
||||
}
|
||||
|
||||
- // Paper start - Add Velocity IP Forwarding Support
|
||||
- boolean usingProxy = org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled;
|
||||
- String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
|
||||
- String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
|
||||
- // Paper end - Add Velocity IP Forwarding Support
|
||||
- if (!this.usesAuthentication()) {
|
||||
- LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
+ // Plazma start - Tweak console logging
|
||||
+ final boolean usingVelocity = io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled;
|
||||
+ if (!this.usesAuthentication()
|
||||
+ && org.plazmamc.plazma.Options.global().consoleLogs.offlineWarnings
|
||||
+ && (!usingVelocity || !io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.onlineMode)
|
||||
+ ) {
|
||||
+ LOGGER.warn("********** SERVER IS RUNNING IN OFFLINE/INSECURE MODE! **********");
|
||||
LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
- // Spigot start
|
||||
- // Paper start - Add Velocity IP Forwarding Support
|
||||
- if (usingProxy) {
|
||||
- LOGGER.warn("Whilst this makes it possible to use {}, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.", proxyFlavor);
|
||||
- LOGGER.warn("Please see {} for further information.", proxyLink);
|
||||
- // Paper end - Add Velocity IP Forwarding Support
|
||||
+ if (usingVelocity || org.spigotmc.SpigotConfig.bungee) {
|
||||
+ LOGGER.warn("Whilst this makes it possible to use {}, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose.", usingVelocity ? "Velocity" : "BungeeCord");
|
||||
+ LOGGER.warn("Please see {} for further information.", usingVelocity ? "https://docs.papermc.io/velocity/security" : "https://www.spigotmc.org/wiki/firewall-guide/");
|
||||
} else {
|
||||
LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
}
|
||||
- // Spigot end
|
||||
LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
|
||||
- }
|
||||
-
|
||||
- // CraftBukkit start
|
||||
- /*
|
||||
- if (this.convertOldUsers()) {
|
||||
@@ -159,7 +214,11 @@
|
||||
- }
|
||||
- */
|
||||
- // CraftBukkit end
|
||||
-
|
||||
+ LOGGER.warn("Or, if you understand exactly about this problem, and if you are prepared measures for it, change the \"console-logs.offline-warnings\" to \"false\" in the config/plazma-global.yml file.");
|
||||
+ LOGGER.warn("This can suppress this warning, but you still need to be careful about related issues.");
|
||||
+ }
|
||||
+ // Plazma end - Tweak console logging
|
||||
|
||||
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/RandomizableContainer.java
|
||||
+++ b/net/minecraft/world/RandomizableContainer.java
|
||||
@@ -88,6 +_,8 @@
|
||||
default void unpackLootTable(@Nullable final Player player, final boolean forceClearLootTable) {
|
||||
// Paper end - LootTable API
|
||||
Level level = this.getLevel();
|
||||
+ if (level.plazmaConfig().entity.populateLootTableOnlyForPlayerInteraction && player == null) return; // Plazma - Populate LootTable only for player interaction
|
||||
+
|
||||
BlockPos blockPos = this.getBlockPos();
|
||||
ResourceKey<LootTable> lootTable = this.getLootTable();
|
||||
// Paper start - LootTable API
|
||||
@@ -9,3 +9,78 @@
|
||||
|
||||
public boolean collisionLoadChunks = false; // Paper
|
||||
private @Nullable org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity;
|
||||
@@ -2187,35 +_,45 @@
|
||||
}
|
||||
|
||||
public void push(Entity entity) {
|
||||
- if (!this.isPassengerOfSameVehicle(entity)) {
|
||||
- if (!entity.noPhysics && !this.noPhysics) {
|
||||
- if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
|
||||
- double d = entity.getX() - this.getX();
|
||||
- double d1 = entity.getZ() - this.getZ();
|
||||
- double max = Mth.absMax(d, d1);
|
||||
- if (max >= 0.01F) {
|
||||
- max = Math.sqrt(max);
|
||||
- d /= max;
|
||||
- d1 /= max;
|
||||
- double d2 = 1.0 / max;
|
||||
- if (d2 > 1.0) {
|
||||
- d2 = 1.0;
|
||||
- }
|
||||
-
|
||||
- d *= d2;
|
||||
- d1 *= d2;
|
||||
- d *= 0.05F;
|
||||
- d1 *= 0.05F;
|
||||
- if (!this.isVehicle() && this.isPushable()) {
|
||||
- this.push(-d, 0.0, -d1);
|
||||
- }
|
||||
-
|
||||
- if (!entity.isVehicle() && entity.isPushable()) {
|
||||
- entity.push(d, 0.0, d1);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ // Plazma start - Swaps the predicate order of collision - Based on Akarin
|
||||
+ if (entity.noPhysics || this.noPhysics || this.isPassengerOfSameVehicle(entity)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) { // Paper - Collision option for requiring a player participant
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ double dX = entity.getX() - this.getX();
|
||||
+ double dZ = entity.getZ() - this.getZ();
|
||||
+ double max = Mth.absMax(dX, dZ);
|
||||
+ if (max < 0.01F) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ max = Math.sqrt(max);
|
||||
+ dX /= max;
|
||||
+ dZ /= max;
|
||||
+
|
||||
+ double maxPercent = 1.0 / max;
|
||||
+ if (maxPercent > 1.0) {
|
||||
+ maxPercent = 1.0;
|
||||
+ }
|
||||
+
|
||||
+ dX *= maxPercent;
|
||||
+ dZ *= maxPercent;
|
||||
+ dX *= 0.05F;
|
||||
+ dZ *= 0.05F;
|
||||
+
|
||||
+ if (!this.isVehicle() && this.isPushable()) {
|
||||
+ this.push(-dX, 0.0, -dZ);
|
||||
+ }
|
||||
+
|
||||
+ if (!entity.isVehicle() && entity.isPushable()) {
|
||||
+ entity.push(dX, 0.0, dZ);
|
||||
+ }
|
||||
+
|
||||
+ // Plazma end - Swaps the predicate order of collision
|
||||
}
|
||||
|
||||
public void push(Vec3 vector) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
@@ -104,6 +_,8 @@
|
||||
}
|
||||
|
||||
default void unpackChestVehicleLootTable(@Nullable Player player) {
|
||||
+ if (this.level().plazmaConfig().entity.populateLootTableOnlyForPlayerInteraction && player == null) return; // Plazma - Populate LootTable only for player interaction
|
||||
+
|
||||
MinecraftServer server = this.level().getServer();
|
||||
if (server != null && this.lootableData().shouldReplenish(this, com.destroystokyo.paper.loottable.PaperLootableInventoryData.ENTITY, player)) { // Paper - LootTable API
|
||||
LootTable lootTable = server.reloadableRegistries().getLootTable(this.getContainerLootTable());
|
||||
@@ -0,0 +1,39 @@
|
||||
--- a/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
+++ b/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -62,27 +_,30 @@
|
||||
|
||||
private Optional<CompoundTag> load(String name, String stringUuid, String suffix) { // CraftBukkit
|
||||
File file = new File(this.playerDir, stringUuid + suffix); // CraftBukkit
|
||||
+ final boolean exists = file.exists(); // Plazma - Avoid double I/O operation - Based on Akarin
|
||||
+
|
||||
// Spigot start
|
||||
boolean usingWrongFile = false;
|
||||
- if (org.bukkit.Bukkit.getOnlineMode() && !file.exists()) { // Paper - Check online mode first
|
||||
- file = new File(this.playerDir, java.util.UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(java.nio.charset.StandardCharsets.UTF_8)).toString() + suffix);
|
||||
+ if (org.bukkit.Bukkit.getOnlineMode() && !exists) { // Paper - Check online mode first // Plazma - Avoid double I/O operation - Based on Akarin
|
||||
+ file = new File(this.playerDir, java.util.UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(java.nio.charset.StandardCharsets.UTF_8)) + suffix); // Plazma - Remove unnecessary type casting
|
||||
if (file.exists()) {
|
||||
usingWrongFile = true;
|
||||
LOGGER.warn("Using offline mode UUID file for player {} as it is the only copy we can find.", name);
|
||||
}
|
||||
}
|
||||
// Spigot end
|
||||
- if (file.exists() && file.isFile()) {
|
||||
+
|
||||
+ if ((usingWrongFile || exists) && file.isFile()) { // Plazma - Avoid double I/O operation - Based on Akarin
|
||||
try {
|
||||
// Spigot start
|
||||
Optional<CompoundTag> optional = Optional.of(NbtIo.readCompressed(file.toPath(), NbtAccounter.unlimitedHeap()));
|
||||
- if (usingWrongFile) {
|
||||
- file.renameTo(new File(file.getPath() + ".offline-read"));
|
||||
+ if (usingWrongFile && !file.renameTo(new File(file.getPath() + ".offline-read"))) { // Plazma - Throw if rename failed
|
||||
+ throw new java.io.IOException("Failed to rename"); // Plazma - Throw if rename failed
|
||||
}
|
||||
return optional;
|
||||
// Spigot end
|
||||
} catch (Exception var5) {
|
||||
- LOGGER.warn("Failed to load player data for {}", name); // CraftBukkit
|
||||
+ LOGGER.warn("Failed to load player data for {}", name, var5); // CraftBukkit // Plazma - Log exception
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
package org.plazmamc.plazma;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.plazmamc.plazma.configurations.GlobalConfiguration;
|
||||
|
||||
import static java.lang.Boolean.getBoolean;
|
||||
|
||||
public interface Options {
|
||||
|
||||
@Contract(pure = true)
|
||||
static @NotNull GlobalConfiguration global() {
|
||||
return GlobalConfiguration.get();
|
||||
}
|
||||
|
||||
boolean ASYNC = getBoolean("Plazma.forciblyAllowAsyncAccess");
|
||||
boolean OPTIMIZE = !getBoolean("Plazma.disableConfigOptimization");
|
||||
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Contract;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Setting;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings({"unused", "InnerClassMayBeStatic"})
|
||||
public final class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
static GlobalConfiguration INSTANCE;
|
||||
@@ -20,4 +20,13 @@ public final class GlobalConfiguration extends ConfigurationPart {
|
||||
@Setting(Configurations.VERSION_FIELD)
|
||||
int version = VERSION;
|
||||
|
||||
public ConsoleLogs consoleLogs;
|
||||
public class ConsoleLogs extends ConfigurationPart {
|
||||
|
||||
public boolean offlineWarnings = true;
|
||||
public boolean rootUserWarning = true;
|
||||
public boolean notSecurePrefix = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.papermc.paper.configuration.Configurations;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Setting;
|
||||
|
||||
@SuppressWarnings({"unused", "FieldCanBeLocal"})
|
||||
@SuppressWarnings({"unused", "InnerClassMayBeStatic", "FieldCanBeLocal"})
|
||||
public final class WorldConfiguration extends ConfigurationPart {
|
||||
|
||||
static final int VERSION = 2;
|
||||
@@ -18,4 +18,11 @@ public final class WorldConfiguration extends ConfigurationPart {
|
||||
@Setting(Configurations.VERSION_FIELD)
|
||||
int version = VERSION;
|
||||
|
||||
public Entity entity;
|
||||
public class Entity extends ConfigurationPart {
|
||||
|
||||
public boolean populateLootTableOnlyForPlayerInteraction = OPTIMIZE;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user