Add Console/CommandBlock support to Fabric/Forge/Sponge (2317)

This commit is contained in:
Alexander Brandes
2023-06-09 13:58:45 +02:00
parent e7876c4eba
commit bb14d93a8d
6 changed files with 56 additions and 25 deletions

View File

@ -96,6 +96,7 @@ public abstract class LocalConfiguration {
public boolean allowSymlinks = false;
public boolean serverSideCUI = true;
public boolean extendedYLimit = false;
public boolean commandBlockSupport = false;
public String defaultLocaleName = "default";
public Locale defaultLocale = Locale.getDefault();

View File

@ -0,0 +1,49 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.extension.platform;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.Location;
public abstract class AbstractCommandBlockActor extends AbstractNonPlayerActor implements Locatable {
protected static final String UUID_PREFIX = "CMD";
private final Location location;
public AbstractCommandBlockActor(Location location) {
this.location = location;
}
@Override
public Location getLocation() {
return this.location;
}
@Override
public boolean setLocation(Location location) {
// Can't move a CommandBlock
return false;
}
@Override
public Extent getExtent() {
return this.location.getExtent();
}
}

View File

@ -140,6 +140,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
serverSideCUI = getBool("server-side-cui", serverSideCUI);
extendedYLimit = getBool("extended-y-limit", extendedYLimit);
setDefaultLocaleName(getString("default-locale", defaultLocaleName));
commandBlockSupport = getBool("command-block-support", commandBlockSupport);
LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15));

View File

@ -152,6 +152,8 @@ public class YAMLConfiguration extends LocalConfiguration {
extendedYLimit = config.getBoolean("compat.extended-y-limit", false);
setDefaultLocaleName(config.getString("default-locale", defaultLocaleName));
commandBlockSupport = config.getBoolean("command-block-support", false);
}
public void unload() {