Allow specific P2 queue hooks to be disabled

Dieser Commit ist enthalten in:
dordsor21 2020-07-09 22:14:24 +01:00
Ursprung 6d6de61560
Commit 33b2b634ac
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
5 geänderte Dateien mit 41 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -16,7 +16,6 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
@ -62,6 +61,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean setCuboids(final PlotArea area, final Set<CuboidRegion> regions, final Pattern blocks, final int minY, final int maxY) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.CUBOIDS) {
return parent.setCuboids(area, regions, blocks, minY, maxY);
}
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
World world = BukkitAdapter.adapt(getWorld(area.getWorldName()));
@ -83,7 +85,7 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean notifyClear(PlotManager manager) {
if (!(manager instanceof HybridPlotManager)) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.CLEAR || !(manager instanceof HybridPlotManager)) {
return false;
}
final HybridPlotWorld hpw = ((HybridPlotManager) manager).getHybridPlotWorld();
@ -92,7 +94,7 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean handleClear(final Plot plot, final Runnable whenDone, final PlotManager manager) {
if (!(manager instanceof HybridPlotManager)) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.CLEAR || !(manager instanceof HybridPlotManager)) {
return false;
}
TaskManager.IMP.async(() -> {
@ -123,7 +125,7 @@ public class FaweRegionManager extends RegionManager {
Region airRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1),
pos2.withY(manager.getWorldHeight()));
Clipboard clipboard = new BlockArrayClipboard(new CuboidRegion(pos1, pos2));
Clipboard clipboard = new BlockArrayClipboard(new CuboidRegion(pos1.withY(0), pos2.withY(255)));
clipboard.setBlocks(bedrockRegion, bedrock);
clipboard.setBlocks(fillingRegion, filling);
@ -162,6 +164,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
parent.swap(pos1, pos2, pos3, pos4, whenDone);
}
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
//todo because of the following code this should proably be in the Bukkit module
@ -190,6 +195,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, String world, Runnable whenDone) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.SET_BIOME) {
parent.setBiome(region, extendBiome, biome, world, whenDone);
}
region.expand(BlockVector3.at(extendBiome, 0, extendBiome));
region.expand(BlockVector3.at(-extendBiome, 0, -extendBiome));
TaskManager.IMP.async(() -> {
@ -210,6 +218,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean copyRegion(final Location pos1, final Location pos2, final Location pos3, final Runnable whenDone) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
return parent.copyRegion(pos1, pos2, pos3, whenDone);
}
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));

Datei anzeigen

@ -39,7 +39,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() {
super("PlotSquared");
log.debug("Optimizing PlotSquared");
if (com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_HOOK) {
if (com.boydti.fawe.config.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try {
setupBlockQueue();

Datei anzeigen

@ -2,6 +2,7 @@ package com.boydti.fawe.bukkit.regions.plotsquaredv4;
import static org.bukkit.Bukkit.getWorld;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.object.Location;
@ -49,6 +50,9 @@ public class FaweChunkManager extends ChunkManager {
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
if (!Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
parent.swap(pos1, pos2, pos3, pos4, whenDone);
}
TaskManager.IMP.async(() -> {
synchronized (FaweChunkManager.class) {
//todo because of the following code this should proably be in the Bukkit module
@ -77,6 +81,9 @@ public class FaweChunkManager extends ChunkManager {
@Override
public boolean copyRegion(final Location pos1, final Location pos2, final Location pos3, final Runnable whenDone) {
if (!Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
return parent.copyRegion(pos1, pos2, pos3, whenDone);
}
TaskManager.IMP.async(() -> {
synchronized (FaweChunkManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));

Datei anzeigen

@ -41,7 +41,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() {
super("PlotSquared");
log.debug("Optimizing PlotSquared");
if (com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_HOOK) {
if (com.boydti.fawe.config.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try {
setupBlockQueue();

Datei anzeigen

@ -14,8 +14,6 @@ public class Settings extends Config {
@Ignore
public boolean PROTOCOL_SUPPORT_FIX = false;
@Ignore
public boolean PLOTSQUARED_HOOK = true;
@Comment("These first 6 aren't configurable") // This is a comment
@Final // Indicates that this value isn't configurable
@ -46,6 +44,8 @@ public class Settings extends Config {
})
public int MAX_MEMORY_PERCENT = 95;
@Create
public ENABLED_COMPONENTS ENABLED_COMPONENTS;
@Create
public CLIPBOARD CLIPBOARD;
@Create
@ -55,6 +55,8 @@ public class Settings extends Config {
@Create
public WEB WEB;
@Create
public PLOTSQUARED_INTEGRATION PLOTSQUARED_INTEGRATION;
@Create
public EXTENT EXTENT;
@Create
public EXPERIMENTAL EXPERIMENTAL;
@ -67,11 +69,16 @@ public class Settings extends Config {
@Create
public REGION_RESTRICTIONS_OPTIONS REGION_RESTRICTIONS_OPTIONS;
@Create
public ENABLED_COMPONENTS ENABLED_COMPONENTS;
public ConfigBlock<LIMITS> LIMITS;
@Comment("Enable or disable core components")
public static final class ENABLED_COMPONENTS {
public boolean COMMANDS = true;
@Comment({
"Disable the FAWE-PlotSquared hook to take over most intense P2 queueing",
"Specific aspects can be turned on and off further below"
})
public boolean PLOTSQUARED_HOOK = true;
}
@Comment("Paths for various directories")
@ -103,10 +110,6 @@ public class Settings extends Config {
public String MODE = "MEMBER";
}
@Create // This value will be generated automatically
public ConfigBlock<LIMITS> LIMITS;
@Comment({
"The \"default\" limit group affects those without a specific limit permission.",
"To grant someone different limits, copy the default limits group",
@ -388,6 +391,13 @@ public class Settings extends Config {
public boolean ALLOW_TICK_EXISTING = true;
}
public static class PLOTSQUARED_INTEGRATION {
public boolean CLEAR = true;
public boolean CUBOIDS = true;
public boolean COPY_AND_SWAP = true;
public boolean SET_BIOME = true;
}
public static class WEB {
@Comment({
"Should download urls be shortened?",