Removes applyStartupFixes, and adds controlUpdateDelay
Now, all updating of Stargates' control blocks happens through a queue. The amount of ticks between each time the queue is polled from is configurable using controlUpdateDelay
This commit is contained in:
@@ -66,11 +66,6 @@ public enum ConfigOption {
|
||||
*/
|
||||
DESTROYED_BY_EXPLOSION("gates.integrity.destroyedByExplosion", "Whether stargates should be destroyed by explosions", false),
|
||||
|
||||
/**
|
||||
* Whether to fix incorrect signs, buttons or openings during startup
|
||||
*/
|
||||
APPLY_STARTUP_FIXES("gates.integrity.applyStartupFixes", "Whether Stargates should fix incorrect signs, buttons or openings during startup", true),
|
||||
|
||||
/**
|
||||
* Whether to verify each portal's gate layout after each load
|
||||
*/
|
||||
@@ -203,7 +198,14 @@ public enum ConfigOption {
|
||||
* Whether to hide Dynmap icons by default
|
||||
*/
|
||||
DYNMAP_ICONS_DEFAULT_HIDDEN("dynmap.dynmapIconsHiddenByDefault",
|
||||
"Whether to hide Stargate's Dynmap icons by default, requiring the user to enable them.", true);
|
||||
"Whether to hide Stargate's Dynmap icons by default, requiring the user to enable them.", true),
|
||||
|
||||
/**
|
||||
* The amount of ticks to wait when processing the Stargate control update queue
|
||||
*/
|
||||
CONTROL_UPDATE_QUEUE_DELAY("gates.integrity.controlUpdateDelay",
|
||||
"The delay between each time a Stargate's controls are updated after startup", 3),
|
||||
;
|
||||
|
||||
private final String configNode;
|
||||
private final String description;
|
||||
|
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@@ -232,10 +233,10 @@ public final class StargateConfig {
|
||||
|
||||
//Perform all block change requests to prevent mismatch if a gate's open-material changes. Changing the
|
||||
// closed-material still requires a restart.
|
||||
BlockChangeRequest firstElement = Stargate.getBlockChangeRequestQueue().peek();
|
||||
BlockChangeRequest firstElement = Stargate.getControlBlockUpdateRequestQueue().peek();
|
||||
while (firstElement != null) {
|
||||
BlockChangeThread.pollQueue();
|
||||
firstElement = Stargate.getBlockChangeRequestQueue().peek();
|
||||
firstElement = Stargate.getControlBlockUpdateRequestQueue().peek();
|
||||
}
|
||||
|
||||
//Store the old enable bungee state in case it changes
|
||||
@@ -516,16 +517,24 @@ public final class StargateConfig {
|
||||
//Load old and new configuration
|
||||
Stargate.getInstance().reloadConfig();
|
||||
FileConfiguration oldConfiguration = Stargate.getInstance().getConfig();
|
||||
InputStream configStream = FileHelper.getInputStreamForInternalFile("/config.yml");
|
||||
if (configStream == null) {
|
||||
Stargate.logSevere("Could not migrate the configuration, as the internal configuration could not be read!");
|
||||
return;
|
||||
}
|
||||
YamlConfiguration newConfiguration = StargateYamlConfiguration.loadConfiguration(
|
||||
FileHelper.getBufferedReaderFromInputStream(
|
||||
FileHelper.getInputStreamForInternalFile("/config.yml")));
|
||||
FileHelper.getBufferedReaderFromInputStream(configStream));
|
||||
|
||||
//Read all available config migrations
|
||||
Map<String, String> migrationFields;
|
||||
try {
|
||||
migrationFields = FileHelper.readKeyValuePairs(FileHelper.getBufferedReaderFromInputStream(
|
||||
FileHelper.getInputStreamForInternalFile("/config-migrations.txt")), "=",
|
||||
ColorConversion.NORMAL);
|
||||
InputStream migrationStream = FileHelper.getInputStreamForInternalFile("/config-migrations.txt");
|
||||
if (migrationStream == null) {
|
||||
Stargate.logSevere("Could not migrate the configuration, as the internal migration paths could not be read!");
|
||||
return;
|
||||
}
|
||||
migrationFields = FileHelper.readKeyValuePairs(FileHelper.getBufferedReaderFromInputStream(migrationStream),
|
||||
"=", ColorConversion.NORMAL);
|
||||
} catch (IOException exception) {
|
||||
Stargate.debug(debugPath, "Unable to load config migration file");
|
||||
return;
|
||||
|
@@ -101,6 +101,17 @@ public final class StargateGateConfig {
|
||||
return (boolean) configOptions.get(ConfigOption.HANDLE_CREATURE_TRANSPORTATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the delay to wait between each update of a Stargate's control block
|
||||
*
|
||||
* <p>This only affects the queued control updates during startup. It does not affect normal gameplay.</p>
|
||||
*
|
||||
* @return <p>The amount of ticks to delay control updates by</p>
|
||||
*/
|
||||
public int controlUpdateDelay() {
|
||||
return (int) configOptions.get(ConfigOption.CONTROL_UPDATE_QUEUE_DELAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether vehicles containing a creature, but not a player should be handled
|
||||
*
|
||||
@@ -195,15 +206,6 @@ public final class StargateGateConfig {
|
||||
return (boolean) configOptions.get(ConfigOption.DESTROYED_BY_EXPLOSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether to destroy portals when any blocks are broken by explosions
|
||||
*
|
||||
* @return <p>Whether to destroy portals when any blocks are broken by explosions</p>
|
||||
*/
|
||||
public boolean applyStartupFixes() {
|
||||
return (boolean) configOptions.get(ConfigOption.APPLY_STARTUP_FIXES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default portal network to use if no other network is given
|
||||
*
|
||||
|
Reference in New Issue
Block a user