Skip to content

Commit

Permalink
Add option to disable startup warning (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 authored Jan 18, 2024
1 parent 9871a13 commit 6f0b427
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 55 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/close-invalid-prs.yml

This file was deleted.

20 changes: 17 additions & 3 deletions patches/server/0005-Rebrand.patch
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ index b5b6657e52e4f7a630229bd3ba433438af293e22..c468733f44ccb3ff4ba3c20921a4ec52
stringbuilder.append("// ");
stringbuilder.append(CrashReport.getErrorComment());
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index a7ebf851a65231074c89a24f30de4ac2fb5b63e4..ed7bcd832340a7a46897f0275c99e72b7247a5de 100644
index a7ebf851a65231074c89a24f30de4ac2fb5b63e4..6f8b44bdf4d419b2bf0982dc209def53e4b4763c 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -111,6 +111,18 @@ public class Main {
@@ -111,6 +111,19 @@ public class Main {
*/ // CraftBukkit end

try {
Expand All @@ -169,7 +169,8 @@ index a7ebf851a65231074c89a24f30de4ac2fb5b63e4..ed7bcd832340a7a46897f0275c99e72b
+ \033[38;2;236;61;151m┃\033[38;2;236;61;157m \033[38;2;237;62;163m┃\033[38;2;237;62;169m \033[38;2;238;62;175m \033[38;2;238;63;181m \033[38;2;239;63;187m \033[38;2;239;63;193m \033[38;2;239;64;200m┃\033[38;2;240;64;206m \033[38;2;240;64;212m┗\033[38;2;241;65;218m━\033[38;2;241;65;224m━\033[38;2;242;65;230m━\033[38;2;242;66;236m━\033[38;2;242;66;242m┓\033[38;2;237;66;243m┃\033[38;2;232;67;243m \033[38;2;227;67;244m┃\033[38;2;221;67;244m \033[38;2;216;68;244m \033[38;2;211;68;245m┃\033[38;2;205;69;245m \033[38;2;200;69;246m┃\033[38;2;195;69;246m┏\033[38;2;189;70;246m┛\033[38;2;184;70;247m \033[38;2;179;70;247m \033[38;2;173;71;247m┗\033[38;2;168;71;248m━\033[38;2;163;72;248m━\033[38;2;157;72;249m┓\033[38;2;152;72;249m┃\033[38;2;147;73;249m \033[38;2;141;73;250m┃\033[38;2;136;74;250m \033[38;2;131;74;250m┗\033[38;2;125;74;251m━\033[38;2;120;75;251m┛\033[38;2;115;75;251m \033[38;2;109;76;252m┃\033[38;2;104;76;252m \033[38;2;99;77;252m┃\033[38;2;94;77;253m┃\033[38;2;88;77;253m \033[38;2;83;78;253m┃\033[38;2;78;79;254m \033[38;2;79;85;254m \033[38;2;79;91;254m┃\033[38;2;80;97;255m \033[38;2;80;103;255m┃
+ \033[38;2;236;61;151m┗\033[38;2;236;61;157m━\033[38;2;237;62;163m┛\033[38;2;237;62;169m \033[38;2;238;62;175m \033[38;2;238;63;181m \033[38;2;239;63;187m \033[38;2;239;63;193m \033[38;2;239;64;200m┗\033[38;2;240;64;206m━\033[38;2;240;64;212m━\033[38;2;241;65;218m━\033[38;2;241;65;224m━\033[38;2;242;65;230m━\033[38;2;242;66;236m━\033[38;2;242;66;242m┛\033[38;2;237;66;243m┗\033[38;2;232;67;243m━\033[38;2;227;67;244m┛\033[38;2;221;67;244m \033[38;2;216;68;244m \033[38;2;211;68;245m┗\033[38;2;205;69;245m━\033[38;2;200;69;246m┛\033[38;2;195;69;246m┗\033[38;2;189;70;246m━\033[38;2;184;70;247m━\033[38;2;179;70;247m━\033[38;2;173;71;247m━\033[38;2;168;71;248m━\033[38;2;163;72;248m━\033[38;2;157;72;249m┛\033[38;2;152;72;249m┗\033[38;2;147;73;249m━\033[38;2;141;73;250m┛\033[38;2;136;74;250m \033[38;2;131;74;250m \033[38;2;125;74;251m \033[38;2;120;75;251m \033[38;2;115;75;251m \033[38;2;109;76;252m┗\033[38;2;104;76;252m━\033[38;2;99;77;252m┛\033[38;2;94;77;253m┗\033[38;2;88;77;253m━\033[38;2;83;78;253m┛\033[38;2;78;79;254m \033[38;2;79;85;254m \033[38;2;79;91;254m┗\033[38;2;80;97;255m━\033[38;2;80;103;255m┛
+ """);
+ LOGGER.warn("Warning! Plazma may cause unexpected problems, so be sure to test it thoroughly before using it on a public server.");
+ if (org.plazmamc.plazma.Options.iKnowWhatIAmDoing)
+ LOGGER.warn("Warning! Plazma may cause unexpected problems, so be sure to test it thoroughly before using it on a public server.");
+ // Plazma end
+
// Paper start
Expand Down Expand Up @@ -321,6 +322,19 @@ index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..0e695ea608c4e4770f5491d54ad47616
}
+ // Plazma end
}
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
new file mode 100644
index 0000000000000000000000000000000000000000..a858b7ddef7f6877c0b92f4150e0dd37bea121aa
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/Options.java
@@ -0,0 +1,7 @@
+package org.plazmamc.plazma;
+
+public interface Options {
+
+ boolean iKnowWhatIAmDoing = Boolean.getBoolean("Plazma.iKnowWhatIAmDoing");
+
+}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 3633574e112f217b412217dd243a631dc4e9c40c..d0d31002562e728fa1a6c9bc81baa4534f11d365 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
Expand Down
62 changes: 31 additions & 31 deletions patches/server/0009-Optimize-Default-Configurations.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Original: YouHaveTrouble/minecraft-optimization, YouHaveTrouble/minecraft-exploi
Copyright (C) 2023 YouHaveTrouble, AkiraDevelopment

diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index 3e36958365bc136516bafbaad0c168f7956406f1..47e96912f8cde6e6988b5d609a4fbd8e00b126cb 100644
index 3e36958365bc136516bafbaad0c168f7956406f1..78bd9082366ea678c1ee4107b69845062eeede86 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -211,8 +211,8 @@ public class PufferfishConfig {
Expand All @@ -18,12 +18,12 @@ index 3e36958365bc136516bafbaad0c168f7956406f1..47e96912f8cde6e6988b5d609a4fbd8e
- maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed.");
+ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 10 : 8, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); // Plazma
+ maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed.");

setComment("projectile", "Optimizes projectile settings");
}
@@ -225,16 +225,16 @@ public class PufferfishConfig {
public static int activationDistanceMod;

private static void dynamicActivationOfBrains() throws IOException {
- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur
- startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
Expand Down Expand Up @@ -64,21 +64,21 @@ index 3e36958365bc136516bafbaad0c168f7956406f1..47e96912f8cde6e6988b5d609a4fbd8e
"These values define a entity's maximum lifespan. If an",
"entity is in this list and it has survived for longer than",
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 3bc7230ca62ebe3426da293e436a962bb0134f85..766e518c6a3b3e684f5fda65a680b5378c9c0479 100644
index 3bc7230ca62ebe3426da293e436a962bb0134f85..af7dd492435f66877078a69310c20c42757525f2 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -143,7 +143,7 @@ public class GlobalConfiguration extends ConfigurationPart {

public class Watchdog extends ConfigurationPart {
public int earlyWarningEvery = 5000;
- public int earlyWarningDelay = 10000;
+ public int earlyWarningDelay = Boolean.getBoolean("Plazma.disableConfigOptimization") ? 10000 : 180000; // Plazma - Optimize Default Configurations
}

public SpamLimiter spamLimiter;
@@ -230,7 +230,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public BookSize bookSize;

public class BookSize extends ConfigurationPart {
- public int pageMax = 2560; // TODO this appears to be a duplicate setting with one above
+ public int pageMax = !Boolean.getBoolean("Plazma.disableConfigOptimization") ? 1024 : 2560; // TODO this appears to be a duplicate setting with one above // Plazma - Optimize Default Configurations
Expand All @@ -99,7 +99,7 @@ index 3bc7230ca62ebe3426da293e436a962bb0134f85..766e518c6a3b3e684f5fda65a680b537
+ }
+ }};
+ // Plazma end

@ConfigSerializable
public record PacketLimit(@Required double interval, @Required double maxPacketRate, ViolateAction action) {
@@ -308,7 +316,7 @@ public class GlobalConfiguration extends ConfigurationPart {
Expand All @@ -116,7 +116,7 @@ index f45afb7e2607617d1239abeca13a9002dd9a3a18..3f7868dbc4b5b7cf665e9d60b146374f
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -88,15 +88,15 @@ public class WorldConfiguration extends ConfigurationPart {

public class AntiXray extends ConfigurationPart {
public boolean enabled = false;
- public EngineMode engineMode = EngineMode.HIDE;
Expand All @@ -135,25 +135,25 @@ index f45afb7e2607617d1239abeca13a9002dd9a3a18..3f7868dbc4b5b7cf665e9d60b146374f
+ // Plazma end
}
}

@@ -120,8 +120,8 @@ public class WorldConfiguration extends ConfigurationPart {
public ArmorStands armorStands;

public class ArmorStands extends ConfigurationPart {
- public boolean doCollisionEntityLookups = true;
- public boolean tick = true;
+ public boolean doCollisionEntityLookups = Boolean.getBoolean("Plazma.disableConfigOptimization"); // Plazma - Optimize Default Configurations
+ public boolean tick = Boolean.getBoolean("Plazma.disableConfigOptimization");; // Plazma - Optimize Default Configurations
}

public Markers markers;
@@ -150,7 +150,7 @@ public class WorldConfiguration extends ConfigurationPart {
@MergeMap
public Reference2IntMap<MobCategory> spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1)));
@MergeMap
- public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance())));
+ public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), Boolean.getBoolean("Plazma.disableConfigOptimization") ? category.getDespawnDistance() : (net.minecraft.server.MinecraftServer.getServer().server.getSimulationDistance() * 16) + 8))); // Plazma - Optimize Default Configurations

@ConfigSerializable
public record DespawnRange(@Required int soft, @Required int hard) {
@@ -372,7 +372,7 @@ public class WorldConfiguration extends ConfigurationPart {
Expand All @@ -176,9 +176,9 @@ index f45afb7e2607617d1239abeca13a9002dd9a3a18..3f7868dbc4b5b7cf665e9d60b146374f
+ public int maxEntityCollisions = Boolean.getBoolean("Plazma.disableConfigOptimization") ? 8 : 2; // Plazma - Optimize Default Configurations
public boolean allowPlayerCrammingDamage = false;
}

@@ -462,18 +462,40 @@ public class WorldConfiguration extends ConfigurationPart {

public class Chunks extends ConfigurationPart {
public AutosavePeriod autoSaveInterval = AutosavePeriod.def();
- public int maxAutoSaveChunksPerTick = 24;
Expand Down Expand Up @@ -229,7 +229,7 @@ index f45afb7e2607617d1239abeca13a9002dd9a3a18..3f7868dbc4b5b7cf665e9d60b146374f
}
@@ -488,9 +510,9 @@ public class WorldConfiguration extends ConfigurationPart {
public TickRates tickRates;

public class TickRates extends ConfigurationPart {
- public int grassSpread = 1;
+ public int grassSpread = Boolean.getBoolean("Plazma.disableConfigOptimization") ? 1 : 4; // Plazma - Optimize Default Configurations
Expand All @@ -240,7 +240,7 @@ index f45afb7e2607617d1239abeca13a9002dd9a3a18..3f7868dbc4b5b7cf665e9d60b146374f
public Table<EntityType<?>, String, Integer> behavior = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "validatenearbypoi", -1));
}
@@ -514,9 +536,9 @@ public class WorldConfiguration extends ConfigurationPart {

public class Misc extends ConfigurationPart {
public int lightQueueSize = 20;
- public boolean updatePathfindingOnBlockUpdate = true;
Expand All @@ -256,28 +256,28 @@ index 24763d3d270c29c95e0b3e85111145234f660a62..18bc271a34ffba8c83743fef7eaf4a2c
--- a/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java
+++ b/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java
@@ -29,6 +29,7 @@ public class ArrowDespawnRate extends FallbackValue.Int {

@Override
protected int fallback() {
+ if (!Boolean.getBoolean("Plazma.disableConfigOptimization")) return 100; // Plazma - Optimize Default Configurations
return this.get(FallbackValue.SPIGOT_WORLD_CONFIG).arrowDespawnRate;
}

diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index ed7bcd832340a7a46897f0275c99e72b7247a5de..65e0a4c04b91e6fd6d2959927bdb75a4fcf8f86b 100644
index 6f8b44bdf4d419b2bf0982dc209def53e4b4763c..c1ea9101bfc4c101c98ea14d1db71dcb95cb7ceb 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -166,7 +166,7 @@ public class Main {
@@ -167,7 +167,7 @@ public class Main {
File configFile = (File) optionset.valueOf("bukkit-settings");
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(configFile);
configuration.options().copyDefaults(true);
- configuration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(Main.class.getClassLoader().getResourceAsStream("configurations/bukkit.yml"), Charsets.UTF_8)));
+ configuration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(Main.class.getClassLoader().getResourceAsStream(Boolean.getBoolean("Plazma.disableConfigOptimization") ? "configurations/bukkit.yml" : "configurations/bukkit_optimized.yml"), Charsets.UTF_8))); // Plazma - Optimize Default Configurations
configuration.save(configFile);

File commandFile = (File) optionset.valueOf("commands-settings");
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index 1ea3012995c738c67b31e997c138f824f9e69ba1..aa37c7a7bfe75064db9cf78e967a6644f61b0e09 100644
index 1ea3012995c738c67b31e997c138f824f9e69ba1..9683794c187dcafc1fbbde4c074cb86402467cb1 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -120,7 +120,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
Expand Down Expand Up @@ -324,7 +324,7 @@ index c43023fecf0882101248f625a28975586da05071..6b092fec6e8c468f3ecd2fc150f54634
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -429,7 +429,7 @@ public final class CraftServer implements Server {

this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
this.configuration.options().copyDefaults(true);
- this.configuration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml"), Charsets.UTF_8)));
Expand All @@ -347,11 +347,11 @@ index d0d31002562e728fa1a6c9bc81baa4534f11d365..d0968eeb0f9edeee43394da8a32d3ee8
+ // Plazma end
private static File CONFIG_FILE;
public static YamlConfiguration config;

@@ -241,7 +244,7 @@ public class PurpurConfig {
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
}

- public static boolean useAlternateKeepAlive = false;
+ public static boolean useAlternateKeepAlive = !Boolean.getBoolean("Plazma.disableConfigOptimization"); // Plazma - Optimize Default Configurations
private static void useAlternateKeepAlive() {
Expand Down Expand Up @@ -391,15 +391,15 @@ index 5b5109e942b18418b3a3a0e2109fe4ef15045fe5..e24106f0d936375f200cb82339dc03f8
+ this.itemMerge = this.getDouble("merge-radius.item", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 2.5 : 3.5 ); // Plazma - Optimize Default Configurations
this.log( "Item Merge Radius: " + this.itemMerge );
}

public double expMerge;
private void expMerge()
{
- this.expMerge = this.getDouble("merge-radius.exp", 3.0 );
+ this.expMerge = this.getDouble("merge-radius.exp", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 3.0 : 4.0 ); // Plazma - Optimize Default Configurations
this.log( "Experience Merge Radius: " + this.expMerge );
}

@@ -196,7 +196,7 @@ public class SpigotWorldConfig
public byte mobSpawnRange;
private void mobSpawnRange()
Expand All @@ -408,11 +408,11 @@ index 5b5109e942b18418b3a3a0e2109fe4ef15045fe5..e24106f0d936375f200cb82339dc03f8
+ this.mobSpawnRange = (byte) getInt( "mob-spawn-range", Boolean.getBoolean("Plazma.disableConfigOptimization") ? 8 : 3 ); // Paper - Vanilla // Plazma - Optimize Default Configurations
this.log( "Mob Spawn Range: " + this.mobSpawnRange );
}

@@ -207,26 +207,26 @@ public class SpigotWorldConfig
this.log( "Item Despawn Rate: " + this.itemDespawnRate );
}

- public int animalActivationRange = 32;
- public int monsterActivationRange = 32;
+ public int animalActivationRange = Boolean.getBoolean("Plazma.disableConfigOptimization") ? 32 : 16; // Plazma - Optimize Default Configurations
Expand Down Expand Up @@ -469,7 +469,7 @@ index 5b5109e942b18418b3a3a0e2109fe4ef15045fe5..e24106f0d936375f200cb82339dc03f8
}
diff --git a/src/main/resources/configurations/bukkit_optimized.yml b/src/main/resources/configurations/bukkit_optimized.yml
new file mode 100644
index 0000000000000000000000000000000000000000..eb33b0a19d6060f78d7ead7a2ad63b1b2581293d
index 0000000000000000000000000000000000000000..93589d95cea41b7f4cf89be600b004ec42e8bd26
--- /dev/null
+++ b/src/main/resources/configurations/bukkit_optimized.yml
@@ -0,0 +1,45 @@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ index 38d47fbcd49cc291040ea00470abeb982fe2714c..662f3eee6ff17e0b0191b1c59066465d
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -600,7 +600,7 @@ public abstract class AbstractContainerMenu {
int j2;

if (actionType == ClickType.SWAP) {
- if (slotIndex < 0) return; // Paper
+ if (slotIndex < 0 || button < 0) return; // Paper
Expand Down
Loading

0 comments on commit 6f0b427

Please sign in to comment.