Relight after completing P2 operations

teporarily fix #629
Dieser Commit ist enthalten in:
dordsor21 2020-09-18 12:38:17 +01:00
Ursprung 7375827844
Commit 8e8bd810b5
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
2 geänderte Dateien mit 45 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -1,5 +1,7 @@
package com.boydti.fawe.bukkit.regions.plotsquared;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.object.RelightMode;
import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.TaskManager;
import com.plotsquared.core.configuration.Settings;
@ -75,6 +77,10 @@ public class FaweRegionManager extends RegionManager {
}
try {
session.flushQueue();
for (CuboidRegion region : regions) {
FaweAPI.fixLighting(world, region, null,
RelightMode.valueOf(com.boydti.fawe.config.Settings.IMP.LIGHTING.MODE));
}
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
@ -100,7 +106,8 @@ public class FaweRegionManager extends RegionManager {
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
final HybridPlotWorld hybridPlotWorld = ((HybridPlotManager) manager).getHybridPlotWorld();
EditSession editSession = new EditSessionBuilder(BukkitAdapter.adapt(getWorld(hybridPlotWorld.getWorldName()))).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
World world = BukkitAdapter.adapt(getWorld(hybridPlotWorld.getWorldName()));
EditSession editSession = new EditSessionBuilder(world).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
if (!hybridPlotWorld.PLOT_SCHEMATIC || !Settings.Schematics.PASTE_ON_TOP) {
final BlockType bedrock;
@ -153,7 +160,8 @@ public class FaweRegionManager extends RegionManager {
}
editSession.flushQueue();
FaweAPI.fixLighting(world, new CuboidRegion(plot.getBottomAbs().getBlockVector3(), plot.getTopAbs().getBlockVector3()), null,
RelightMode.valueOf(com.boydti.fawe.config.Settings.IMP.LIGHTING.MODE));
TaskManager.IMP.task(whenDone);
}
});
@ -185,6 +193,10 @@ public class FaweRegionManager extends RegionManager {
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
FaweAPI.fixLighting(pos1World, new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()), null,
RelightMode.valueOf(com.boydti.fawe.config.Settings.IMP.LIGHTING.MODE));
FaweAPI.fixLighting(pos1World, new CuboidRegion(pos3.getBlockVector3(), pos4.getBlockVector3()), null,
RelightMode.valueOf(com.boydti.fawe.config.Settings.IMP.LIGHTING.MODE));
TaskManager.IMP.task(whenDone);
}
});
@ -229,6 +241,9 @@ public class FaweRegionManager extends RegionManager {
try {
Operations.completeLegacy(copy);
to.flushQueue();
FaweAPI.fixLighting(pos1World,
new CuboidRegion(pos3.getBlockVector3(), pos3.getBlockVector3().add(pos2.getBlockVector3().subtract(pos1.getBlockVector3()))),
null, RelightMode.valueOf(com.boydti.fawe.config.Settings.IMP.LIGHTING.MODE));
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}

Datei anzeigen

@ -1,7 +1,32 @@
package com.boydti.fawe.object;
import java.util.HashMap;
import java.util.Map;
public enum RelightMode {
NONE, // no relighting
OPTIMAL, // relight changed light sources and changed blocks
ALL // relight every single block
NONE(0), // no relighting
OPTIMAL(1), // relight changed light sources and changed blocks
ALL(2); // relight every single block
private static final Map<Integer, RelightMode> map = new HashMap<>();
static {
for (RelightMode mode : RelightMode.values()) {
map.put(mode.mode, mode);
}
}
private final int mode;
RelightMode(int mode) {
this.mode = mode;
}
public static RelightMode valueOf(int mode) {
return map.get(mode);
}
public int getMode() {
return mode;
}
}