From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AlphaKR93 Date: Wed, 27 Sep 2023 16:42:17 +0900 Subject: [PATCH] Optimize default configurations [REFERENCE] - YouHaveTrouble/minecraft-optimization - AkiraDevelopment/SimplyMC - YouHaveTrouble/minecraft-exploits-and-how-to-fix-them diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java index cba3d725245223c5d9e8e59dcceec61f0acc1b85..63af4c9e2bc662e08ebf858d84933b3e4e3b92cb 100644 --- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java +++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java @@ -72,7 +72,7 @@ public class PufferfishConfig { getString("info.version", "1.0"); setComment("info", "Pufferfish Configuration", - "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", + // "Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host", // Plazma - Sponsorblock "Join our Discord for support: https://discord.gg/reZw4vQV9H", "Download new builds at https://ci.pufferfish.host/job/Pufferfish"); @@ -227,7 +227,7 @@ public class PufferfishConfig { public static int maxProjectileLoadsPerTick; public static int maxProjectileLoadsPerProjectile; private static void projectileLoading() { - maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); + maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); 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"); @@ -241,12 +241,12 @@ public class PufferfishConfig { public static int activationDistanceMod; private static void dynamicActivationOfBrains() throws IOException { - dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur + dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()); // Purpur startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12, "This value determines how far away an entity has to be", "from the player to start being effected by DEAR."); startDistanceSquared = startDistance * startDistance; - maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20, + maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 7 : 8, "This value defines how often in ticks, the furthest entity", "will get their pathfinders and behaviors ticked. 20 = 1s"); activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8, @@ -269,8 +269,18 @@ public class PufferfishConfig { public static Map projectileTimeouts; private static void projectileTimeouts() { // Set some defaults - getInt("entity_timeouts.SNOWBALL", -1); - getInt("entity_timeouts.LLAMA_SPIT", -1); + // Plazma start - Optimize default configurations + if (org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()) { + getInt("entity_timeouts.ARROW", 200); + getInt("entity_timeouts.EGG", 200); + getInt("entity_timeouts.ENDER_PEARL", 200); + getInt("entity_timeouts.SNOWBALL", 200); + getInt("entity_timeouts.LLAMA_SPIT", 200); + } else { + getInt("entity_timeouts.SNOWBALL", -1); + getInt("entity_timeouts.LLAMA_SPIT", -1); + } + // Plazma end - Optimize default configurations setComment("entity_timeouts", "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 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cdec0842e18 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -167,7 +167,7 @@ public class GlobalConfiguration extends ConfigurationPart { public class Watchdog extends ConfigurationPart { public int earlyWarningEvery = 5000; - public int earlyWarningDelay = 10000; + public int earlyWarningDelay = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 180000 : 10000; // Plazma - Optimize default configurations } public SpamLimiter spamLimiter; @@ -207,7 +207,7 @@ public class GlobalConfiguration extends ConfigurationPart { public Commands commands; public class Commands extends ConfigurationPart { - public boolean suggestPlayerNamesWhenNullTabCompletions = true; + public boolean suggestPlayerNamesWhenNullTabCompletions = !org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations public boolean fixTargetSelectorTagCompletion = true; public boolean timeCommandAffectsAllWorlds = false; } @@ -256,7 +256,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 = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1024 : 2560; // TODO this appears to be a duplicate setting with one above // Plazma - Optimize default configurations public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class } public boolean resolveSelectorsInBooks = false; @@ -267,7 +267,15 @@ public class GlobalConfiguration extends ConfigurationPart { public class PacketLimiter extends ConfigurationPart { public Component kickMessage = Component.translatable("disconnect.exceeded_packet_rate", NamedTextColor.RED); public PacketLimit allPackets = new PacketLimit(7.0, 500.0, PacketLimit.ViolateAction.KICK); - public Map>, PacketLimit> overrides = Map.of(ServerboundPlaceRecipePacket.class, new PacketLimit(4.0, 5.0, PacketLimit.ViolateAction.DROP)); + // Plazma start - Optimize default configurations + public Map>, PacketLimit> overrides = new java.util.HashMap<>() {{ + put(ServerboundPlaceRecipePacket.class, new PacketLimit(4.0, 5.0, PacketLimit.ViolateAction.DROP)); + if (org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()) { + put(net.minecraft.network.protocol.game.ServerboundCommandSuggestionPacket.class, new PacketLimit(1.0, 15.0, PacketLimit.ViolateAction.DROP)); + put(net.minecraft.network.protocol.game.ServerboundPlaceRecipePacket.class, new PacketLimit(4.0, 5.0, PacketLimit.ViolateAction.DROP)); + } + }}; + // Plazma end @ConfigSerializable public record PacketLimit(@Required double interval, @Required double maxPacketRate, ViolateAction action) { @@ -335,7 +343,7 @@ public class GlobalConfiguration extends ConfigurationPart { executor.setMaximumPoolSize(_chatExecutorMaxSize); } } - public int maxJoinsPerTick = 5; + public int maxJoinsPerTick = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 3 : 5; // Plazma - Optimize default configurations public boolean fixEntityPositionDesync = true; public boolean loadPermissionsYmlBeforePlugins = true; @Constraints.Min(4) diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3e27d5ab5 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java @@ -96,12 +96,32 @@ public class WorldConfiguration extends ConfigurationPart { public class AntiXray extends ConfigurationPart { public boolean enabled = false; - public EngineMode engineMode = EngineMode.HIDE; + public EngineMode engineMode = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? EngineMode.OBFUSCATE_LAYER : EngineMode.HIDE; // Plazma - Optimize default configurations public int maxBlockHeight = 64; public int updateRadius = 2; - public boolean lavaObscures = false; + public boolean lavaObscures = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations public boolean usePermission = false; - public List hiddenBlocks = List.of( + // Plazma start - Optimize default configurations + public List hiddenBlocks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? List.of( + // + Blocks.AIR, + Blocks.COPPER_ORE, + Blocks.DEEPSLATE_COPPER_ORE, + Blocks.RAW_COPPER_BLOCK, + Blocks.IRON_ORE, + Blocks.DEEPSLATE_IRON_ORE, + Blocks.RAW_IRON_BLOCK, + Blocks.GOLD_ORE, + Blocks.DEEPSLATE_GOLD_ORE, + Blocks.RAW_GOLD_BLOCK, + Blocks.REDSTONE_ORE, + Blocks.DEEPSLATE_REDSTONE_ORE, + Blocks.LAPIS_ORE, + Blocks.DEEPSLATE_LAPIS_ORE, + Blocks.DIAMOND_ORE, + Blocks.DEEPSLATE_DIAMOND_ORE + // + ) : List.of( // Blocks.COPPER_ORE, Blocks.DEEPSLATE_COPPER_ORE, @@ -128,7 +148,28 @@ public class WorldConfiguration extends ConfigurationPart { Blocks.ENDER_CHEST // ); - public List replacementBlocks = List.of(Blocks.STONE, Blocks.OAK_PLANKS, Blocks.DEEPSLATE); + public List replacementBlocks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? List.of( + // + Blocks.CHEST, + Blocks.AMETHYST_BLOCK, + Blocks.ANDESITE, + Blocks.BUDDING_AMETHYST, + Blocks.CALCITE, + Blocks.COAL_ORE, + Blocks.DEEPSLATE_COAL_ORE, + Blocks.DEEPSLATE, + Blocks.DIORITE, + Blocks.DIRT, + Blocks.EMERALD_ORE, + Blocks.GRANITE, + Blocks.GRAVEL, + Blocks.OAK_PLANKS, + Blocks.SMOOTH_BASALT, + Blocks.STONE, + Blocks.TUFF + // + ) : List.of(Blocks.STONE, Blocks.OAK_PLANKS, Blocks.DEEPSLATE); + // Plazma end } } @@ -151,14 +192,14 @@ public class WorldConfiguration extends ConfigurationPart { public ArmorStands armorStands; public class ArmorStands extends ConfigurationPart { - public boolean doCollisionEntityLookups = true; - public boolean tick = true; + public boolean doCollisionEntityLookups = !org.plazmamc.plazma.Options.AGGRESSIVE; // Plazma - Optimize default configurations + public boolean tick = !org.plazmamc.plazma.Options.AGGRESSIVE; // Plazma - Optimize default configurations } public Markers markers; public class Markers extends ConfigurationPart { - public boolean tick = true; + public boolean tick = !org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations } public Sniffer sniffer; @@ -181,7 +222,7 @@ public class WorldConfiguration extends ConfigurationPart { @MergeMap public Reference2IntMap spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); @MergeMap - public Map despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance()))); + public Map despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? (net.minecraft.server.MinecraftServer.getServer().server.getSimulationDistance() * 16) + 8 : category.getDespawnDistance()))); // Plazma - Optimize default configurations @MergeMap public Reference2IntMap ticksPerSpawn = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); @@ -382,7 +423,7 @@ public class WorldConfiguration extends ConfigurationPart { public class Environment extends ConfigurationPart { public boolean disableThunder = false; public boolean disableIceAndSnow = false; - public boolean optimizeExplosions = false; + public boolean optimizeExplosions = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations public boolean disableExplosionKnockback = false; public boolean generateFlatBedrock = false; public FrostedIce frostedIce; @@ -434,7 +475,7 @@ public class WorldConfiguration extends ConfigurationPart { public Fixes fixes; public class Fixes extends ConfigurationPart { - public boolean fixItemsMergingThroughWalls = false; + public boolean fixItemsMergingThroughWalls = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations public boolean disableUnloadedChunkEnderpearlExploit = true; public boolean preventTntFromMovingInWater = false; public boolean splitOverstackedLoot = true; @@ -462,9 +503,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Collisions extends ConfigurationPart { public boolean onlyPlayersCollide = false; public boolean allowVehicleCollisions = true; - public boolean fixClimbingBypassingCrammingRule = false; + public boolean fixClimbingBypassingCrammingRule = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations @RequiresSpigotInitialization(MaxEntityCollisionsInitializer.class) - public int maxEntityCollisions = 8; + public int maxEntityCollisions = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 2 : 8; // Plazma - Optimize default configurations public boolean allowPlayerCrammingDamage = false; } @@ -472,18 +513,41 @@ public class WorldConfiguration extends ConfigurationPart { public class Chunks extends ConfigurationPart { public AutosavePeriod autoSaveInterval = AutosavePeriod.def(); - public int maxAutoSaveChunksPerTick = 24; + public int maxAutoSaveChunksPerTick = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 24; // Plazma - Optimize default configurations public int fixedChunkInhabitedTime = -1; - public boolean preventMovingIntoUnloadedChunks = false; + public boolean preventMovingIntoUnloadedChunks = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations public Duration delayChunkUnloadsBy = Duration.of("10s"); public Reference2IntMap> entityPerChunkSaveLimit = Util.make(new Reference2IntOpenHashMap<>(BuiltInRegistries.ENTITY_TYPE.size()), map -> { map.defaultReturnValue(-1); - map.put(EntityType.EXPERIENCE_ORB, -1); - map.put(EntityType.SNOWBALL, -1); - map.put(EntityType.ENDER_PEARL, -1); - map.put(EntityType.ARROW, -1); - map.put(EntityType.FIREBALL, -1); - map.put(EntityType.SMALL_FIREBALL, -1); + // Plazma start - Optimize default configurations + if (org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()) { + map.put(EntityType.AREA_EFFECT_CLOUD, 8); + map.put(EntityType.ARROW, 16); + map.put(EntityType.DRAGON_FIREBALL, 3); + map.put(EntityType.EGG, 8); + map.put(EntityType.ENDER_PEARL, 8); + map.put(EntityType.EXPERIENCE_BOTTLE, 3); + map.put(EntityType.EXPERIENCE_ORB, 16); + map.put(EntityType.EYE_OF_ENDER, 8); + map.put(EntityType.FIREBALL, 8); + map.put(EntityType.FIREWORK_ROCKET, 8); + map.put(EntityType.LLAMA_SPIT, 3); + map.put(EntityType.POTION, 8); + map.put(EntityType.SHULKER_BULLET, 8); + map.put(EntityType.SMALL_FIREBALL, 8); + map.put(EntityType.SNOWBALL, 8); + map.put(EntityType.SPECTRAL_ARROW, 16); + map.put(EntityType.TRIDENT, 16); + map.put(EntityType.WITHER_SKULL, 4); + } else { + map.put(EntityType.EXPERIENCE_ORB, -1); + map.put(EntityType.SNOWBALL, -1); + map.put(EntityType.ENDER_PEARL, -1); + map.put(EntityType.ARROW, -1); + map.put(EntityType.FIREBALL, -1); + map.put(EntityType.SMALL_FIREBALL, -1); + } + // Plazma end }); public boolean flushRegionsOnSave = false; } @@ -498,9 +562,9 @@ public class WorldConfiguration extends ConfigurationPart { public TickRates tickRates; public class TickRates extends ConfigurationPart { - public int grassSpread = 1; + public int grassSpread = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4 : 1; // Plazma - Optimize default configurations public int containerUpdate = 1; - public int mobSpawner = 1; + public int mobSpawner = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 2 : 1; // Plazma - Optimize default configurations public int wetFarmland = 1; public int dryFarmland = 1; public Table, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40)); @@ -534,9 +598,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Misc extends ConfigurationPart { public int lightQueueSize = 20; - public boolean updatePathfindingOnBlockUpdate = true; + public boolean updatePathfindingOnBlockUpdate = !org.plazmamc.plazma.Options.AGGRESSIVE; // Plazma - Optimize default configurations public boolean showSignClickCommandFailureMsgsToPlayer = false; - public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA; + public RedstoneImplementation redstoneImplementation = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? RedstoneImplementation.ALTERNATE_CURRENT : RedstoneImplementation.VANILLA; // Plazma - Optimize default configurations public boolean disableEndCredits = false; public float maxLeashDistance = 10f; public boolean disableSprintInterruptionOnAttack = false; diff --git a/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java b/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java index 24763d3d270c29c95e0b3e85111145234f660a62..80ddc627e02e3c749e6b074afa93d357d9c7d62a 100644 --- 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 (org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()) 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 c464e8440e854bd0d68042fdb9937fcfa8b77485..d2215f5293c568b4ae525f4a63996bac6edf787b 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -178,7 +178,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(org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? "configurations/bukkit_optimized.yml" : "configurations/bukkit.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 55e16ed1151c5d53f492581f66a3406ac418b653..9af7df196ed74a48a6b6426df36353f92fb7728d 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java @@ -131,14 +131,14 @@ public class DedicatedServerProperties extends Settings { return Mth.clamp(integer, 1, 29999984); }, 29999984); - this.syncChunkWrites = this.get("sync-chunk-writes", true) && Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - Hide sync chunk writes behind flag + this.syncChunkWrites = Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - Hide sync chunk writes behind flag // Plazma - Completely remove this setting this.regionFileComression = this.get("region-file-compression", "deflate"); this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false); this.enableStatus = this.get("enable-status", true); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 1afae84afd5a6fcc11227daf75123e8b65642b01..6de746c3e0f30bcf3dc24b2a4d369c86db445738 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -433,7 +433,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(this.getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml"), Charsets.UTF_8))); + this.configuration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? "configurations/bukkit_optimized.yml" : "configurations/bukkit.yml"), Charsets.UTF_8))); // Plazma - Optimize default configurations ConfigurationSection legacyAlias = null; if (!this.configuration.isString("aliases")) { legacyAlias = this.configuration.getConfigurationSection("aliases"); diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java index b02a0dddd99df1691c125660828a61cc4a5a4d02..d6ead6b1bc73df85a8e8938acd2e8465dd82df97 100644 --- a/src/main/java/org/plazmamc/plazma/Options.java +++ b/src/main/java/org/plazmamc/plazma/Options.java @@ -6,5 +6,6 @@ public interface Options { boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization"); boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing"); + boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE; } diff --git a/src/main/java/org/plazmamc/plazma/configurations/PlazmaConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/PlazmaConfigurations.java index 09053b4ccf268fd204c81dbb8d4f10fa9edcad5f..93f67f125b3674e645cfdae27e579e12d31a236e 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/PlazmaConfigurations.java +++ b/src/main/java/org/plazmamc/plazma/configurations/PlazmaConfigurations.java @@ -35,6 +35,15 @@ public class PlazmaConfigurations extends Configurations" : "Outdated client! Please use {0}"; // Plazma - Optimize default configurations + public static String outdatedServerMessage = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? "" : "Outdated server! I\'m still on {0}"; // Plazma - Optimize default configurations private static String transform(String s) { return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\\\n", "\n" ); @@ -211,9 +211,9 @@ public class SpigotConfig SpigotConfig.set( "messages.outdated-server", SpigotConfig.outdatedServerMessage ); } - SpigotConfig.whitelistMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.whitelist", "You are not whitelisted on this server!" ) ); - SpigotConfig.unknownCommandMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.unknown-command", "Unknown command. Type \"/help\" for help." ) ); - SpigotConfig.serverFullMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.server-full", "The server is full!" ) ); + SpigotConfig.whitelistMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.whitelist", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? "" : "You are not whitelisted on this server!" ) ); // Plazma - Optimize default configurations + SpigotConfig.unknownCommandMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.unknown-command", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? "" : "Unknown command. Type \"/help\" for help." ) ); // Plazma - Optimize default configurations + SpigotConfig.serverFullMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.server-full", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? "" : "The server is full!" ) ); // Plazma - Optimize default configurations SpigotConfig.outdatedClientMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.outdated-client", SpigotConfig.outdatedClientMessage ) ); SpigotConfig.outdatedServerMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.outdated-server", SpigotConfig.outdatedServerMessage ) ); } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java index 1cf6d4f854d89c515e48e1fb365eb95ff9340765..7d1ae99e83dc6511838092c3ab6e0fd5f39faabc 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -150,14 +150,14 @@ public class SpigotWorldConfig public double itemMerge; private void itemMerge() { - this.itemMerge = this.getDouble("merge-radius.item", 2.5 ); + this.itemMerge = this.getDouble("merge-radius.item", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 3.5 : 2.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", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4.0 : 3.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() { - this.mobSpawnRange = (byte) getInt( "mob-spawn-range", 8 ); // Paper - Vanilla + this.mobSpawnRange = (byte) getInt( "mob-spawn-range", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 3 : 8 ); // 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 = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32; // Plazma - Optimize default configurations + public int monsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 24 : 32; // Plazma - Optimize default configurations public int raiderActivationRange = 48; - public int miscActivationRange = 16; + public int miscActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16; // Plazma - Optimize default configurations // Paper start - public int flyingMonsterActivationRange = 32; - public int waterActivationRange = 16; - public int villagerActivationRange = 32; + public int flyingMonsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 48 : 32; // Plazma - Optimize default configurations + public int waterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16; // Plazma - Optimize default configurations + public int villagerActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32; // Plazma - Optimize default configurations public int wakeUpInactiveAnimals = 4; public int wakeUpInactiveAnimalsEvery = 60*20; - public int wakeUpInactiveAnimalsFor = 5*20; - public int wakeUpInactiveMonsters = 8; + public int wakeUpInactiveAnimalsFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 40 : 100; // Plazma - Optimize default configurations + public int wakeUpInactiveMonsters = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4 : 8; // Plazma - Optimize default configurations public int wakeUpInactiveMonstersEvery = 20*20; - public int wakeUpInactiveMonstersFor = 5*20; - public int wakeUpInactiveVillagers = 4; + public int wakeUpInactiveMonstersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100; // Plazma - Optimize default configurations + public int wakeUpInactiveVillagers = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 4; // Plazma - Optimize default configurations public int wakeUpInactiveVillagersEvery = 30*20; - public int wakeUpInactiveVillagersFor = 5*20; - public int wakeUpInactiveFlying = 8; + public int wakeUpInactiveVillagersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 20 : 100; // Plazma - Optimize default configurations + public int wakeUpInactiveFlying = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 8; // Plazma - Optimize default configurations public int wakeUpInactiveFlyingEvery = 10*20; - public int wakeUpInactiveFlyingFor = 5*20; + public int wakeUpInactiveFlyingFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100; // Plazma - Optimize default configurations public int villagersWorkImmunityAfter = 5*20; public int villagersWorkImmunityFor = 20; public boolean villagersActiveForPanic = true; @@ -299,7 +299,7 @@ public class SpigotWorldConfig { this.set( "ticks-per.hopper-check", 1 ); } - this.hopperCheck = this.getInt( "ticks-per.hopper-check", 1 ); + this.hopperCheck = this.getInt( "ticks-per.hopper-check", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8: 1 ); // Plazma - Optimize default configurations this.hopperAmount = this.getInt( "hopper-amount", 1 ); this.hopperCanLoadChunks = this.getBoolean( "hopper-can-load-chunks", false ); this.log( "Hopper Transfer: " + this.hopperTransfer + " Hopper Check: " + this.hopperCheck + " Hopper Amount: " + this.hopperAmount + " Hopper Can Load Chunks: " + this.hopperCanLoadChunks ); @@ -309,7 +309,7 @@ public class SpigotWorldConfig public int tridentDespawnRate; private void arrowDespawnRate() { - this.arrowDespawnRate = this.getInt( "arrow-despawn-rate", 1200 ); + this.arrowDespawnRate = this.getInt( "arrow-despawn-rate", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 300 : 1200 ); // Plazma - Optimize default configurations this.tridentDespawnRate = this.getInt( "trident-despawn-rate", this.arrowDespawnRate ); this.log( "Arrow Despawn Rate: " + this.arrowDespawnRate + " Trident Respawn Rate:" + this.tridentDespawnRate ); } 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 --- /dev/null +++ b/src/main/resources/configurations/bukkit_optimized.yml @@ -0,0 +1,45 @@ +# This is the main configuration file for Bukkit. +# As you can see, there's actually not that much to configure without any plugins. +# For a reference for any variable inside this file, check out the Bukkit Wiki at +# https://www.spigotmc.org/go/bukkit-yml +# +# If you need help on this file, feel free to join us on Discord or leave a message +# on the forums asking for advice. +# +# Discord: https://www.spigotmc.org/go/discord +# Forums: https://www.spigotmc.org/ +# Bug tracker: https://www.spigotmc.org/go/bugs + + +settings: + allow-end: true + warn-on-overload: true + permissions-file: permissions.yml + update-folder: update + plugin-profiling: false + connection-throttle: 4000 + query-plugins: true + deprecated-verbose: default + shutdown-message: Server closed + minimum-api: none + use-map-color-cache: true +spawn-limits: + monsters: 20 + animals: 5 + water-animals: 2 + water-ambient: 2 + water-underground-creature: 3 + axolotls: 3 + ambient: 1 +chunk-gc: + period-in-ticks: 400 +ticks-per: + animal-spawns: 400 + monster-spawns: 10 + water-spawns: 400 + water-ambient-spawns: 400 + water-underground-creature-spawns: 400 + axolotl-spawns: 400 + ambient-spawns: 400 + autosave: 6000 +aliases: now-in-commands.yml