mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-12 04:23:54 +00:00
Update Upstream
d48530c Don't allow editing without a Bukkit Impl Adapter. (1920)
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.sk89q.util.yaml.YAMLProcessor;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.util.YAMLConfiguration;
|
||||
import com.sk89q.worldedit.util.report.Unreported;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@ -32,10 +33,11 @@ import java.nio.file.Path;
|
||||
*/
|
||||
public class BukkitConfiguration extends YAMLConfiguration {
|
||||
|
||||
public boolean noOpPermissions = false;
|
||||
public boolean commandBlockSupport = false;
|
||||
@Unreported
|
||||
private final WorldEditPlugin plugin;
|
||||
public boolean noOpPermissions = false;
|
||||
public boolean commandBlockSupport = false;
|
||||
public boolean unsupportedVersionEditing = false;
|
||||
|
||||
public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) {
|
||||
super(config, LogManager.getLogger(plugin.getLogger().getName()));
|
||||
@ -47,6 +49,12 @@ public class BukkitConfiguration extends YAMLConfiguration {
|
||||
super.load();
|
||||
noOpPermissions = config.getBoolean("no-op-permissions", false);
|
||||
commandBlockSupport = config.getBoolean("command-block-support", false);
|
||||
unsupportedVersionEditing = "I accept that I will receive no support with this flag enabled.".equals(
|
||||
config.getString("allow-editing-on-unsupported-versions", "false"));
|
||||
if (unsupportedVersionEditing) {
|
||||
WorldEdit.logger.warn("Editing without a Bukkit adapter has been enabled. You will not receive support "
|
||||
+ "for any issues that arise as a result.");
|
||||
}
|
||||
migrateLegacyFolders();
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public void sendAnnouncements() {
|
||||
if (WorldEditPlugin.getInstance().getLifecycledBukkitImplAdapter() == null) {
|
||||
if (!WorldEditPlugin.getInstance().getLifecycledBukkitImplAdapter().isValid()) {
|
||||
//FAWE start - swap out EH download url with ours
|
||||
print(Caption.of(
|
||||
"worldedit.version.bukkit.unsupported-adapter",
|
||||
|
@ -97,7 +97,7 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getDataVersion() {
|
||||
if (plugin.getLifecycledBukkitImplAdapter() != null) {
|
||||
if (plugin.getLifecycledBukkitImplAdapter().isValid()) {
|
||||
return Bukkit.getUnsafe().getDataVersion();
|
||||
}
|
||||
return -1;
|
||||
|
@ -33,6 +33,7 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.bukkit.adapter.UnsupportedVersionEditException;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
@ -488,8 +489,12 @@ public class BukkitWorld extends AbstractWorld {
|
||||
}
|
||||
}
|
||||
}
|
||||
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
|
||||
if (WorldEditPlugin.getInstance().getLocalConfiguration().unsupportedVersionEditing) {
|
||||
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
|
||||
} else {
|
||||
throw new RuntimeException(new UnsupportedVersionEditException());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.bukkit.adapter;
|
||||
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
|
||||
public class UnsupportedVersionEditException extends WorldEditException {
|
||||
|
||||
public UnsupportedVersionEditException() {
|
||||
super(Caption.of("worldedit.bukkit.no-edit-without-adapter"));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user