Log error for invalid entity-per-chunk-save-limit configs (#6522)

This commit is contained in:
Jason 2021-08-29 23:19:43 -05:00 committed by GitHub
parent ba1773373c
commit cf27619809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 43 additions and 27 deletions

View File

@ -9,7 +9,7 @@ defaults are only included for certain entites, this allows setting
limits for any entity type.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 8047470af6f3a9842ab78c46b8e27a4fa9c961fc..d4bbb93c09d2183e5eb12d6629ed109bd2f43d76 100644
index 8047470af6f3a9842ab78c46b8e27a4fa9c961fc..f7cf534e11aef42c3f383fa8e8a62b74f0a85a0f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,9 +1,12 @@
@ -25,7 +25,7 @@ index 8047470af6f3a9842ab78c46b8e27a4fa9c961fc..d4bbb93c09d2183e5eb12d6629ed109b
import net.minecraft.world.entity.monster.Vindicator;
import net.minecraft.world.entity.monster.Zombie;
import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode;
@@ -123,6 +126,22 @@ public class PaperWorldConfig {
@@ -123,6 +126,38 @@ public class PaperWorldConfig {
);
}
@ -37,12 +37,28 @@ index 8047470af6f3a9842ab78c46b8e27a4fa9c961fc..d4bbb93c09d2183e5eb12d6629ed109b
+ getInt("entity-per-chunk-save-limit.arrow", -1);
+ getInt("entity-per-chunk-save-limit.fireball", -1);
+ getInt("entity-per-chunk-save-limit.small_fireball", -1);
+ EntityType.getEntityNameList().forEach(name -> {
+ final EntityType<?> type = EntityType.byString(name.getPath()).orElseThrow(() -> new IllegalStateException("Unknown Entity Type: " + name.toString()));
+ final String path = ".entity-per-chunk-save-limit." + name.getPath();
+ final int value = config.getInt("world-settings." + worldName + path, config.getInt("world-settings.default" + path, -1)); // get without setting defaults
+ if (value != -1) entityPerChunkSaveLimits.put(type, value);
+ });
+
+ addEntityPerChunkSaveLimitsFromSection(config.getConfigurationSection("world-settings.default.entity-per-chunk-save-limit"), entityPerChunkSaveLimits);
+ addEntityPerChunkSaveLimitsFromSection(config.getConfigurationSection("world-settings." + worldName + ".entity-per-chunk-save-limit"), entityPerChunkSaveLimits);
+ }
+
+ private static void addEntityPerChunkSaveLimitsFromSection(final ConfigurationSection section, final Map<EntityType<?>, Integer> limitMap) {
+ if (section == null) {
+ return;
+ }
+ for (final String key : section.getKeys(false)) {
+ final int value = section.getInt(key);
+ final EntityType<?> type = EntityType.byString(key).orElse(null);
+ if (type == null) {
+ logError("Invalid entity-per-chunk-save-limit config, '" + key+ "' is not a valid entity type. Correct this in paper.yml.");
+ continue;
+ }
+ if (value >= 0) {
+ limitMap.put(type, value);
+ } else {
+ limitMap.remove(type);
+ }
+ }
+ }
+
public short keepLoadedRange;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Limit item frame cursors on maps
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d4bbb93c09d2183e5eb12d6629ed109bd2f43d76..604100365cf396165651b1731574938598507ed3 100644
index c2e1d52368f3c4233df95d6b967706e353d3ce6c..6091fb02ea5a53b348d5059759ea19e114c5a3c6 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -794,5 +794,10 @@ public class PaperWorldConfig {
@@ -810,5 +810,10 @@ public class PaperWorldConfig {
private void allowUsingSignsInsideSpawnProtection() {
allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add option to fix items merging through walls
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 604100365cf396165651b1731574938598507ed3..c6b7133a5ac742e402f617acbf4ba351539123d1 100644
index 6091fb02ea5a53b348d5059759ea19e114c5a3c6..07c3673642fbda4ef70ae24d6dbedc26f07ced47 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -799,5 +799,10 @@ public class PaperWorldConfig {
@@ -815,5 +815,10 @@ public class PaperWorldConfig {
private void mapItemFrameCursorLimit() {
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix invulnerable end crystals
MC-108513
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index c6b7133a5ac742e402f617acbf4ba351539123d1..d8c45d689aeb1c5193d71b8f9b7ea85ae78a4206 100644
index 07c3673642fbda4ef70ae24d6dbedc26f07ced47..be0bc4793976e28d32b36c9d57cf1e4961065b61 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -804,5 +804,10 @@ public class PaperWorldConfig {
@@ -820,5 +820,10 @@ public class PaperWorldConfig {
private void fixItemsMergingThroughWalls() {
fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] add per world spawn limits
Taken from #2982. Credit to Chasewhip8
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d8c45d689aeb1c5193d71b8f9b7ea85ae78a4206..dbace53ecb13cf372c8ad0dce2af7dcfe16e86d4 100644
index be0bc4793976e28d32b36c9d57cf1e4961065b61..a0149014d5ab5b5905caf432cdbfa50b179bb881 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -660,6 +660,19 @@ public class PaperWorldConfig {
@@ -676,6 +676,19 @@ public class PaperWorldConfig {
zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance);
}

View File

@ -10,10 +10,10 @@ This patch changes sign command logic so that `run_command` click events:
- sends failure messages to the player who clicked the sign
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index dbace53ecb13cf372c8ad0dce2af7dcfe16e86d4..8b5f6b1c68fb1b4e945233aa8460d64a09642bc7 100644
index a0149014d5ab5b5905caf432cdbfa50b179bb881..e86e780fb5805afaa5d9f9fc146647723d895af2 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -822,5 +822,10 @@ public class PaperWorldConfig {
@@ -838,5 +838,10 @@ public class PaperWorldConfig {
private void fixInvulnerableEndCrystalExploit() {
fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add config for mobs immune to default effects
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 8b5f6b1c68fb1b4e945233aa8460d64a09642bc7..899fbd4e60ccab353e6e2b2ae2ddbe94f43255d0 100644
index e86e780fb5805afaa5d9f9fc146647723d895af2..e68e20606f2bcb39bc845649a53568e92dc2d590 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -650,6 +650,21 @@ public class PaperWorldConfig {
@@ -666,6 +666,21 @@ public class PaperWorldConfig {
log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled"));
}

View File

@ -11,10 +11,10 @@ It does not make a lot of sense to damage players if they get crammed,
For those who really want it a config option is provided.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 899fbd4e60ccab353e6e2b2ae2ddbe94f43255d0..6ad258d211277e671b0b15f06bcc60673c04017b 100644
index e68e20606f2bcb39bc845649a53568e92dc2d590..ea645479e7bc6182438f1f9e48b3cebef5ec85ad 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -842,5 +842,10 @@ public class PaperWorldConfig {
@@ -858,5 +858,10 @@ public class PaperWorldConfig {
private void showSignClickCommandFailureMessagesToPlayer() {
showSignClickCommandFailureMessagesToPlayer = getBoolean("show-sign-click-command-failure-msgs-to-player", showSignClickCommandFailureMessagesToPlayer);
}
@ -26,7 +26,7 @@ index 899fbd4e60ccab353e6e2b2ae2ddbe94f43255d0..6ad258d211277e671b0b15f06bcc6067
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0b648abb4e7a116912b327641a810b4ec574baff..1f5dfc88e6e9674f7c557848fa1d1a3a2800ddb5 100644
index b391cc306c719aee2cd334df8d92c3ed3d282c4d..b242109d2d5248a4342635978def79d32d99928b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1421,7 +1421,7 @@ public class ServerPlayer extends Player {

View File

@ -28,7 +28,7 @@ index b9cdbf8acccfd6b207a0116f068168f3b8c8e17d..8c883d2f88acc731734a121ebb76821e
* Get a named timer for the specified tile entity type to track type specific timings.
* @param entity
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6ad258d211277e671b0b15f06bcc60673c04017b..ea397cd57ccbf7efc4f31d532cd6dfdccfcee8d8 100644
index ea645479e7bc6182438f1f9e48b3cebef5ec85ad..862ba4bf39fdd798767ad5b22f1da0db7b27cb94 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -3,14 +3,19 @@ package com.destroystokyo.paper;
@ -51,7 +51,7 @@ index 6ad258d211277e671b0b15f06bcc60673c04017b..ea397cd57ccbf7efc4f31d532cd6dfdc
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -847,5 +852,58 @@ public class PaperWorldConfig {
@@ -863,5 +868,58 @@ public class PaperWorldConfig {
private void playerCrammingDamage() {
allowPlayerCrammingDamage = getBoolean("allow-player-cramming-damage", allowPlayerCrammingDamage);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable item frame map cursor update interval
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0f91fbf2ae9735943d3214e8d26c1951cf0b5160..261633687b5dd55559b2ddb305c3a21a8b308ada 100644
index a6957e06d014f4c86feae00ab60195a9244e4d04..cbb8bd956ea90663e9066343cc9a024cdae180ee 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -838,6 +838,11 @@ public class PaperWorldConfig {
@@ -854,6 +854,11 @@ public class PaperWorldConfig {
mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
}