callable) {
- super(chartId);
- this.callable = callable;
- }
-
- @Override
- protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
- int value = callable.call();
- if (value == 0) {
- // Null = skip the chart
- return null;
- }
- return new JsonObjectBuilder().appendField("value", value).build();
- }
- }
-
- /**
- * An extremely simple JSON builder.
- *
- * While this class is neither feature-rich nor the most performant one, it's sufficient enough
- * for its use-case.
- */
- public static class JsonObjectBuilder {
-
- private StringBuilder builder = new StringBuilder();
-
- private boolean hasAtLeastOneField = false;
-
- public JsonObjectBuilder() {
- builder.append("{");
- }
-
- /**
- * Appends a null field to the JSON.
- *
- * @param key The key of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendNull(String key) {
- appendFieldUnescaped(key, "null");
- return this;
- }
-
- /**
- * Appends a string field to the JSON.
- *
- * @param key The key of the field.
- * @param value The value of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, String value) {
- if (value == null) {
- throw new IllegalArgumentException("JSON value must not be null");
- }
- appendFieldUnescaped(key, "\"" + escape(value) + "\"");
- return this;
- }
-
- /**
- * Appends an integer field to the JSON.
- *
- * @param key The key of the field.
- * @param value The value of the field.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, int value) {
- appendFieldUnescaped(key, String.valueOf(value));
- return this;
- }
-
- /**
- * Appends an object to the JSON.
- *
- * @param key The key of the field.
- * @param object The object.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, JsonObject object) {
- if (object == null) {
- throw new IllegalArgumentException("JSON object must not be null");
- }
- appendFieldUnescaped(key, object.toString());
- return this;
- }
-
- /**
- * Appends a string array to the JSON.
- *
- * @param key The key of the field.
- * @param values The string array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, String[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values)
- .map(value -> "\"" + escape(value) + "\"")
- .collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends an integer array to the JSON.
- *
- * @param key The key of the field.
- * @param values The integer array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, int[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values).mapToObj(String::valueOf).collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends an object array to the JSON.
- *
- * @param key The key of the field.
- * @param values The integer array.
- * @return A reference to this object.
- */
- public JsonObjectBuilder appendField(String key, JsonObject[] values) {
- if (values == null) {
- throw new IllegalArgumentException("JSON values must not be null");
- }
- String escapedValues =
- Arrays.stream(values).map(JsonObject::toString).collect(Collectors.joining(","));
- appendFieldUnescaped(key, "[" + escapedValues + "]");
- return this;
- }
-
- /**
- * Appends a field to the object.
- *
- * @param key The key of the field.
- * @param escapedValue The escaped value of the field.
- */
- private void appendFieldUnescaped(String key, String escapedValue) {
- if (builder == null) {
- throw new IllegalStateException("JSON has already been built");
- }
- if (key == null) {
- throw new IllegalArgumentException("JSON key must not be null");
- }
- if (hasAtLeastOneField) {
- builder.append(",");
- }
- builder.append("\"").append(escape(key)).append("\":").append(escapedValue);
- hasAtLeastOneField = true;
- }
-
- /**
- * Builds the JSON string and invalidates this builder.
- *
- * @return The built JSON string.
- */
- public JsonObject build() {
- if (builder == null) {
- throw new IllegalStateException("JSON has already been built");
- }
- JsonObject object = new JsonObject(builder.append("}").toString());
- builder = null;
- return object;
- }
-
- /**
- * Escapes the given string like stated in https://www.ietf.org/rfc/rfc4627.txt.
- *
- *
This method escapes only the necessary characters '"', '\'. and '\u0000' - '\u001F'.
- * Compact escapes are not used (e.g., '\n' is escaped as "\u000a" and not as "\n").
- *
- * @param value The value to escape.
- * @return The escaped value.
- */
- private static String escape(String value) {
- final StringBuilder builder = new StringBuilder();
- for (int i = 0; i < value.length(); i++) {
- char c = value.charAt(i);
- if (c == '"') {
- builder.append("\\\"");
- } else if (c == '\\') {
- builder.append("\\\\");
- } else if (c <= '\u000F') {
- builder.append("\\u000").append(Integer.toHexString(c));
- } else if (c <= '\u001F') {
- builder.append("\\u00").append(Integer.toHexString(c));
- } else {
- builder.append(c);
- }
- }
- return builder.toString();
- }
-
- /**
- * A super simple representation of a JSON object.
- *
- *
This class only exists to make methods of the {@link JsonObjectBuilder} type-safe and not
- * allow a raw string inputs for methods like {@link JsonObjectBuilder#appendField(String,
- * JsonObject)}.
- */
- public static class JsonObject {
-
- private final String value;
-
- private JsonObject(String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return value;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/commands/ExploitDBCommand.java b/src/main/java/net/lewmc/kryptonite/commands/ExploitDBCommand.java
index f44555b..79f0466 100644
--- a/src/main/java/net/lewmc/kryptonite/commands/ExploitDBCommand.java
+++ b/src/main/java/net/lewmc/kryptonite/commands/ExploitDBCommand.java
@@ -1,11 +1,11 @@
package net.lewmc.kryptonite.commands;
+import net.lewmc.foundry.Permissions;
import net.lewmc.kryptonite.Kryptonite;
import net.lewmc.kryptonite.edb.Check;
import net.lewmc.kryptonite.edb.Patch;
import net.lewmc.kryptonite.edb.gui.EDB_MainGui;
import net.lewmc.kryptonite.utils.MessageUtil;
-import net.lewmc.kryptonite.utils.PermissionUtil;
import net.lewmc.kryptonite.utils.SoftwareUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -42,9 +42,8 @@ public boolean onCommand(
String[] args
) {
this.message = new MessageUtil(commandSender);
- PermissionUtil perm = new PermissionUtil();
- if (perm.isOperator(commandSender)) {
+ if (new Permissions(commandSender).isOp()) {
if (args.length >= 1) {
Check check = new Check(plugin, commandSender);
if (Objects.equals(args[0].toLowerCase(), "check")) {
diff --git a/src/main/java/net/lewmc/kryptonite/commands/OptimiseCommand.java b/src/main/java/net/lewmc/kryptonite/commands/OptimiseCommand.java
index 53ae618..1df8c41 100644
--- a/src/main/java/net/lewmc/kryptonite/commands/OptimiseCommand.java
+++ b/src/main/java/net/lewmc/kryptonite/commands/OptimiseCommand.java
@@ -1,10 +1,10 @@
package net.lewmc.kryptonite.commands;
+import net.lewmc.foundry.Permissions;
import net.lewmc.kryptonite.Kryptonite;
import net.lewmc.kryptonite.kos.AutoKOS;
import net.lewmc.kryptonite.kos.gui.KOS_MainGui;
import net.lewmc.kryptonite.utils.MessageUtil;
-import net.lewmc.kryptonite.utils.PermissionUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -34,9 +34,8 @@ public OptimiseCommand(Kryptonite plugin) {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
MessageUtil message = new MessageUtil(commandSender);
- PermissionUtil perm = new PermissionUtil();
- if (perm.isOperator(commandSender)) {
+ if (new Permissions(commandSender).isOp()) {
if (commandSender instanceof Player) {
KOS_MainGui gui = new KOS_MainGui(this.plugin, commandSender);
gui.show();
diff --git a/src/main/java/net/lewmc/kryptonite/config/BukkitConfig.java b/src/main/java/net/lewmc/kryptonite/config/BukkitConfig.java
new file mode 100644
index 0000000..43f5ed4
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/config/BukkitConfig.java
@@ -0,0 +1,285 @@
+package net.lewmc.kryptonite.config;
+
+import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.utils.config.ConfigCollection;
+import net.lewmc.kryptonite.utils.config.IntegerConfigItem;
+
+import java.util.List;
+
+/**
+ * Configuration data for bukkit.yml
+ * @since 2.1.0
+ */
+public class BukkitConfig extends ConfigCollection {
+ /**
+ * Constructs the bukkit.yml data.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public BukkitConfig(Kryptonite plugin) {
+ String file = "bukkit.yml";
+
+ values.put(Key.SPAWN_LIMITS_MONSTERS.toString(), new IntegerConfigItem(
+ file,
+ Key.SPAWN_LIMITS_MONSTERS.toString(),
+ "Spawn Limit (Monsters)",
+ List.of(
+ "A limit for how many mobs should spawn in the world.",
+ "The server has less work to do with lower numbers,",
+ "but survival worlds may be less realistic."),
+ true,
+ 1,
+ 200,
+ "20-50",
+ plugin
+ ));
+
+ values.put(Key.SPAWN_LIMITS_ANIMALS.toString(), new IntegerConfigItem(
+ file,
+ Key.SPAWN_LIMITS_ANIMALS.toString(),
+ "Spawn Limit (Animals)",
+ List.of(
+ "A limit for how many animals should spawn in the",
+ "world. The server has less work to do with lower",
+ "numbers, but survival worlds may be less realistic."),
+ true,
+ 1,
+ 200,
+ "5-10",
+ plugin
+ ));
+
+ values.put(Key.SPAWN_LIMITS_WATER_ANIMALS.toString(), new IntegerConfigItem(
+ file,
+ Key.SPAWN_LIMITS_WATER_ANIMALS.toString(),
+ "Spawn Limit (Water Animals)",
+ List.of(
+ "A limit for how many water animals should spawn in",
+ "the world. The server has less work to do with lower",
+ "numbers, but survival worlds may be less realistic."),
+ true,
+ 1,
+ 200,
+ "2-5",
+ plugin
+ ));
+
+ values.put(Key.SPAWN_LIMITS_WATER_AMBIENT.toString(), new IntegerConfigItem(
+ file,
+ Key.SPAWN_LIMITS_WATER_AMBIENT.toString(),
+ "Spawn Limit (Water Ambient)",
+ List.of(
+ "A limit for how many water ambient should spawn in",
+ "the world. The server has less work to do with lower",
+ "numbers, but survival worlds may be less realistic."),
+ true,
+ 1,
+ 200,
+ "2-10",
+ plugin
+ ));
+
+ values.put(Key.SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE.toString(), new IntegerConfigItem(
+ file,
+ Key.SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE.toString(),
+ "Spawn Limit (Water Underground Creature)",
+ List.of(
+ "A limit for how many water underground creatures",
+ "should spawn in the world. The server has less work",
+ "to do with lower numbers, but survival worlds may be",
+ "less realistic."),
+ true,
+ 1,
+ 200,
+ "2-5",
+ plugin
+ ));
+
+ values.put(Key.SPAWN_LIMITS_AXOLOTLS.toString(), new IntegerConfigItem(
+ file,
+ Key.SPAWN_LIMITS_AXOLOTLS.toString(),
+ "Spawn Limit (Axolotls)",
+ List.of(
+ "A limit for how many axolotls should spawn in the",
+ "world. The server has less work to do with lower",
+ "numbers, but survival worlds may be less realistic."),
+ true,
+ 1,
+ 200,
+ "2-4",
+ plugin
+ ));
+
+ values.put(Key.TICKS_PER_MONSTER_SPAWNS.toString(), new IntegerConfigItem(
+ file,
+ Key.TICKS_PER_MONSTER_SPAWNS.toString(),
+ "Ticks Per Monster Spawns",
+ List.of(
+ "How often (in ticks) the server attempts to spawn",
+ "monsters. The server has less work to do with lower",
+ "numbers, but survival worlds may be less realistic."),
+ true,
+ 1,
+ 1000,
+ "5-10",
+ plugin
+ ));
+
+ values.put(Key.TICKS_PER_ANIMAL_SPAWNS.toString(), new IntegerConfigItem(
+ file,
+ Key.TICKS_PER_ANIMAL_SPAWNS.toString(),
+ "Ticks Per Animal Spawns",
+ List.of(
+ "How often (in ticks) the server attempts to spawn",
+ "animals. The server has less work to do with lower",
+ "numbers, but survival worlds may be less realistic."),
+ true,
+ 1,
+ 1000,
+ "400",
+ plugin
+ ));
+
+ values.put(Key.TICKS_PER_WATER_SPAWNS.toString(), new IntegerConfigItem(
+ file,
+ Key.TICKS_PER_WATER_SPAWNS.toString(),
+ "Ticks Per Water Spawns",
+ List.of(
+ "How often (in ticks) the server attempts to spawn",
+ "water creatures. The server has less work to do with",
+ "lower numbers, but survival worlds may be less",
+ "realistic."),
+ true,
+ 1,
+ 1000,
+ "400",
+ plugin
+ ));
+
+ values.put(Key.TICKS_PER_WATER_AMBIENT_SPAWNS.toString(), new IntegerConfigItem(
+ file,
+ Key.TICKS_PER_WATER_AMBIENT_SPAWNS.toString(),
+ "Ticks Per Water Ambient Spawns",
+ List.of(
+ "How often (in ticks) the server attempts to spawn",
+ "water ambient creatures. The server has less work",
+ "to do with lower numbers, but survival worlds may",
+ "be less realistic."),
+ true,
+ 1,
+ 1000,
+ "400",
+ plugin
+ ));
+
+ values.put(Key.TICKS_PER_AXOLOTL_SPAWNS.toString(), new IntegerConfigItem(
+ file,
+ Key.TICKS_PER_AXOLOTL_SPAWNS.toString(),
+ "Ticks Per Axolotl Spawns",
+ List.of(
+ "How often (in ticks) the server attempts to spawn",
+ "axolotls. The server has less work to do with lower",
+ "numbers, but survival worlds may be less realistic."),
+ true,
+ 1,
+ 1000,
+ "400",
+ plugin
+ ));
+
+ values.put(Key.TICKS_PER_AMBIENT_SPAWNS.toString(), new IntegerConfigItem(
+ file,
+ Key.TICKS_PER_AMBIENT_SPAWNS.toString(),
+ "Ticks Per Ambient Spawns",
+ List.of(
+ "How often (in ticks) the server attempts to spawn",
+ "ambient creatures. The server has less work to do",
+ "with lower numbers, but survival worlds may be less.",
+ "realistic"),
+ true,
+ 1,
+ 1000,
+ "400",
+ plugin
+ ));
+
+ values.put(Key.CHUNK_GC_PERIOD_IN_TICKS.toString(), new IntegerConfigItem(
+ file,
+ Key.CHUNK_GC_PERIOD_IN_TICKS.toString(),
+ "Chunk GC Period in Ticks",
+ List.of(
+ "The ticks between each chunk garbage collection",
+ "consideration."),
+ true,
+ 1,
+ 1000,
+ "400-600",
+ plugin
+ ));
+ }
+
+ /**
+ * Configuration values supported by this format.
+ */
+ public enum Key {
+ SPAWN_LIMITS_MONSTERS {
+ @Override
+ public String toString() { return "spawn-limits.monsters"; }
+ },
+ SPAWN_LIMITS_ANIMALS {
+ @Override
+ public String toString() { return "spawn-limits.animals"; }
+ },
+ SPAWN_LIMITS_WATER_ANIMALS {
+ @Override
+ public String toString() { return "spawn-limits.water-animals"; }
+ },
+ SPAWN_LIMITS_WATER_AMBIENT {
+ @Override
+ public String toString() { return "spawn-limits.water-ambient"; }
+ },
+ SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE {
+ @Override
+ public String toString() { return "spawn-limits.water-underground-creature"; }
+ },
+ SPAWN_LIMITS_AXOLOTLS {
+ @Override
+ public String toString() { return "spawn-limits.axolotls"; }
+ },
+ SPAWN_LIMITS_AMBIENT {
+ @Override
+ public String toString() { return "spawn-limits.ambient"; }
+ },
+ TICKS_PER_MONSTER_SPAWNS {
+ @Override
+ public String toString() { return "ticks-per.monster-spawns"; }
+ },
+ TICKS_PER_ANIMAL_SPAWNS {
+ @Override
+ public String toString() { return "ticks-per.animal-spawns"; }
+ },
+ TICKS_PER_WATER_SPAWNS {
+ @Override
+ public String toString() { return "ticks-per.water-spawns"; }
+ },
+ TICKS_PER_WATER_AMBIENT_SPAWNS {
+ @Override
+ public String toString() { return "ticks-per.water-ambient-spawns"; }
+ },
+ TICKS_PER_WATER_UNDERGROUND_CREATURE_SPAWNS {
+ @Override
+ public String toString() { return "ticks-per.water-underground-creature-spawns"; }
+ },
+ TICKS_PER_AXOLOTL_SPAWNS {
+ @Override
+ public String toString() { return "ticks-per.axolotl-spawns"; }
+ },
+ TICKS_PER_AMBIENT_SPAWNS {
+ @Override
+ public String toString() { return "ticks-per.ambient-spawns"; }
+ },
+ CHUNK_GC_PERIOD_IN_TICKS {
+ @Override
+ public String toString() { return "chunk-gc.period-in-ticks"; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/config/LeafConfig.java b/src/main/java/net/lewmc/kryptonite/config/LeafConfig.java
new file mode 100644
index 0000000..e53a98f
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/config/LeafConfig.java
@@ -0,0 +1,356 @@
+package net.lewmc.kryptonite.config;
+
+import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.utils.config.*;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * Configuration data for leaf-global.yml
+ * @since 2.1.0
+ */
+public class LeafConfig extends ConfigCollection {
+ /**
+ * Constructs the leaf-global.yml data.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public LeafConfig(Kryptonite plugin) {
+ String file = "config" + File.separator + "leaf-global.yml";
+
+ values.put(Key.ASYNC_PARALLEL_WORLD_TICKING_ENABLED.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_PARALLEL_WORLD_TICKING_ENABLED.toString(),
+ "Parallel World Tracing",
+ List.of(
+ "Parallel processing different worlds in separate",
+ "threads. Experimental feature, potentially unstable",
+ "Only use if you experience specific bottlenecks and",
+ "understand the risks. Learn more at leafmc.one/docs"),
+ true,
+ false,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PARALLEL_WORLD_TICKING_THREADS.toString(), new IntegerConfigItem(
+ file,
+ Key.ASYNC_PARALLEL_WORLD_TICKING_THREADS.toString(),
+ "Parallel World Tracing Threads",
+ List.of("Number of threads dedicated to parallel world",
+ "ticking. Consider setting based on amount of worlds",
+ "in the server."
+ ),
+ (Boolean) values.get("async.parallel-world-ticking.enabled").getValue(),
+ 1,
+ 100,
+ null,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PARALLEL_WORLD_TICKING_LOG_CONTAINER_CREATION_STACKTRACES.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_PARALLEL_WORLD_TICKING_LOG_CONTAINER_CREATION_STACKTRACES.toString(),
+ "Parallel World Tracing Log Container Creation Stacktraces",
+ List.of(
+ "Log stacktraces when containers (like Tile Entities",
+ "or Entities) are created during parallel ticking.",
+ "Useful for debugging potential concurrency issues."),
+ (Boolean) values.get("async.parallel-world-ticking.enabled").getValue(),
+ false,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PARALLEL_WORLD_TICKING_DISABLE_HARD_THROW.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_PARALLEL_WORLD_TICKING_DISABLE_HARD_THROW.toString(),
+ "Parallel World Tracing Disable Hard Throw",
+ List.of(
+ "Disable hard throws (which usually stop the server)",
+ "related to parallel ticking errors. Might mask",
+ "underlying issues but could prevent crashes in",
+ "unstable experimental phases. Use with caution."),
+ (Boolean) values.get("async.parallel-world-ticking.enabled").getValue(),
+ false,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PARALLEL_WORLD_TICKING_RUN_ASYNC_TASKS_SYNC.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_PARALLEL_WORLD_TICKING_RUN_ASYNC_TASKS_SYNC.toString(),
+ "Parallel World Tracing Run Async Tasks Sync",
+ List.of(
+ "Run asynchronous tasks synchronously within the",
+ "parallel ticking system. Might be needed for",
+ "compatibility with certain plugins but largely",
+ "negates the performance benefits of parallel ticking."),
+ (Boolean) values.get("async.parallel-world-ticking.enabled").getValue(),
+ false,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_ENTITY_TRACKER_ENABLED.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_ENTITY_TRACKER_ENABLED.toString(),
+ "Async Entity Tracker",
+ List.of(
+ "Make entity tracking asynchronous, can improve",
+ "performance significantly, especially in situations",
+ "with massive numbers of entities in a small area.",
+ "If using NPC plugins, enable compat-mode as well."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_ENTITY_TRACKER_COMPAT_MODE.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_ENTITY_TRACKER_COMPAT_MODE.toString(),
+ "Async Entity Tracker Compat Mode",
+ List.of(
+ "Enable compatibility mode for plugins like",
+ "Citizens or other NPC plugins that use real, player",
+ "type entities. You should enable compat-mode ONLY",
+ "IF you have installed Citizens or similar real",
+ "entity NPC plugins and are experiencing issues."),
+ (Boolean) values.get("async.async-entity-tracker.enabled").getValue(),
+ null,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_ENTITY_TRACKER_MAX_THREADS.toString(), new IntegerConfigItem(
+ file,
+ Key.ASYNC_ENTITY_TRACKER_MAX_THREADS.toString(),
+ "Async Entity Tracker Max Threads",
+ List.of("Maximum number of threads for the async entity",
+ "tracker to use. When set to 0, 1/4 of available",
+ "CPU cores are used. Recommended to set to 1/2,",
+ "of cores depending on server load and core count."
+ ),
+ (Boolean) values.get("async.async-entity-tracker.enabled").getValue(),
+ 0,
+ 100,
+ null,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_ENTITY_TRACKER_KEEPALIVE.toString(), new IntegerConfigItem(
+ file,
+ Key.ASYNC_ENTITY_TRACKER_KEEPALIVE.toString(),
+ "Async Entity Tracker Keepalive",
+ List.of("Thread keepalive time. Threads with no tasks",
+ "will be terminated if they remain idle for",
+ "this duration. Measured in seconds."),
+ (Boolean) values.get("async.async-entity-tracker.enabled").getValue(),
+ 1,
+ 120,
+ "50-70",
+ plugin
+ ));
+
+ values.put(Key.ASYNC_ENTITY_TRACKER_QUEUE_SIZE.toString(), new IntegerConfigItem(
+ file,
+ Key.ASYNC_ENTITY_TRACKER_QUEUE_SIZE.toString(),
+ "Async Entity Tracker Queue Size",
+ List.of("Maximum size of the queue for pending entity",
+ "tracking tasks. If set to 0, the queue size is",
+ "dynamically calculated as max-threads * 384.",
+ "A limit might prevent excessive memory usage",
+ "under extreme load but could potentially lead",
+ "to tasks being dropped or delayed"),
+ (Boolean) values.get("async.async-entity-tracker.enabled").getValue(),
+ 0,
+ 500,
+ null,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_TARGET_FINDING.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_TARGET_FINDING.toString(),
+ "Async Target Finding",
+ List.of(
+ "Moves the expensive entity target search",
+ "calculations (finding nearby entities to attack or",
+ "interact with) to a background thread"),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PLAYERDATA_SAVE.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_PLAYERDATA_SAVE.toString(),
+ "Async Playerdata Save",
+ List.of(
+ "Make playerdata saving aynchronous. Warning: might",
+ "cause data loss in some circumstances - use with",
+ "extreme caution and ensure robust backups!"),
+ true,
+ false,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PATHFINDING_ENABLED.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_PATHFINDING_ENABLED.toString(),
+ "Async Pathfinding",
+ List.of(
+ "Make mob pathfinding calculations asynchronous."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PATHFINDING_MAX_THREADS.toString(), new IntegerConfigItem(
+ file,
+ Key.ASYNC_PATHFINDING_MAX_THREADS.toString(),
+ "Async Pathfinding Max Threads",
+ List.of("Maximum number of threads for async entity",
+ "pathfinding to use. When set to 0, 1/4 of available",
+ "CPU cores are used. Recommended to set to 1/3, of",
+ "cores depending on server load and core count."
+ ),
+ (Boolean) values.get("async.async-pathfinding.enabled").getValue(),
+ 0,
+ 100,
+ null,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PATHFINDING_KEEPALIVE.toString(), new IntegerConfigItem(
+ file,
+ Key.ASYNC_PATHFINDING_KEEPALIVE.toString(),
+ "Async Pathfinding Keepalive",
+ List.of("Thread keepalive time. Threads with no tasks",
+ "will be terminated if they remain idle for",
+ "this duration. Measured in seconds."),
+ (Boolean) values.get("async.async-pathfinding.enabled").getValue(),
+ 1,
+ 120,
+ "50-70",
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PATHFINDING_QUEUE_SIZE.toString(), new IntegerConfigItem(
+ file,
+ Key.ASYNC_PATHFINDING_QUEUE_SIZE.toString(),
+ "Async Entity Tracker Queue Size",
+ List.of("Maximum size of the queue for pending",
+ "pathfinding tasks. If set to 0, the queue size",
+ "dynamically calculated as max-threads * 256."),
+ (Boolean) values.get("async.async-pathfinding.enabled").getValue(),
+ 0,
+ 500,
+ null,
+ plugin
+ ));
+
+ values.put(Key.ASYNC_PATHFINDING_REJECT_POLICY.toString(), new StringConfigItem(
+ file,
+ Key.ASYNC_PATHFINDING_REJECT_POLICY.toString(),
+ "Async Entity Tracker Queue Size",
+ List.of("The policy to use when the pathfinding task queue",
+ "is full (only relevant if queue-size is > 0) and a",
+ "new task is submitted"),
+ (Boolean) values.get("async.async-pathfinding.enabled").getValue(),
+ List.of("FLUSH_ALL", "CALLER_RUNS"),
+ List.of("CALLER_RUNS"),
+ plugin
+ ));
+
+ values.put(Key.ASYNC_MOB_SPAWNING_ENABLED.toString(), new BooleanConfigItem(
+ file,
+ Key.ASYNC_MOB_SPAWNING_ENABLED.toString(),
+ "Async Pathfinding",
+ List.of(
+ "Whether asynchronous mob spawning calculations should",
+ "be enabled. On servers with many entities, this can",
+ "improve performance by offloading some expensive",
+ "calculations required for mob spawning to other threads.",
+ "You must have Paper's per-player-mob-spawns config set",
+ "to true in paper-world-defaults.yml for this to work",
+ "effectively."),
+ true,
+ true,
+ plugin
+ ));
+ }
+
+ /**
+ * Configuration values supported by this format.
+ */
+ public enum Key {
+ ASYNC_PARALLEL_WORLD_TICKING_ENABLED {
+ @Override
+ public String toString() { return "async.parallel-world-ticking.enabled"; }
+ },
+ ASYNC_PARALLEL_WORLD_TICKING_THREADS {
+ @Override
+ public String toString() { return "async.parallel-world-ticking.threads"; }
+ },
+ ASYNC_PARALLEL_WORLD_TICKING_LOG_CONTAINER_CREATION_STACKTRACES {
+ @Override
+ public String toString() { return "async.parallel-world-ticking.log-container-creation-stacktraces"; }
+ },
+ ASYNC_PARALLEL_WORLD_TICKING_DISABLE_HARD_THROW {
+ @Override
+ public String toString() { return "async.parallel-world-ticking.disable-hard-throw"; }
+ },
+ ASYNC_PARALLEL_WORLD_TICKING_RUN_ASYNC_TASKS_SYNC {
+ @Override
+ public String toString() { return "async.parallel-world-ticking.run-async-tasks-sync"; }
+ },
+ ASYNC_ENTITY_TRACKER_ENABLED {
+ @Override
+ public String toString() { return "async.async-entity-tracker.enabled"; }
+ },
+ ASYNC_ENTITY_TRACKER_COMPAT_MODE {
+ @Override
+ public String toString() { return "async.async-entity-tracker.compat-mode"; }
+ },
+ ASYNC_ENTITY_TRACKER_MAX_THREADS {
+ @Override
+ public String toString() { return "async.async-entity-tracker.max-threads"; }
+ },
+ ASYNC_ENTITY_TRACKER_KEEPALIVE {
+ @Override
+ public String toString() { return "async.async-entity-tracker.keepalive"; }
+ },
+ ASYNC_ENTITY_TRACKER_QUEUE_SIZE {
+ @Override
+ public String toString() { return "async.async-entity-tracker.queue-size"; }
+ },
+ ASYNC_TARGET_FINDING {
+ @Override
+ public String toString() { return "async.async-target-finding"; }
+ },
+ ASYNC_PLAYERDATA_SAVE {
+ @Override
+ public String toString() { return "async.async-playerdata-save"; }
+ },
+ ASYNC_PATHFINDING_ENABLED {
+ @Override
+ public String toString() { return "async.async-pathfinding.enabled"; }
+ },
+ ASYNC_PATHFINDING_MAX_THREADS {
+ @Override
+ public String toString() { return "async.async-pathfinding.max-threads"; }
+ },
+ ASYNC_PATHFINDING_KEEPALIVE {
+ @Override
+ public String toString() { return "async.async-pathfinding.keepalive"; }
+ },
+ ASYNC_PATHFINDING_QUEUE_SIZE {
+ @Override
+ public String toString() { return "async.async-pathfinding.queue-size"; }
+ },
+ ASYNC_PATHFINDING_REJECT_POLICY {
+ @Override
+ public String toString() { return "async.async-pathfinding.reject-policy"; }
+ },
+ ASYNC_MOB_SPAWNING_ENABLED {
+ @Override
+ public String toString() { return "async.async-mob-spawning.enabled"; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/config/MinecraftConfig.java b/src/main/java/net/lewmc/kryptonite/config/MinecraftConfig.java
new file mode 100644
index 0000000..f52919e
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/config/MinecraftConfig.java
@@ -0,0 +1,116 @@
+package net.lewmc.kryptonite.config;
+
+import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.utils.config.BooleanConfigItem;
+import net.lewmc.kryptonite.utils.config.ConfigCollection;
+import net.lewmc.kryptonite.utils.config.IntegerConfigItem;
+
+import java.util.*;
+
+/**
+ * Configuration data for server.properties
+ * @since 2.1.0
+ */
+public class MinecraftConfig extends ConfigCollection {
+ /**
+ * Constructs the server.properties data.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public MinecraftConfig(Kryptonite plugin) {
+ String file = "server.properties";
+
+ values.put(Key.NETWORK_COMPRESSION_THRESHOLD.toString(), new IntegerConfigItem(
+ file,
+ Key.NETWORK_COMPRESSION_THRESHOLD.toString(),
+ "Network Compression Threshold",
+ List.of(
+ "The cap for the size of a packet before the",
+ "server attempts to compress it."),
+ true,
+ -1,
+ 1000,
+ "256",
+ plugin
+ ));
+
+ values.put(Key.VIEW_DISTANCE.toString(), new IntegerConfigItem(
+ file,
+ Key.VIEW_DISTANCE.toString(),
+ "View Distance",
+ List.of("The distance players can see. Using client mods",
+ "such as Distant Horizons or Bobby allow players",
+ "to see further without any performance impact",
+ "for the server."
+ ),
+ true,
+ 1,
+ 50,
+ "5 - 10",
+ plugin
+ ));
+
+ values.put(Key.SIMULATION_DISTANCE.toString(), new IntegerConfigItem(
+ file,
+ Key.SIMULATION_DISTANCE.toString(),
+ "Simulation Distance",
+ List.of("The distance mobs will be simulated."),
+ true,
+ 1,
+ 50,
+ "5 - "+values.get("view-distance").getValue(),
+ plugin
+ ));
+
+ values.put(Key.SYNC_CHUNK_WRITES.toString(), new BooleanConfigItem(
+ file,
+ Key.SYNC_CHUNK_WRITES.toString(),
+ "Sync Chunk Writes",
+ List.of("Forces the server to write chunks on the main",
+ "thread which impacts performance."
+ ),
+ true,
+ false,
+ plugin
+ ));
+
+ values.put(Key.ALLOW_FLIGHT.toString(), new BooleanConfigItem(
+ file,
+ Key.ALLOW_FLIGHT.toString(),
+ "Allow Flight",
+ List.of("This prevents players from getting kicked by the",
+ "server for 'flying' while riding a horse or",
+ "climbing on scaffolding. Doesn't actually allow",
+ "players to fly."
+ ),
+ true,
+ null,
+ plugin
+ ));
+ }
+
+ /**
+ * Configuration values supported by this format.
+ */
+ public enum Key {
+ NETWORK_COMPRESSION_THRESHOLD {
+ @Override
+ public String toString() { return "network-compression-threshold";}
+ },
+ VIEW_DISTANCE {
+ @Override
+ public String toString() { return "view-distance";}
+ },
+ SIMULATION_DISTANCE {
+ @Override
+ public String toString() { return "simulation-distance";}
+ },
+ SYNC_CHUNK_WRITES {
+ @Override
+ public String toString() { return "sync-chunk-writes";}
+ },
+ ALLOW_FLIGHT {
+ @Override
+ public String toString() { return "allow-flight";}
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/config/PaperWorldConfig.java b/src/main/java/net/lewmc/kryptonite/config/PaperWorldConfig.java
new file mode 100644
index 0000000..399766f
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/config/PaperWorldConfig.java
@@ -0,0 +1,572 @@
+package net.lewmc.kryptonite.config;
+
+import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.utils.config.BooleanConfigItem;
+import net.lewmc.kryptonite.utils.config.ConfigCollection;
+import net.lewmc.kryptonite.utils.config.IntegerConfigItem;
+import net.lewmc.kryptonite.utils.config.StringConfigItem;
+
+import java.util.List;
+
+/**
+ * Configuration data for config/paper-world-defaults.yml
+ * @since 2.1.0
+ */
+public class PaperWorldConfig extends ConfigCollection {
+ /**
+ * Constructs the config/paper-world-defaults data.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public PaperWorldConfig(Kryptonite plugin) {
+ String file = "config/paper-world-defaults";
+
+ values.put(Key.DELAY_CHUNK_UNLOADS_BY.toString(), new StringConfigItem(
+ file,
+ Key.DELAY_CHUNK_UNLOADS_BY.toString(),
+ "Delay Chunk Unloads By",
+ List.of("Delays chunk unloads by the specified time.",
+ "Recommended value: 'default' (click to lowest)"),
+ true,
+ List.of("default","1s","2s","3s","4s","5s","6s","7s","8s","9s","10s","11s","12s","13s","14s","15s","16s","17s","18s","19s","20s","21s","22s","23s","24s","25s","26s","27s","28s","29s","30s","1m","5m","10m","30m","1h","3h","6h","12h","1d"),
+ List.of("default"),
+ plugin
+ ));
+
+ values.put(Key.MAX_AUTOSAVE_CHUNKS_PER_TICK.toString(), new IntegerConfigItem(
+ file,
+ Key.MAX_AUTOSAVE_CHUNKS_PER_TICK.toString(),
+ "Max Autosave Chunks Per Tick",
+ List.of("The maximum number of chunks the auto-save system",
+ "will save in a single tick."),
+ true,
+ 0,
+ 100,
+ "24",
+ plugin
+ ));
+
+ values.put(Key.PREVENT_MOVING_INTO_UNLOADED_CHUNKS.toString(), new BooleanConfigItem(
+ file,
+ Key.PREVENT_MOVING_INTO_UNLOADED_CHUNKS.toString(),
+ "Prevent Moving into Unloaded Chunks",
+ List.of("Sets whether the server will prevent players from",
+ "moving into unloaded chunks or not. Can reduce",
+ "server lag, but players may stutter when travelling,",
+ "especially at high speeds."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_AREA_EFFECT_CLOUD.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_AREA_EFFECT_CLOUD.toString(),
+ "Entity Per Chunk Save Limit (Area Effect Cloud)",
+ List.of("Limits the number of area effect cloud entities that",
+ "will be saved and loaded per chunk. A value of -1 ",
+ "disables the limit."),
+ true,
+ 0,
+ 255,
+ "<12",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ARROW.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ARROW.toString(),
+ "Entity Per Chunk Save Limit (Arrow)",
+ List.of("Limits the number of arrows that will be saved and",
+ "loaded per chunk. A value of -1 disables the limit."),
+ true,
+ -1,
+ 256,
+ "16-20",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_DRAGON_FIREBALL.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_DRAGON_FIREBALL.toString(),
+ "Entity Per Chunk Save Limit (Dragon Fireball)",
+ List.of("Limits the number of dragon fireball entities that",
+ "will be saved and loaded per chunk. A value of -1 ",
+ "disables the limit."),
+ true,
+ -1,
+ 256,
+ "3-5",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EGG.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EGG.toString(),
+ "Entity Per Chunk Save Limit (Egg)",
+ List.of("Limits the number of eggs that will be saved and",
+ "loaded per chunk. A value of -1 disables the limit."),
+ true,
+ -1,
+ 256,
+ "8-20",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ENDER_PEARL.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ENDER_PEARL.toString(),
+ "Entity Per Chunk Save Limit (Ender Pearl)",
+ List.of("Limits the number of ender pearls that will be",
+ "saved and loaded per chunk. A value of -1 disables",
+ "the limit."),
+ true,
+ -1,
+ 256,
+ "8-20",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_BOTTLE.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_BOTTLE.toString(),
+ "Entity Per Chunk Save Limit (Experience Bottle)",
+ List.of("Limits the number of experience bottles that will be",
+ "saved and loaded per chunk. A value of -1 disables",
+ "the limit."),
+ true,
+ -1,
+ 256,
+ "3-5",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_ORB.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_ORB.toString(),
+ "Entity Per Chunk Save Limit (Experience Orb)",
+ List.of("Limits the number of experience orbs that will be",
+ "saved and loaded per chunk. A value of -1 disables",
+ "the limit."),
+ true,
+ -1,
+ 256,
+ "16-50",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EYE_OF_ENDER.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EYE_OF_ENDER.toString(),
+ "Entity Per Chunk Save Limit (Eye of Ender)",
+ List.of("Limits the number of eyes of ender that will be",
+ "saved and loaded per chunk. A value of -1 disables",
+ "the limit."),
+ true,
+ -1,
+ 256,
+ "8-20",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_FIREBALL.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_FIREBALL.toString(),
+ "Entity Per Chunk Save Limit (Fireball)",
+ List.of("Limits the number of fireballs that will be saved and",
+ "loaded per chunk. A value of -1 disables the limit."),
+ true,
+ -1,
+ 256,
+ "8-10",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_LLAMA_SPIT.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_LLAMA_SPIT.toString(),
+ "Entity Per Chunk Save Limit (Llama Spit)",
+ List.of("Limits the number of llama spit entities that will",
+ "be saved and loaded per chunk. A value of -1",
+ "disables the limit."),
+ true,
+ -1,
+ 256,
+ "3-5",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_POTION.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_POTION.toString(),
+ "Entity Per Chunk Save Limit (Splash Potion)",
+ List.of("Limits the number of splash potion clouds that",
+ "will be saved and loaded per chunk. A value of",
+ "-1 disables the limit."),
+ true,
+ -1,
+ 256,
+ "8-10",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SHULKER_BULLET.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SHULKER_BULLET.toString(),
+ "Entity Per Chunk Save Limit (Shulker Bullet)",
+ List.of("Limits the number of shulker bullets that will",
+ "be saved and loaded per chunk. A value of -1",
+ "disables the limit."),
+ true,
+ -1,
+ 256,
+ "8",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SMALL_FIREBALL.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SMALL_FIREBALL.toString(),
+ "Entity Per Chunk Save Limit (Small Fireball)",
+ List.of("Limits the number of small fireballs that will",
+ "be saved and loaded per chunk. A value of -1",
+ "disables the limit."),
+ true,
+ -1,
+ 256,
+ "8",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SNOWBALL.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SNOWBALL.toString(),
+ "Entity Per Chunk Save Limit (Snowball)",
+ List.of("Limits the number of snowball entities that will",
+ "be saved and loaded per chunk. A value of -1",
+ "disables the limit."),
+ true,
+ -1,
+ 256,
+ "8-20",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SPECTRAL_ARROW.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SPECTRAL_ARROW.toString(),
+ "Entity Per Chunk Save Limit (Spectral Arrow)",
+ List.of("Limits the number of spectral arrows that will",
+ "be saved and loaded per chunk. A value of -1",
+ "disables the limit."),
+ true,
+ -1,
+ 256,
+ "5-16",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_TRIDENT.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_TRIDENT.toString(),
+ "Entity Per Chunk Save Limit (Trident)",
+ List.of("Limits the number of trident entities that will",
+ "be saved and loaded per chunk. A value of -1",
+ "disables the limit."),
+ true,
+ -1,
+ 256,
+ "10-16",
+ plugin
+ ));
+
+ values.put(Key.ENTITY_PER_CHUNK_SAVE_LIMIT_WITHER_SKULL.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_PER_CHUNK_SAVE_LIMIT_WITHER_SKULL.toString(),
+ "Entity Per Chunk Save Limit (Wither Skull)",
+ List.of("Limits the number of wither skulls that will",
+ "be saved and loaded per chunk. A value of -1",
+ "disables the limit."),
+ true,
+ -1,
+ 256,
+ "72",
+ plugin
+ ));
+ }
+
+ /**
+ * Configuration values supported by this format.
+ */
+ public enum Key {
+ DELAY_CHUNK_UNLOADS_BY {
+ @Override public String toString() { return "chunks.delay-chunk-unloads-by"; }
+ },
+ MAX_AUTOSAVE_CHUNKS_PER_TICK {
+ @Override public String toString() { return "chunks.max-auto-save-chunks-per-tick"; }
+ },
+ PREVENT_MOVING_INTO_UNLOADED_CHUNKS {
+ @Override public String toString() { return "chunks.prevent-moving-into-unloaded-chunks"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_AREA_EFFECT_CLOUD {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.area_effect_cloud"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_ARROW {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.arrow"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_DRAGON_FIREBALL {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.dragon_fireball"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_EGG {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.egg"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_ENDER_PEARL {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.ender_pearl"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_BOTTLE {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.experience_bottle"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_ORB {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.experience_orb"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_EYE_OF_ENDER {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.eye_of_ender"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_FIREBALL {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.fireball"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_LLAMA_SPIT {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.llama_spit"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_POTION {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.splash_potion"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_SHULKER_BULLET {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.shulker_bullet"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_SMALL_FIREBALL {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.small_fireball"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_SNOWBALL {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.snowball"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_SPECTRAL_ARROW {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.spectral_arrow"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_TRIDENT {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.trident"; }
+ },
+ ENTITY_PER_CHUNK_SAVE_LIMIT_WITHER_SKULL {
+ @Override public String toString() { return "chunks.entity-per-chunk-save-limit.wither_skull"; }
+ },
+ ENTITY_DESPAWN_RANGES_AMBIENT_HARD {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.ambient.hard"; }
+ },
+ ENTITY_DESPAWN_RANGES_AMBIENT_SOFT {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.ambient.soft"; }
+ },
+ ENTITY_DESPAWN_RANGES_AXOLOTLS_HARD {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.axolotls.hard"; }
+ },
+ ENTITY_DESPAWN_RANGES_AXOLOTLS_SOFT {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.axolotls.soft"; }
+ },
+ ENTITY_DESPAWN_RANGES_CREATURE_HARD {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.creature.hard"; }
+ },
+ ENTITY_DESPAWN_RANGES_CREATURE_SOFT {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.creature.soft"; }
+ },
+ ENTITY_DESPAWN_RANGES_MISC_HARD {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.misc.hard"; }
+ },
+ ENTITY_DESPAWN_RANGES_MISC_SOFT {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.misc.soft"; }
+ },
+ ENTITY_DESPAWN_RANGES_MONSTER_HARD {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.monster.hard"; }
+ },
+ ENTITY_DESPAWN_RANGES_MONSTER_SOFT {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.monster.soft"; }
+ },
+ ENTITY_DESPAWN_RANGES_UNDERGROUND_WATER_CREATURE_HARD {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.underground_water_creature.hard"; }
+ },
+ ENTITY_DESPAWN_RANGES_UNDERGROUND_WATER_CREATURE_SOFT {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.underground_water_creature.soft"; }
+ },
+ ENTITY_DESPAWN_RANGES_WATER_AMBIENT_HARD {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.water_ambient.hard"; }
+ },
+ ENTITY_DESPAWN_RANGES_WATER_AMBIENT_SOFT {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.water_ambient.soft"; }
+ },
+ ENTITY_DESPAWN_RANGES_WATER_CREATURE_HARD {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.water_creature.hard"; }
+ },
+ ENTITY_DESPAWN_RANGES_WATER_CREATURE_SOFT {
+ @Override public String toString() { return "entities.spawning.despawn-ranges.water_creature.soft"; }
+ },
+ PER_PLAYER_MOB_SPAWNS {
+ @Override public String toString() { return "entities.spawning.per-player-mob-spawns"; }
+ },
+ MAX_ENTITY_COLLISIONS {
+ @Override public String toString() { return "collisions.max-entity-collisions"; }
+ },
+ UPDATE_PATHFINDING_ON_BLOCK_UPDATE {
+ @Override public String toString() { return "misc.update-pathfinding-on-block-update"; }
+ },
+ FIX_CLIMBING_BYPASSING_CRAMMING_RULE {
+ @Override public String toString() { return "collisions.fix-climbing-bypassing-cramming-rule"; }
+ },
+ ARMOR_STANDS_TICK {
+ @Override public String toString() { return "entities.armor-stands.tick"; }
+ },
+ ARMOR_STANDS_DO_COLLISION_ENTITY_LOOKUPS {
+ @Override public String toString() { return "entities.armor-stands.do-collision-entity-lookups"; }
+ },
+ TICK_RATE_VILLAGER_VALIDATES_NEARBY_POI {
+ @Override public String toString() { return "tick-rates.behavior.villager.validatenearbypoi"; }
+ },
+ TICK_RATE_VILLAGER_ACQUIRE_POI {
+ @Override public String toString() { return "tick-rates.behavior.villager.acquirepoi"; }
+ },
+ TICK_RATE_VILLAGER_SENSOR_NEAREST_BED {
+ @Override public String toString() { return "tick-rates.sensor.villager.nearestbedsensor"; }
+ },
+ TICK_RATE_VILLAGER_SENSOR_SECONDARY_POI {
+ @Override public String toString() { return "tick-rates.sensor.villager.secondarypoisensor"; }
+ },
+ TICK_RATE_VILLAGER_SENSOR_VILLAGER_BABIES {
+ @Override public String toString() { return "tick-rates.sensor.villager.villagerbabiessensor"; }
+ },
+ TICK_RATE_VILLAGER_SENSOR_PLAYER {
+ @Override public String toString() { return "tick-rates.sensor.villager.playersensor"; }
+ },
+ TICK_RATE_VILLAGER_SENSOR_NEAREST_LIVING_ENTITY {
+ @Override public String toString() { return "tick-rates.sensor.villager.nearestlivingentitysensor"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_ENABLED {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.enabled"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_COBBLESTONE {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.cobblestone"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_NETHERRACK {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.netherrack"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_SAND {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.sand"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_RED_SAND {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.red_sand"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_GRAVEL {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.gravel"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_DIRT {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.dirt"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_SHORT_GRASS {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.short_grass"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_PUMPKIN {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.pumpkin"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_MELON_SLICE {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.melon_slice"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_KELP {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.kelp"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_BAMBOO {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.bamboo"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_SUGAR_CANE {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.sugar_cane"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_TWISTING_VINES {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.twisting_vines"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_WEEPING_VINES {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.weeping_vines"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_OAK_LEAVES {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.oak_leaves"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_SPRUCE_LEAVES {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.spruce_leaves"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_BIRCH_LEAVES {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.birch_leaves"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_JUNGLE_LEAVES {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.jungle_leaves"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_ACACIA_LEAVES {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.acacia_leaves"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_DARK_OAK_LEAVES {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.dark_oak_leaves"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_MANGROVE_LEAVES {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.mangrove_leaves"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_CACTUS {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.cactus"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_DIORITE {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.diorite"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_GRANITE {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.granite"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_ANDESITE {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.andesite"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_SCAFFOLDING {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.scaffolding"; }
+ },
+ ALT_ITEM_DESPAWN_RATE_EGG {
+ @Override public String toString() { return "entities.spawning.alt-item-despawn-rate.items.egg"; }
+ },
+ REDSTONE_IMPLEMENTATION {
+ @Override public String toString() { return "misc.redstone-implementation"; }
+ },
+ HOPPER_DISABLE_MOVE_EVENT {
+ @Override public String toString() { return "hopper.disable-move-event"; }
+ },
+ HOPPER_IGNORE_OCCLUDING_BLOCKS {
+ @Override public String toString() { return "hopper.ignore-occluding-blocks"; }
+ },
+ TICK_RATE_MOB_SPAWNER {
+ @Override public String toString() { return "tick-rates.mob-spawner"; }
+ },
+ OPTIMIZE_EXPLOSIONS {
+ @Override public String toString() { return "environment.optimize-explosions"; }
+ },
+ TREASURE_MAPS_ENABLED {
+ @Override public String toString() { return "environment.treasure-maps.enabled"; }
+ },
+ TREASURE_MAPS_FIND_ALREADY_DISCOVERED_LOOT_TABLES {
+ @Override public String toString() { return "environment.treasure-maps.find-already-discovered.loot-tables"; }
+ },
+ TREASURE_MAPS_FIND_ALREADY_DISCOVERED_VILLAGER_TRADE {
+ @Override public String toString() { return "environment.treasure-maps.find-already-discovered.villager-trade"; }
+ },
+ TICK_RATE_GRASS_SPREAD {
+ @Override public String toString() { return "tick-rates.grass-spread"; }
+ },
+ TICK_RATE_CONTAINER_UPDATE {
+ @Override public String toString() { return "tick-rates.container-update"; }
+ },
+ ARROW_DESPAWN_RATE_NON_PLAYER {
+ @Override public String toString() { return "entities.spawning.non-player-arrow-despawn-rate"; }
+ },
+ ARROW_DESPAWN_RATE_CREATIVE {
+ @Override public String toString() { return "entities.spawning.creative-arrow-despawn-rate"; }
+ },
+ NERFED_SPAWNER_MOBS_SHOULD_JUMP {
+ @Override public String toString() { return "spawner-nerfed-mobs-should-jump"; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/config/PufferfishConfig.java b/src/main/java/net/lewmc/kryptonite/config/PufferfishConfig.java
new file mode 100644
index 0000000..f2fbcd4
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/config/PufferfishConfig.java
@@ -0,0 +1,161 @@
+package net.lewmc.kryptonite.config;
+
+import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.utils.config.BooleanConfigItem;
+import net.lewmc.kryptonite.utils.config.ConfigCollection;
+import net.lewmc.kryptonite.utils.config.IntegerConfigItem;
+
+import java.util.List;
+
+/**
+ * Configuration data for pufferfish.yml
+ * @since 2.1.0
+ */
+public class PufferfishConfig extends ConfigCollection {
+ /**
+ * Constructs the pufferfish.yml data.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public PufferfishConfig(Kryptonite plugin) {
+ String file = "pufferfish.yml";
+
+ values.put(Key.MAX_LOADS_PER_PROJECTILE.toString(), new IntegerConfigItem(
+ file,
+ Key.MAX_LOADS_PER_PROJECTILE.toString(),
+ "Max Loads per Projectile",
+ List.of("Specifies the maximum amount of chunks a projectile",
+ "can load in its lifetime. Decreasing will reduce chunk",
+ "loads caused by entity projectiles, but could cause",
+ "issues with tridents, enderpearls, etc."),
+ true,
+ 1,
+ 100,
+ "8-12",
+ plugin
+ ));
+
+ values.put(Key.DAB_ENABLED.toString(), new BooleanConfigItem(
+ file,
+ Key.DAB_ENABLED.toString(),
+ "DAB Enabled",
+ List.of("Dynamic Activation of Brain - decreases how frequently",
+ "complex AI ticks. May impact mob farms, you may want to",
+ "consider increasing the activation-dist-mod parameter",
+ "or disabling DAB altogether if it is causing issues."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.DAB_MAX_TICK_FREQ.toString(), new IntegerConfigItem(
+ file,
+ Key.DAB_MAX_TICK_FREQ.toString(),
+ "DAB Max Tick Frequency",
+ List.of("No matter what the result of the Activation Distance Modifier",
+ "calculation is, entities will never be ticked less frequently",
+ "than this often (in ticks)."),
+ true,
+ 0,
+ 100,
+ "20",
+ plugin
+ ));
+
+ values.put(Key.DAB_ACTIVATION_DIST_MOD.toString(), new IntegerConfigItem(
+ file,
+ Key.DAB_ACTIVATION_DIST_MOD.toString(),
+ "DAB Activation Distance Modifier",
+ List.of("Controls how quickly the effects of DAB wear off with distance.",
+ "The default value of 8 is sufficient for most servers. Servers",
+ "with large amounts of villagers may benefit from decreasing",
+ "this value to 7, but the value should never be decreased below",
+ "6. If you have a small server, you may want to either increase",
+ "this value to 10, or simply disable DAB."),
+ true,
+ 6,
+ 50,
+ "8",
+ plugin
+ ));
+
+ values.put(Key.ENABLE_ASYNC_MOB_SPAWNING.toString(), new BooleanConfigItem(
+ file,
+ Key.ENABLE_ASYNC_MOB_SPAWNING.toString(),
+ "Enable Async Mob Spawning",
+ List.of("Enables asynchronous mob spawning."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.ENABLE_SUFFOCATION_OPTIMIZATION.toString(), new BooleanConfigItem(
+ file,
+ Key.ENABLE_SUFFOCATION_OPTIMIZATION.toString(),
+ "Enable Suffocation Optimization",
+ List.of("Enables suffocation optimization."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.INACTIVE_GOAL_SELECTOR_THROTTLE.toString(), new BooleanConfigItem(
+ file,
+ Key.INACTIVE_GOAL_SELECTOR_THROTTLE.toString(),
+ "Inactive Goal Selector Throttle",
+ List.of("Improves performance. May have minor gameplay implications"),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.DISABLE_METHOD_PROFILER.toString(), new BooleanConfigItem(
+ file,
+ Key.DISABLE_METHOD_PROFILER.toString(),
+ "Disable Method Profiler",
+ List.of("Disables some additional profiling done by the game. This",
+ "profiling is not necessary to run in production and can cause",
+ "additional lag."),
+ true,
+ true,
+ plugin
+ ));
+ }
+
+ /**
+ * Configuration values supported by this format.
+ */
+ public enum Key {
+ MAX_LOADS_PER_PROJECTILE {
+ @Override
+ public String toString() { return "projectile.max-loads-per-projectile"; }
+ },
+ DAB_ENABLED {
+ @Override
+ public String toString() { return "dab.enabled"; }
+ },
+ DAB_MAX_TICK_FREQ {
+ @Override
+ public String toString() { return "dab.max-tick-freq"; }
+ },
+ DAB_ACTIVATION_DIST_MOD {
+ @Override
+ public String toString() { return "dab.activation-dist-mod"; }
+ },
+ ENABLE_ASYNC_MOB_SPAWNING {
+ @Override
+ public String toString() { return "enable-async-mob-spawning"; }
+ },
+ ENABLE_SUFFOCATION_OPTIMIZATION {
+ @Override
+ public String toString() { return "enable-suffocation-optimization"; }
+ },
+ INACTIVE_GOAL_SELECTOR_THROTTLE {
+ @Override
+ public String toString() { return "inactive-goal-selector-throttle"; }
+ },
+ DISABLE_METHOD_PROFILER {
+ @Override
+ public String toString() { return "misc.disable-method-profiler"; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/config/PurpurConfig.java b/src/main/java/net/lewmc/kryptonite/config/PurpurConfig.java
new file mode 100644
index 0000000..862f31b
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/config/PurpurConfig.java
@@ -0,0 +1,187 @@
+package net.lewmc.kryptonite.config;
+
+import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.utils.config.BooleanConfigItem;
+import net.lewmc.kryptonite.utils.config.ConfigCollection;
+import net.lewmc.kryptonite.utils.config.IntegerConfigItem;
+
+import java.util.List;
+
+/**
+ * Configuration data for purpur.yml
+ * @since 2.1.0
+ */
+public class PurpurConfig extends ConfigCollection {
+ /**
+ * Constructs the purpur.yml data.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public PurpurConfig(Kryptonite plugin) {
+ String file = "purpur.yml";
+
+ values.put(Key.USE_ALTERNATE_KEEPALIVE.toString(), new BooleanConfigItem(
+ file,
+ Key.USE_ALTERNATE_KEEPALIVE.toString(),
+ "Use Alternate Keepalive",
+ List.of(
+ "Uses a different approach to keepalive ping timeouts.",
+ "Enabling this sends a keepalive packet once per",
+ "second to a player, and only kicks for timeout if",
+ "none of them were responded to in 30 seconds. Cannot",
+ "enable if using TCPShield."),
+ !plugin.getConfig().getBoolean("using-tcpshield"),
+ true,
+ plugin
+ ));
+
+ values.put(Key.ZOMBIE_AGGRESSIVE_TOWARDS_VILLAGER_WHEN_LAGGING.toString(), new BooleanConfigItem(
+ file,
+ Key.ZOMBIE_AGGRESSIVE_TOWARDS_VILLAGER_WHEN_LAGGING.toString(),
+ "Zombie Aggressive Towards Villager when Lagging",
+ List.of(
+ "Set to false to stop zombie aggressiveness towards",
+ "villagers when lagging. May impact vanilla behaviour",
+ "when lagging, but may reduce overall lag."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.ENTITIES_CAN_USE_PORTALS.toString(), new BooleanConfigItem(
+ file,
+ Key.ENTITIES_CAN_USE_PORTALS.toString(),
+ "Entities can use Portals",
+ List.of(
+ "Set to false to stop entities from being able to use",
+ "portals reduces lag but impacts vanilla behaviour."),
+ true,
+ false,
+ plugin
+ ));
+
+ values.put(Key.VILLAGER_IS_LOBOTOMIZED.toString(), new BooleanConfigItem(
+ file,
+ Key.VILLAGER_IS_LOBOTOMIZED.toString(),
+ "Villagers Lobotomize",
+ List.of(
+ "Lobotomizes the villager if it cannot move (Does not",
+ "disable trading, but some trades may not refill). May",
+ "impact vanilla behaviour, only enable if you have done",
+ "ABSOLUTELY EVERYTHING ELSE to try and reduce lag. May",
+ "break iron golem farms."),
+ true,
+ false,
+ plugin
+ ));
+
+ values.put(Key.VILLAGER_SEARCH_RADIUS_ACQUIRE_POI.toString(), new IntegerConfigItem(
+ file,
+ Key.VILLAGER_SEARCH_RADIUS_ACQUIRE_POI.toString(),
+ "Villager Search Radius (Acquire POI)",
+ List.of(
+ "Radius within which villagers search to acquire POI.",
+ "Below 48 may break iron golem farms."),
+ true,
+ 1,
+ 100,
+ "16-32",
+ plugin
+ ));
+
+ values.put(Key.VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR.toString(), new IntegerConfigItem(
+ file,
+ Key.VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR.toString(),
+ "Villager Search Radius (Nearest Bed Sensor)",
+ List.of(
+ "Radius within which villagers search to detect the",
+ "nearest bed. Below 48 may break iron golem farms."),
+ true,
+ 1,
+ 100,
+ "16-32",
+ plugin
+ ));
+
+ values.put(Key.DOLPHIN_DISABLE_TREASURE_SEARCHING.toString(), new BooleanConfigItem(
+ file,
+ Key.DOLPHIN_DISABLE_TREASURE_SEARCHING.toString(),
+ "Villager Search Radius (Nearest Bed Sensor)",
+ List.of(
+ "Stops the dolphin from treasure hunting. Will impact",
+ "vanilla behaviour."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.TELEPORT_IF_OUTSIDE_BORDER.toString(), new BooleanConfigItem(
+ file,
+ Key.TELEPORT_IF_OUTSIDE_BORDER.toString(),
+ "Teleport if Outside Border",
+ List.of(
+ "Teleports you to spawn if you somehow get outside the",
+ "world border."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.LAGGING_THRESHOLD.toString(), new IntegerConfigItem(
+ file,
+ Key.LAGGING_THRESHOLD.toString(),
+ "Lagging Threshold",
+ List.of(
+ "Purpur keeps track of when it is lagging in order to",
+ "have the ability to change behaviors accordingly. If",
+ "vanilla behaviour is being impacted too much, consider",
+ "reducing this. 19 is a good starting point."),
+ true,
+ 1,
+ 19,
+ "15-19",
+ plugin
+ ));
+ }
+
+ /**
+ * Configuration values supported by this format.
+ */
+ public enum Key {
+ USE_ALTERNATE_KEEPALIVE {
+ @Override
+ public String toString() { return "settings.use-alternate-keepalive"; }
+ },
+ ZOMBIE_AGGRESSIVE_TOWARDS_VILLAGER_WHEN_LAGGING {
+ @Override
+ public String toString() { return "world-settings.default.mobs.zombie.aggressive-towards-villager-when-lagging"; }
+ },
+ ENTITIES_CAN_USE_PORTALS {
+ @Override
+ public String toString() { return "world-settings.default.gameplay-mechanics.entities-can-use-portals"; }
+ },
+ VILLAGER_IS_LOBOTOMIZED {
+ @Override
+ public String toString() { return "world-settings.default.mobs.villager.lobotomize.enabled"; }
+ },
+ VILLAGER_SEARCH_RADIUS_ACQUIRE_POI {
+ @Override
+ public String toString() { return "world-settings.default.mobs.villager.search-radius.acquire-poi"; }
+ },
+ VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR {
+ @Override
+ public String toString() { return "world-settings.default.mobs.villager.search-radius.nearest-bed-sensor"; }
+ },
+ DOLPHIN_DISABLE_TREASURE_SEARCHING {
+ @Override
+ public String toString() { return "world-settings.default.mobs.dolphin.disable-treasure-searching"; }
+ },
+ TELEPORT_IF_OUTSIDE_BORDER {
+ @Override
+ public String toString() { return "world-settings.default.gameplay-mechanics.player.teleport-if-outside-border"; }
+ },
+ LAGGING_THRESHOLD {
+ @Override
+ public String toString() { return "settings.lagging-threshold"; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/config/SpigotConfig.java b/src/main/java/net/lewmc/kryptonite/config/SpigotConfig.java
new file mode 100644
index 0000000..95432ad
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/config/SpigotConfig.java
@@ -0,0 +1,371 @@
+package net.lewmc.kryptonite.config;
+
+import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.utils.config.BooleanConfigItem;
+import net.lewmc.kryptonite.utils.config.ConfigCollection;
+import net.lewmc.kryptonite.utils.config.IntegerConfigItem;
+import net.lewmc.kryptonite.utils.config.StringConfigItem;
+
+import java.util.List;
+
+/**
+ * Configuration data for purpur.yml
+ * @since 2.1.0
+ */
+public class SpigotConfig extends ConfigCollection {
+ /**
+ * Constructs the purpur.yml data.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public SpigotConfig(Kryptonite plugin) {
+ String file = "spigot.yml";
+
+ int simulationDistance = ((int) new MinecraftConfig(plugin).values.get("simulation-distance").getValue() -1)*16;
+
+ values.put(Key.VIEW_DISTANCE.toString(), new StringConfigItem(
+ file,
+ Key.VIEW_DISTANCE.toString(),
+ "View Distance",
+ List.of(
+ "The distance the server will send to the client.",
+ "Recommended value: 'default' (click to zero)"),
+ true,
+ List.of("default","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32"),
+ List.of("default"),
+ plugin
+ ));
+
+ values.put(Key.MOB_SPAWN_RANGE.toString(), new IntegerConfigItem(
+ file,
+ Key.MOB_SPAWN_RANGE.toString(),
+ "Mob Spawn Range",
+ List.of("The distance the server will spawn mobs."),
+ true,
+ 1,
+ 100,
+ "3-8",
+ plugin
+ ));
+
+ values.put(Key.MOB_SPAWN_RANGE.toString(), new IntegerConfigItem(
+ file,
+ Key.MOB_SPAWN_RANGE.toString(),
+ "Entity Activation Range (Mobs)",
+ List.of("The distance the server will 'activate' mob",
+ "entities."),
+ true,
+ 1,
+ 100,
+ "16-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_ACTIVATION_RANGE_ANIMALS.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_ACTIVATION_RANGE_ANIMALS.toString(),
+ "Entity Activation Range (Animals)",
+ List.of("The distance the server will 'activate'",
+ "animal entities."),
+ true,
+ 1,
+ 100,
+ "16-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_ACTIVATION_RANGE_MONSTERS.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_ACTIVATION_RANGE_MONSTERS.toString(),
+ "Entity Activation Range (Monsters)",
+ List.of("The distance the server will 'activate'",
+ "monster entities."),
+ true,
+ 1,
+ 100,
+ "16-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_ACTIVATION_RANGE_RAIDERS.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_ACTIVATION_RANGE_RAIDERS.toString(),
+ "Entity Activation Range (Raiders)",
+ List.of("The distance the server will 'activate'",
+ "raider entities."),
+ true,
+ 1,
+ 100,
+ "16-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_ACTIVATION_RANGE_MISC.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_ACTIVATION_RANGE_MISC.toString(),
+ "Entity Activation Range (Misc)",
+ List.of("The distance the server will 'activate'",
+ "miscellaneous entities."),
+ true,
+ 1,
+ 100,
+ "16-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_ACTIVATION_RANGE_WATER.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_ACTIVATION_RANGE_WATER.toString(),
+ "Entity Activation Range (Water)",
+ List.of("The distance the server will 'activate'",
+ "water entities."),
+ true,
+ 1,
+ 100,
+ "16-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_ACTIVATION_RANGE_VILLAGERS.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_ACTIVATION_RANGE_VILLAGERS.toString(),
+ "Entity Activation Range (Villagers)",
+ List.of("The distance the server will 'activate'",
+ "villager entities."),
+ true,
+ 1,
+ 100,
+ "16-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS.toString(),
+ "Entity Activation Range (Flying Monsters)",
+ List.of("The distance the server will 'activate' flying",
+ "monster entities."),
+ true,
+ 1,
+ 100,
+ "16-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_TRACKING_RANGE_PLAYERS.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_TRACKING_RANGE_PLAYERS.toString(),
+ "Entity Tracking Range (Players)",
+ List.of("Controls how far in blocks players are tracked",
+ "(sent to) the player."),
+ true,
+ 1,
+ 100,
+ "6-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_TRACKING_RANGE_ANIMALS.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_TRACKING_RANGE_ANIMALS.toString(),
+ "Entity Tracking Range (Animals)",
+ List.of("Controls how far in blocks animals are tracked",
+ "(sent to) the player."),
+ true,
+ 1,
+ 100,
+ "6-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_TRACKING_RANGE_MONSTERS.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_TRACKING_RANGE_MONSTERS.toString(),
+ "Entity Tracking Range (Monsters)",
+ List.of("Controls how far in blocks monsters are tracked",
+ "(sent to) the player."),
+ true,
+ 1,
+ 100,
+ "6-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_TRACKING_RANGE_MISC.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_TRACKING_RANGE_MISC.toString(),
+ "Entity Tracking Range (Miscellaneous)",
+ List.of("Controls how far in blocks miscellaneous entities",
+ "are tracked (sent to) the player."),
+ true,
+ 1,
+ 100,
+ "6-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_TRACKING_RANGE_OTHER.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_TRACKING_RANGE_OTHER.toString(),
+ "Entity Tracking Range (Other)",
+ List.of("Controls how far in blocks other entities are",
+ "tracked (sent to) the player."),
+ true,
+ 1,
+ 100,
+ "6-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.ENTITY_TRACKING_RANGE_DISPLAY.toString(), new IntegerConfigItem(
+ file,
+ Key.ENTITY_TRACKING_RANGE_DISPLAY.toString(),
+ "Entity Tracking Range (Display)",
+ List.of("Controls how far in blocks display entities are",
+ "tracked (sent to) the player."),
+ true,
+ 1,
+ 100,
+ "6-"+simulationDistance,
+ plugin
+ ));
+
+ values.put(Key.TICK_INACTIVE_VILLAGERS.toString(), new BooleanConfigItem(
+ file,
+ Key.TICK_INACTIVE_VILLAGERS.toString(),
+ "Tick Inactive Villagers",
+ List.of("This allows you to control whether villagers should",
+ "be ticked outside of the activation range. This will",
+ "make villagers proceed as normal and ignore the",
+ "activation range. Disabling this will help performance,",
+ "but might be confusing for players in certain situations.",
+ "May cause issues with iron farms and trade restocking."),
+ true,
+ false,
+ plugin
+ ));
+
+ values.put(Key.NERF_SPAWNER_MOBS.toString(), new BooleanConfigItem(
+ file,
+ Key.NERF_SPAWNER_MOBS.toString(),
+ "Nerf Spawner Mobs",
+ List.of("Removes AI from mobs created by spawners. Helps server",
+ "performance but greatly impacts vanilla experience."),
+ true,
+ true,
+ plugin
+ ));
+
+ values.put(Key.TICKS_PER_HOPPER_TRANSFER.toString(), new IntegerConfigItem(
+ file,
+ Key.TICKS_PER_HOPPER_TRANSFER.toString(),
+ "Ticks per Hopper Transfer",
+ List.of("Time in ticks that hoppers will wait to move an item.",
+ "Increasing this improves performance if there are a lot",
+ "of hoppers on your server, but will break hopper-based",
+ "clocks and possibly item sorting systems if set too high."),
+ true,
+ 1,
+ 32,
+ "8",
+ plugin
+ ));
+
+ values.put(Key.TICKS_PER_HOPPER_CHECK.toString(), new IntegerConfigItem(
+ file,
+ Key.TICKS_PER_HOPPER_CHECK.toString(),
+ "Ticks per Hopper Check",
+ List.of("Time in ticks between hoppers checking for an item above",
+ "them or in the inventory above them. Increasing this improves",
+ "performance if there are a lot of hoppers on your server, but",
+ "will break hopper-based clocks and possibly sorting systems",
+ "if set too high."),
+ true,
+ 1,
+ 32,
+ "8",
+ plugin
+ ));
+ }
+
+ /**
+ * Configuration values supported by this format.
+ */
+ public enum Key {
+ VIEW_DISTANCE {
+ @Override
+ public String toString() { return "world-settings.default.view-distance"; }
+ },
+ MOB_SPAWN_RANGE {
+ @Override
+ public String toString() { return "world-settings.default.mob-spawn-range"; }
+ },
+ ENTITY_ACTIVATION_RANGE_ANIMALS {
+ @Override
+ public String toString() { return "world-settings.default.entity-activation-range.animals"; }
+ },
+ ENTITY_ACTIVATION_RANGE_MONSTERS {
+ @Override
+ public String toString() { return "world-settings.default.entity-activation-range.monsters"; }
+ },
+ ENTITY_ACTIVATION_RANGE_RAIDERS {
+ @Override
+ public String toString() { return "world-settings.default.entity-activation-range.raiders"; }
+ },
+ ENTITY_ACTIVATION_RANGE_MISC {
+ @Override
+ public String toString() { return "world-settings.default.entity-activation-range.misc"; }
+ },
+ ENTITY_ACTIVATION_RANGE_WATER {
+ @Override
+ public String toString() { return "world-settings.default.entity-activation-range.water"; }
+ },
+ ENTITY_ACTIVATION_RANGE_VILLAGERS {
+ @Override
+ public String toString() { return "world-settings.default.entity-activation-range.villagers"; }
+ },
+ ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS {
+ @Override
+ public String toString() { return "world-settings.default.entity-activation-range.flying-monsters"; }
+ },
+ ENTITY_TRACKING_RANGE_PLAYERS {
+ @Override
+ public String toString() { return "world-settings.default.entity-tracking-range.players"; }
+ },
+ ENTITY_TRACKING_RANGE_ANIMALS {
+ @Override
+ public String toString() { return "world-settings.default.entity-tracking-range.animals"; }
+ },
+ ENTITY_TRACKING_RANGE_MONSTERS {
+ @Override
+ public String toString() { return "world-settings.default.entity-tracking-range.monsters"; }
+ },
+ ENTITY_TRACKING_RANGE_MISC {
+ @Override
+ public String toString() { return "world-settings.default.entity-tracking-range.misc"; }
+ },
+ ENTITY_TRACKING_RANGE_OTHER {
+ @Override
+ public String toString() { return "world-settings.default.entity-tracking-range.other"; }
+ },
+ ENTITY_TRACKING_RANGE_DISPLAY {
+ @Override
+ public String toString() { return "world-settings.default.entity-tracking-range.display"; }
+ },
+ TICK_INACTIVE_VILLAGERS {
+ @Override
+ public String toString() { return "world-settings.default.entity-activation-range.tick-inactive-villagers"; }
+ },
+ NERF_SPAWNER_MOBS {
+ @Override
+ public String toString() { return "world-settings.default.nerf-spawner-mobs"; }
+ },
+ TICKS_PER_HOPPER_TRANSFER {
+ @Override
+ public String toString() { return "world-settings.default.ticks-per.hopper-transfer"; }
+ },
+ TICKS_PER_HOPPER_CHECK {
+ @Override
+ public String toString() { return "world-settings.default.ticks-per.hopper-check"; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/edb/Check.java b/src/main/java/net/lewmc/kryptonite/edb/Check.java
index 01b0964..f8b4178 100644
--- a/src/main/java/net/lewmc/kryptonite/edb/Check.java
+++ b/src/main/java/net/lewmc/kryptonite/edb/Check.java
@@ -1,9 +1,8 @@
package net.lewmc.kryptonite.edb;
+import net.lewmc.foundry.Logger;
import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.ServerProperties;
import net.lewmc.kryptonite.utils.ConfigurationUtil;
-import net.lewmc.kryptonite.utils.LogUtil;
import net.lewmc.kryptonite.utils.PropertiesUtil;
import net.lewmc.kryptonite.utils.SoftwareUtil;
import org.bukkit.command.CommandSender;
@@ -12,14 +11,14 @@
public class Check {
private final Kryptonite plugin;
private final SoftwareUtil softwareUtil;
- private final LogUtil log;
+ private final Logger log;
private final CommandSender player;
public Check(Kryptonite plugin, CommandSender player) {
this.player = player;
this.plugin = plugin;
this.softwareUtil = new SoftwareUtil(plugin);
- this.log = new LogUtil(plugin);
+ this.log = new Logger(plugin.foundryConfig);
}
public boolean edb1() {
@@ -406,7 +405,7 @@ public boolean edb11() {
}
public boolean edb12() {
- if (this.softwareUtil.supportsServerProperties()) {
+ if (this.softwareUtil.supportsMinecraft()) {
PropertiesUtil sp = new PropertiesUtil("server.properties");
if (!Objects.equals(sp.getProperty("online-mode"), "true")) {
@@ -432,8 +431,4 @@ public boolean edb12() {
public void logThis(String id, String value, String current, String expected) {
this.log.warn("[" + id + "][FAIL] '" + value + "' is '" + current + "' - expected '" + expected + "'");
}
-
- public void warnThis(String id, String value, String current, String expected) {
- this.log.warn("[" + id + "][WARN] '" + value + "' is '" + current + "' - expected '" + expected + "'");
- }
}
diff --git a/src/main/java/net/lewmc/kryptonite/edb/Patch.java b/src/main/java/net/lewmc/kryptonite/edb/Patch.java
index 8b3a485..61a6b9e 100644
--- a/src/main/java/net/lewmc/kryptonite/edb/Patch.java
+++ b/src/main/java/net/lewmc/kryptonite/edb/Patch.java
@@ -1,29 +1,20 @@
package net.lewmc.kryptonite.edb;
import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.edb.gui.EDB_MainGui;
import net.lewmc.kryptonite.utils.ConfigurationUtil;
-import net.lewmc.kryptonite.utils.LogUtil;
import net.lewmc.kryptonite.utils.PropertiesUtil;
import net.lewmc.kryptonite.utils.SoftwareUtil;
import org.bukkit.command.CommandSender;
-import org.bukkit.configuration.InvalidConfigurationException;
-import org.checkerframework.checker.units.qual.C;
-
-import java.io.File;
-import java.io.IOException;
public class Patch {
private final Kryptonite plugin;
private final SoftwareUtil softwareUtil;
- private final LogUtil log;
private final Check check;
private final CommandSender user;
public Patch(Kryptonite plugin, CommandSender sender) {
this.plugin = plugin;
this.softwareUtil = new SoftwareUtil(plugin);
- this.log = new LogUtil(plugin);
this.check = new Check(plugin, sender);
this.user = sender;
}
@@ -228,7 +219,7 @@ public boolean edb11() {
}
public boolean edb12() {
- if (softwareUtil.supportsServerProperties()) {
+ if (softwareUtil.supportsMinecraft()) {
PropertiesUtil propertiesUtil = new PropertiesUtil("server.properties");
propertiesUtil.setProperty("online-mode", "true");
diff --git a/src/main/java/net/lewmc/kryptonite/kos/AutoKOS.java b/src/main/java/net/lewmc/kryptonite/kos/AutoKOS.java
index 0abd152..cd38a75 100644
--- a/src/main/java/net/lewmc/kryptonite/kos/AutoKOS.java
+++ b/src/main/java/net/lewmc/kryptonite/kos/AutoKOS.java
@@ -1,11 +1,15 @@
package net.lewmc.kryptonite.kos;
+import net.lewmc.foundry.Logger;
import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.config.*;
import net.lewmc.kryptonite.kos.config.*;
import net.lewmc.kryptonite.utils.ConfigurationUtil;
-import net.lewmc.kryptonite.utils.LogUtil;
import net.lewmc.kryptonite.utils.MessageUtil;
import net.lewmc.kryptonite.utils.SoftwareUtil;
+import net.lewmc.kryptonite.utils.config.BooleanConfigItem;
+import net.lewmc.kryptonite.utils.config.IntegerConfigItem;
+import net.lewmc.kryptonite.utils.config.StringConfigItem;
import org.bukkit.command.CommandSender;
import java.io.File;
@@ -15,7 +19,7 @@
*/
public class AutoKOS {
private final Kryptonite plugin;
- private final LogUtil log;
+ private final Logger log;
private final SoftwareUtil softwareUtil;
private final MessageUtil message;
private final CommandSender user;
@@ -27,7 +31,7 @@ public class AutoKOS {
*/
public AutoKOS(Kryptonite plugin, CommandSender user) {
this.plugin = plugin;
- this.log = new LogUtil(plugin);
+ this.log = new Logger(plugin.foundryConfig);
this.softwareUtil = new SoftwareUtil(plugin);
this.message = new MessageUtil(user);
this.user = user;
@@ -79,18 +83,19 @@ public void run(boolean pregeneratedWorld, String profile) {
}
private void runVanilla() {
- if (this.softwareUtil.supportsServerProperties()) {
+ if (this.softwareUtil.supportsMinecraft()) {
this.log.info("[KOS] 1/6 - Running Vanilla optimisations");
- ServerProperties properties = new ServerProperties(this.plugin);
+ MinecraftConfig m = new MinecraftConfig(this.plugin);
- properties.set(ServerProperties.Key.NETWORK_COMPRESSION_THRESHOLD, this.patches.getString("server.network-compression-threshold"));
- properties.set(ServerProperties.Key.SIMULATION_DISTANCE, this.patches.getString("server.distance.simulation"));
- properties.set(ServerProperties.Key.VIEW_DISTANCE, this.patches.getString("server.distance.view"));
- properties.set(ServerProperties.Key.SYNC_CHUNK_WRITES, this.patches.getString("server.sync-chunk-writes"));
+ ((IntegerConfigItem)m.values.get(MinecraftConfig.Key.NETWORK_COMPRESSION_THRESHOLD.toString())).setValue(this.patches.getInt("server.network-compression-threshold"));
+ ((IntegerConfigItem)m.values.get(MinecraftConfig.Key.SIMULATION_DISTANCE.toString())).setValue(this.patches.getInt("server.distance.simulation"));
+ ((IntegerConfigItem)m.values.get(MinecraftConfig.Key.VIEW_DISTANCE.toString())).setValue(this.patches.getInt("server.distance.view"));
+ ((BooleanConfigItem)m.values.get(MinecraftConfig.Key.SYNC_CHUNK_WRITES.toString())).setValue(this.patches.getBoolean("server.sync-chunk-writes"));
+ ((BooleanConfigItem)m.values.get(MinecraftConfig.Key.ALLOW_FLIGHT.toString())).setValue(this.patches.getBoolean("server.allow-flight"));
} else {
- this.log.info("[KOS] 2/6 - Server does not support Server Properties, skipping...");
- this.log.warn("[KOS] 2/6 - This shouldn't happen, please open an issue at github.com/lewmc/kryptonite");
+ this.log.info("[KOS] 1/6 - Server does not support Server Properties, skipping...");
+ this.log.warn("[KOS] 1/6 - This shouldn't happen, please contact LewMC for help at lewmc.net/help");
}
}
@@ -98,25 +103,24 @@ private void runCraftBukkit() {
if (this.softwareUtil.supportsCraftBukkit()) {
this.log.info("[KOS] 2/6 - Running CraftBukkit optimisations");
- Bukkit bukkit = new Bukkit(this.plugin, user);
-
- bukkit.setInt(Bukkit.Key.SPAWN_LIMITS_MONSTERS, this.patches.getInt("craftbukkit.spawn-limits.monsters"));
- bukkit.setInt(Bukkit.Key.SPAWN_LIMITS_ANIMALS, this.patches.getInt("craftbukkit.spawn-limits.animals"));
- bukkit.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_ANIMALS, this.patches.getInt("craftbukkit.spawn-limits.water.animals"));
- bukkit.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_AMBIENT, this.patches.getInt("craftbukkit.spawn-limits.water.ambient"));
- bukkit.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE, this.patches.getInt("craftbukkit.spawn-limits.water.underground.creature"));
- bukkit.setInt(Bukkit.Key.SPAWN_LIMITS_AXOLOTLS, this.patches.getInt("craftbukkit.spawn-limits.axolotls"));
- bukkit.setInt(Bukkit.Key.SPAWN_LIMITS_AMBIENT, this.patches.getInt("craftbukkit.spawn-limits.ambient"));
-
- bukkit.setInt(Bukkit.Key.TICKS_PER_MONSTER_SPAWNS, this.patches.getInt("craftbukkit.ticks-per.monsters"));
- bukkit.setInt(Bukkit.Key.TICKS_PER_ANIMAL_SPAWNS, this.patches.getInt("craftbukkit.ticks-per.animals"));
- bukkit.setInt(Bukkit.Key.TICKS_PER_WATER_SPAWNS, this.patches.getInt("craftbukkit.ticks-per.water.animals"));
- bukkit.setInt(Bukkit.Key.TICKS_PER_WATER_AMBIENT_SPAWNS, this.patches.getInt("craftbukkit.ticks-per.water.ambient"));
- bukkit.setInt(Bukkit.Key.TICKS_PER_WATER_UNDERGROUND_CREATURE_SPAWNS, this.patches.getInt("craftbukkit.ticks-per.water.underground-creature"));
- bukkit.setInt(Bukkit.Key.TICKS_PER_AXOLOTL_SPAWNS, this.patches.getInt("craftbukkit.ticks-per.axolotls"));
- bukkit.setInt(Bukkit.Key.TICKS_PER_AMBIENT_SPAWNS, this.patches.getInt("craftbukkit.ticks-per.ambient"));
-
- bukkit.setInt(Bukkit.Key.CHUNK_GC_PERIOD_IN_TICKS, this.patches.getInt("craftbukkit.chunk-gc-period-in-ticks"));
+ BukkitConfig bukkit = new BukkitConfig(this.plugin);
+
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.SPAWN_LIMITS_MONSTERS.toString())).setValue(this.patches.getInt("craftbukkit.spawn-limits.monsters"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.SPAWN_LIMITS_ANIMALS.toString())).setValue(this.patches.getInt("craftbukkit.spawn-limits.animals"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.SPAWN_LIMITS_WATER_AMBIENT.toString())).setValue(this.patches.getInt("craftbukkit.spawn-limits.water.ambient"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE.toString())).setValue(this.patches.getInt("craftbukkit.spawn-limits.water.underground.creature"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.SPAWN_LIMITS_AXOLOTLS.toString())).setValue(this.patches.getInt("craftbukkit.spawn-limits.axolotls"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.SPAWN_LIMITS_AMBIENT.toString())).setValue(this.patches.getInt("craftbukkit.spawn-limits.ambient"));
+
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.TICKS_PER_MONSTER_SPAWNS.toString())).setValue(this.patches.getInt("craftbukkit.ticks-per.monsters"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.TICKS_PER_ANIMAL_SPAWNS.toString())).setValue(this.patches.getInt("craftbukkit.ticks-per.animals"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.TICKS_PER_WATER_SPAWNS.toString())).setValue(this.patches.getInt("craftbukkit.ticks-per.water.animals"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.TICKS_PER_WATER_AMBIENT_SPAWNS.toString())).setValue(this.patches.getInt("craftbukkit.ticks-per.water.ambient"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.TICKS_PER_WATER_UNDERGROUND_CREATURE_SPAWNS.toString())).setValue(this.patches.getInt("craftbukkit.ticks-per.water.underground-creature"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.TICKS_PER_AXOLOTL_SPAWNS.toString())).setValue(this.patches.getInt("craftbukkit.ticks-per.axolotls"));
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.TICKS_PER_AMBIENT_SPAWNS.toString())).setValue(this.patches.getInt("craftbukkit.ticks-per.ambient"));
+
+ ((IntegerConfigItem)bukkit.values.get(BukkitConfig.Key.CHUNK_GC_PERIOD_IN_TICKS.toString())).setValue(this.patches.getInt("craftbukkit.chunk-gc-period-in-ticks"));
} else {
this.log.info("[KOS] 2/6 - Server does not support CraftBukkit configurations, skipping...");
this.log.warn("[KOS] 2/6 - This shouldn't happen, please open an issue at github.com/lewmc/kryptonite");
@@ -127,26 +131,26 @@ private void runSpigot() {
if (this.softwareUtil.supportsSpigot()) {
this.log.info("[KOS] 3/6 - Running Spigot optimisations");
- Spigot spigot = new Spigot(this.plugin, this.user);
-
- spigot.setString(Spigot.Key.VIEW_DISTANCE, this.patches.getString("spigot.view-distance"));
- spigot.setInt(Spigot.Key.MOB_SPAWN_RANGE, this.patches.getInt("spigot.mob-spawn-range"));
- spigot.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_ANIMALS, this.patches.getInt("spigot.entities.activation-range.animals"));
- spigot.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MONSTERS, this.patches.getInt("spigot.entities.activation-range.monsters"));
- spigot.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_RAIDERS, this.patches.getInt("spigot.entities.activation-range.raiders"));
- spigot.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MISC, this.patches.getInt("spigot.entities.activation-range.misc"));
- spigot.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_WATER, this.patches.getInt("spigot.entities.activation-range.water"));
- spigot.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_VILLAGERS, this.patches.getInt("spigot.entities.activation-range.villagers"));
- spigot.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS, this.patches.getInt("spigot.entities.activation-range.flying"));
- spigot.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_PLAYERS, this.patches.getInt("spigot.entities.tracking-range.players"));
- spigot.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_ANIMALS, this.patches.getInt("spigot.entities.tracking-range.animals"));
- spigot.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_MONSTERS, this.patches.getInt("spigot.entities.tracking-range.monsters"));
- spigot.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_MISC, this.patches.getInt("spigot.entities.tracking-range.misc"));
- spigot.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_OTHER, this.patches.getInt("spigot.entities.tracking-range.other"));
- spigot.setBoolean(Spigot.Key.TICK_INACTIVE_VILLAGERS, this.patches.getBoolean("spigot.entities.tick-inactive-villagers"));
- spigot.setBoolean(Spigot.Key.NERF_SPAWNER_MOBS, this.patches.getBoolean("spigot.entities.spawner-mobs-nerfed"));
- spigot.setInt(Spigot.Key.TICKS_PER_HOPPER_TRANSFER, this.patches.getInt("spigot.hopper.transfer"));
- spigot.setInt(Spigot.Key.TICKS_PER_HOPPER_CHECK, this.patches.getInt("spigot.hopper.check"));
+ SpigotConfig spigot = new SpigotConfig(this.plugin);
+
+ ((StringConfigItem)spigot.values.get(SpigotConfig.Key.VIEW_DISTANCE.toString())).setValue(this.patches.getString("spigot.view-distance"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.MOB_SPAWN_RANGE.toString())).setValue(this.patches.getInt("spigot.mob-spawn-range"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_ACTIVATION_RANGE_ANIMALS.toString())).setValue(this.patches.getInt("spigot.entities.activation-range.animals"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_ACTIVATION_RANGE_MONSTERS.toString())).setValue(this.patches.getInt("spigot.entities.activation-range.monsters"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_ACTIVATION_RANGE_RAIDERS.toString())).setValue(this.patches.getInt("spigot.entities.activation-range.raiders"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_ACTIVATION_RANGE_MISC.toString())).setValue(this.patches.getInt("spigot.entities.activation-range.misc"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_ACTIVATION_RANGE_WATER.toString())).setValue(this.patches.getInt("spigot.entities.activation-range.water"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_ACTIVATION_RANGE_VILLAGERS.toString())).setValue(this.patches.getInt("spigot.entities.activation-range.villagers"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS.toString())).setValue(this.patches.getInt("spigot.entities.activation-range.flying"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_TRACKING_RANGE_PLAYERS.toString())).setValue(this.patches.getInt("spigot.entities.tracking-range.players"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_TRACKING_RANGE_ANIMALS.toString())).setValue(this.patches.getInt("spigot.entities.tracking-range.animals"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_TRACKING_RANGE_MONSTERS.toString())).setValue(this.patches.getInt("spigot.entities.tracking-range.monsters"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_TRACKING_RANGE_MISC.toString())).setValue(this.patches.getInt("spigot.entities.tracking-range.misc"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.ENTITY_TRACKING_RANGE_OTHER.toString())).setValue(this.patches.getInt("spigot.entities.tracking-range.other"));
+ ((BooleanConfigItem)spigot.values.get(SpigotConfig.Key.TICK_INACTIVE_VILLAGERS.toString())).setValue(this.patches.getBoolean("spigot.entities.tick-inactive-villagers"));
+ ((BooleanConfigItem)spigot.values.get(SpigotConfig.Key.NERF_SPAWNER_MOBS.toString())).setValue(this.patches.getBoolean("spigot.entities.spawner-mobs-nerfed"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.TICKS_PER_HOPPER_TRANSFER.toString())).setValue(this.patches.getInt("spigot.hopper.transfer"));
+ ((IntegerConfigItem)spigot.values.get(SpigotConfig.Key.TICKS_PER_HOPPER_CHECK.toString())).setValue(this.patches.getInt("spigot.hopper.check"));
} else {
log.info("[KOS] 3/6 - Server does not support Spigot configurations, skipping...");
}
@@ -156,134 +160,130 @@ private void runPaper(boolean pregeneratedWorld) {
if (this.softwareUtil.supportsPaperWorld()) {
this.log.info("[KOS] 4/6 - Running Paper optimisations");
- PaperWorld pw = new PaperWorld(this.plugin, this.user);
-
- pw.setInt(PaperWorld.Key.DELAY_CHUNK_UNLOADS_BY, this.patches.getInt("paper.chunks.delay-unloads"));
- pw.setInt(PaperWorld.Key.MAX_AUTOSAVE_CHUNKS_PER_TICK, this.patches.getInt("paper.chunks.max-autosave-per-tick"));
- pw.setBoolean(PaperWorld.Key.PREVENT_MOVING_INTO_UNLOADED_CHUNKS, this.patches.getBoolean("paper.chunks.prevent-moving-into-unloaded"));
-
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_AREA_EFFECT_CLOUD, this.patches.getInt("paper.chunks.entity-save-limit.area-effect-cloud"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ARROW, this.patches.getInt("paper.chunks.entity-save-limit.arrow"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_DRAGON_FIREBALL, this.patches.getInt("paper.chunks.entity-save-limit.dragon-fireball"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EGG, this.patches.getInt("paper.chunks.entity-save-limit.egg"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ENDER_PEARL, this.patches.getInt("paper.chunks.entity-save-limit.ender-pearl"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_BOTTLE, this.patches.getInt("paper.chunks.entity-save-limit.experience-bottle"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_ORB, this.patches.getInt("paper.chunks.entity-save-limit.experience-orb"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EYE_OF_ENDER, this.patches.getInt("paper.chunks.entity-save-limit.eye-of-ender"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_FIREBALL, this.patches.getInt("paper.chunks.entity-save-limit.fireball"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_LLAMA_SPIT, this.patches.getInt("paper.chunks.entity-save-limit.llama-spit"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_POTION, this.patches.getInt("paper.chunks.entity-save-limit.potion"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SHULKER_BULLET, this.patches.getInt("paper.chunks.entity-save-limit.shulker-bullet"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SMALL_FIREBALL, this.patches.getInt("paper.chunks.entity-save-limit.small-fireball"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SNOWBALL, this.patches.getInt("paper.chunks.entity-save-limit.snowball"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SPECTRAL_ARROW, this.patches.getInt("paper.chunks.entity-save-limit.spectral-arrow"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_TRIDENT, this.patches.getInt("paper.chunks.entity-save-limit.trident"));
- pw.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_WITHER_SKULL, this.patches.getInt("paper.chunks.entity-save-limit.wither-skull"));
-
-
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_AMBIENT_HARD, this.patches.getString("paper.despawn-ranges.ambient.hard"));
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_AMBIENT_SOFT, this.patches.getString("paper.despawn-ranges.ambient.soft"));
-
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_AXOLOTLS_HARD, this.patches.getString("paper.despawn-ranges.axolotl.hard"));
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_AXOLOTLS_SOFT, this.patches.getString("paper.despawn-ranges.axolotl.soft"));
-
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_CREATURE_HARD, this.patches.getString("paper.despawn-ranges.creature.hard"));
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_CREATURE_SOFT, this.patches.getString("paper.despawn-ranges.creature.soft"));
-
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_MISC_HARD, this.patches.getString("paper.despawn-ranges.misc.hard"));
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_MISC_SOFT, this.patches.getString("paper.despawn-ranges.misc.soft"));
-
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_MONSTER_HARD, this.patches.getString("paper.despawn-ranges.monster.hard"));
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_MONSTER_SOFT, this.patches.getString("paper.despawn-ranges.monster.soft"));
-
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_UNDERGROUND_WATER_CREATURE_HARD, this.patches.getString("paper.despawn-ranges.water.underground-creature.hard"));
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_UNDERGROUND_WATER_CREATURE_SOFT, this.patches.getString("paper.despawn-ranges.water.underground-creature.soft"));
-
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_WATER_AMBIENT_HARD, this.patches.getString("paper.despawn-ranges.water.ambient.hard"));
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_WATER_AMBIENT_SOFT, this.patches.getString("paper.despawn-ranges.water.ambient.soft"));
-
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_WATER_CREATURE_HARD, this.patches.getString("paper.despawn-ranges.water.creature.hard"));
- pw.setString(PaperWorld.Key.ENTITY_DESPAWN_RANGES_WATER_CREATURE_SOFT, this.patches.getString("paper.despawn-ranges.water.creature.soft"));
-
-
- pw.setBoolean(PaperWorld.Key.PER_PLAYER_MOB_SPAWNS, this.patches.getBoolean("paper.per-player-mob-spawns"));
- pw.setInt(PaperWorld.Key.MAX_ENTITY_COLLISIONS, this.patches.getInt("paper.max-entity-collisions"));
- pw.setBoolean(PaperWorld.Key.UPDATE_PATHFINDING_ON_BLOCK_UPDATE, this.patches.getBoolean("paper.update-pathfinding-on-block-update"));
- pw.setBoolean(PaperWorld.Key.FIX_CLIMBING_BYPASSING_CRAMMING_RULE, this.patches.getBoolean("paper.fix-climbing-bypass-cramming-rule"));
- pw.setBoolean(PaperWorld.Key.ARMOR_STANDS_TICK, this.patches.getBoolean("paper.armor-stands.tick"));
- pw.setBoolean(PaperWorld.Key.ARMOR_STANDS_DO_COLLISION_ENTITY_LOOKUPS, this.patches.getBoolean("paper.armor-stands.do-collision-entity-lookups"));
- pw.setBoolean(PaperWorld.Key.NERFED_SPAWNER_MOBS_SHOULD_JUMP, this.patches.getBoolean("paper.nerfed-spawner-mobs-can-jump"));
+ PaperWorldConfig pw = new PaperWorldConfig(this.plugin);
+
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.DELAY_CHUNK_UNLOADS_BY.toString())).setValue(this.patches.getInt("paper.chunks.delay-unloads"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.MAX_AUTOSAVE_CHUNKS_PER_TICK.toString())).setValue(this.patches.getInt("paper.chunks.max-autosave-per-tick"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.PREVENT_MOVING_INTO_UNLOADED_CHUNKS.toString())).setValue(this.patches.getBoolean("paper.chunks.prevent-moving-into-unloaded"));
+
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_AREA_EFFECT_CLOUD.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.area-effect-cloud"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ARROW.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.arrow"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_DRAGON_FIREBALL.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.dragon-fireball"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EGG.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.egg"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ENDER_PEARL.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.ender-pearl"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_BOTTLE.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.experience-bottle"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_ORB.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.experience-orb"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EYE_OF_ENDER.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.eye-of-ender"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_FIREBALL.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.fireball"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_LLAMA_SPIT.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.llama-spit"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_POTION.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.potion"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SHULKER_BULLET.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.shulker-bullet"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SMALL_FIREBALL.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.small-fireball"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SNOWBALL.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.snowball"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SPECTRAL_ARROW.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.spectral-arrow"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_TRIDENT.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.trident"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_WITHER_SKULL.toString())).setValue(this.patches.getInt("paper.chunks.entity-save-limit.wither-skull"));
+
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_AMBIENT_HARD.toString())).setValue(this.patches.getString("paper.despawn-ranges.ambient.hard"));
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_AMBIENT_SOFT.toString())).setValue(this.patches.getString("paper.despawn-ranges.ambient.soft"));
+
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_AXOLOTLS_HARD.toString())).setValue(this.patches.getString("paper.despawn-ranges.axolotl.hard"));
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_AXOLOTLS_SOFT.toString())).setValue(this.patches.getString("paper.despawn-ranges.axolotl.soft"));
+
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_CREATURE_HARD.toString())).setValue(this.patches.getString("paper.despawn-ranges.creature.hard"));
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_CREATURE_SOFT.toString())).setValue(this.patches.getString("paper.despawn-ranges.creature.soft"));
+
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_MISC_HARD.toString())).setValue(this.patches.getString("paper.despawn-ranges.misc.hard"));
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_MISC_SOFT.toString())).setValue(this.patches.getString("paper.despawn-ranges.misc.soft"));
+
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_MONSTER_HARD.toString())).setValue(this.patches.getString("paper.despawn-ranges.monster.hard"));
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_MONSTER_SOFT.toString())).setValue(this.patches.getString("paper.despawn-ranges.monster.soft"));
+
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_UNDERGROUND_WATER_CREATURE_HARD.toString())).setValue(this.patches.getString("paper.despawn-ranges.water.underground-creature.hard"));
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_UNDERGROUND_WATER_CREATURE_SOFT.toString())).setValue(this.patches.getString("paper.despawn-ranges.water.underground-creature.soft"));
+
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_WATER_AMBIENT_HARD.toString())).setValue(this.patches.getString("paper.despawn-ranges.water.ambient.hard"));
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_WATER_AMBIENT_SOFT.toString())).setValue(this.patches.getString("paper.despawn-ranges.water.ambient.soft"));
+
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_WATER_CREATURE_HARD.toString())).setValue(this.patches.getString("paper.despawn-ranges.water.creature.hard"));
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.ENTITY_DESPAWN_RANGES_WATER_CREATURE_SOFT.toString())).setValue(this.patches.getString("paper.despawn-ranges.water.creature.soft"));
+
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.PER_PLAYER_MOB_SPAWNS.toString())).setValue(this.patches.getBoolean("paper.per-player-mob-spawns"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.MAX_ENTITY_COLLISIONS.toString())).setValue(this.patches.getInt("paper.max-entity-collisions"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.UPDATE_PATHFINDING_ON_BLOCK_UPDATE.toString())).setValue(this.patches.getBoolean("paper.update-pathfinding-on-block-update"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.FIX_CLIMBING_BYPASSING_CRAMMING_RULE.toString())).setValue(this.patches.getBoolean("paper.fix-climbing-bypass-cramming-rule"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.ARMOR_STANDS_TICK.toString())).setValue(this.patches.getBoolean("paper.armor-stands.tick"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.ARMOR_STANDS_DO_COLLISION_ENTITY_LOOKUPS.toString())).setValue(this.patches.getBoolean("paper.armor-stands.do-collision-entity-lookups"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.NERFED_SPAWNER_MOBS_SHOULD_JUMP.toString())).setValue(this.patches.getBoolean("paper.nerfed-spawner-mobs-can-jump"));
if (!this.softwareUtil.supportsPufferfish()) {
- pw.setInt(PaperWorld.Key.TICK_RATE_VILLAGER_VALIDATES_NEARBY_POI, this.patches.getInt("paper.tick-rates.villager.behaviour.nearby-poi"));
- pw.setInt(PaperWorld.Key.TICK_RATE_VILLAGER_ACQUIRE_POI, this.patches.getInt("paper.tick-rates.villager.behaviour.acquire-poi"));
-
- pw.setInt(PaperWorld.Key.TICK_RATE_VILLAGER_SENSOR_SECONDARY_POI, this.patches.getInt("paper.tick-rates.villager.sensor.secondary-poi"));
- pw.setInt(PaperWorld.Key.TICK_RATE_VILLAGER_SENSOR_NEAREST_BED, this.patches.getInt("paper.tick-rates.villager.sensor.nearest-bed"));
- pw.setInt(PaperWorld.Key.TICK_RATE_VILLAGER_SENSOR_VILLAGER_BABIES, this.patches.getInt("paper.tick-rates.villager.sensor.villager-babies"));
- pw.setInt(PaperWorld.Key.TICK_RATE_VILLAGER_SENSOR_PLAYER, this.patches.getInt("paper.tick-rates.villager.sensor.player"));
- pw.setInt(PaperWorld.Key.TICK_RATE_VILLAGER_SENSOR_NEAREST_LIVING_ENTITY, this.patches.getInt("paper.tick-rates.villager.sensor.nearest-living-entity"));
-
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_VILLAGER_VALIDATES_NEARBY_POI.toString())).setValue(this.patches.getInt("paper.tick-rates.villager.behaviour.nearby-poi"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_VILLAGER_ACQUIRE_POI.toString())).setValue(this.patches.getInt("paper.tick-rates.villager.behaviour.acquire-poi"));
+
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_VILLAGER_SENSOR_SECONDARY_POI.toString())).setValue(this.patches.getInt("paper.tick-rates.villager.sensor.secondary-poi"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_VILLAGER_SENSOR_NEAREST_BED.toString())).setValue(this.patches.getInt("paper.tick-rates.villager.sensor.nearest-bed"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_VILLAGER_SENSOR_VILLAGER_BABIES.toString())).setValue(this.patches.getInt("paper.tick-rates.villager.sensor.villager-babies"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_VILLAGER_SENSOR_PLAYER.toString())).setValue(this.patches.getInt("paper.tick-rates.villager.sensor.player"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_VILLAGER_SENSOR_NEAREST_LIVING_ENTITY.toString())).setValue(this.patches.getInt("paper.tick-rates.villager.sensor.nearest-living-entity"));
} else {
this.log.info("[KOS][4/6] You're running Pufferfish, skipping some steps due to incompatibility...");
}
- pw.setBoolean(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_ENABLED, this.patches.getBoolean("paper.optimised-despawn.enabled"));
-
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_COBBLESTONE, this.patches.getInt("paper.optimised-despawn.cobblestone"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_NETHERRACK, this.patches.getInt("paper.optimised-despawn.netherrack"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_SAND, this.patches.getInt("paper.optimised-despawn.sand"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_RED_SAND, this.patches.getInt("paper.optimised-despawn.red-sand"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_GRAVEL, this.patches.getInt("paper.optimised-despawn.gravel"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_DIRT, this.patches.getInt("paper.optimised-despawn.dirt"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_SHORT_GRASS, this.patches.getInt("paper.optimised-despawn.short-grass"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_PUMPKIN, this.patches.getInt("paper.optimised-despawn.pumpkin"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_MELON_SLICE, this.patches.getInt("paper.optimised-despawn.melon-slice"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_KELP, this.patches.getInt("paper.optimised-despawn.kelp"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_BAMBOO, this.patches.getInt("paper.optimised-despawn.bamboo"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_SUGAR_CANE, this.patches.getInt("paper.optimised-despawn.sugar-cane"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_TWISTING_VINES, this.patches.getInt("paper.optimised-despawn.twisting-vines"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_WEEPING_VINES, this.patches.getInt("paper.optimised-despawn.weeping-vines"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_OAK_LEAVES, this.patches.getInt("paper.optimised-despawn.oak-leaves"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_SPRUCE_LEAVES, this.patches.getInt("paper.optimised-despawn.spruce-leaves"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_BIRCH_LEAVES, this.patches.getInt("paper.optimised-despawn.birch-leaves"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_JUNGLE_LEAVES, this.patches.getInt("paper.optimised-despawn.jungle-leaves"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_ACACIA_LEAVES, this.patches.getInt("paper.optimised-despawn.acacia-leaves"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_DARK_OAK_LEAVES, this.patches.getInt("paper.optimised-despawn.dark-oak-leaves"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_MANGROVE_LEAVES, this.patches.getInt("paper.optimised-despawn.mangrove-leaves"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_CACTUS, this.patches.getInt("paper.optimised-despawn.cactus"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_DIORITE, this.patches.getInt("paper.optimised-despawn.diorite"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_GRANITE, this.patches.getInt("paper.optimised-despawn.granite"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_ANDESITE, this.patches.getInt("paper.optimised-despawn.andesite"));
- pw.setInt(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_SCAFFOLDING, this.patches.getInt("paper.optimised-despawn.scaffolding"));
-
-
- pw.setString(PaperWorld.Key.REDSTONE_IMPLEMENTATION, this.patches.getString("paper.redstone-implementation"));
- pw.setBoolean(PaperWorld.Key.HOPPER_DISABLE_MOVE_EVENT, this.patches.getBoolean("paper.hoppers.disable-move-event"));
- pw.setBoolean(PaperWorld.Key.HOPPER_IGNORE_OCCLUDING_BLOCKS, this.patches.getBoolean("paper.hoppers.ignore-occluding-blocks"));
- pw.setInt(PaperWorld.Key.TICK_RATE_MOB_SPAWNER, this.patches.getInt("paper.tick-rates.mob-spawner"));
- pw.setBoolean(PaperWorld.Key.OPTIMIZE_EXPLOSIONS, this.patches.getBoolean("paper.optimise-explosions"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_ENABLED.toString())).setValue(this.patches.getBoolean("paper.optimised-despawn.enabled"));
+
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_COBBLESTONE.toString())).setValue(this.patches.getInt("paper.optimised-despawn.cobblestone"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_NETHERRACK.toString())).setValue(this.patches.getInt("paper.optimised-despawn.netherrack"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_SAND.toString())).setValue(this.patches.getInt("paper.optimised-despawn.sand"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_RED_SAND.toString())).setValue(this.patches.getInt("paper.optimised-despawn.red-sand"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_GRAVEL.toString())).setValue(this.patches.getInt("paper.optimised-despawn.gravel"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_DIRT.toString())).setValue(this.patches.getInt("paper.optimised-despawn.dirt"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_SHORT_GRASS.toString())).setValue(this.patches.getInt("paper.optimised-despawn.short-grass"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_PUMPKIN.toString())).setValue(this.patches.getInt("paper.optimised-despawn.pumpkin"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_MELON_SLICE.toString())).setValue(this.patches.getInt("paper.optimised-despawn.melon-slice"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_KELP.toString())).setValue(this.patches.getInt("paper.optimised-despawn.kelp"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_BAMBOO.toString())).setValue(this.patches.getInt("paper.optimised-despawn.bamboo"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_SUGAR_CANE.toString())).setValue(this.patches.getInt("paper.optimised-despawn.sugar-cane"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_TWISTING_VINES.toString())).setValue(this.patches.getInt("paper.optimised-despawn.twisting-vines"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_WEEPING_VINES.toString())).setValue(this.patches.getInt("paper.optimised-despawn.weeping-vines"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_OAK_LEAVES.toString())).setValue(this.patches.getInt("paper.optimised-despawn.oak-leaves"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_SPRUCE_LEAVES.toString())).setValue(this.patches.getInt("paper.optimised-despawn.spruce-leaves"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_BIRCH_LEAVES.toString())).setValue(this.patches.getInt("paper.optimised-despawn.birch-leaves"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_JUNGLE_LEAVES.toString())).setValue(this.patches.getInt("paper.optimised-despawn.jungle-leaves"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_ACACIA_LEAVES.toString())).setValue(this.patches.getInt("paper.optimised-despawn.acacia-leaves"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_DARK_OAK_LEAVES.toString())).setValue(this.patches.getInt("paper.optimised-despawn.dark-oak-leaves"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_MANGROVE_LEAVES.toString())).setValue(this.patches.getInt("paper.optimised-despawn.mangrove-leaves"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_CACTUS.toString())).setValue(this.patches.getInt("paper.optimised-despawn.cactus"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_DIORITE.toString())).setValue(this.patches.getInt("paper.optimised-despawn.diorite"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_GRANITE.toString())).setValue(this.patches.getInt("paper.optimised-despawn.granite"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_ANDESITE.toString())).setValue(this.patches.getInt("paper.optimised-despawn.andesite"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ALT_ITEM_DESPAWN_RATE_SCAFFOLDING.toString())).setValue(this.patches.getInt("paper.optimised-despawn.scaffolding"));
+
+ ((StringConfigItem)pw.values.get(PaperWorldConfig.Key.REDSTONE_IMPLEMENTATION.toString())).setValue(this.patches.getString("paper.redstone-implementation"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.HOPPER_DISABLE_MOVE_EVENT.toString())).setValue(this.patches.getBoolean("paper.hoppers.disable-move-event"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.HOPPER_IGNORE_OCCLUDING_BLOCKS.toString())).setValue(this.patches.getBoolean("paper.hoppers.ignore-occluding-blocks"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_MOB_SPAWNER.toString())).setValue(this.patches.getInt("paper.tick-rates.mob-spawner"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.OPTIMIZE_EXPLOSIONS.toString())).setValue(this.patches.getBoolean("paper.optimise-explosions"));
if (pregeneratedWorld) {
this.log.info("[KOS][4/6] World is pregenerated, enabling treasure maps...");
- pw.setBoolean(PaperWorld.Key.TREASURE_MAPS_ENABLED, true);
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.TREASURE_MAPS_ENABLED.toString())).setValue(true);
} else {
if (this.plugin.getConfig().getBoolean("kos.override-pregenerated-world-protections")) {
- pw.setBoolean(PaperWorld.Key.TREASURE_MAPS_ENABLED, true);
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.TREASURE_MAPS_ENABLED.toString())).setValue(true);
this.log.warn("[KOS][4/6] override-pregenerated-world-protections is TRUE, enabling treasure maps. This may cause lag.");
} else {
- pw.setBoolean(PaperWorld.Key.TREASURE_MAPS_ENABLED, false);
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.TREASURE_MAPS_ENABLED.toString())).setValue(false);
this.log.info("[KOS][4/6] World not pregenerated, disabling treasure maps...");
this.message.Warning("Treasure maps have been disabled, please pre-generate your world to re-enable them.");
}
}
- pw.setBoolean(PaperWorld.Key.TREASURE_MAPS_FIND_ALREADY_DISCOVERED_LOOT_TABLES, this.patches.getBoolean("paper.find-already-discovered-loot-tables"));
- pw.setBoolean(PaperWorld.Key.TREASURE_MAPS_FIND_ALREADY_DISCOVERED_VILLAGER_TRADE, this.patches.getBoolean("paper.find-already-discovered-villager-trade"));
- pw.setInt(PaperWorld.Key.TICK_RATE_GRASS_SPREAD, this.patches.getInt("paper.tick-rates.grass-spread"));
- pw.setInt(PaperWorld.Key.TICK_RATE_CONTAINER_UPDATE, this.patches.getInt("paper.tick-rates.container-update"));
- pw.setInt(PaperWorld.Key.ARROW_DESPAWN_RATE_NON_PLAYER, this.patches.getInt("paper.optimised-despawn.arrow.non-player"));
- pw.setInt(PaperWorld.Key.ARROW_DESPAWN_RATE_CREATIVE, this.patches.getInt("paper.optimised-despawn.arrow.creative"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.TREASURE_MAPS_FIND_ALREADY_DISCOVERED_LOOT_TABLES.toString())).setValue(this.patches.getBoolean("paper.find-already-discovered-loot-tables"));
+ ((BooleanConfigItem)pw.values.get(PaperWorldConfig.Key.TREASURE_MAPS_FIND_ALREADY_DISCOVERED_VILLAGER_TRADE.toString())).setValue(this.patches.getBoolean("paper.find-already-discovered-villager-trade"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_GRASS_SPREAD.toString())).setValue(this.patches.getInt("paper.tick-rates.grass-spread"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.TICK_RATE_CONTAINER_UPDATE.toString())).setValue(this.patches.getInt("paper.tick-rates.container-update"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ARROW_DESPAWN_RATE_NON_PLAYER.toString())).setValue(this.patches.getInt("paper.optimised-despawn.arrow.non-player"));
+ ((IntegerConfigItem)pw.values.get(PaperWorldConfig.Key.ARROW_DESPAWN_RATE_CREATIVE.toString())).setValue(this.patches.getInt("paper.optimised-despawn.arrow.creative"));
} else {
log.info("[KOS] 4/6 - Server does not support Paper World configurations, skipping...");
}
@@ -293,37 +293,36 @@ private void runPurpur(boolean pregeneratedWorld) {
if (this.softwareUtil.supportsPurpur()) {
this.log.info("[KOS] 5/6 - Running Purpur optimisations");
- Purpur purpur = new Purpur(this.plugin, this.user);
+ PurpurConfig purpur = new PurpurConfig(this.plugin);
if (this.plugin.getConfig().getBoolean("kos.using-tcpshield")) {
this.log.info("[KOS] 5/6 - You're using TCPShield, disabling use-alternative-keepalive.");
- purpur.setBoolean(Purpur.Key.USE_ALTERNATE_KEEPALIVE, false);
+ ((BooleanConfigItem)purpur.values.get(PurpurConfig.Key.USE_ALTERNATE_KEEPALIVE.toString())).setValue(false);
} else {
- purpur.setBoolean(Purpur.Key.USE_ALTERNATE_KEEPALIVE, this.patches.getBoolean("purpur.use-alternative-keepalive"));
+ ((BooleanConfigItem)purpur.values.get(PurpurConfig.Key.USE_ALTERNATE_KEEPALIVE.toString())).setValue(this.patches.getBoolean("purpur.use-alternative-keepalive"));
}
- purpur.setBoolean(Purpur.Key.ZOMBIE_AGGRESSIVE_TOWARDS_VILLAGER_WHEN_LAGGING, this.patches.getBoolean("purpur.entities.zombie.aggressive-towards-villager-when-lagging"));
- purpur.setBoolean(Purpur.Key.ENTITIES_CAN_USE_PORTALS, this.patches.getBoolean("purpur.entities.all.can-use-portals"));
- purpur.setBoolean(Purpur.Key.VILLAGER_IS_LOBOTOMIZED, this.patches.getBoolean("purpur.entities.villager.lobotomized"));
- purpur.setInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_ACQUIRE_POI, this.patches.getInt("purpur.entities.villager.search-radius.acquire-poi"));
- purpur.setInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR, this.patches.getInt("purpur.entities.villager.search-radius.nearest-bed-sensor"));
+ ((BooleanConfigItem)purpur.values.get(PurpurConfig.Key.ZOMBIE_AGGRESSIVE_TOWARDS_VILLAGER_WHEN_LAGGING.toString())).setValue(this.patches.getBoolean("purpur.entities.zombie.aggressive-towards-villager-when-lagging"));
+ ((BooleanConfigItem)purpur.values.get(PurpurConfig.Key.ENTITIES_CAN_USE_PORTALS.toString())).setValue(this.patches.getBoolean("purpur.entities.all.can-use-portals"));
+ ((BooleanConfigItem)purpur.values.get(PurpurConfig.Key.VILLAGER_IS_LOBOTOMIZED.toString())).setValue(this.patches.getBoolean("purpur.entities.villager.lobotomized"));
+ ((IntegerConfigItem)purpur.values.get(PurpurConfig.Key.VILLAGER_SEARCH_RADIUS_ACQUIRE_POI.toString())).setValue(this.patches.getInt("purpur.entities.villager.search-radius.acquire-poi"));
+ ((IntegerConfigItem)purpur.values.get(PurpurConfig.Key.VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR.toString())).setValue(this.patches.getInt("purpur.entities.villager.search-radius.nearest-bed-sensor"));
if (pregeneratedWorld) {
this.log.info("[KOS][4/6] World is pregenerated, enabling dolphin treasure searching...");
- purpur.setBoolean(Purpur.Key.DOLPHIN_DISABLE_TREASURE_SEARCHING, false);
+ ((BooleanConfigItem)purpur.values.get(PurpurConfig.Key.DOLPHIN_DISABLE_TREASURE_SEARCHING.toString())).setValue(false);
} else {
if (this.plugin.getConfig().getBoolean("kos.override-pregenerated-world-protections")) {
- purpur.setBoolean(Purpur.Key.DOLPHIN_DISABLE_TREASURE_SEARCHING, false);
+ ((BooleanConfigItem)purpur.values.get(PurpurConfig.Key.DOLPHIN_DISABLE_TREASURE_SEARCHING.toString())).setValue(false);
this.log.warn("[KOS][4/6] override-pregenerated-world-protections is TRUE, enabling dolphin treasure searching. This may cause lag.");
} else {
- purpur.setBoolean(Purpur.Key.DOLPHIN_DISABLE_TREASURE_SEARCHING, true);
+ ((BooleanConfigItem)purpur.values.get(PurpurConfig.Key.DOLPHIN_DISABLE_TREASURE_SEARCHING.toString())).setValue(true);
this.log.info("[KOS][4/6] World not pregenerated, disabling dolphin treasure searching...");
this.message.Warning("Dolphin treasure searching has been disabled, please pre-generate your world to re-enable this.");
}
}
- purpur.setBoolean(Purpur.Key.TELEPORT_IF_OUTSIDE_BORDER, this.patches.getBoolean("purpur.teleport-if-outside-worldborder"));
- purpur.setInt(Purpur.Key.LAGGING_THRESHOLD, this.patches.getInt("purpur.lagging-tps-threshold"));
-
+ ((BooleanConfigItem)purpur.values.get(PurpurConfig.Key.TELEPORT_IF_OUTSIDE_BORDER.toString())).setValue(this.patches.getBoolean("purpur.teleport-if-outside-worldborder"));
+ ((IntegerConfigItem)purpur.values.get(PurpurConfig.Key.LAGGING_THRESHOLD.toString())).setValue(this.patches.getInt("purpur.lagging-tps-threshold"));
} else {
this.log.info("[KOS] 5/6 - Server does not support Purpur configurations, skipping...");
}
@@ -332,16 +331,16 @@ private void runPurpur(boolean pregeneratedWorld) {
private void runPufferfish() {
if (this.softwareUtil.supportsPufferfish()) {
this.log.info("[KOS] 6/6 - Running Pufferfish optimisations");
- Pufferfish pufferfish = new Pufferfish(this.plugin, this.user);
-
- pufferfish.setInt(Pufferfish.Key.MAX_LOADS_PER_PROJECTILE, this.patches.getInt("pufferfish.max-loads-per-projectile"));
- pufferfish.setBoolean(Pufferfish.Key.DAB_ENABLED, this.patches.getBoolean("pufferfish.entities.dynamic-activation-of-brain.enabled"));
- pufferfish.setInt(Pufferfish.Key.DAB_MAX_TICK_FREQ, this.patches.getInt("pufferfish.entities.dynamic-activation-of-brain.max-tick-freq"));
- pufferfish.setInt(Pufferfish.Key.DAB_ACTIVATION_DIST_MOD, this.patches.getInt("pufferfish.entities.dynamic-activation-of-brain.activation-distance-modifier"));
- pufferfish.setBoolean(Pufferfish.Key.ENABLE_ASYNC_MOB_SPAWNING, this.patches.getBoolean("pufferfish.entities.async-mob-spawning"));
- pufferfish.setBoolean(Pufferfish.Key.ENABLE_SUFFOCATION_OPTIMIZATION, this.patches.getBoolean("pufferfish.entities.suffocation-optimisation"));
- pufferfish.setBoolean(Pufferfish.Key.INACTIVE_GOAL_SELECTOR_THROTTLE, this.patches.getBoolean("pufferfish.entities.inactive-goal-selector-throttle"));
- pufferfish.setBoolean(Pufferfish.Key.DISABLE_METHOD_PROFILER, this.patches.getBoolean("pufferfish.disable-method-profiler"));
+ PufferfishConfig pufferfish = new PufferfishConfig(this.plugin);
+
+ ((IntegerConfigItem)pufferfish.values.get(PufferfishConfig.Key.MAX_LOADS_PER_PROJECTILE.toString())).setValue(this.patches.getInt("pufferfish.max-loads-per-projectile"));
+ ((BooleanConfigItem)pufferfish.values.get(PufferfishConfig.Key.DAB_ENABLED.toString())).setValue(this.patches.getBoolean("pufferfish.entities.dynamic-activation-of-brain.enabled"));
+ ((IntegerConfigItem)pufferfish.values.get(PufferfishConfig.Key.DAB_MAX_TICK_FREQ.toString())).setValue(this.patches.getInt("pufferfish.entities.dynamic-activation-of-brain.max-tick-freq"));
+ ((IntegerConfigItem)pufferfish.values.get(PufferfishConfig.Key.DAB_ACTIVATION_DIST_MOD.toString())).setValue(this.patches.getInt("pufferfish.entities.dynamic-activation-of-brain.activation-distance-modifier"));
+ ((BooleanConfigItem)pufferfish.values.get(PufferfishConfig.Key.ENABLE_ASYNC_MOB_SPAWNING.toString())).setValue(this.patches.getBoolean("pufferfish.entities.async-mob-spawning"));
+ ((BooleanConfigItem)pufferfish.values.get(PufferfishConfig.Key.ENABLE_SUFFOCATION_OPTIMIZATION.toString())).setValue(this.patches.getBoolean("pufferfish.entities.suffocation-optimisation"));
+ ((BooleanConfigItem)pufferfish.values.get(PufferfishConfig.Key.INACTIVE_GOAL_SELECTOR_THROTTLE.toString())).setValue(this.patches.getBoolean("pufferfish.entities.inactive-goal-selector-throttle"));
+ ((BooleanConfigItem)pufferfish.values.get(PufferfishConfig.Key.DISABLE_METHOD_PROFILER.toString())).setValue(this.patches.getBoolean("pufferfish.disable-method-profiler"));
} else {
this.log.info("[KOS] 6/6 - Server does not support Pufferfish configurations, skipping...");
}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/config/Bukkit.java b/src/main/java/net/lewmc/kryptonite/kos/config/Bukkit.java
deleted file mode 100644
index 1a0ae7c..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/config/Bukkit.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package net.lewmc.kryptonite.kos.config;
-
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.utils.ConfigurationUtil;
-import net.lewmc.kryptonite.utils.LogUtil;
-import org.bukkit.command.CommandSender;
-
-/**
- * The Bukkit class manages the bukkit.yml configuration file.
- */
-public class Bukkit {
- private final Kryptonite plugin;
- private final CommandSender user;
-
- /**
- * Constructor for the Bukkit class.
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public Bukkit(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
- }
-
- /**
- * Configuration values supported by this format.
- */
- public enum Key {
- SPAWN_LIMITS_MONSTERS {
- @Override
- public String toString() { return "spawn-limits.monsters"; }
- },
- SPAWN_LIMITS_ANIMALS {
- @Override
- public String toString() { return "spawn-limits.animals"; }
- },
- SPAWN_LIMITS_WATER_ANIMALS {
- @Override
- public String toString() { return "spawn-limits.water-animals"; }
- },
- SPAWN_LIMITS_WATER_AMBIENT {
- @Override
- public String toString() { return "spawn-limits.water-ambient"; }
- },
- SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE {
- @Override
- public String toString() { return "spawn-limits.water-underground-creature"; }
- },
- SPAWN_LIMITS_AXOLOTLS {
- @Override
- public String toString() { return "spawn-limits.axolotls"; }
- },
- SPAWN_LIMITS_AMBIENT {
- @Override
- public String toString() { return "spawn-limits.ambient"; }
- },
- TICKS_PER_MONSTER_SPAWNS {
- @Override
- public String toString() { return "ticks-per.monster-spawns"; }
- },
- TICKS_PER_ANIMAL_SPAWNS {
- @Override
- public String toString() { return "ticks-per.animal-spawns"; }
- },
- TICKS_PER_WATER_SPAWNS {
- @Override
- public String toString() { return "ticks-per.water-spawns"; }
- },
- TICKS_PER_WATER_AMBIENT_SPAWNS {
- @Override
- public String toString() { return "ticks-per.water-ambient-spawns"; }
- },
- TICKS_PER_WATER_UNDERGROUND_CREATURE_SPAWNS {
- @Override
- public String toString() { return "ticks-per.water-underground-creature-spawns"; }
- },
- TICKS_PER_AXOLOTL_SPAWNS {
- @Override
- public String toString() { return "ticks-per.axolotl-spawns"; }
- },
- TICKS_PER_AMBIENT_SPAWNS {
- @Override
- public String toString() { return "ticks-per.ambient-spawns"; }
- },
- CHUNK_GC_PERIOD_IN_TICKS {
- @Override
- public String toString() { return "chunk-gc.period-in-ticks"; }
- }
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setInt(Key key, int value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("bukkit.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>bukkit.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public int getInt(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("bukkit.yml");
- return cfg.getInt(key.toString());
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/config/Leaf.java b/src/main/java/net/lewmc/kryptonite/kos/config/Leaf.java
deleted file mode 100644
index dcc1c71..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/config/Leaf.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package net.lewmc.kryptonite.kos.config;
-
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.utils.ConfigurationUtil;
-import net.lewmc.kryptonite.utils.LogUtil;
-import org.bukkit.command.CommandSender;
-
-/**
- * The leaf class manages the leaf.yml configuration file.
- */
-public class Leaf {
- private final Kryptonite plugin;
- private final CommandSender user;
-
- /**
- * Constructor for the leaf class.
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public Leaf(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
- }
-
- /**
- * Configuration values supported by this format.
- */
- public enum Key {
- PARALLEL_WORLD_TRACING_ENABLED {
- @Override
- public String toString() { return "async.parallel-world-tracing.enabled"; }
- }
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setInt(Key key, int value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("leaf.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>leaf.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public int getInt(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("leaf.yml");
- return cfg.getInt(key.toString());
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setBoolean(Key key, boolean value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("leaf.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>leaf.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public boolean getBoolean(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("leaf.yml");
- return cfg.getBoolean(key.toString());
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setString(Key key, String value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("leaf.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>leaf.yml set '" + key + "' to '" + value + "'");
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/config/PaperWorld.java b/src/main/java/net/lewmc/kryptonite/kos/config/PaperWorld.java
index 09590a2..2a7c157 100644
--- a/src/main/java/net/lewmc/kryptonite/kos/config/PaperWorld.java
+++ b/src/main/java/net/lewmc/kryptonite/kos/config/PaperWorld.java
@@ -7,7 +7,9 @@
/**
* The PaperWorld class manages the paper-world-defaults.yml configuration file.
+ * @deprecated
*/
+@Deprecated
public class PaperWorld {
private final Kryptonite plugin;
private final CommandSender user;
diff --git a/src/main/java/net/lewmc/kryptonite/kos/config/Pufferfish.java b/src/main/java/net/lewmc/kryptonite/kos/config/Pufferfish.java
deleted file mode 100644
index 7a9884b..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/config/Pufferfish.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package net.lewmc.kryptonite.kos.config;
-
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.utils.ConfigurationUtil;
-import net.lewmc.kryptonite.utils.LogUtil;
-import org.bukkit.command.CommandSender;
-
-/**
- * The Pufferfish class manages the pufferfish.yml configuration file.
- */
-public class Pufferfish {
- private final Kryptonite plugin;
- private final CommandSender user;
-
- /**
- * Constructor for the Pufferfish class.
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public Pufferfish(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
- }
-
- /**
- * Configuration values supported by this format.
- */
- public enum Key {
- MAX_LOADS_PER_PROJECTILE {
- @Override
- public String toString() { return "projectile.max-loads-per-projectile"; }
- },
- DAB_ENABLED {
- @Override
- public String toString() { return "dab.enabled"; }
- },
- DAB_MAX_TICK_FREQ {
- @Override
- public String toString() { return "dab.max-tick-freq"; }
- },
- DAB_ACTIVATION_DIST_MOD {
- @Override
- public String toString() { return "dab.activation-dist-mod"; }
- },
- ENABLE_ASYNC_MOB_SPAWNING {
- @Override
- public String toString() { return "enable-async-mob-spawning"; }
- },
- ENABLE_SUFFOCATION_OPTIMIZATION {
- @Override
- public String toString() { return "enable-suffocation-optimization"; }
- },
- INACTIVE_GOAL_SELECTOR_THROTTLE {
- @Override
- public String toString() { return "inactive-goal-selector-throttle"; }
- },
- DISABLE_METHOD_PROFILER {
- @Override
- public String toString() { return "misc.disable-method-profiler"; }
- }
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setInt(Key key, int value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("pufferfish.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>pufferfish.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public int getInt(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("pufferfish.yml");
- return cfg.getInt(key.toString());
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setBoolean(Key key, boolean value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("pufferfish.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>pufferfish.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public boolean getBoolean(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("pufferfish.yml");
- return cfg.getBoolean(key.toString());
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setString(Key key, String value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("pufferfish.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>pufferfish.yml set '" + key + "' to '" + value + "'");
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/config/Purpur.java b/src/main/java/net/lewmc/kryptonite/kos/config/Purpur.java
deleted file mode 100644
index 1904fbe..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/config/Purpur.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package net.lewmc.kryptonite.kos.config;
-
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.utils.ConfigurationUtil;
-import net.lewmc.kryptonite.utils.LogUtil;
-import org.bukkit.command.CommandSender;
-
-/**
- * The Purpur class manages the purpur.yml configuration file.
- */
-public class Purpur {
- private final Kryptonite plugin;
- private final CommandSender user;
-
- /**
- * Constructor for the Purpur class.
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public Purpur(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
- }
-
- /**
- * Configuration values supported by this format.
- */
- public enum Key {
- USE_ALTERNATE_KEEPALIVE {
- @Override
- public String toString() { return "settings.use-alternate-keepalive"; }
- },
- ZOMBIE_AGGRESSIVE_TOWARDS_VILLAGER_WHEN_LAGGING {
- @Override
- public String toString() { return "world-settings.default.mobs.zombie.aggressive-towards-villager-when-lagging"; }
- },
- ENTITIES_CAN_USE_PORTALS {
- @Override
- public String toString() { return "world-settings.default.gameplay-mechanics.entities-can-use-portals"; }
- },
- VILLAGER_IS_LOBOTOMIZED {
- @Override
- public String toString() { return "world-settings.default.mobs.villager.lobotomize.enabled"; }
- },
- VILLAGER_SEARCH_RADIUS_ACQUIRE_POI {
- @Override
- public String toString() { return "world-settings.default.mobs.villager.search-radius.acquire-poi"; }
- },
- VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR {
- @Override
- public String toString() { return "world-settings.default.mobs.villager.search-radius.nearest-bed-sensor"; }
- },
- DOLPHIN_DISABLE_TREASURE_SEARCHING {
- @Override
- public String toString() { return "world-settings.default.mobs.dolphin.disable-treasure-searching"; }
- },
- TELEPORT_IF_OUTSIDE_BORDER {
- @Override
- public String toString() { return "world-settings.default.gameplay-mechanics.player.teleport-if-outside-border"; }
- },
- LAGGING_THRESHOLD {
- @Override
- public String toString() { return "settings.lagging-threshold"; }
- }
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setInt(Key key, int value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("purpur.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>purpur.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public int getInt(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("purpur.yml");
- return cfg.getInt(key.toString());
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setBoolean(Key key, boolean value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("purpur.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>purpur.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public boolean getBoolean(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("purpur.yml");
- return cfg.getBoolean(key.toString());
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setString(Key key, String value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("purpur.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>purpur.yml set '" + key + "' to '" + value + "'");
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/config/ServerProperties.java b/src/main/java/net/lewmc/kryptonite/kos/config/ServerProperties.java
deleted file mode 100644
index 21e3f6a..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/config/ServerProperties.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package net.lewmc.kryptonite.kos.config;
-
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.utils.LogUtil;
-import net.lewmc.kryptonite.utils.PropertiesUtil;
-
-/**
- * The ServerProperties class manages the server.properties configuration file.
- */
-public class ServerProperties {
- private final PropertiesUtil util;
- private final Kryptonite plugin;
-
- /**
- * Constructor for the ServerProperties class.
- * @param plugin Kryptonite - Reference to the main plugin class.
- */
- public ServerProperties(Kryptonite plugin) {
- this.util = new PropertiesUtil("server.properties");
- this.plugin = plugin;
- }
-
- /**
- * Configuration values supported by this format.
- */
- public enum Key {
- NETWORK_COMPRESSION_THRESHOLD {
- @Override
- public String toString() {
- return "network-compression-threshold";
- }
- },
- SIMULATION_DISTANCE {
- @Override
- public String toString() {
- return "simulation-distance";
- }
- },
- VIEW_DISTANCE {
- @Override
- public String toString() {
- return "view-distance";
- }
- },
- SYNC_CHUNK_WRITES {
- @Override
- public String toString() {
- return "sync-chunk-writes";
- }
- },
- ALLOW_FLIGHT {
- @Override
- public String toString() {
- return "allow-flight";
- }
- }
- }
-
- /**
- * Sets a value.
- * @param key Config - A valid configuration key.
- * @param value String - The value to set.
- */
- public void set(Key key, String value) {
- plugin.restartRequired = true;
- this.util.setProperty(key.toString(), value);
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>server.properties set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Retrieves a string from the configuration.
- * @param key Config - A valid configuration key.
- * @return String - The value.
- */
- public String getString(Key key) {
- return this.util.getProperty(key.toString());
- }
-
- /**
- * Retrieves an integer from the configuration.
- * @param key Config - A valid configuration key.
- * @return int - The value.
- */
- public int getInt(Key key) {
- return Integer.parseInt(this.util.getProperty(key.toString()));
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/config/Spigot.java b/src/main/java/net/lewmc/kryptonite/kos/config/Spigot.java
deleted file mode 100644
index e8879bf..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/config/Spigot.java
+++ /dev/null
@@ -1,184 +0,0 @@
-package net.lewmc.kryptonite.kos.config;
-
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.utils.ConfigurationUtil;
-import net.lewmc.kryptonite.utils.LogUtil;
-import org.bukkit.command.CommandSender;
-
-/**
- * The Spigot class manages the spigot.yml configuration file.
- */
-public class Spigot {
- private final Kryptonite plugin;
- private final CommandSender user;
-
- /**
- * Constructor for the Spigot class.
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public Spigot(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
- }
-
- /**
- * Configuration values supported by this format.
- */
- public enum Key {
- VIEW_DISTANCE {
- @Override
- public String toString() { return "world-settings.default.view-distance"; }
- },
- MOB_SPAWN_RANGE {
- @Override
- public String toString() { return "world-settings.default.mob-spawn-range"; }
- },
- ENTITY_ACTIVATION_RANGE_ANIMALS {
- @Override
- public String toString() { return "world-settings.default.entity-activation-range.animals"; }
- },
- ENTITY_ACTIVATION_RANGE_MONSTERS {
- @Override
- public String toString() { return "world-settings.default.entity-activation-range.monsters"; }
- },
- ENTITY_ACTIVATION_RANGE_RAIDERS {
- @Override
- public String toString() { return "world-settings.default.entity-activation-range.raiders"; }
- },
- ENTITY_ACTIVATION_RANGE_MISC {
- @Override
- public String toString() { return "world-settings.default.entity-activation-range.misc"; }
- },
- ENTITY_ACTIVATION_RANGE_WATER {
- @Override
- public String toString() { return "world-settings.default.entity-activation-range.water"; }
- },
- ENTITY_ACTIVATION_RANGE_VILLAGERS {
- @Override
- public String toString() { return "world-settings.default.entity-activation-range.villagers"; }
- },
- ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS {
- @Override
- public String toString() { return "world-settings.default.entity-activation-range.flying-monsters"; }
- },
- ENTITY_TRACKING_RANGE_PLAYERS {
- @Override
- public String toString() { return "world-settings.default.entity-tracking-range.players"; }
- },
- ENTITY_TRACKING_RANGE_ANIMALS {
- @Override
- public String toString() { return "world-settings.default.entity-tracking-range.animals"; }
- },
- ENTITY_TRACKING_RANGE_MONSTERS {
- @Override
- public String toString() { return "world-settings.default.entity-tracking-range.monsters"; }
- },
- ENTITY_TRACKING_RANGE_MISC {
- @Override
- public String toString() { return "world-settings.default.entity-tracking-range.misc"; }
- },
- ENTITY_TRACKING_RANGE_OTHER {
- @Override
- public String toString() { return "world-settings.default.entity-tracking-range.other"; }
- },
- ENTITY_TRACKING_RANGE_DISPLAY {
- @Override
- public String toString() { return "world-settings.default.entity-tracking-range.display"; }
- },
- TICK_INACTIVE_VILLAGERS {
- @Override
- public String toString() { return "world-settings.default.entity-activation-range.tick-inactive-villagers"; }
- },
- NERF_SPAWNER_MOBS {
- @Override
- public String toString() { return "world-settings.default.nerf-spawner-mobs"; }
- },
- TICKS_PER_HOPPER_TRANSFER {
- @Override
- public String toString() { return "world-settings.default.ticks-per.hopper-transfer"; }
- },
- TICKS_PER_HOPPER_CHECK {
- @Override
- public String toString() { return "world-settings.default.ticks-per.hopper-check"; }
- }
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setInt(Key key, int value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("spigot.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>spigot.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public int getInt(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("spigot.yml");
- return cfg.getInt(key.toString());
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setBoolean(Key key, boolean value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("spigot.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>spigot.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public boolean getBoolean(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("spigot.yml");
- return cfg.getBoolean(key.toString());
- }
-
- /**
- * Sets a requested key to a requested value.
- * @param key Key - The requested key.
- * @param value int - The requested value.
- */
- public void setString(Key key, String value) {
- this.plugin.restartRequired = true;
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("spigot.yml");
- cfg.set(key.toString(), value);
- cfg.save();
-
- LogUtil log = new LogUtil(this.plugin);
- log.veboseInfo("KOS>spigot.yml set '" + key + "' to '" + value + "'");
- }
-
- /**
- * Gets a requested key's value.
- * @param key Key - The requested key.
- */
- public Object getObject(Key key) {
- ConfigurationUtil cfg = new ConfigurationUtil(this.plugin, this.user);
- cfg.load("spigot.yml");
- return cfg.get(key.toString());
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_AutoGUI.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_AutoGUI.java
index 70bb98e..b26cecd 100644
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_AutoGUI.java
+++ b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_AutoGUI.java
@@ -2,10 +2,10 @@
import de.themoep.inventorygui.InventoryGui;
import de.themoep.inventorygui.StaticGuiElement;
+import net.lewmc.foundry.Logger;
import net.lewmc.kryptonite.Kryptonite;
import net.lewmc.kryptonite.kos.AutoKOS;
import net.lewmc.kryptonite.utils.ConfigurationUtil;
-import net.lewmc.kryptonite.utils.LogUtil;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
@@ -50,7 +50,7 @@ public void show() {
* Adds pre-programmed elements to the GUI
*/
private void addElements() {
- LogUtil log = new LogUtil(this.plugin);
+ Logger log = new Logger(this.plugin.foundryConfig);
File folder = new File(this.plugin.getDataFolder(), "profiles");
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_BukkitGui.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_BukkitGui.java
deleted file mode 100644
index ca1134c..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_BukkitGui.java
+++ /dev/null
@@ -1,629 +0,0 @@
-package net.lewmc.kryptonite.kos.gui;
-
-import de.themoep.inventorygui.GuiElement;
-import de.themoep.inventorygui.InventoryGui;
-import de.themoep.inventorygui.StaticGuiElement;
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.Objects;
-
-/**
- * KOS Bukkit GUI
- */
-public class KOS_BukkitGui {
- private final Kryptonite plugin;
- private final CommandSender user;
- private InventoryGui gui;
- private Bukkit bukkit;
-
- /**
- * Constructor for the KOS Bukkit GUI
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public KOS_BukkitGui(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
-
- this.bukkit = new Bukkit(plugin, user);
- }
-
- /**
- * Shows the KOS Bukkit GUI
- */
- public void show() {
- InventoryHolder holder = this.user.getServer().getPlayer(this.user.getName());
- this.gui = new InventoryGui(this.plugin, holder, "KOS - Bukkit Configuration", this.getElements());
- this.addElements();
-
- this.gui.build();
- this.gui.show((Player) this.user);
- }
-
- /**
- * Adds pre-programmed elements to the GUI
- */
- private void addElements() {
- this.spawnLimitMonsters('a');
- this.spawnLimitAnimals('b');
- this.spawnLimitWaterAnimals('c');
- this.spawnLimitWaterAmbient('d');
- this.spawnLimitWaterUndergroundCreature('e');
- this.spawnLimitAxolotls('f');
- this.spawnLimitAmbient('g');
- this.ticksPerMonsterSpawns('h');
- this.ticksPerAnimalSpawns('i');
-
- this.ticksPerWaterSpawns('j');
- this.ticksPerWaterAmbientSpawns('k');
- this.ticksPerWaterUndergroundCreatureSpawns('l');
- this.ticksPerAxolotlSpawns('m');
- this.ticksPerAmbientSpawns('n');
- this.chunkGcPeriodInTicks('o');
-
- KOS_GuiConstants consts = new KOS_GuiConstants(this.plugin, this.gui);
- consts.addConstants();
- }
-
- /**
- * Determines where the elements should be positioned.
- * @return String[] - The position of the elements.
- */
- private String[] getElements() {
-
- return new String[]{
- "abcdefghi",
- "jklmno ",
- " w x y "
- };
- }
-
- private void spawnLimitMonsters(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.SPAWN_LIMITS_MONSTERS);
- if (value >= 20 && value <= 60) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_MONSTERS, click, value),
- ChatColor.DARK_GREEN + "Spawn Limit (Monsters)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 20) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_MONSTERS, click, value),
- ChatColor.GOLD + "Spawn Limit (Monsters)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_MONSTERS, click, value),
- ChatColor.DARK_RED + "Spawn Limit (Monsters)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void spawnLimitAnimals(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.SPAWN_LIMITS_ANIMALS);
- if (value >= 5 && value <= 10) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_ANIMALS, click, value),
- ChatColor.DARK_GREEN + "Spawn Limit (Animals)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_ANIMALS, click, value),
- ChatColor.GOLD + "Spawn Limit (Animals)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_ANIMALS, click, value),
- ChatColor.DARK_RED + "Spawn Limit (Animals)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void spawnLimitWaterAnimals(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.SPAWN_LIMITS_WATER_ANIMALS);
- if (value >= 2 && value <= 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_ANIMALS, click, value),
- ChatColor.DARK_GREEN + "Spawn Limit (Water Animals)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 2) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_ANIMALS, click, value),
- ChatColor.GOLD + "Spawn Limit (Water Animals)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_ANIMALS, click, value),
- ChatColor.DARK_RED + "Spawn Limit (Water Animals)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void spawnLimitWaterAmbient(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.SPAWN_LIMITS_WATER_AMBIENT);
- if (value >= 2 && value <= 10) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_AMBIENT, click, value),
- ChatColor.DARK_GREEN + "Spawn Limit (Water Ambient)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 2) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_AMBIENT, click, value),
- ChatColor.GOLD + "Spawn Limit (Water Ambient)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_AMBIENT, click, value),
- ChatColor.DARK_RED + "Spawn Limit (Water Ambient)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void spawnLimitWaterUndergroundCreature(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE);
- if (value >= 3 && value <= 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE, click, value),
- ChatColor.DARK_GREEN + "Spawn Limit (Water Ambient)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 3) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE, click, value),
- ChatColor.GOLD + "Spawn Limit (Water Ambient)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_WATER_UNDERGROUND_CREATURE, click, value),
- ChatColor.DARK_RED + "Spawn Limit (Water Ambient)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void spawnLimitAxolotls(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.SPAWN_LIMITS_AXOLOTLS);
- if (value >= 3 && value <= 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_AXOLOTLS, click, value),
- ChatColor.DARK_GREEN + "Spawn Limit (Axolotls)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 3) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_AXOLOTLS, click, value),
- ChatColor.GOLD + "Spawn Limit (Axolotls)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_AXOLOTLS, click, value),
- ChatColor.DARK_RED + "Spawn Limit (Axolotls)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void spawnLimitAmbient(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.SPAWN_LIMITS_AMBIENT);
- if (value >= 1 && value <= 10) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_AMBIENT, click, value),
- ChatColor.DARK_GREEN + "Spawn Limit (Ambient)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 1) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_AMBIENT, click, value),
- ChatColor.GOLD + "Spawn Limit (Ambient)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.SPAWN_LIMITS_AMBIENT, click, value),
- ChatColor.DARK_RED + "Spawn Limit (Ambient)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void ticksPerMonsterSpawns(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.TICKS_PER_MONSTER_SPAWNS);
- if (value >= 5 && value <= 15) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_MONSTER_SPAWNS, click, value),
- ChatColor.DARK_GREEN + "Ticks Per Monster Spawns",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_MONSTER_SPAWNS, click, value),
- ChatColor.DARK_RED + "Ticks Per Monster Spawns",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_MONSTER_SPAWNS, click, value),
- ChatColor.GOLD + "Ticks Per Monster Spawns",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void ticksPerAnimalSpawns(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.TICKS_PER_ANIMAL_SPAWNS);
- if (value == 400) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_ANIMAL_SPAWNS, click, value),
- ChatColor.DARK_GREEN + "Ticks Per Monster Spawns",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 400) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_ANIMAL_SPAWNS, click, value),
- ChatColor.DARK_RED + "Ticks Per Monster Spawns",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_ANIMAL_SPAWNS, click, value),
- ChatColor.GOLD + "Ticks Per Monster Spawns",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void ticksPerWaterSpawns(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.TICKS_PER_WATER_SPAWNS);
- if (value >= 100 && value <= 400) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_WATER_SPAWNS, click, value),
- ChatColor.DARK_GREEN + "Ticks Per Water Spawns",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_WATER_SPAWNS, click, value),
- ChatColor.DARK_RED + "Ticks Per Water Spawns",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_WATER_SPAWNS, click, value),
- ChatColor.GOLD + "Ticks Per Water Spawns",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void ticksPerWaterAmbientSpawns(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.TICKS_PER_WATER_AMBIENT_SPAWNS);
- if (value >= 100 && value <= 400) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_WATER_AMBIENT_SPAWNS, click, value),
- ChatColor.DARK_GREEN + "Ticks Per Water Ambient Spawns",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_WATER_AMBIENT_SPAWNS, click, value),
- ChatColor.DARK_RED + "Ticks Per Water Ambient Spawns",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_WATER_AMBIENT_SPAWNS, click, value),
- ChatColor.GOLD + "Ticks Per Water Ambient Spawns",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void ticksPerWaterUndergroundCreatureSpawns(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.TICKS_PER_WATER_UNDERGROUND_CREATURE_SPAWNS);
- if (value >= 100 && value <= 400) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_WATER_UNDERGROUND_CREATURE_SPAWNS, click, value),
- ChatColor.DARK_GREEN + "Ticks Per Water Ambient Spawns",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_WATER_UNDERGROUND_CREATURE_SPAWNS, click, value),
- ChatColor.DARK_RED + "Ticks Per Water Ambient Spawns",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_WATER_UNDERGROUND_CREATURE_SPAWNS, click, value),
- ChatColor.GOLD + "Ticks Per Water Ambient Spawns",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void ticksPerAxolotlSpawns(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.TICKS_PER_AXOLOTL_SPAWNS);
- if (value >= 100 && value <= 400) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_AXOLOTL_SPAWNS, click, value),
- ChatColor.DARK_GREEN + "Ticks Per Axolotl Spawns",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_AXOLOTL_SPAWNS, click, value),
- ChatColor.DARK_RED + "Ticks Per Axolotl Spawns",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_AXOLOTL_SPAWNS, click, value),
- ChatColor.GOLD + "Ticks Per Axolotl Spawns",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void ticksPerAmbientSpawns(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.TICKS_PER_AMBIENT_SPAWNS);
- if (value >= 100 && value <= 400) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_AMBIENT_SPAWNS, click, value),
- ChatColor.DARK_GREEN + "Ticks Per Ambient Spawns",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_AMBIENT_SPAWNS, click, value),
- ChatColor.DARK_RED + "Ticks Per Ambient Spawns",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.TICKS_PER_AMBIENT_SPAWNS, click, value),
- ChatColor.GOLD + "Ticks Per Ambient Spawns",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void chunkGcPeriodInTicks(char id) {
- int value = this.bukkit.getInt(Bukkit.Key.CHUNK_GC_PERIOD_IN_TICKS);
- if (value >= 400 && value <= 600) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.CHUNK_GC_PERIOD_IN_TICKS, click, value),
- ChatColor.DARK_GREEN + "Chunk GC Period (In Ticks)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.CHUNK_GC_PERIOD_IN_TICKS, click, value),
- ChatColor.DARK_RED + "Chunk GC Period (In Ticks)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Bukkit.Key.CHUNK_GC_PERIOD_IN_TICKS, click, value),
- ChatColor.DARK_RED + "Chunk GC Period (In Ticks)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private boolean setInt(Bukkit.Key key, GuiElement.Click click, int value) {
- click.getGui().close();
- if (click.getType() == ClickType.RIGHT) {
- this.bukkit.setInt(key, value + 1);
- } else if (click.getType() == ClickType.SHIFT_RIGHT) {
- this.bukkit.setInt(key, value + 10);
- } else if (click.getType() == ClickType.LEFT && value != 0) {
- this.bukkit.setInt(key, value - 1);
- } else if (click.getType() == ClickType.SHIFT_LEFT && value >= 10) {
- this.bukkit.setInt(key, value - 10);
- }
-
- this.show();
- return true;
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ConfigItemGui.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ConfigItemGui.java
new file mode 100644
index 0000000..9223a08
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ConfigItemGui.java
@@ -0,0 +1,240 @@
+package net.lewmc.kryptonite.kos.gui;
+
+import de.themoep.inventorygui.GuiElement;
+import de.themoep.inventorygui.InventoryGui;
+import de.themoep.inventorygui.StaticGuiElement;
+import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.config.*;
+import net.lewmc.kryptonite.utils.config.*;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * KOS Config Item GUI
+ */
+public class KOS_ConfigItemGui {
+ private final Kryptonite plugin;
+ private final CommandSender user;
+ private final Kryptonite.ConfigurationOptions type;
+ private ConfigCollection config;
+ private InventoryGui gui;
+
+ /**
+ * Constructor for the KOS Config Item GUI
+ * @param plugin Kryptonite - Reference to the main plugin class.
+ * @param user CommandSender - The user who sent the command.
+ * @param type Kryptonite.ConfigurationOptions - The type of GUI to display.
+ */
+ public KOS_ConfigItemGui(Kryptonite plugin, CommandSender user, Kryptonite.ConfigurationOptions type) {
+ this.plugin = plugin;
+ this.user = user;
+ this.type = type;
+ }
+
+ /**
+ * Shows the KOS Server Properties GUI
+ */
+ public void show() {
+ if (type == Kryptonite.ConfigurationOptions.MINECRAFT) {
+ this.config = new MinecraftConfig(plugin);
+ } else if (type == Kryptonite.ConfigurationOptions.BUKKIT) {
+ this.config = new BukkitConfig(plugin);
+ } else if (type == Kryptonite.ConfigurationOptions.SPIGOT) {
+ this.config = new SpigotConfig(plugin);
+ } else if (type == Kryptonite.ConfigurationOptions.PAPER_WORLD) {
+ this.config = new PaperWorldConfig(plugin);
+ } else if (type == Kryptonite.ConfigurationOptions.PURPUR) {
+ this.config = new PurpurConfig(plugin);
+ } else if (type == Kryptonite.ConfigurationOptions.PUFFERFISH) {
+ this.config = new PufferfishConfig(plugin);
+ } else if (type == Kryptonite.ConfigurationOptions.LEAF) {
+ this.config = new LeafConfig(plugin);
+ } else {
+ this.config = null;
+ }
+
+ this.gui = new InventoryGui(this.plugin, (Player) this.user, "KOS - Server Configuration", this.getElements());
+ this.addElements();
+
+ this.gui.build();
+ this.gui.show((Player) this.user);
+ }
+
+ /**
+ * Adds pre-programmed elements to the GUI
+ */
+ private void addElements() {
+ if (this.config != null) {
+ int index = 0;
+ for (Map.Entry entry : this.config.values.entrySet()) {
+ GenericConfigItem> config = entry.getValue();
+ char id = (char) ('a' + index);
+ plugin.getLogger().info("Adding config element: id=" + id + " index=" + index + " name=" + config.getName());
+
+ ItemStack display = buildDisplayItem(config);
+
+ this.gui.addElement(new StaticGuiElement(
+ id,
+ display,
+ 1,
+ click -> {
+ handleClick(config, click);
+ return true;
+ }
+ ));
+
+ index++;
+ }
+
+ KOS_GuiConstants consts = new KOS_GuiConstants(this.plugin, this.gui);
+ consts.addConstants();
+ }
+ }
+
+ private ItemStack buildDisplayItem(GenericConfigItem> config) {
+ Material material;
+
+ if (config.isValid()) {
+ material = (config.isIdeal()) ? Material.LIME_CONCRETE : Material.RED_CONCRETE;
+ } else {
+ material = Material.BLACK_CONCRETE;
+ }
+
+ ItemStack item = new ItemStack(material);
+ ItemMeta meta = item.getItemMeta();
+ List lore = new ArrayList<>();
+
+ String idealValue = config.getIdealValue();
+ if (config.isValid()) {
+ meta.setDisplayName(((config.isIdeal()) ? ChatColor.DARK_GREEN : ChatColor.DARK_RED) + config.getName());
+ lore.add(((config.isIdeal()) ? ChatColor.DARK_GREEN : ChatColor.DARK_RED) + String.valueOf(config.getValue()));
+ if (config.getDescription() != null) {
+ lore.addAll(config.getDescription().stream()
+ .map(line -> ((config.isIdeal()) ? ChatColor.GREEN : ChatColor.RED) + line)
+ .toList());
+ }
+ lore.add(ChatColor.WHITE + "Ideal value: " + ((idealValue != null) ? idealValue : "Any"));
+ } else {
+ meta.setDisplayName(ChatColor.DARK_GRAY + config.getName());
+ lore.add(ChatColor.GRAY + String.valueOf(config.getValue()));
+ if (config.getDescription() != null) {
+ lore.addAll(config.getDescription().stream()
+ .map(line -> ChatColor.GRAY + line)
+ .toList());
+ }
+ if (!config.dependencyIsEnabled()) {
+ lore.add(ChatColor.WHITE + "This feature requires another feature that");
+ lore.add(ChatColor.WHITE + "is currently disabled. Please enable it to");
+ lore.add(ChatColor.WHITE + "setup this item.");
+ } else {
+ lore.add(ChatColor.WHITE + "Invalid value.");
+ lore.add(ChatColor.WHITE + "Ideal value: " + ((idealValue != null) ? idealValue : "Any"));
+ }
+ }
+
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+
+ return item;
+ }
+
+ private void handleClick(GenericConfigItem> config, GuiElement.Click click) {
+ click.getGui().close();
+
+ if (config instanceof BooleanConfigItem boolItem) {
+ if (boolItem.willBeValid(!boolItem.getValue())) {
+ boolItem.setValue(!boolItem.getValue());
+ }
+ } else if (config instanceof IntegerConfigItem intItem) {
+ int current = intItem.getValue();
+ if (click.getType() == ClickType.RIGHT) {
+ if (intItem.willBeValid(intItem.getValue() + 1)) {
+ intItem.setValue(current + 1);
+ }
+ } else if (click.getType() == ClickType.SHIFT_RIGHT) {
+ if (intItem.willBeValid(intItem.getValue() + 10)) {
+ intItem.setValue(current + 10);
+ }
+ } else if (click.getType() == ClickType.LEFT) {
+ if (intItem.willBeValid(intItem.getValue() - 1)) {
+ intItem.setValue(current - 1);
+ }
+ } else if (click.getType() == ClickType.SHIFT_LEFT) {
+ if (intItem.willBeValid(intItem.getValue() - 10)) {
+ intItem.setValue(current - 10);
+ }
+ }
+ } else if (config instanceof DoubleConfigItem doubleItem) {
+ Double current = doubleItem.getValue();
+ if (click.getType() == ClickType.RIGHT) {
+ if (doubleItem.willBeValid(doubleItem.getValue() + 1.0)) {
+ doubleItem.setValue(current + 1.0);
+ }
+ } else if (click.getType() == ClickType.SHIFT_RIGHT) {
+ if (doubleItem.willBeValid(doubleItem.getValue() + 10.0)) {
+ doubleItem.setValue(current + 10.0);
+ }
+ } else if (click.getType() == ClickType.LEFT) {
+ if (doubleItem.willBeValid(doubleItem.getValue() - 1.0)) {
+ doubleItem.setValue(current - 1.0);
+ }
+ } else if (click.getType() == ClickType.SHIFT_LEFT) {
+ if (doubleItem.willBeValid(doubleItem.getValue() - 10.0)) {
+ doubleItem.setValue(current - 10.0);
+ }
+ }
+ } else if (config instanceof StringConfigItem stringItem) {
+ // TODO: Implement strings.
+ }
+
+ this.show();
+ }
+
+
+
+ /**
+ * Determines where the elements should be positioned.
+ * @return String[] - The position of the elements.
+ */
+ private String[] getElements() {
+ if (this.config != null && this.config.values != null) {
+ int rows = (int) Math.ceil(this.config.values.size() / 9.0);
+
+ // +1 row for the constant footer row
+ String[] layout = new String[rows + 1];
+
+ int index = 0;
+ for (int r = 0; r < rows; r++) {
+ StringBuilder row = new StringBuilder(" ");
+ for (int c = 0; c < 9 && index < this.config.values.size(); c++) {
+ char id = (char) ('a' + index);
+ row.setCharAt(c, id);
+ index++;
+ }
+ layout[r] = row.toString();
+ }
+
+ layout[rows] = " t u v ";
+ this.plugin.getLogger().info(Arrays.toString(layout));
+ for (int r = 0; r < layout.length; r++) {
+ plugin.getLogger().info("Layout row " + r + ": '" + layout[r] + "'");
+ }
+
+ return layout;
+ } else {
+ this.plugin.getLogger().severe("Unable to return elements: config is null.");
+ return new String[] {"",""," t u v "};
+ }
+ }
+
+}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_GuiConstants.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_GuiConstants.java
index 9a80c2c..8fd42ec 100644
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_GuiConstants.java
+++ b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_GuiConstants.java
@@ -29,7 +29,7 @@ public KOS_GuiConstants(Kryptonite plugin, InventoryGui gui) {
* Adds the 'w', 'x', and 'y' (help, alerts, and exit) positions to the selected GUI.
*/
public void addConstants() {
- this.gui.addElement(new StaticGuiElement('w',
+ this.gui.addElement(new StaticGuiElement('t',
new ItemStack(Material.BOOK),
1,
click -> {
@@ -43,7 +43,7 @@ public void addConstants() {
));
if (plugin.restartRequired) {
- this.gui.addElement(new StaticGuiElement('x',
+ this.gui.addElement(new StaticGuiElement('u',
new ItemStack(Material.YELLOW_CONCRETE),
1,
click -> true,
@@ -60,7 +60,7 @@ public void addConstants() {
));
}
- this.gui.addElement(new StaticGuiElement('y',
+ this.gui.addElement(new StaticGuiElement('v',
new ItemStack(Material.OAK_DOOR),
1,
click -> {
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_LeafGui.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_LeafGui.java
deleted file mode 100644
index a91a3ea..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_LeafGui.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package net.lewmc.kryptonite.kos.gui;
-
-import de.themoep.inventorygui.GuiElement;
-import de.themoep.inventorygui.InventoryGui;
-import de.themoep.inventorygui.StaticGuiElement;
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.Leaf;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-
-/**
- * KOS Leaf GUI
- */
-public class KOS_LeafGui {
- private final Kryptonite plugin;
- private final CommandSender user;
- private InventoryGui gui;
- private final Leaf leaf;
-
- /**
- * Constructor for the KOS Pufferfish GUI
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public KOS_LeafGui(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
-
- this.leaf = new Leaf(plugin, user);
- }
-
- /**
- * Shows the KOS Pufferfish GUI
- */
- public void show() {
- InventoryHolder holder = this.user.getServer().getPlayer(this.user.getName());
- this.gui = new InventoryGui(this.plugin, holder, "KOS - Leaf Configuration", this.getElements());
- this.addElements();
-
- this.gui.build();
- this.gui.show((Player) this.user);
- }
-
- /**
- * Adds pre-programmed elements to the GUI
- */
- private void addElements() {
- this.parallelWorldTracingEnabled('a');
-
- KOS_GuiConstants consts = new KOS_GuiConstants(this.plugin, this.gui);
- consts.addConstants();
- }
-
- /**
- * Determines where the elements should be positioned.
- * @return String[] - The position of the elements.
- */
- private String[] getElements() {
-
- return new String[]{
- "a ",
- " ",
- " w x y "
- };
- }
-
- private void parallelWorldTracingEnabled(char id) {
- boolean value = this.leaf.getBoolean(Leaf.Key.PARALLEL_WORLD_TRACING_ENABLED);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> { this.leaf.setBoolean(Leaf.Key.PARALLEL_WORLD_TRACING_ENABLED, false); return true; },
- ChatColor.GOLD + "Parallel World Tracing",
- ChatColor.YELLOW + "true",
- ChatColor.YELLOW + "Experimental feature, potentially unsafe.",
- ChatColor.YELLOW + "Potential performance gain.",
- ChatColor.YELLOW + "May cause issues with some plugins.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> { this.leaf.setBoolean(Leaf.Key.PARALLEL_WORLD_TRACING_ENABLED, true); return true; },
- ChatColor.GOLD + "Parallel World Tracing",
- ChatColor.YELLOW + "false",
- ChatColor.YELLOW + "Experimental feature, potentially unsafe.",
- ChatColor.YELLOW + "Potential performance gain.",
- ChatColor.YELLOW + "May cause issues with some plugins.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private boolean setInt(Leaf.Key key, GuiElement.Click click, int value, boolean canBeDefault) {
- click.getGui().close();
- if (click.getType() == ClickType.RIGHT) {
- this.leaf.setInt(key, value + 1);
- } else if (click.getType() == ClickType.SHIFT_RIGHT) {
- this.leaf.setInt(key, value + 10);
- } else if (click.getType() == ClickType.LEFT && value != 0) {
- this.leaf.setInt(key, value - 1);
- } else if (click.getType() == ClickType.SHIFT_LEFT && value >= 10) {
- this.leaf.setInt(key, value - 10);
- } else if ((click.getType() == ClickType.LEFT || click.getType() == ClickType.SHIFT_LEFT) && value == 0 && canBeDefault) {
- this.leaf.setString(key, "default");
- }
-
- this.show();
- return true;
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ManualGUI.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ManualGUI.java
index a93196c..f7ed643 100644
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ManualGUI.java
+++ b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ManualGUI.java
@@ -44,27 +44,28 @@ public void show() {
* Adds pre-programmed elements to the GUI
*/
private void addElements() {
- if (this.plugin.SupportedConfigurations.contains(Kryptonite.ConfigurationOptions.SERVER_PROPERTIES)) {
+ if (this.plugin.SupportedConfigurations.contains(Kryptonite.ConfigurationOptions.MINECRAFT)) {
this.gui.addElement(new StaticGuiElement('p',
new ItemStack(Material.COMMAND_BLOCK_MINECART),
1,
click -> {
click.getGui().close();
- KOS_ServerPropertiesGui spGui = new KOS_ServerPropertiesGui(this.plugin, this.user);
- spGui.show();
+ new KOS_ConfigItemGui(this.plugin, this.user, Kryptonite.ConfigurationOptions.MINECRAFT).show();
return true;
},
- ChatColor.BLUE + "Server",
- ChatColor.AQUA + "Manage the Server configuration."
+ ChatColor.BLUE + "Minecraft",
+ ChatColor.AQUA + "Manage Minecraft's configuration."
));
} else {
this.gui.addElement(new StaticGuiElement('p',
new ItemStack(Material.BARRIER),
1,
click -> true,
- ChatColor.DARK_RED + "Server",
- ChatColor.RED + "Manage the Server configuration.",
- ChatColor.RED + "Your server does not support this."
+ ChatColor.DARK_RED + "Minecraft",
+ ChatColor.RED + "Manage Minecraft's configuration.",
+ ChatColor.RED + "Your server does not support this, but it",
+ ChatColor.RED + "should. Please contact LewMC for help at",
+ ChatColor.RED + "lewmc.net/help"
));
}
@@ -74,8 +75,7 @@ private void addElements() {
1,
click -> {
click.getGui().close();
- KOS_BukkitGui bGui = new KOS_BukkitGui(this.plugin, this.user);
- bGui.show();
+ new KOS_ConfigItemGui(this.plugin, this.user, Kryptonite.ConfigurationOptions.BUKKIT).show();
return true;
},
ChatColor.BLUE + "Bukkit",
@@ -98,8 +98,7 @@ private void addElements() {
1,
click -> {
click.getGui().close();
- KOS_SpigotGui_1 spigGui = new KOS_SpigotGui_1(this.plugin, this.user);
- spigGui.show();
+ new KOS_ConfigItemGui(this.plugin, this.user, Kryptonite.ConfigurationOptions.SPIGOT).show();
return true;
},
ChatColor.BLUE + "Spigot",
@@ -144,8 +143,7 @@ private void addElements() {
1,
click -> {
click.getGui().close();
- KOS_PaperWorld_1 paperWorldGui = new KOS_PaperWorld_1(this.plugin, this.user);
- paperWorldGui.show();
+ new KOS_ConfigItemGui(this.plugin, this.user, Kryptonite.ConfigurationOptions.PAPER_WORLD).show();
return true;
},
ChatColor.BLUE + "Paper World",
@@ -168,8 +166,7 @@ private void addElements() {
1,
click -> {
click.getGui().close();
- KOS_PurpurGui purpurGui = new KOS_PurpurGui(this.plugin, this.user);
- purpurGui.show();
+ new KOS_ConfigItemGui(this.plugin, this.user, Kryptonite.ConfigurationOptions.PURPUR).show();
return true;
},
ChatColor.BLUE + "Purpur",
@@ -192,8 +189,7 @@ private void addElements() {
1,
click -> {
click.getGui().close();
- KOS_PufferfishGui pufferfishGui = new KOS_PufferfishGui(this.plugin, this.user);
- pufferfishGui.show();
+ new KOS_ConfigItemGui(this.plugin, this.user, Kryptonite.ConfigurationOptions.PUFFERFISH).show();
return true;
},
ChatColor.BLUE + "Pufferfish",
@@ -211,20 +207,19 @@ private void addElements() {
}
if (this.plugin.SupportedConfigurations.contains(Kryptonite.ConfigurationOptions.LEAF)) {
- this.gui.addElement(new StaticGuiElement('g',
+ this.gui.addElement(new StaticGuiElement('l',
new ItemStack(Material.OAK_LEAVES),
1,
click -> {
click.getGui().close();
- KOS_LeafGui leafGui = new KOS_LeafGui(this.plugin, this.user);
- leafGui.show();
+ new KOS_ConfigItemGui(this.plugin, this.user, Kryptonite.ConfigurationOptions.LEAF).show();
return true;
},
ChatColor.BLUE + "Leaf",
ChatColor.AQUA + "Manage the Leaf configuration."
));
} else {
- this.gui.addElement(new StaticGuiElement('f',
+ this.gui.addElement(new StaticGuiElement('l',
new ItemStack(Material.BARRIER),
1,
click -> true,
@@ -246,7 +241,7 @@ private String[] getElements() {
return new String[]{
" p b s g ",
- " o u f ",
+ " o u f l ",
" w x y "
};
}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_1.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_1.java
deleted file mode 100644
index b8cefab..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_1.java
+++ /dev/null
@@ -1,597 +0,0 @@
-package net.lewmc.kryptonite.kos.gui;
-
-import de.themoep.inventorygui.GuiElement;
-import de.themoep.inventorygui.InventoryGui;
-import de.themoep.inventorygui.StaticGuiElement;
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.PaperWorld;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-
-/**
- * KOS Paper World GUI (Page 1/5)
- */
-public class KOS_PaperWorld_1 {
- private final Kryptonite plugin;
- private final CommandSender user;
- private final PaperWorld paperWorld;
- private InventoryGui gui;
-
- /**
- * Constructor for the KOS Paper World GUI (Page 1/5)
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public KOS_PaperWorld_1(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
- this.paperWorld = new PaperWorld(plugin, user);
- }
-
- /**
- * Shows the KOS Paper World GUI (Page 1/5)
- */
- public void show() {
- InventoryHolder holder = this.user.getServer().getPlayer(this.user.getName());
- this.gui = new InventoryGui(this.plugin, holder, "KOS - Paper World Configuration (1/5)", this.getElements());
- this.addElements();
-
- this.gui.build();
- this.gui.show((Player) this.user);
- }
-
- /**
- * Adds pre-programmed elements to the GUI
- */
- private void addElements() {
- this.delayChunkUnloadsBy('a');
- this.maxAutosaveChunksPerTick('b');
- this.preventMovingIntoUnloadedChucks('c');
- this.entityPerChunkSaveLimitAreaEffectCloud('d');
- this.entityPerChunkSaveLimitArrow('e');
- this.entityPerChunkSaveLimitDragonFireball('f');
- this.entityPerChunkSaveLimitEgg('g');
- this.entityPerChunkSaveLimitEnderPearl('h');
- this.entityPerChunkSaveLimitExperienceBottle('i');
- this.entityPerChunkSaveLimitExperienceOrb('j');
- this.entityPerChunkSaveLimitEyeOfEnder('k');
- this.entityPerChunkSaveLimitFireball('l');
- this.entityPerChunkSaveLimitLlamaSpit('m');
- this.entityPerChunkSaveLimitPotion('n');
- this.entityPerChunkSaveLimitShulkerBullet('o');
- this.entityPerChunkSaveLimitSmallFireball('p');
- this.entityPerChunkSaveLimitSnowball('q');
- this.entityPerChunkSaveLimitSpectralArrow('r');
-
- KOS_GuiConstants consts = new KOS_GuiConstants(this.plugin, this.gui);
- consts.addConstants();
-
- this.gui.addElement(new StaticGuiElement('z',
- new ItemStack(Material.OAK_SIGN),
- 1,
- click -> {
- click.getGui().close();
- KOS_PaperWorld_2 nextGui = new KOS_PaperWorld_2(this.plugin, this.user);
- nextGui.show();
- return true;
- },
- ChatColor.WHITE + "Next page"
- ));
- }
-
- /**
- * Determines where the elements should be positioned.
- * @return String[] - The position of the elements.
- */
- private String[] getElements() {
-
- return new String[]{
- "abcdefghi",
- "jklmnopqr",
- " w x y z"
- };
- }
-
- private void delayChunkUnloadsBy(char id) {
- Object value = this.paperWorld.getObject(PaperWorld.Key.DELAY_CHUNK_UNLOADS_BY);
- if (value instanceof String && value == "default") {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.DELAY_CHUNK_UNLOADS_BY, click, 0, true),
- ChatColor.DARK_GREEN + "Delay Chunk Unloads By",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value instanceof String && value != "default") {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.WHITE_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.DELAY_CHUNK_UNLOADS_BY, click, (int) value, true),
- ChatColor.WHITE + "Delay Chunk Unloads By",
- ChatColor.GRAY + String.valueOf(value),
- ChatColor.GRAY + "'default' (lowest value) is ideal for most servers.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value instanceof Integer) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.WHITE_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.DELAY_CHUNK_UNLOADS_BY, click, (int) value, true),
- ChatColor.WHITE + "Delay Chunk Unloads By",
- ChatColor.GRAY + String.valueOf(value),
- ChatColor.GRAY + "'default' (lowest value) is ideal for most servers.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.BARRIER),
- 1,
- click -> true,
- ChatColor.DARK_RED + "Delay Chunk Unloads By",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Kryptonite cannot recognise this value, and therefore cannot edit it.",
- ChatColor.RED + "Please send a screenshot of this error to github.com/lewmc/kryptonite"
- ));
- }
- }
-
- private void maxAutosaveChunksPerTick(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.MAX_AUTOSAVE_CHUNKS_PER_TICK);
- if (value == 24) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.MAX_AUTOSAVE_CHUNKS_PER_TICK, click, value, false),
- ChatColor.DARK_GREEN + "Max Autosave Chunks Per Tick",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.MAX_AUTOSAVE_CHUNKS_PER_TICK, click, value, false),
- ChatColor.DARK_RED + "Max Autosave Chunks Per Tick",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Advanced players only - may cause performance issues if set incorrectly.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void preventMovingIntoUnloadedChucks(char id) {
- boolean value = this.paperWorld.getBoolean(PaperWorld.Key.PREVENT_MOVING_INTO_UNLOADED_CHUNKS);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.paperWorld.setBoolean(PaperWorld.Key.PREVENT_MOVING_INTO_UNLOADED_CHUNKS, false);
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "Prevent Moving into Unloaded Chunks",
- ChatColor.GREEN + "true",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.paperWorld.setBoolean(PaperWorld.Key.PREVENT_MOVING_INTO_UNLOADED_CHUNKS, true);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Prevent Moving into Unloaded Chunks",
- ChatColor.RED + "false",
- ChatColor.RED + "Heavy impact to performance.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitAreaEffectCloud(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_AREA_EFFECT_CLOUD);
- if (value < 11) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_AREA_EFFECT_CLOUD, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Area Effect Cloud)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_AREA_EFFECT_CLOUD, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Area Effect Cloud)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitArrow(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ARROW);
- if (value < 20) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ARROW, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Arrow)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ARROW, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Arrow)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitDragonFireball(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_DRAGON_FIREBALL);
- if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_DRAGON_FIREBALL, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Dragon Fireball)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_DRAGON_FIREBALL, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Dragon Fireball)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitEgg(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EGG);
- if (value < 9) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EGG, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Egg)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EGG, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Egg)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitEnderPearl(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ENDER_PEARL);
- if (value < 9) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ENDER_PEARL, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Ender Pearl)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_ENDER_PEARL, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Ender Pearl)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitExperienceBottle(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_BOTTLE);
- if (value < 4) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_BOTTLE, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Experience Bottle)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_BOTTLE, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Experience Bottle)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitExperienceOrb(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_ORB);
- if (value < 21) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_ORB, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Experience Orb)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EXPERIENCE_ORB, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Experience Orb)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitEyeOfEnder(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EYE_OF_ENDER);
- if (value < 11) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EYE_OF_ENDER, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Eye of Ender)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_EYE_OF_ENDER, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Eye of Ender)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitFireball(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_FIREBALL);
- if (value < 11) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_FIREBALL, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Fireball)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_FIREBALL, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Fireball)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitLlamaSpit(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_LLAMA_SPIT);
- if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_LLAMA_SPIT, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Llama Spit)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_LLAMA_SPIT, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Llama Spit)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitPotion(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_POTION);
- if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_POTION, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Potion)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_POTION, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Potion)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitShulkerBullet(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SHULKER_BULLET);
- if (value < 9) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SHULKER_BULLET, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Shulker Bullet)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SHULKER_BULLET, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Shulker Bullet)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitSmallFireball(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SMALL_FIREBALL);
- if (value < 11) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SMALL_FIREBALL, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Small Fireball)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SMALL_FIREBALL, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Small Fireball)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitSnowball(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SNOWBALL);
- if (value < 21) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SNOWBALL, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Snowball)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SNOWBALL, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Snowball)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityPerChunkSaveLimitSpectralArrow(char id) {
- int value = this.paperWorld.getInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SPECTRAL_ARROW);
- if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SPECTRAL_ARROW, click, value, false),
- ChatColor.DARK_GREEN + "Entity Per Chunk Save Limit (Spectral Arrow)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(PaperWorld.Key.ENTITY_PER_CHUNK_SAVE_LIMIT_SPECTRAL_ARROW, click, value, false),
- ChatColor.DARK_RED + "Entity Per Chunk Save Limit (Spectral Arrow)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to chunk loading performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private boolean setInt(PaperWorld.Key key, GuiElement.Click click, int value, boolean canBeDefault) {
- click.getGui().close();
- if (click.getType() == ClickType.RIGHT) {
- this.paperWorld.setInt(key, value + 1);
- } else if (click.getType() == ClickType.SHIFT_RIGHT) {
- this.paperWorld.setInt(key, value + 10);
- } else if (click.getType() == ClickType.LEFT && value != 0) {
- this.paperWorld.setInt(key, value - 1);
- } else if (click.getType() == ClickType.SHIFT_LEFT && value >= 10) {
- this.paperWorld.setInt(key, value - 10);
- } else if ((click.getType() == ClickType.LEFT || click.getType() == ClickType.SHIFT_LEFT) && value == 0 && canBeDefault) {
- this.paperWorld.setString(key, "default");
- }
-
- this.show();
- return true;
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_2.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_2.java
index db60002..e915675 100644
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_2.java
+++ b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_2.java
@@ -15,7 +15,9 @@
/**
* KOS Paper World GUI (Page 2/5)
+ * @deprecated
*/
+@Deprecated
public class KOS_PaperWorld_2 {
private final Kryptonite plugin;
private final CommandSender user;
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_3.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_3.java
index 5102886..eb3983b 100644
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_3.java
+++ b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_3.java
@@ -16,7 +16,9 @@
/**
* KOS Paper World GUI (Page 3/5)
+ * @deprecated
*/
+@Deprecated
public class KOS_PaperWorld_3 {
private final Kryptonite plugin;
private final CommandSender user;
@@ -36,7 +38,7 @@ public KOS_PaperWorld_3(Kryptonite plugin, CommandSender user) {
this.paperWorld = new PaperWorld(plugin, user);
SoftwareUtil sw = new SoftwareUtil(this.plugin);
- this.dabEnabled = sw.dabEnabled(this.user);
+ this.dabEnabled = sw.dabEnabled();
this.isAltItemDespawnRateEnabled = this.paperWorld.getBoolean(PaperWorld.Key.ALT_ITEM_DESPAWN_RATE_ENABLED);
}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_4.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_4.java
index 18b1b77..a244fa7 100644
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_4.java
+++ b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_4.java
@@ -15,7 +15,9 @@
/**
* KOS Paper World GUI (Page 4/5)
+ * @deprecated
*/
+@Deprecated
public class KOS_PaperWorld_4 {
private final Kryptonite plugin;
private final CommandSender user;
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_5.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_5.java
index eeff083..7924bbb 100644
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_5.java
+++ b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PaperWorld_5.java
@@ -15,7 +15,9 @@
/**
* KOS Paper World GUI (Page 5/5)
+ * @deprecated
*/
+@Deprecated
public class KOS_PaperWorld_5 {
private final Kryptonite plugin;
private final CommandSender user;
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PufferfishGui.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PufferfishGui.java
deleted file mode 100644
index 368b59b..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PufferfishGui.java
+++ /dev/null
@@ -1,390 +0,0 @@
-package net.lewmc.kryptonite.kos.gui;
-
-import de.themoep.inventorygui.GuiElement;
-import de.themoep.inventorygui.InventoryGui;
-import de.themoep.inventorygui.StaticGuiElement;
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.Pufferfish;
-import net.lewmc.kryptonite.kos.config.ServerProperties;
-import net.lewmc.kryptonite.kos.config.Spigot;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-
-/**
- * KOS Pufferfish GUI
- */
-public class KOS_PufferfishGui {
- private final Kryptonite plugin;
- private final CommandSender user;
- private final int simulationDistance;
- private InventoryGui gui;
- private Pufferfish pufferfish;
-
- /**
- * Constructor for the KOS Pufferfish GUI
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public KOS_PufferfishGui(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
- this.simulationDistance = (new ServerProperties(plugin).getInt(ServerProperties.Key.SIMULATION_DISTANCE) -1)*16;
-
- this.pufferfish = new Pufferfish(plugin, user);
- }
-
- /**
- * Shows the KOS Pufferfish GUI
- */
- public void show() {
- InventoryHolder holder = this.user.getServer().getPlayer(this.user.getName());
- this.gui = new InventoryGui(this.plugin, holder, "KOS - Pufferfish Configuration", this.getElements());
- this.addElements();
-
- this.gui.build();
- this.gui.show((Player) this.user);
- }
-
- /**
- * Adds pre-programmed elements to the GUI
- */
- private void addElements() {
- this.maxLoadsPerProjectile('a');
- this.dabEnabled('b');
- this.dabMaxTickFreq('c');
- this.dabActivationDistMod('d');
- this.enableAsyncMobSpawning('e');
- this.enableSuffocationOptimization('f');
- this.inactiveGoalSelectorThrottle('g');
- this.disableMethodProfiler('h');
-
- KOS_GuiConstants consts = new KOS_GuiConstants(this.plugin, this.gui);
- consts.addConstants();
- }
-
- /**
- * Determines where the elements should be positioned.
- * @return String[] - The position of the elements.
- */
- private String[] getElements() {
-
- return new String[]{
- "abcdefgh ",
- " ",
- " w x y "
- };
- }
-
- private void maxLoadsPerProjectile(char id) {
- int value = this.pufferfish.getInt(Pufferfish.Key.MAX_LOADS_PER_PROJECTILE);
- if (value >= 8 && value <= 12) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Pufferfish.Key.MAX_LOADS_PER_PROJECTILE, click, value, false),
- ChatColor.DARK_GREEN + "Max Loads per Projectile",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 8) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Pufferfish.Key.MAX_LOADS_PER_PROJECTILE, click, value, false),
- ChatColor.GOLD + "Max Loads per Projectile",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.YELLOW + "May cause issues with tridents and ender pearls.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Pufferfish.Key.MAX_LOADS_PER_PROJECTILE, click, value, false),
- ChatColor.DARK_RED + "Max Loads per Projectile",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.RED + "Hopper-based clocks and item sorting systems may also break.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void dabEnabled(char id) {
- boolean value = this.pufferfish.getBoolean(Pufferfish.Key.DAB_ENABLED);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.DAB_ENABLED, true);
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "DAB Enabled",
- ChatColor.GREEN + "true",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.DAB_ENABLED, true);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Max Loads per Projectile",
- ChatColor.RED + "false",
- ChatColor.RED + "Impact to performance.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void dabMaxTickFreq(char id) {
- int value = this.pufferfish.getInt(Pufferfish.Key.DAB_MAX_TICK_FREQ);
- if (value == 20) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Pufferfish.Key.DAB_MAX_TICK_FREQ, click, value, false),
- ChatColor.DARK_GREEN + "DAB Max Tick Frequency",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 20) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Pufferfish.Key.DAB_MAX_TICK_FREQ, click, value, false),
- ChatColor.DARK_RED + "DAB Max Tick Frequency",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.RED + "If DAB is breaking mob farms, having this decreased will",
- ChatColor.RED + "improve your player experience, but may cost performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Pufferfish.Key.DAB_MAX_TICK_FREQ, click, value, false),
- ChatColor.GOLD + "DAB Max Tick Frequency",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.YELLOW + "May break mob farms or nerf mob behaviour.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void dabActivationDistMod(char id) {
- int value = this.pufferfish.getInt(Pufferfish.Key.DAB_ACTIVATION_DIST_MOD);
- if (value == 8 || value == 7) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Pufferfish.Key.DAB_ACTIVATION_DIST_MOD, click, value, false),
- ChatColor.DARK_GREEN + "DAB Activation Distance Modifier",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value > 8) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Pufferfish.Key.DAB_ACTIVATION_DIST_MOD, click, value, false),
- ChatColor.DARK_RED + "DAB Activation Distance Modifier",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.RED + "If DAB is breaking mob farms, having this increased will",
- ChatColor.RED + "improve your player experience, but may cost performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Pufferfish.Key.DAB_ACTIVATION_DIST_MOD, click, value, false),
- ChatColor.GOLD + "DAB Activation Distance Modifier",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.YELLOW + "May break mob farms or nerf mob behaviour.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void enableAsyncMobSpawning(char id) {
- boolean value = this.pufferfish.getBoolean(Pufferfish.Key.ENABLE_ASYNC_MOB_SPAWNING);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.ENABLE_ASYNC_MOB_SPAWNING, true);
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "Enable Async Mob Spawning",
- ChatColor.GREEN + "true",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.ENABLE_ASYNC_MOB_SPAWNING, true);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Enable Async Mob Spawning",
- ChatColor.RED + "false",
- ChatColor.RED + "Impact to performance.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void enableSuffocationOptimization(char id) {
- boolean value = this.pufferfish.getBoolean(Pufferfish.Key.ENABLE_SUFFOCATION_OPTIMIZATION);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.ENABLE_SUFFOCATION_OPTIMIZATION, true);
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "Enable Suffocation Optimization",
- ChatColor.GREEN + "true",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.ENABLE_SUFFOCATION_OPTIMIZATION, true);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Enable Suffocation Optimization",
- ChatColor.RED + "false",
- ChatColor.RED + "Impact to performance.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void inactiveGoalSelectorThrottle(char id) {
- boolean value = this.pufferfish.getBoolean(Pufferfish.Key.INACTIVE_GOAL_SELECTOR_THROTTLE);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.INACTIVE_GOAL_SELECTOR_THROTTLE, true);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Inactive Goal Selector Throttle",
- ChatColor.YELLOW + "true",
- ChatColor.YELLOW + "Impact to player experience.",
- ChatColor.YELLOW + "May have minor gameplay implications.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.INACTIVE_GOAL_SELECTOR_THROTTLE, true);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Inactive Goal Selector Throttle",
- ChatColor.RED + "false",
- ChatColor.RED + "Impact to performance.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void disableMethodProfiler(char id) {
- boolean value = this.pufferfish.getBoolean(Pufferfish.Key.DISABLE_METHOD_PROFILER);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.DISABLE_METHOD_PROFILER, true);
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "Disable Method Profiler",
- ChatColor.GREEN + "true",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.pufferfish.setBoolean(Pufferfish.Key.DISABLE_METHOD_PROFILER, true);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Disable Method Profiler",
- ChatColor.RED + "false",
- ChatColor.RED + "Impact to performance - this is not necessary in",
- ChatColor.RED + "production environments.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private boolean setInt(Pufferfish.Key key, GuiElement.Click click, int value, boolean canBeDefault) {
- click.getGui().close();
- if (click.getType() == ClickType.RIGHT) {
- this.pufferfish.setInt(key, value + 1);
- } else if (click.getType() == ClickType.SHIFT_RIGHT) {
- this.pufferfish.setInt(key, value + 10);
- } else if (click.getType() == ClickType.LEFT && value != 0) {
- this.pufferfish.setInt(key, value - 1);
- } else if (click.getType() == ClickType.SHIFT_LEFT && value >= 10) {
- this.pufferfish.setInt(key, value - 10);
- } else if ((click.getType() == ClickType.LEFT || click.getType() == ClickType.SHIFT_LEFT) && value == 0 && canBeDefault) {
- this.pufferfish.setString(key, "default");
- }
-
- this.show();
- return true;
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PurpurGui.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PurpurGui.java
deleted file mode 100644
index 4797266..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_PurpurGui.java
+++ /dev/null
@@ -1,463 +0,0 @@
-package net.lewmc.kryptonite.kos.gui;
-
-import de.themoep.inventorygui.GuiElement;
-import de.themoep.inventorygui.InventoryGui;
-import de.themoep.inventorygui.StaticGuiElement;
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.Purpur;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-
-/**
- * KOS Purpur GUI
- */
-public class KOS_PurpurGui {
- private final Kryptonite plugin;
- private final CommandSender user;
- private final Purpur purpur;
- private InventoryGui gui;
-
- /**
- * Constructor for the KOS Purpur GUI
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public KOS_PurpurGui(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
-
- this.purpur = new Purpur(plugin, user);
- }
-
- /**
- * Shows the KOS Purpur GUI
- */
- public void show() {
- InventoryHolder holder = this.user.getServer().getPlayer(this.user.getName());
- this.gui = new InventoryGui(this.plugin, holder, "KOS - Purpur Configuration", this.getElements());
- this.addElements();
-
- this.gui.build();
- this.gui.show((Player) this.user);
- }
-
- /**
- * Adds pre-programmed elements to the GUI
- */
- private void addElements() {
- this.useAlternateKeepalive('a');
- this.zombieAggressiveTowardsVillagerWhenLagging('b');
- this.entitiesCanUsePortals('c');
- this.villagerIsLobotomized('d');
- this.villagerSearchRadiusAcquirePoi('e');
- this.villagerSearchRadiusNearestBedSensor('f');
- this.dolphinDisableTreasureSearching('g');
- this.teleportIfOutsideBorder('h');
- this.laggingThreshold('i');
-
- KOS_GuiConstants consts = new KOS_GuiConstants(this.plugin, this.gui);
- consts.addConstants();
- }
-
- /**
- * Determines where the elements should be positioned.
- * @return String[] - The position of the elements.
- */
- private String[] getElements() {
-
- return new String[]{
- "abcdefghi",
- " ",
- " w x y "
- };
- }
-
- private void useAlternateKeepalive(char id) {
- boolean value = this.purpur.getBoolean(Purpur.Key.USE_ALTERNATE_KEEPALIVE);
- if (value) {
- if (this.plugin.getConfig().getBoolean("using-tcpshield")) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.USE_ALTERNATE_KEEPALIVE, false);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Use Alternate Keepalive",
- ChatColor.YELLOW + "true",
- ChatColor.YELLOW + "You've indicated that you're using TCPShield, this feature",
- ChatColor.YELLOW + "has a known compatability issue and may not work correctly.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.USE_ALTERNATE_KEEPALIVE, false);
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "Use Alternate Keepalive",
- ChatColor.GREEN + "true",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- } else {
- if (this.plugin.getConfig().getBoolean("using-tcpshield")) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.USE_ALTERNATE_KEEPALIVE, true);
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "Use Alternate Keepalive",
- ChatColor.GREEN + "false",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.GREEN + "You've indicated that you're using TCPShield, this feature",
- ChatColor.GREEN + "has a known compatability issue and may not work correctly.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.USE_ALTERNATE_KEEPALIVE, true);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Use Alternate Keepalive",
- ChatColor.YELLOW + "false",
- ChatColor.YELLOW + "Impact to player experience.",
- ChatColor.YELLOW + "Enabling this prevents players from timing out as often.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
- }
-
- private void zombieAggressiveTowardsVillagerWhenLagging(char id) {
- boolean value = this.purpur.getBoolean(Purpur.Key.ZOMBIE_AGGRESSIVE_TOWARDS_VILLAGER_WHEN_LAGGING);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.ZOMBIE_AGGRESSIVE_TOWARDS_VILLAGER_WHEN_LAGGING, false);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Zombie Aggressive Towards Villager When Lagging",
- ChatColor.YELLOW + "true",
- ChatColor.YELLOW + "Impact to player experience - vanilla behaviour will be",
- ChatColor.YELLOW + "lost if the server's TPS is below the lag threshold.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.ZOMBIE_AGGRESSIVE_TOWARDS_VILLAGER_WHEN_LAGGING, true);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Zombie Aggressive Towards Villager When Lagging",
- ChatColor.RED + "false",
- ChatColor.RED + "Impact to performance.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void entitiesCanUsePortals(char id) {
- boolean value = this.purpur.getBoolean(Purpur.Key.ENTITIES_CAN_USE_PORTALS);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.ENTITIES_CAN_USE_PORTALS, false);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Entities can use Portals",
- ChatColor.RED + "true",
- ChatColor.RED + "Impact to performance.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.ENTITIES_CAN_USE_PORTALS, true);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Entities can use Portals",
- ChatColor.YELLOW + "false",
- ChatColor.YELLOW + "Impact to player experience - entities can",
- ChatColor.YELLOW + "not use portals.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void villagerIsLobotomized(char id) {
- boolean value = this.purpur.getBoolean(Purpur.Key.VILLAGER_IS_LOBOTOMIZED);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.VILLAGER_IS_LOBOTOMIZED, false);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Villagers are Lobotomized",
- ChatColor.RED + "true",
- ChatColor.RED + "Impact to performance - ONLY ENABLE THIS IF",
- ChatColor.RED + "YOU'VE TRIED EVERYTHING ELSE TO REDUCE LAG.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.VILLAGER_IS_LOBOTOMIZED, true);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Villagers are Lobotomized",
- ChatColor.YELLOW + "false",
- ChatColor.YELLOW + "Impact to player experience - villagers will have",
- ChatColor.YELLOW + "no AI and not work as expected. ONLY ENABLE THIS",
- ChatColor.YELLOW + "IF YOU'VE TRIED EVERYTHING ELSE TO REDUCE LAG.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void villagerSearchRadiusAcquirePoi(char id) {
- int value = this.purpur.getInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_ACQUIRE_POI);
- if (value >= 16 && value <= 32) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_ACQUIRE_POI, click, value, false),
- ChatColor.DARK_GREEN + "Villager Search Radius (Acquire POI)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 16) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_ACQUIRE_POI, click, value, false),
- ChatColor.GOLD + "Villager Search Radius (Acquire POI)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Impact to player experience - villagers may",
- ChatColor.YELLOW + "struggle to detect job sites or beds.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_ACQUIRE_POI, click, value, false),
- ChatColor.DARK_RED + "Villager Search Radius (Acquire POI)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void villagerSearchRadiusNearestBedSensor(char id) {
- int value = this.purpur.getInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR);
- if (value >= 16 && value <= 32) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR, click, value, false),
- ChatColor.DARK_GREEN + "Villager Search Radius (Nearest Bed Sensor)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 16) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR, click, value, false),
- ChatColor.GOLD + "Villager Search Radius (Nearest Bed Sensor)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Impact to player experience - villagers may",
- ChatColor.YELLOW + "struggle to detect beds.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Purpur.Key.VILLAGER_SEARCH_RADIUS_NEAREST_BED_SENSOR, click, value, false),
- ChatColor.DARK_RED + "Villager Search Radius (Nearest Bed Sensor)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void dolphinDisableTreasureSearching(char id) {
- boolean value = this.purpur.getBoolean(Purpur.Key.DOLPHIN_DISABLE_TREASURE_SEARCHING);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.DOLPHIN_DISABLE_TREASURE_SEARCHING, false);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Dolphin Disable Treasure Searching",
- ChatColor.YELLOW + "true",
- ChatColor.YELLOW + "Impact to player experience - dolphins won't",
- ChatColor.YELLOW + "perform structure searches.",
- ChatColor.YELLOW + "Only enable if you have pre-generated your world.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.DOLPHIN_DISABLE_TREASURE_SEARCHING, true);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Dolphin Disable Treasure Searching",
- ChatColor.RED + "false",
- ChatColor.RED + "Impact to performance.",
- ChatColor.RED + "Only enable if you have pre-generated your world.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void teleportIfOutsideBorder(char id) {
- boolean value = this.purpur.getBoolean(Purpur.Key.TELEPORT_IF_OUTSIDE_BORDER);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.TELEPORT_IF_OUTSIDE_BORDER, false);
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "Teleport if Outside Border",
- ChatColor.GREEN + "true",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.purpur.setBoolean(Purpur.Key.TELEPORT_IF_OUTSIDE_BORDER, true);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Teleport if Outside Border",
- ChatColor.YELLOW + "false",
- ChatColor.YELLOW + "Impact to player experience - may allow for exploits.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void laggingThreshold(char id) {
- int value = this.purpur.getInt(Purpur.Key.LAGGING_THRESHOLD);
- if (value > 15 && value < 20) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Purpur.Key.LAGGING_THRESHOLD, click, value, false),
- ChatColor.DARK_GREEN + "Lagging Threshold",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range - If player experience is",
- ChatColor.GREEN + "being impacted you may wish to lower this.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value == 20) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Purpur.Key.LAGGING_THRESHOLD, click, value, false),
- ChatColor.GOLD + "Lagging Threshold",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Impact to player experience - this may break a",
- ChatColor.YELLOW + "number of in-game functions.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Purpur.Key.LAGGING_THRESHOLD, click, value, false),
- ChatColor.DARK_RED + "Lagging Threshold",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - may cause more lag. If player experience is",
- ChatColor.RED + "being impacted you may wish to lower this",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private boolean setInt(Purpur.Key key, GuiElement.Click click, int value, boolean canBeDefault) {
- click.getGui().close();
- if (click.getType() == ClickType.RIGHT) {
- this.purpur.setInt(key, value + 1);
- } else if (click.getType() == ClickType.SHIFT_RIGHT) {
- this.purpur.setInt(key, value + 10);
- } else if (click.getType() == ClickType.LEFT && value != 0) {
- this.purpur.setInt(key, value - 1);
- } else if (click.getType() == ClickType.SHIFT_LEFT && value >= 10) {
- this.purpur.setInt(key, value - 10);
- } else if ((click.getType() == ClickType.LEFT || click.getType() == ClickType.SHIFT_LEFT) && value == 0 && canBeDefault) {
- this.purpur.setString(key, "default");
- }
-
- this.show();
- return true;
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ServerPropertiesGui.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ServerPropertiesGui.java
deleted file mode 100644
index 379db95..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_ServerPropertiesGui.java
+++ /dev/null
@@ -1,282 +0,0 @@
-package net.lewmc.kryptonite.kos.gui;
-
-import de.themoep.inventorygui.GuiElement;
-import de.themoep.inventorygui.InventoryGui;
-import de.themoep.inventorygui.StaticGuiElement;
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.ServerProperties;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.Objects;
-
-/**
- * KOS Server Properties GUI
- */
-public class KOS_ServerPropertiesGui {
- private final Kryptonite plugin;
- private final CommandSender user;
- private InventoryGui gui;
- private ServerProperties properties;
-
- /**
- * Constructor for the KOS Server Properties GUI
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public KOS_ServerPropertiesGui(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
-
- this.properties = new ServerProperties(this.plugin);
- }
-
- /**
- * Shows the KOS Server Properties GUI
- */
- public void show() {
- InventoryHolder holder = this.user.getServer().getPlayer(this.user.getName());
- this.gui = new InventoryGui(this.plugin, holder, "KOS - Server Configuration", this.getElements());
- this.addElements();
-
- this.gui.build();
- this.gui.show((Player) this.user);
- }
-
- /**
- * Adds pre-programmed elements to the GUI
- */
- private void addElements() {
- this.networkCompressionThreshold('a');
- this.viewDistance('b');
- this.simulationDistance('c');
- this.syncChunkWrites('d');
- this.allowFlight('e');
-
- KOS_GuiConstants consts = new KOS_GuiConstants(this.plugin, this.gui);
- consts.addConstants();
- }
-
- /**
- * Determines where the elements should be positioned.
- * @return String[] - The position of the elements.
- */
- private String[] getElements() {
-
- return new String[]{
- " a b c d ",
- " e ",
- " w x y "
- };
- }
-
- private void networkCompressionThreshold(char id) {
- int value = this.properties.getInt(ServerProperties.Key.NETWORK_COMPRESSION_THRESHOLD);
- if (value == 256) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.NETWORK_COMPRESSION_THRESHOLD, click, value),
- ChatColor.DARK_GREEN + "Network Compression Threshold",
- ChatColor.GREEN + "256",
- ChatColor.GREEN + "Ideal value",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 256) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.NETWORK_COMPRESSION_THRESHOLD, click, value),
- ChatColor.DARK_RED + "Network Compression Threshold",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.NETWORK_COMPRESSION_THRESHOLD, click, value),
- ChatColor.DARK_RED + "Network Compression Threshold",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void viewDistance(char id) {
- int value = this.properties.getInt(ServerProperties.Key.VIEW_DISTANCE);
-
- if (value < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.VIEW_DISTANCE, click, value),
- ChatColor.DARK_RED + "View distance",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value > 10) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.VIEW_DISTANCE, click, value),
- ChatColor.DARK_RED + "View distance",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - large impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value > 8) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.VIEW_DISTANCE, click, value),
- ChatColor.DARK_RED + "View distance",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "High - moderate impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.VIEW_DISTANCE, click, value),
- ChatColor.DARK_GREEN + "View distance",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void simulationDistance(char id) {
- int viewDistance = this.properties.getInt(ServerProperties.Key.VIEW_DISTANCE);
- int simuDistance = this.properties.getInt(ServerProperties.Key.SIMULATION_DISTANCE);
-
- if (simuDistance < 5) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.SIMULATION_DISTANCE, click, simuDistance),
- ChatColor.DARK_RED + "Simulation Distance",
- ChatColor.RED + String.valueOf(simuDistance),
- ChatColor.RED + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (simuDistance <= viewDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.SIMULATION_DISTANCE, click, simuDistance),
- ChatColor.DARK_GREEN + "Simulation Distance",
- ChatColor.GREEN + String.valueOf(simuDistance),
- ChatColor.GREEN + "Lower or equal to view distance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(ServerProperties.Key.SIMULATION_DISTANCE, click, simuDistance),
- ChatColor.DARK_RED + "Simulation Distance",
- ChatColor.RED + String.valueOf(simuDistance),
- ChatColor.RED + "Higher than view distance - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void syncChunkWrites(char id) {
- String value = this.properties.getString(ServerProperties.Key.SYNC_CHUNK_WRITES);
-
- if (Objects.equals(value, "false")) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.properties.set(ServerProperties.Key.SYNC_CHUNK_WRITES, "true");
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Sync Chunk Writes",
- ChatColor.RED + "false",
- ChatColor.RED + "False - impact to player experience.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.properties.set(ServerProperties.Key.SYNC_CHUNK_WRITES, "false");
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "Sync Chunk Writes",
- ChatColor.GREEN + "true",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void allowFlight(char id) {
- String value = this.properties.getString(ServerProperties.Key.ALLOW_FLIGHT);
-
- if (Objects.equals(value, "false")) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.properties.set(ServerProperties.Key.ALLOW_FLIGHT, "true");
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Allow Flight",
- ChatColor.RED + "false",
- ChatColor.RED + "False - players may be kicked if it lags.",
- ChatColor.BLUE + "Click to toggle true/false"
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.properties.set(ServerProperties.Key.ALLOW_FLIGHT, "false");
- this.show();
- return true;
- },
- ChatColor.DARK_GREEN + "Allow Flight",
- ChatColor.GREEN + "true",
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Click to toggle true/false"
- ));
- }
- }
-
- private boolean setInt(ServerProperties.Key key, GuiElement.Click click, int value) {
- click.getGui().close();
- if (click.getType() == ClickType.RIGHT) {
- this.properties.set(key, String.valueOf(value + 1));
- } else if (click.getType() == ClickType.SHIFT_RIGHT) {
- this.properties.set(key, String.valueOf(value + 10));
- } else if (click.getType() == ClickType.LEFT && value != 0) {
- this.properties.set(key, String.valueOf(value - 1));
- } else if (click.getType() == ClickType.SHIFT_LEFT && value >= 10) {
- this.properties.set(key, String.valueOf(value - 10));
- }
- this.show();
- return true;
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_SpigotGui_1.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_SpigotGui_1.java
deleted file mode 100644
index 09ce313..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_SpigotGui_1.java
+++ /dev/null
@@ -1,755 +0,0 @@
-package net.lewmc.kryptonite.kos.gui;
-
-import de.themoep.inventorygui.GuiElement;
-import de.themoep.inventorygui.InventoryGui;
-import de.themoep.inventorygui.StaticGuiElement;
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.ServerProperties;
-import net.lewmc.kryptonite.kos.config.Spigot;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-
-/**
- * KOS Spigot GUI (Page 1/2)
- */
-public class KOS_SpigotGui_1 {
- private final Kryptonite plugin;
- private final CommandSender user;
- private final int simulationDistance;
- private InventoryGui gui;
- private final Spigot spigot;
-
- /**
- * Constructor for the KOS Spigot GUI (Page 1/2)
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public KOS_SpigotGui_1(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
- this.simulationDistance = (new ServerProperties(plugin).getInt(ServerProperties.Key.SIMULATION_DISTANCE) -1)*16;
-
- this.spigot = new Spigot(plugin, user);
- }
-
- /**
- * Shows the KOS Spigot GUI (Page 1/2)
- */
- public void show() {
- InventoryHolder holder = this.user.getServer().getPlayer(this.user.getName());
- this.gui = new InventoryGui(this.plugin, holder, "KOS - Spigot Configuration (1/2)", this.getElements());
- this.addElements();
-
- this.gui.build();
- this.gui.show((Player) this.user);
- }
-
- /**
- * Adds pre-programmed elements to the GUI
- */
- private void addElements() {
- this.viewDistance('a');
- this.mobSpawnRange('b');
- this.entityActivationRangeAnimals('c');
- this.entityActivationRangeMonsters('d');
- this.entityActivationRangeRaiders('e');
- this.entityActivationRangeMisc('f');
- this.entityActivationRangeWater('g');
- this.entityActivationRangeVillagers('h');
- this.entityActivationRangeFlyingMonsters('i');
- this.entityTrackingRangePlayers('j');
- this.entityTrackingRangeAnimals('k');
- this.entityTrackingRangeMonsters('l');
- this.entityTrackingRangeMisc('m');
- this.entityTrackingRangeOther('n');
- this.entityTrackingRangeDisplay('o');
- this.tickInactiveVillagers('p');
- this.nerfSpawnerMobs('q');
- this.ticksPerHopperTransfer('r');
-
- KOS_GuiConstants consts = new KOS_GuiConstants(this.plugin, this.gui);
- consts.addConstants();
-
- this.gui.addElement(new StaticGuiElement('z',
- new ItemStack(Material.OAK_SIGN),
- 1,
- click -> {
- click.getGui().close();
- KOS_SpigotGui_2 spigotGui2 = new KOS_SpigotGui_2(this.plugin, this.user);
- spigotGui2.show();
- return true;
- },
- ChatColor.WHITE + "Next page"
- ));
- }
-
- /**
- * Determines where the elements should be positioned.
- * @return String[] - The position of the elements.
- */
- private String[] getElements() {
-
- return new String[]{
- "abcdefghi",
- "jklmnopqr",
- " w x y z"
- };
- }
-
- private void viewDistance(char id) {
- Object value = this.spigot.getObject(Spigot.Key.VIEW_DISTANCE);
- if (value instanceof String) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.VIEW_DISTANCE, click, 0, true),
- ChatColor.DARK_GREEN + "View Distance",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Ideal.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value instanceof Integer) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.WHITE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.VIEW_DISTANCE, click, (int) value, true),
- ChatColor.WHITE + "View Distance",
- ChatColor.GRAY + String.valueOf(value),
- ChatColor.GRAY + "This value is ambiguous with other configuration options.",
- ChatColor.GRAY + "Recommended value is default (lowest value), and manage.",
- ChatColor.GRAY + "through the Server configuration menu instead.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.BARRIER),
- 1,
- click -> true,
- ChatColor.DARK_RED + "Spawn Limit (Monsters)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Kryptonite cannot recognise this value, and therefore cannot edit it.",
- ChatColor.RED + "Please send a screenshot of this error to github.com/lewmc/kryptonite"
- ));
- }
- }
-
- private void mobSpawnRange(char id) {
- int value = this.spigot.getInt(Spigot.Key.MOB_SPAWN_RANGE);
- if (value >= 3 && value <= 8) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.MOB_SPAWN_RANGE, click, value, false),
- ChatColor.DARK_GREEN + "Mob Spawn Range",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 3) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.MOB_SPAWN_RANGE, click, value, false),
- ChatColor.GOLD + "Mob Spawn Range",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.MOB_SPAWN_RANGE, click, value, false),
- ChatColor.DARK_RED + "Mob Spawn Range",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityActivationRangeAnimals(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_ANIMALS);
- if (value >= 16 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_ANIMALS, click, value, false),
- ChatColor.DARK_GREEN + "Entity Activation Range (Animals)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 16) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_ANIMALS, click, value, false),
- ChatColor.GOLD + "Entity Activation Range (Animals)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_ANIMALS, click, value, false),
- ChatColor.DARK_RED + "Entity Activation Range (Animals)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityActivationRangeMonsters(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MONSTERS);
- if (value >= 16 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MONSTERS, click, value, false),
- ChatColor.DARK_GREEN + "Entity Activation Range (Monsters)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 16) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MONSTERS, click, value, false),
- ChatColor.GOLD + "Entity Activation Range (Monsters)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MONSTERS, click, value, false),
- ChatColor.DARK_RED + "Entity Activation Range (Monsters)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityActivationRangeRaiders(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_RAIDERS);
- if (value >= 16 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_RAIDERS, click, value, false),
- ChatColor.DARK_GREEN + "Entity Activation Range (Raiders)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 16) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_RAIDERS, click, value, false),
- ChatColor.GOLD + "Entity Activation Range (Raiders)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_RAIDERS, click, value, false),
- ChatColor.DARK_RED + "Entity Activation Range (Raiders)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityActivationRangeMisc(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MISC);
- if (value >= 16 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MISC, click, value, false),
- ChatColor.DARK_GREEN + "Entity Activation Range (Misc)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 16) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MISC, click, value, false),
- ChatColor.GOLD + "Entity Activation Range (Misc)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_MISC, click, value, false),
- ChatColor.DARK_RED + "Entity Activation Range (Misc)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityActivationRangeWater(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_WATER);
- if (value >= 16 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_WATER, click, value, false),
- ChatColor.DARK_GREEN + "Entity Activation Range (Water)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 16) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_WATER, click, value, false),
- ChatColor.GOLD + "Entity Activation Range (Water)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_WATER, click, value, false),
- ChatColor.DARK_RED + "Entity Activation Range (Water)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityActivationRangeVillagers(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_VILLAGERS);
- if (value >= 16 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_VILLAGERS, click, value, false),
- ChatColor.DARK_GREEN + "Entity Activation Range (Villagers)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 16) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_VILLAGERS, click, value, false),
- ChatColor.GOLD + "Entity Activation Range (Villagers)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_VILLAGERS, click, value, false),
- ChatColor.DARK_RED + "Entity Activation Range (Villagers)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityActivationRangeFlyingMonsters(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS);
- if (value >= 16 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS, click, value, false),
- ChatColor.DARK_GREEN + "Entity Activation Range (Flying Monsters)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 16) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS, click, value, false),
- ChatColor.GOLD + "Entity Activation Range (Flying Monsters)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_ACTIVATION_RANGE_FLYING_MONSTERS, click, value, false),
- ChatColor.DARK_RED + "Entity Activation Range (Flying Monsters)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityTrackingRangePlayers(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_TRACKING_RANGE_PLAYERS);
- if (value >= 6 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_PLAYERS, click, value, false),
- ChatColor.DARK_GREEN + "Entity Tracking Range (Players)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_PLAYERS, click, value, false),
- ChatColor.GOLD + "Entity Tracking Range (Players)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_PLAYERS, click, value, false),
- ChatColor.DARK_RED + "Entity Tracking Range (Players)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityTrackingRangeAnimals(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_TRACKING_RANGE_ANIMALS);
- if (value >= 6 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_ANIMALS, click, value, false),
- ChatColor.DARK_GREEN + "Entity Tracking Range (Animals)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_ANIMALS, click, value, false),
- ChatColor.GOLD + "Entity Tracking Range (Animals)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_ANIMALS, click, value, false),
- ChatColor.DARK_RED + "Entity Tracking Range (Animals)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityTrackingRangeMonsters(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_TRACKING_RANGE_MONSTERS);
- if (value >= 6 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_MONSTERS, click, value, false),
- ChatColor.DARK_GREEN + "Entity Tracking Range (Monsters)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_MONSTERS, click, value, false),
- ChatColor.GOLD + "Entity Tracking Range (Monsters)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_MONSTERS, click, value, false),
- ChatColor.DARK_RED + "Entity Tracking Range (Monsters)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityTrackingRangeMisc(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_TRACKING_RANGE_MISC);
- if (value >= 6 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_MISC, click, value, false),
- ChatColor.DARK_GREEN + "Entity Tracking Range (Misc)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_MISC, click, value, false),
- ChatColor.GOLD + "Entity Tracking Range (Misc)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_MISC, click, value, false),
- ChatColor.DARK_RED + "Entity Tracking Range (Misc)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityTrackingRangeOther(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_TRACKING_RANGE_OTHER);
- if (value >= 6 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_OTHER, click, value, false),
- ChatColor.DARK_GREEN + "Entity Tracking Range (Other)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_OTHER, click, value, false),
- ChatColor.GOLD + "Entity Tracking Range (Other)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_OTHER, click, value, false),
- ChatColor.DARK_RED + "Entity Tracking Range (Other)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void entityTrackingRangeDisplay(char id) {
- int value = this.spigot.getInt(Spigot.Key.ENTITY_TRACKING_RANGE_DISPLAY);
- if (value >= 6 && value <= simulationDistance) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_DISPLAY, click, value, false),
- ChatColor.DARK_GREEN + "Entity Tracking Range (Display)",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Within ideal range.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value < 6) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_DISPLAY, click, value, false),
- ChatColor.GOLD + "Entity Tracking Range (Display)",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too low - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_DISPLAY, click, value, false),
- ChatColor.DARK_RED + "Entity Tracking Range (Display)",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too high - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private void tickInactiveVillagers(char id) {
- boolean value = this.spigot.getBoolean(Spigot.Key.TICK_INACTIVE_VILLAGERS);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.spigot.setBoolean(Spigot.Key.TICK_INACTIVE_VILLAGERS, false);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Tick Inactive Villagers",
- ChatColor.RED + "true",
- ChatColor.RED + "Impact to performance.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.spigot.setBoolean(Spigot.Key.TICK_INACTIVE_VILLAGERS, true);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Tick Inactive Villagers",
- ChatColor.YELLOW + "false",
- ChatColor.YELLOW + "Impact to player experience - villagers and iron farms",
- ChatColor.YELLOW + "may not work as expected without players nearby.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void nerfSpawnerMobs(char id) {
- boolean value = this.spigot.getBoolean(Spigot.Key.NERF_SPAWNER_MOBS);
- if (value) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.spigot.setBoolean(Spigot.Key.NERF_SPAWNER_MOBS, false);
- this.show();
- return true;
- },
- ChatColor.GOLD + "Nerf Spawner Mobs",
- ChatColor.YELLOW + "false",
- ChatColor.YELLOW + "Impact to player experience - mobs spawned by",
- ChatColor.YELLOW + "spawners will have no AI and do nothing.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> {
- click.getGui().close();
- this.spigot.setBoolean(Spigot.Key.NERF_SPAWNER_MOBS, true);
- this.show();
- return true;
- },
- ChatColor.DARK_RED + "Nerf Spawner Mobs",
- ChatColor.RED + "true",
- ChatColor.RED + "Impact to performance if players can move spawners.",
- ChatColor.BLUE + "Click to toggle true/false."
- ));
- }
- }
-
- private void ticksPerHopperTransfer(char id) {
- int value = this.spigot.getInt(Spigot.Key.TICKS_PER_HOPPER_TRANSFER);
- if (value == 8) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.TICKS_PER_HOPPER_TRANSFER, click, value, false),
- ChatColor.DARK_GREEN + "Ticks per Hopper Transfer",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value > 8) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.TICKS_PER_HOPPER_TRANSFER, click, value, false),
- ChatColor.GOLD + "Ticks per Hopper Transfer",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.ENTITY_TRACKING_RANGE_DISPLAY, click, value, false),
- ChatColor.DARK_RED + "Ticks per Hopper Transfer",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private boolean setInt(Spigot.Key key, GuiElement.Click click, int value, boolean canBeDefault) {
- click.getGui().close();
- if (click.getType() == ClickType.RIGHT) {
- this.spigot.setInt(key, value + 1);
- } else if (click.getType() == ClickType.SHIFT_RIGHT) {
- this.spigot.setInt(key, value + 10);
- } else if (click.getType() == ClickType.LEFT && value != 0) {
- this.spigot.setInt(key, value - 1);
- } else if (click.getType() == ClickType.SHIFT_LEFT && value >= 10) {
- this.spigot.setInt(key, value - 10);
- } else if ((click.getType() == ClickType.LEFT || click.getType() == ClickType.SHIFT_LEFT) && value == 0 && canBeDefault) {
- this.spigot.setString(key, "default");
- }
-
- this.show();
- return true;
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_SpigotGui_2.java b/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_SpigotGui_2.java
deleted file mode 100644
index d74479b..0000000
--- a/src/main/java/net/lewmc/kryptonite/kos/gui/KOS_SpigotGui_2.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package net.lewmc.kryptonite.kos.gui;
-
-import de.themoep.inventorygui.GuiElement;
-import de.themoep.inventorygui.InventoryGui;
-import de.themoep.inventorygui.StaticGuiElement;
-import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.ServerProperties;
-import net.lewmc.kryptonite.kos.config.Spigot;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.ClickType;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-
-/**
- * KOS Spigot GUI (Page 2/2)
- */
-public class KOS_SpigotGui_2 {
- private final Kryptonite plugin;
- private final CommandSender user;
- private InventoryGui gui;
- private final Spigot spigot;
-
- /**
- * Constructor for the KOS Spigot GUI (Page 2/2)
- * @param plugin Kryptonite - Reference to the main plugin class.
- * @param user CommandSender - The user who sent the command.
- */
- public KOS_SpigotGui_2(Kryptonite plugin, CommandSender user) {
- this.plugin = plugin;
- this.user = user;
-
- this.spigot = new Spigot(plugin, user);
- }
-
- /**
- * Shows the KOS Spigot GUI (Page 2/2)
- */
- public void show() {
- InventoryHolder holder = this.user.getServer().getPlayer(this.user.getName());
- this.gui = new InventoryGui(this.plugin, holder, "KOS - Spigot Configuration (2/2)", this.getElements());
- this.addElements();
-
- this.gui.build();
- this.gui.show((Player) this.user);
- }
-
- /**
- * Adds pre-programmed elements to the GUI
- */
- private void addElements() {
- this.ticksPerHopperCheck('a');
-
- KOS_GuiConstants consts = new KOS_GuiConstants(this.plugin, this.gui);
- consts.addConstants();
-
- this.gui.addElement(new StaticGuiElement('v',
- new ItemStack(Material.OAK_SIGN),
- 1,
- click -> {
- click.getGui().close();
- KOS_SpigotGui_1 spigotGui1 = new KOS_SpigotGui_1(this.plugin, this.user);
- spigotGui1.show();
- return true;
- },
- ChatColor.WHITE + "Previous page"
- ));
- }
-
- /**
- * Determines where the elements should be positioned.
- * @return String[] - The position of the elements.
- */
- private String[] getElements() {
-
- return new String[]{
- "a ",
- " ",
- "v w x y "
- };
- }
-
- private void ticksPerHopperCheck(char id) {
- int value = this.spigot.getInt(Spigot.Key.TICKS_PER_HOPPER_CHECK);
- if (value == 8) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.LIME_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.TICKS_PER_HOPPER_CHECK, click, value, false),
- ChatColor.DARK_GREEN + "Ticks per Hopper Check",
- ChatColor.GREEN + String.valueOf(value),
- ChatColor.GREEN + "Ideal value.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else if (value > 8) {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.ORANGE_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.TICKS_PER_HOPPER_CHECK, click, value, false),
- ChatColor.GOLD + "Ticks per Hopper Check",
- ChatColor.YELLOW + String.valueOf(value),
- ChatColor.YELLOW + "Too high - impact to player experience.",
- ChatColor.YELLOW + "Hopper-based clocks and item sorting systems may break.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- } else {
- this.gui.addElement(new StaticGuiElement(id,
- new ItemStack(Material.RED_CONCRETE),
- 1,
- click -> this.setInt(Spigot.Key.TICKS_PER_HOPPER_CHECK, click, value, false),
- ChatColor.DARK_RED + "Ticks per Hopper Check",
- ChatColor.RED + String.valueOf(value),
- ChatColor.RED + "Too low - impact to performance.",
- ChatColor.RED + "Hopper-based clocks and item sorting systems may also break.",
- ChatColor.BLUE + "Right click to increase - left click to decrease."
- ));
- }
- }
-
- private boolean setInt(Spigot.Key key, GuiElement.Click click, int value, boolean canBeDefault) {
- click.getGui().close();
- if (click.getType() == ClickType.RIGHT) {
- this.spigot.setInt(key, value + 1);
- } else if (click.getType() == ClickType.SHIFT_RIGHT) {
- this.spigot.setInt(key, value + 10);
- } else if (click.getType() == ClickType.LEFT && value != 0) {
- this.spigot.setInt(key, value - 1);
- } else if (click.getType() == ClickType.SHIFT_LEFT && value >= 10) {
- this.spigot.setInt(key, value - 10);
- } else if ((click.getType() == ClickType.LEFT || click.getType() == ClickType.SHIFT_LEFT) && value == 0 && canBeDefault) {
- this.spigot.setString(key, "default");
- }
-
- this.show();
- return true;
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/report/Report.java b/src/main/java/net/lewmc/kryptonite/report/Report.java
index e3c415f..380393b 100644
--- a/src/main/java/net/lewmc/kryptonite/report/Report.java
+++ b/src/main/java/net/lewmc/kryptonite/report/Report.java
@@ -1,26 +1,23 @@
package net.lewmc.kryptonite.report;
import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.Bukkit;
import net.lewmc.kryptonite.utils.MessageUtil;
import net.lewmc.kryptonite.utils.SoftwareUtil;
import org.bukkit.command.CommandSender;
public class Report {
private Kryptonite plugin;
- private CommandSender user;
private MessageUtil message;
private SoftwareUtil softwareUtil;
public void runReport(Kryptonite plugin, CommandSender user) {
this.plugin = plugin;
- this.user = user;
this.message = new MessageUtil(user);
this.softwareUtil = new SoftwareUtil(this.plugin);
}
private void runKOSReport() {
- if (this.softwareUtil.supportsServerProperties()) {
+ if (this.softwareUtil.supportsMinecraft()) {
message.Info("Reporting [1/7] Gathering server configuration.");
} else {
message.Info("Reporting [1/7] Server not supported, skipping...");
@@ -28,10 +25,10 @@ private void runKOSReport() {
if (this.softwareUtil.supportsCraftBukkit()) {
message.Info("Reporting [2/7] Gathering Bukkit configuration.");
- Bukkit bukkit = new Bukkit(this.plugin, this.user);
- for (Bukkit.Key item : Bukkit.Key.values()) {
+ //Bukkit bukkit = new Bukkit(this.plugin, this.user);
+ //for (Bukkit.Key item : Bukkit.Key.values()) {
- }
+ //}
} else {
message.Info("Reporting [2/7] Bukkit not supported, skipping...");
}
diff --git a/src/main/java/net/lewmc/kryptonite/utils/CompatablityUtil.java b/src/main/java/net/lewmc/kryptonite/utils/CompatablityUtil.java
index 240865d..98e3cd6 100644
--- a/src/main/java/net/lewmc/kryptonite/utils/CompatablityUtil.java
+++ b/src/main/java/net/lewmc/kryptonite/utils/CompatablityUtil.java
@@ -26,7 +26,13 @@ public List badPlugins() {
p.getName().equalsIgnoreCase("PluginManager") ||
p.getName().equalsIgnoreCase("AutoPluginLoader") ||
p.getName().equalsIgnoreCase("PlugMan") ||
- p.getName().equalsIgnoreCase("PlugManX")
+ p.getName().equalsIgnoreCase("PlugManX") ||
+ p.getName().equalsIgnoreCase("WildStacker") ||
+ p.getName().equalsIgnoreCase("FarmLimiter") ||
+ p.getName().equalsIgnoreCase("ChunkSpawnerLimiter") ||
+ p.getName().equalsIgnoreCase("AntiLagX") ||
+ p.getName().equalsIgnoreCase("WildTools") ||
+ p.getName().equalsIgnoreCase("AutoClear")
) {
badPlugins.add(p.getName());
}
diff --git a/src/main/java/net/lewmc/kryptonite/utils/ConfigurationUtil.java b/src/main/java/net/lewmc/kryptonite/utils/ConfigurationUtil.java
index 423ec6f..ba6417d 100644
--- a/src/main/java/net/lewmc/kryptonite/utils/ConfigurationUtil.java
+++ b/src/main/java/net/lewmc/kryptonite/utils/ConfigurationUtil.java
@@ -1,5 +1,6 @@
package net.lewmc.kryptonite.utils;
+import net.lewmc.foundry.Logger;
import net.lewmc.kryptonite.Kryptonite;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.InvalidConfigurationException;
@@ -12,7 +13,7 @@
*/
public class ConfigurationUtil {
private final MessageUtil message;
- private final LogUtil log;
+ private final Logger log;
private YamlConfiguration config;
private String path;
@@ -23,7 +24,7 @@ public class ConfigurationUtil {
*/
public ConfigurationUtil(Kryptonite plugin, CommandSender user) {
this.message = new MessageUtil(user);
- this.log = new LogUtil(plugin);
+ this.log = new Logger(plugin.foundryConfig);
}
/**
diff --git a/src/main/java/net/lewmc/kryptonite/utils/LogUtil.java b/src/main/java/net/lewmc/kryptonite/utils/LogUtil.java
index 4f03893..eddc472 100644
--- a/src/main/java/net/lewmc/kryptonite/utils/LogUtil.java
+++ b/src/main/java/net/lewmc/kryptonite/utils/LogUtil.java
@@ -14,10 +14,13 @@
/**
* LogUtil manages logging of information.
+ * @deprecated
*/
+@Deprecated
public class LogUtil {
private final Kryptonite plugin;
+ @Deprecated
private enum Type {
LOG_INFO {
@Override public String toString() { return "INFO"; }
@@ -33,7 +36,9 @@ private enum Type {
/**
* Constructor for the LogUtil class.
* @param plugin Kryptonite - Reference to the main plugin class.
+ * @deprecated
*/
+ @Deprecated
public LogUtil(Kryptonite plugin) {
this.plugin = plugin;
}
@@ -41,7 +46,9 @@ public LogUtil(Kryptonite plugin) {
/**
* Logs informational messages if verbose mode is on.
* @param message String - The message to log.
+ * @deprecated
*/
+ @Deprecated
public void veboseInfo(String message) {
message = "[Kryptonite] " + message;
@@ -55,7 +62,9 @@ public void veboseInfo(String message) {
/**
* Logs informational messages.
* @param message String - The message to log.
+ * @deprecated
*/
+ @Deprecated
public void info(String message) {
message = "[Kryptonite] " + message;
@@ -65,7 +74,9 @@ public void info(String message) {
/**
* Logs warning messages.
* @param message String - The message to log.
+ * @deprecated
*/
+ @Deprecated
public void warn(String message) {
message = "[Kryptonite] " + message;
@@ -75,7 +86,9 @@ public void warn(String message) {
/**
* Logs severe messages.
* @param message String - The message to log.
+ * @deprecated
*/
+ @Deprecated
public void severe(String message) {
message = "[Kryptonite] " + message;
@@ -86,7 +99,9 @@ public void severe(String message) {
* Logs informational messages.
* @param type Type - The type of message to log.
* @param message String - The message to log.
+ * @deprecated
*/
+ @Deprecated
private void logToFile(Type type, final String message) {
if (this.plugin.getConfig().getBoolean("logfile")) {
FoliaLib foliaLib = new FoliaLib(this.plugin);
diff --git a/src/main/java/net/lewmc/kryptonite/utils/PermissionUtil.java b/src/main/java/net/lewmc/kryptonite/utils/PermissionUtil.java
deleted file mode 100644
index 2a9aa6c..0000000
--- a/src/main/java/net/lewmc/kryptonite/utils/PermissionUtil.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package net.lewmc.kryptonite.utils;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import java.util.Objects;
-
-public class PermissionUtil {
- public boolean isOperator(CommandSender commandSender) {
- if (commandSender instanceof Player) {
- String player = commandSender.getName();
- return Objects.requireNonNull(Bukkit.getServer().getPlayer(player)).isOp();
- } else {
- return true;
- }
- }
-}
diff --git a/src/main/java/net/lewmc/kryptonite/utils/SoftwareUtil.java b/src/main/java/net/lewmc/kryptonite/utils/SoftwareUtil.java
index bc39de4..51c3c95 100644
--- a/src/main/java/net/lewmc/kryptonite/utils/SoftwareUtil.java
+++ b/src/main/java/net/lewmc/kryptonite/utils/SoftwareUtil.java
@@ -1,8 +1,8 @@
package net.lewmc.kryptonite.utils;
import net.lewmc.kryptonite.Kryptonite;
-import net.lewmc.kryptonite.kos.config.Pufferfish;
-import org.bukkit.command.CommandSender;
+import net.lewmc.kryptonite.config.PufferfishConfig;
+import net.lewmc.kryptonite.utils.config.BooleanConfigItem;
public class SoftwareUtil {
private final Kryptonite plugin;
@@ -11,8 +11,8 @@ public SoftwareUtil(Kryptonite plugin) {
this.plugin = plugin;
}
- public boolean supportsServerProperties() {
- return this.plugin.SupportedConfigurations.contains(Kryptonite.ConfigurationOptions.SERVER_PROPERTIES);
+ public boolean supportsMinecraft() {
+ return this.plugin.SupportedConfigurations.contains(Kryptonite.ConfigurationOptions.MINECRAFT);
}
public boolean supportsCraftBukkit() {
@@ -35,10 +35,9 @@ public boolean supportsPufferfish() {
return this.plugin.SupportedConfigurations.contains(Kryptonite.ConfigurationOptions.PUFFERFISH);
}
- public boolean dabEnabled(CommandSender cs) {
+ public boolean dabEnabled() {
if (this.supportsPufferfish()) {
- Pufferfish pf = new Pufferfish(this.plugin, cs);
- return pf.getBoolean(Pufferfish.Key.DAB_ENABLED);
+ return ((BooleanConfigItem)new PufferfishConfig(this.plugin).values.get(PufferfishConfig.Key.DAB_ENABLED.toString())).getValue();
} else {
return false;
}
diff --git a/src/main/java/net/lewmc/kryptonite/utils/UpdateUtil.java b/src/main/java/net/lewmc/kryptonite/utils/UpdateUtil.java
index ce90c0d..2cbd50e 100644
--- a/src/main/java/net/lewmc/kryptonite/utils/UpdateUtil.java
+++ b/src/main/java/net/lewmc/kryptonite/utils/UpdateUtil.java
@@ -1,6 +1,7 @@
package net.lewmc.kryptonite.utils;
import com.tchristofferson.configupdater.ConfigUpdater;
+import net.lewmc.foundry.Logger;
import net.lewmc.kryptonite.Kryptonite;
import java.io.File;
@@ -11,11 +12,11 @@
public class UpdateUtil {
private final Kryptonite plugin;
- private final LogUtil log;
+ private final Logger log;
public UpdateUtil(Kryptonite plugin) {
this.plugin = plugin;
- this.log = new LogUtil(plugin);
+ this.log = new Logger(plugin.foundryConfig);
}
public void VersionCheck() {
diff --git a/src/main/java/net/lewmc/kryptonite/utils/config/BooleanConfigItem.java b/src/main/java/net/lewmc/kryptonite/utils/config/BooleanConfigItem.java
new file mode 100644
index 0000000..2fe9087
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/utils/config/BooleanConfigItem.java
@@ -0,0 +1,95 @@
+package net.lewmc.kryptonite.utils.config;
+
+import net.lewmc.foundry.Logger;
+import net.lewmc.kryptonite.Kryptonite;
+
+import java.util.List;
+
+/**
+ * A boolean version of GenericConfigItem
+ * @since 2.1.0
+ */
+public class BooleanConfigItem extends GenericConfigItem {
+ /**
+ * The ideal value.
+ */
+ private final Boolean idealValue;
+
+ /**
+ * The Boolean config item.
+ * @param file String - The file the config item is located in.
+ * @param key String - The key of the config item within the file.
+ * @param name String - The config item's human-readable name.
+ * @param description List of Strings - The config item's description, for the GUI each String is a new line.
+ * @param dependencyIsEnabled Boolean - If the config's dependencies are enabled. If none, set to true.
+ * @param idealValue Boolean - String list of ideal values.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public BooleanConfigItem(String file, String key, String name, List description, Boolean dependencyIsEnabled, Boolean idealValue, Kryptonite plugin) {
+ super(file, key, name, description, dependencyIsEnabled, plugin);
+ this.idealValue = idealValue;
+ }
+
+ /**
+ * Retrieves the current value of the config item.
+ * @return Boolean - The config's current value.
+ */
+ @Override
+ public Boolean getValue() {
+ if (this.file.contains(".properties")) {
+ return Boolean.parseBoolean(propFile.getProperty(key));
+ } else if (this.file.contains(".yml") || file.contains(".yaml")) {
+ this.loadFile();
+ Boolean value = yamlFile.getBoolean(key);
+ yamlFile.close();
+ return value;
+ } else {
+ new Logger(this.plugin.foundryConfig).severe("Unable to load file: '"+this.file+"' extension not supported.");
+ return false;
+ }
+ }
+
+ /**
+ * Sets the current value of the config item.
+ * @param value Boolean - The config's current value.
+ */
+ @Override
+ public void setValue(Boolean value) {
+ if (this.file.contains(".properties")) {
+ propFile.setProperty(this.key, String.valueOf(value));
+ } else if (file.contains(".yml") || file.contains(".yaml")) {
+ this.loadFile();
+ yamlFile.set(this.key, value);
+ yamlFile.save();
+ }
+ }
+
+ /**
+ * Checks if the value will be valid.
+ * @param value Boolean - The value to check.
+ * @return boolean - Is it valid?
+ */
+ @Override
+ public boolean willBeValid(Boolean value) {
+ return this.dependencyIsEnabled;
+ }
+
+ /**
+ * Checks if the config value is ideal.
+ * @return boolean - Is it ideal?
+ */
+ @Override
+ public boolean isIdeal() {
+ if (idealValue == null) { return true; }
+ return getValue().equals(idealValue);
+ }
+
+ /**
+ * Returns the ideal value in human-readable, string format.
+ * @return String - The ideal value.
+ */
+ @Override
+ public String getIdealValue() {
+ return idealValue == null ? "any" : Boolean.toString(idealValue);
+ }
+}
diff --git a/src/main/java/net/lewmc/kryptonite/utils/config/ConfigCollection.java b/src/main/java/net/lewmc/kryptonite/utils/config/ConfigCollection.java
new file mode 100644
index 0000000..1f593dc
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/utils/config/ConfigCollection.java
@@ -0,0 +1,14 @@
+package net.lewmc.kryptonite.utils.config;
+
+import java.util.LinkedHashMap;
+
+/**
+ * Configuration data template for config files.
+ * @since 2.1.0
+ */
+public abstract class ConfigCollection {
+ /**
+ * Holds configuration data for the relevant file.
+ */
+ public LinkedHashMap values = new LinkedHashMap<>();
+}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/utils/config/DoubleConfigItem.java b/src/main/java/net/lewmc/kryptonite/utils/config/DoubleConfigItem.java
new file mode 100644
index 0000000..5a05a60
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/utils/config/DoubleConfigItem.java
@@ -0,0 +1,140 @@
+package net.lewmc.kryptonite.utils.config;
+
+import net.lewmc.foundry.Logger;
+import net.lewmc.kryptonite.Kryptonite;
+
+import java.util.List;
+
+/**
+ * A double version of GenericConfigItem
+ * @since 2.1.0
+ */
+public class DoubleConfigItem extends GenericConfigItem {
+ /**
+ * The minimum allowed value.
+ */
+ private final Double minValue;
+
+ /**
+ * The maximum allowed value.
+ */
+ private final Double maxValue;
+
+ /**
+ * The ideal value in String format (e.g. "7" or "1-5" meaning 1 to 5)
+ */
+ private final String idealValue;
+
+ /**
+ * The double config item.
+ * @param file String - The file the config item is located in.
+ * @param key String - The key of the config item within the file.
+ * @param name String - The config item's human-readable name.
+ * @param description List of Strings - The config item's description, for the GUI each String is a new line.
+ * @param dependencyIsEnabled Boolean - If the config's dependencies are enabled. If none, set to true.
+ * @param minValue Double - The minimum allowed value.
+ * @param maxValue Double - The maximum allowed value.
+ * @param idealValue String - The ideal value in String format (e.g. "7" or "1-5" meaning 1 to 5)
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public DoubleConfigItem(String file, String key, String name, List description, Boolean dependencyIsEnabled, Double minValue, Double maxValue, String idealValue, Kryptonite plugin) {
+ super(file, key, name, description, dependencyIsEnabled, plugin);
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ this.idealValue = idealValue;
+ }
+
+ /**
+ * Retrieves the current value of the config item.
+ * @return Double - The config's current value.
+ */
+ @Override
+ public Double getValue() {
+ if (this.file.contains(".properties")) {
+ try {
+ return Double.parseDouble(propFile.getProperty(key));
+ }
+ catch (NumberFormatException e) {
+ Logger l = new Logger(this.plugin.foundryConfig);
+ l.severe("Unable to parse key '"+this.key+"' in file '"+this.file+"' NumberFormatException");
+ l.severe(e.getMessage());
+ return 0.0;
+ }
+ } else if (this.file.contains(".yml") || file.contains(".yaml")) {
+ this.loadFile();
+ Double value = yamlFile.getDouble(key);
+ yamlFile.close();
+ return value;
+ } else {
+ new Logger(this.plugin.foundryConfig).severe("Unable to load file: '"+this.file+"' extension not supported.");
+ return 0.0;
+ }
+ }
+
+ /**
+ * Sets the current value of the config item.
+ * @param value Double - The config's current value.
+ */
+ @Override
+ public void setValue(Double value) {
+ if (this.file.contains(".properties")) {
+ propFile.setProperty(this.key, String.valueOf(value));
+ } else if (file.contains(".yml") || file.contains(".yaml")) {
+ this.loadFile();
+ yamlFile.set(this.key, value);
+ yamlFile.save();
+ }
+ }
+
+ /**
+ * Checks if the value will be valid.
+ * @param value Double - The value to check.
+ * @return boolean - Is it valid?
+ */
+ @Override
+ public boolean willBeValid(Double value) {
+ return dependencyIsEnabled && (value >= minValue && value <= maxValue);
+ }
+
+ /**
+ * Checks if the config value is ideal.
+ * @return boolean - Is it ideal?
+ */
+ @Override
+ public boolean isIdeal() {
+ if (idealValue == null) {
+ return true;
+ }
+
+ double current = this.getValue();
+ String trimmed = idealValue.trim();
+
+ if (trimmed.contains("-")) {
+ String[] parts = trimmed.split("-");
+ double minIdeal = Double.parseDouble(parts[0].trim());
+ double maxIdeal = Double.parseDouble(parts[1].trim());
+ return current >= minIdeal && current <= maxIdeal;
+ }
+
+ if (trimmed.startsWith(">")) {
+ double threshold = Double.parseDouble(trimmed.substring(1).trim());
+ return current > threshold;
+ }
+
+ if (trimmed.startsWith("<")) {
+ double threshold = Double.parseDouble(trimmed.substring(1).trim());
+ return current < threshold;
+ }
+
+ return current == Double.parseDouble(trimmed);
+ }
+
+ /**
+ * Returns the ideal value in human-readable, string format.
+ * @return String - The ideal value.
+ */
+ @Override
+ public String getIdealValue() {
+ return idealValue == null ? "any" : idealValue;
+ }
+}
diff --git a/src/main/java/net/lewmc/kryptonite/utils/config/GenericConfigItem.java b/src/main/java/net/lewmc/kryptonite/utils/config/GenericConfigItem.java
new file mode 100644
index 0000000..d11466f
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/utils/config/GenericConfigItem.java
@@ -0,0 +1,151 @@
+package net.lewmc.kryptonite.utils.config;
+
+import net.lewmc.foundry.Files;
+import net.lewmc.foundry.Logger;
+import net.lewmc.kryptonite.Kryptonite;
+import net.lewmc.kryptonite.utils.PropertiesUtil;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * A generic ConfigItem
+ * @since 2.1.0
+ * @param
+ */
+public abstract class GenericConfigItem {
+ /**
+ * Handles .yaml and .yml files.
+ */
+ protected Files yamlFile;
+
+ /**
+ * Handles .properties files.
+ */
+ protected PropertiesUtil propFile;
+
+ /**
+ * The file the config item is located in.
+ */
+ protected String file;
+
+ /**
+ * The key of the config item within the file.
+ */
+ protected String key;
+
+ /**
+ * The config item's human-readable name.
+ */
+ protected String name;
+
+ /**
+ * The config item's description, for the GUI each String is a new line.
+ */
+ protected List description;
+
+ /**
+ * If the config's dependencies are enabled. If none, set to true
+ */
+ protected Boolean dependencyIsEnabled;
+
+ /**
+ * Reference to the main Kryptonite class
+ */
+ protected Kryptonite plugin;
+
+ /**
+ * The generic config item.
+ * @param file String - The file the config item is located in.
+ * @param key String - The key of the config item within the file.
+ * @param name String - The config item's human-readable name.
+ * @param description List of Strings - The config item's description, for the GUI each String is a new line.
+ * @param dependencyIsEnabled Boolean - If the config's dependencies are enabled. If none, set to true.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public GenericConfigItem(String file, String key, String name, List description, Boolean dependencyIsEnabled, Kryptonite plugin) {
+ this.file = file;
+ this.key = key;
+ this.name = name;
+ this.description = description;
+ this.dependencyIsEnabled = dependencyIsEnabled;
+ this.plugin = plugin;
+ }
+
+ /**
+ * Loads the file.
+ */
+ public void loadFile() {
+ if (file.contains(".properties")) {
+ this.propFile = new PropertiesUtil(plugin.getServer().getWorldContainer() + File.separator + file);
+ } else if (file.contains(".yaml") || file.contains(".yml")) {
+ this.yamlFile = new Files(plugin.foundryConfig, plugin);
+ this.yamlFile.loadNoReformat(new File(this.plugin.getDataFolder(),"/../../"+file).getAbsoluteFile());
+ } else {
+ new Logger(plugin.foundryConfig).severe("Unable to load file '"+file+"' file extension not supported.");
+ new Logger(plugin.foundryConfig).severe("Expect additional errors.");
+ }
+ }
+
+ /**
+ * Should fetch the current value of the config item.
+ * @return T - The config's current value.
+ */
+ public abstract T getValue();
+
+ /**
+ * Should set the value of the config item.
+ * @param value T - The config's current value.
+ */
+ public abstract void setValue(T value);
+
+ /**
+ * Should check if the config value is valid.
+ * @return boolean - Is it valid?
+ */
+ public boolean isValid() {
+ return this.willBeValid(this.getValue());
+ }
+
+ /**
+ * Should check if the config value will be valid.
+ * @return boolean - Is it valid?
+ */
+ public abstract boolean willBeValid(T value);
+
+ /**
+ * Should check if the config value is ideal.
+ * @return boolean - Is it ideal?
+ */
+ public abstract boolean isIdeal();
+
+ /**
+ * Returns the ideal value in human-readable, string format.
+ * @return String - The ideal value.
+ */
+ public abstract String getIdealValue();
+
+ /**
+ * Returns the config item's name.
+ * @return String - The name.
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Returns the config item's description.
+ * @return List of Strings - The description.
+ */
+ public List getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Returns if the value's dependencies are enabled.
+ * @return boolean - Are they?
+ */
+ public Boolean dependencyIsEnabled() {
+ return this.dependencyIsEnabled;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/lewmc/kryptonite/utils/config/IntegerConfigItem.java b/src/main/java/net/lewmc/kryptonite/utils/config/IntegerConfigItem.java
new file mode 100644
index 0000000..10c4776
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/utils/config/IntegerConfigItem.java
@@ -0,0 +1,141 @@
+package net.lewmc.kryptonite.utils.config;
+
+import net.lewmc.foundry.Logger;
+import net.lewmc.kryptonite.Kryptonite;
+
+import java.util.List;
+
+/**
+ * An integer version of GenericConfigItem
+ * @since 2.1.0
+ */
+public class IntegerConfigItem extends GenericConfigItem {
+ /**
+ * The minimum allowed value.
+ */
+ private final int minValue;
+
+ /**
+ * The maximum allowed value.
+ */
+ private final int maxValue;
+
+ /**
+ * The ideal value in String format (e.g. "7" or "1-5" meaning 1 to 5)
+ */
+ private final String idealValue;
+
+ /**
+ * The integer config item.
+ * @param file String - The file the config item is located in.
+ * @param key String - The key of the config item within the file.
+ * @param name String - The config item's human-readable name.
+ * @param description List of Strings - The config item's description, for the GUI each String is a new line.
+ * @param dependencyIsEnabled Boolean - If the config's dependencies are enabled. If none, set to true.
+ * @param minValue int - The minimum allowed value.
+ * @param maxValue int - The maximum allowed value.
+ * @param idealValue String - The ideal value in String format (e.g. "7" or "1-5" meaning 1 to 5)
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public IntegerConfigItem(String file, String key, String name, List description, Boolean dependencyIsEnabled, int minValue, int maxValue, String idealValue, Kryptonite plugin) {
+ super(file, key, name, description, dependencyIsEnabled, plugin);
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ this.idealValue = idealValue;
+ }
+
+ /**
+ * Retrieves the current value of the config item.
+ * @return int - The config's current value.
+ */
+ @Override
+ public Integer getValue() {
+ if (this.file.contains(".properties")) {
+ try {
+ return Integer.parseInt(propFile.getProperty(key));
+ }
+ catch (NumberFormatException e) {
+ Logger l = new Logger(this.plugin.foundryConfig);
+ l.severe("Unable to parse key '"+this.key+"' in file '"+this.file+"' NumberFormatException");
+ l.severe(e.getMessage());
+ return 0;
+ }
+ } else if (this.file.contains(".yml") || file.contains(".yaml")) {
+ this.loadFile();
+ Integer value = yamlFile.getInt(key);
+ yamlFile.close();
+ return value;
+ } else {
+ new Logger(this.plugin.foundryConfig).severe("Unable to load file: '"+this.file+"' extension not supported.");
+ return 0;
+ }
+ }
+
+ /**
+ * Sets the current value of the config item.
+ * @param value Integer - The config's current value.
+ */
+ @Override
+ public void setValue(Integer value) {
+ if (this.file.contains(".properties")) {
+ propFile.setProperty(this.key, String.valueOf(value));
+ } else if (file.contains(".yml") || file.contains(".yaml")) {
+ this.loadFile();
+ yamlFile.set(this.key, value);
+ yamlFile.save();
+ }
+ }
+
+ /**
+ * Checks if the value will be valid.
+ * @param value Integer - The value to check.
+ * @return boolean - Is it valid?
+ */
+ @Override
+ public boolean willBeValid(Integer value) {
+ return dependencyIsEnabled && (value >= minValue && value <= maxValue);
+ }
+
+ /**
+ * Checks if the config value is ideal.
+ * @return boolean - Is it ideal?
+ */
+ @Override
+ public boolean isIdeal() {
+ if (idealValue == null) {
+ return true;
+ }
+
+ int current = this.getValue();
+ String trimmed = idealValue.trim();
+
+ if (trimmed.contains("-")) {
+ String[] parts = trimmed.split("-");
+ int minIdeal = Integer.parseInt(parts[0].trim());
+ int maxIdeal = Integer.parseInt(parts[1].trim());
+ return current >= minIdeal && current <= maxIdeal;
+ }
+
+ if (trimmed.startsWith(">")) {
+ int threshold = Integer.parseInt(trimmed.substring(1).trim());
+ return current > threshold;
+ }
+
+ if (trimmed.startsWith("<")) {
+ int threshold = Integer.parseInt(trimmed.substring(1).trim());
+ return current < threshold;
+ }
+
+ return current == Integer.parseInt(trimmed);
+ }
+
+
+ /**
+ * Returns the ideal value in human-readable, string format.
+ * @return String - The ideal value.
+ */
+ @Override
+ public String getIdealValue() {
+ return idealValue == null ? "any" : idealValue;
+ }
+}
diff --git a/src/main/java/net/lewmc/kryptonite/utils/config/StringConfigItem.java b/src/main/java/net/lewmc/kryptonite/utils/config/StringConfigItem.java
new file mode 100644
index 0000000..48cb1c1
--- /dev/null
+++ b/src/main/java/net/lewmc/kryptonite/utils/config/StringConfigItem.java
@@ -0,0 +1,103 @@
+package net.lewmc.kryptonite.utils.config;
+
+import net.lewmc.foundry.Logger;
+import net.lewmc.kryptonite.Kryptonite;
+
+import java.util.List;
+
+/**
+ * A string version of GenericConfigItem
+ * @since 2.1.0
+ */
+public class StringConfigItem extends GenericConfigItem {
+ /**
+ * String list of allowed values.
+ */
+ private final List allowedValues;
+
+ /**
+ * String list of ideal values.
+ */
+ private final List idealValues;
+
+ /**
+ * The String config item.
+ * @param file String - The file the config item is located in.
+ * @param key String - The key of the config item within the file.
+ * @param name String - The config item's human-readable name.
+ * @param description List of Strings - The config item's description, for the GUI each String is a new line.
+ * @param dependencyIsEnabled Boolean - If the config's dependencies are enabled. If none, set to true.
+ * @param allowedValues List of Strings - String list of allowed values.
+ * @param idealValues List of Strings - String list of ideal values.
+ * @param plugin Kryptonite - Reference to the main Kryptonite class.
+ */
+ public StringConfigItem(String file, String key, String name, List description, Boolean dependencyIsEnabled, List allowedValues, List idealValues, Kryptonite plugin) {
+ super(file, key, name, description, dependencyIsEnabled, plugin);
+ this.allowedValues = allowedValues;
+ this.idealValues = idealValues;
+ }
+
+ /**
+ * Retrieves the current value of the config item.
+ * @return String - The config's current value.
+ */
+ @Override
+ public String getValue() {
+ if (this.file.contains(".properties")) {
+ return propFile.getProperty(key);
+ } else if (this.file.contains(".yml") || file.contains(".yaml")) {
+ this.loadFile();
+ String value = yamlFile.getString(key);
+ yamlFile.close();
+ return value;
+ } else {
+ new Logger(this.plugin.foundryConfig).severe("Unable to load file: '"+this.file+"' extension not supported.");
+ return null;
+ }
+ }
+
+ /**
+ * Sets the current value of the config item.
+ * @param value Integer - The config's current value.
+ */
+ @Override
+ public void setValue(String value) {
+ if (this.file.contains(".properties")) {
+ propFile.setProperty(this.key, value);
+ } else if (file.contains(".yml") || file.contains(".yaml")) {
+ this.loadFile();
+ yamlFile.set(this.key, value);
+ yamlFile.save();
+ }
+ }
+
+ /**
+ * Checks if the value will be valid.
+ * @param value String - The value to check.
+ * @return boolean - Is it valid?
+ */
+ @Override
+ public boolean willBeValid(String value) {
+ return dependencyIsEnabled && this.allowedValues.contains(value);
+
+ }
+
+ /**
+ * Checks if the config value is ideal.
+ * @return boolean - Is it ideal?
+ */
+ @Override
+ public boolean isIdeal() {
+ if (idealValues == null) { return true; }
+ return idealValues.contains(this.getValue());
+ }
+
+ /**
+ * Returns the ideal value in human-readable, string format.
+ * @return String - The ideal value.
+ */
+ @Override
+ public String getIdealValue() {
+ return idealValues == null ? "any" : idealValues.toString();
+ }
+}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 7fdbf30..fc1c587 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -4,7 +4,7 @@ main: net.lewmc.kryptonite.Kryptonite
author: LewMC
description: The Kryptonite of lag.
website: https://lewmc.net
-api-version: '1.20'
+api-version: '1.21'
load: POSTWORLD
commands:
kryptonite:
@@ -18,5 +18,5 @@ commands:
edb:
description: Exploit Database
usage: /
- aliases: ['exploit']
+ aliases: ['exploit','exploitdb']
folia-supported: true
\ No newline at end of file
diff --git a/src/main/resources/profiles/FarmFriendly.kos b/src/main/resources/profiles/FarmFriendly.kos
index 087ef71..da2b901 100644
--- a/src/main/resources/profiles/FarmFriendly.kos
+++ b/src/main/resources/profiles/FarmFriendly.kos
@@ -18,6 +18,7 @@ server:
view: 8
simulation: 4
sync-chunk-writes: false
+ allow-flight: true
# CraftBukkit Settings
craftbukkit:
diff --git a/src/main/resources/profiles/YouHaveTrouble.kos b/src/main/resources/profiles/YouHaveTrouble.kos
index 4b80a35..1ddae81 100644
--- a/src/main/resources/profiles/YouHaveTrouble.kos
+++ b/src/main/resources/profiles/YouHaveTrouble.kos
@@ -19,6 +19,7 @@ server:
view: 8
simulation: 4
sync-chunk-writes: false
+ allow-flight: true
# CraftBukkit Settings
craftbukkit: