3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Added a config option to entirely disable server side cui.

Dieser Commit ist enthalten in:
Matthew Miller 2018-08-18 19:42:45 +10:00
Ursprung 0cbfc9308e
Commit eba91cac5f
7 geänderte Dateien mit 13 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -143,3 +143,4 @@ no-double-slash: false
no-op-permissions: false no-op-permissions: false
debug: false debug: false
show-help-on-first-use: true show-help-on-first-use: true
server-side-cui: true

Datei anzeigen

@ -134,6 +134,7 @@ public abstract class LocalConfiguration {
public int butcherDefaultRadius = -1; public int butcherDefaultRadius = -1;
public int butcherMaxRadius = -1; public int butcherMaxRadius = -1;
public boolean allowSymlinks = false; public boolean allowSymlinks = false;
public boolean serverSideCUI = true;
/** /**
* Load the configuration. * Load the configuration.

Datei anzeigen

@ -636,6 +636,10 @@ public class LocalSession {
return; // This is for players only. return; // This is for players only.
} }
if (!config.serverSideCUI) {
return; // Disabled in config.
}
Player player = (Player) actor; Player player = (Player) actor;
if (!useServerCUI || hasCUISupport) { if (!useServerCUI || hasCUISupport) {

Datei anzeigen

@ -31,6 +31,7 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.DisallowedUsageException;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.util.command.parametric.Optional; import com.sk89q.worldedit.util.command.parametric.Optional;
@ -124,6 +125,9 @@ public class GeneralCommands {
@CommandPermissions("worldedit.drawsel") @CommandPermissions("worldedit.drawsel")
public void drawSelection(Player player, LocalSession session, CommandContext args) throws WorldEditException { public void drawSelection(Player player, LocalSession session, CommandContext args) throws WorldEditException {
if (!WorldEdit.getInstance().getConfiguration().serverSideCUI) {
throw new DisallowedUsageException("This functionality is disabled in the configuration!");
}
String newState = args.getString(0, null); String newState = args.getString(0, null);
if (session.shouldUseServerCUI()) { if (session.shouldUseServerCUI()) {
if ("on".equals(newState)) { if ("on".equals(newState)) {

Datei anzeigen

@ -114,6 +114,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
butcherDefaultRadius = getInt("butcher-default-radius", butcherDefaultRadius); butcherDefaultRadius = getInt("butcher-default-radius", butcherDefaultRadius);
butcherMaxRadius = getInt("butcher-max-radius", butcherMaxRadius); butcherMaxRadius = getInt("butcher-max-radius", butcherMaxRadius);
allowSymlinks = getBool("allow-symbolic-links", allowSymlinks); allowSymlinks = getBool("allow-symbolic-links", allowSymlinks);
serverSideCUI = getBool("server-side-cui", serverSideCUI);
LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15)); LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15));

Datei anzeigen

@ -112,6 +112,7 @@ public class YAMLConfiguration extends LocalConfiguration {
SessionManager.EXPIRATION_GRACE = config.getInt("history.expiration", 10) * 60 * 1000; SessionManager.EXPIRATION_GRACE = config.getInt("history.expiration", 10) * 60 * 1000;
showHelpInfo = config.getBoolean("show-help-on-first-use", true); showHelpInfo = config.getBoolean("show-help-on-first-use", true);
serverSideCUI = config.getBoolean("server-side-cui", true);
String snapshotsDir = config.getString("snapshots.directory", ""); String snapshotsDir = config.getString("snapshots.directory", "");
if (!snapshotsDir.isEmpty()) { if (!snapshotsDir.isEmpty()) {

Datei anzeigen

@ -120,6 +120,7 @@ public class ConfigurateConfiguration extends LocalConfiguration {
SessionManager.EXPIRATION_GRACE = node.getNode("history", "expiration").getInt(10) * 60 * 1000; SessionManager.EXPIRATION_GRACE = node.getNode("history", "expiration").getInt(10) * 60 * 1000;
showHelpInfo = node.getNode("show-help-on-first-use").getBoolean(true); showHelpInfo = node.getNode("show-help-on-first-use").getBoolean(true);
serverSideCUI = node.getNode("server-side-cui").getBoolean(true);
String snapshotsDir = node.getNode("snapshots", "directory").getString(""); String snapshotsDir = node.getNode("snapshots", "directory").getString("");
if (!snapshotsDir.isEmpty()) { if (!snapshotsDir.isEmpty()) {