Dieser Commit ist enthalten in:
Jesse Boyd 2019-11-08 05:27:04 +00:00
Ursprung 82f5c4ebed
Commit faa63b0c35
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
11 geänderte Dateien mit 88 neuen und 53 gelöschten Zeilen

Datei anzeigen

@ -8,6 +8,7 @@ import com.boydti.fawe.beta.implementation.cache.preloader.Preloader;
import com.boydti.fawe.bukkit.adapter.BukkitQueueHandler; import com.boydti.fawe.bukkit.adapter.BukkitQueueHandler;
import com.boydti.fawe.bukkit.listener.BrushListener; import com.boydti.fawe.bukkit.listener.BrushListener;
import com.boydti.fawe.bukkit.listener.BukkitImageListener; import com.boydti.fawe.bukkit.listener.BukkitImageListener;
import com.boydti.fawe.bukkit.listener.CFIPacketListener;
import com.boydti.fawe.bukkit.listener.ChunkListener_8; import com.boydti.fawe.bukkit.listener.ChunkListener_8;
import com.boydti.fawe.bukkit.listener.ChunkListener_9; import com.boydti.fawe.bukkit.listener.ChunkListener_9;
import com.boydti.fawe.bukkit.listener.RenderListener; import com.boydti.fawe.bukkit.listener.RenderListener;
@ -62,8 +63,7 @@ public class FaweBukkit implements IFawe, Listener {
private boolean listeningImages; private boolean listeningImages;
private BukkitImageListener imageListener; private BukkitImageListener imageListener;
private CFIPacketListener packetListener;
public static boolean PAPER;
public VaultUtil getVault() { public VaultUtil getVault() {
return this.vault; return this.vault;
@ -71,13 +71,6 @@ public class FaweBukkit implements IFawe, Listener {
public FaweBukkit(Plugin plugin) { public FaweBukkit(Plugin plugin) {
this.plugin = plugin; this.plugin = plugin;
try {
Class.forName("com.destroystokyo.paper.Namespaced");
PAPER = true;
} catch (Throwable e) {
e.printStackTrace();
// TODO no paper
}
try { try {
Settings.IMP.TICK_LIMITER.ENABLED = !Bukkit.hasWhitelist(); Settings.IMP.TICK_LIMITER.ENABLED = !Bukkit.hasWhitelist();
Fawe.set(this); Fawe.set(this);
@ -115,13 +108,13 @@ public class FaweBukkit implements IFawe, Listener {
}); });
} }
// @Override // Please don't delete this again, it's WIP @Override // Please don't delete this again, it's WIP
// public void registerPacketListener() { public void registerPacketListener() {
// PluginManager manager = Bukkit.getPluginManager(); PluginManager manager = Bukkit.getPluginManager();
// if (packetListener == null && manager.getPlugin("ProtocolLib") != null) { if (packetListener == null && manager.getPlugin("ProtocolLib") != null) {
// packetListener = new CFIPacketListener(plugin); packetListener = new CFIPacketListener(plugin);
// } }
// } }
@Override @Override
public QueueHandler getQueueHandler() { public QueueHandler getQueueHandler() {
@ -133,7 +126,7 @@ public class FaweBukkit implements IFawe, Listener {
if (listeningImages && imageListener == null) return null; if (listeningImages && imageListener == null) return null;
try { try {
listeningImages = true; listeningImages = true;
//registerPacketListener(); registerPacketListener();
PluginManager manager = Bukkit.getPluginManager(); PluginManager manager = Bukkit.getPluginManager();
if (manager.getPlugin("PacketListenerApi") == null) { if (manager.getPlugin("PacketListenerApi") == null) {
@ -408,7 +401,7 @@ public class FaweBukkit implements IFawe, Listener {
@Override @Override
public Preloader getPreloader() { public Preloader getPreloader() {
if (PAPER) { if (PaperLib.isPaper()) {
return new AsyncPreloader(); return new AsyncPreloader();
} }
return null; return null;

Datei anzeigen

@ -12,6 +12,7 @@ import com.sk89q.worldedit.world.block.BlockID;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache; import com.sk89q.worldedit.world.block.BlockTypesCache;
import io.papermc.lib.PaperLib;
import net.jpountz.util.UnsafeUtils; import net.jpountz.util.UnsafeUtils;
import net.minecraft.server.v1_14_R1.Block; import net.minecraft.server.v1_14_R1.Block;
import net.minecraft.server.v1_14_R1.Chunk; import net.minecraft.server.v1_14_R1.Chunk;
@ -145,7 +146,7 @@ public final class BukkitAdapter_1_14 {
if (Fawe.isMainThread()) { if (Fawe.isMainThread()) {
return nmsWorld.getChunkAt(X, Z); return nmsWorld.getChunkAt(X, Z);
} }
if (FaweBukkit.PAPER) { if (PaperLib.isPaper()) {
CraftWorld craftWorld = nmsWorld.getWorld(); CraftWorld craftWorld = nmsWorld.getWorld();
CompletableFuture<org.bukkit.Chunk> future = craftWorld.getChunkAtAsync(X, Z, true); CompletableFuture<org.bukkit.Chunk> future = craftWorld.getChunkAtAsync(X, Z, true);
try { try {

Datei anzeigen

@ -57,6 +57,7 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import io.papermc.lib.PaperLib;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.TreeType; import org.bukkit.TreeType;
import org.bukkit.World; import org.bukkit.World;
@ -328,7 +329,7 @@ public class BukkitWorld extends AbstractWorld {
if (Fawe.isMainThread()) { if (Fawe.isMainThread()) {
world.getChunkAt(X, Z); world.getChunkAt(X, Z);
} else if (!world.isChunkLoaded(X, Z)) { } else if (!world.isChunkLoaded(X, Z)) {
if (FaweBukkit.PAPER) { if (PaperLib.isPaper()) {
world.getChunkAtAsync(X, Z, true); world.getChunkAtAsync(X, Z, true);
} else { } else {
Fawe.get().getQueueHandler().sync(() -> { Fawe.get().getQueueHandler().sync(() -> {

Datei anzeigen

@ -219,8 +219,6 @@ public enum FaweCache implements Trimable {
public final CleanableThreadLocal<byte[]> BYTE_BUFFER_8192 = new CleanableThreadLocal<>(() -> new byte[8192]); public final CleanableThreadLocal<byte[]> BYTE_BUFFER_8192 = new CleanableThreadLocal<>(() -> new byte[8192]);
public final CleanableThreadLocal<byte[]> BYTE_BUFFER_256 = new CleanableThreadLocal<>(() -> new byte[256]);
public final CleanableThreadLocal<int[]> BLOCK_TO_PALETTE = new CleanableThreadLocal<>(() -> { public final CleanableThreadLocal<int[]> BLOCK_TO_PALETTE = new CleanableThreadLocal<>(() -> {
int[] result = new int[BlockTypesCache.states.length]; int[] result = new int[BlockTypesCache.states.length];
Arrays.fill(result, Integer.MAX_VALUE); Arrays.fill(result, Integer.MAX_VALUE);
@ -243,6 +241,8 @@ public enum FaweCache implements Trimable {
public final CleanableThreadLocal<int[]> INDEX_STORE = new CleanableThreadLocal<>(() -> new int[256]); public final CleanableThreadLocal<int[]> INDEX_STORE = new CleanableThreadLocal<>(() -> new int[256]);
public final CleanableThreadLocal<int[]> HEIGHT_STORE = new CleanableThreadLocal<>(() -> new int[256]);
/** /**
* Holds data for a palette used in a chunk section * Holds data for a palette used in a chunk section
*/ */

Datei anzeigen

@ -36,6 +36,8 @@ public interface IFawe {
return null; return null;
} }
public default void registerPacketListener() {}
String getPlatformVersion(); String getPlatformVersion();
boolean isOnlineMode(); boolean isOnlineMode();

Datei anzeigen

@ -1,9 +1,5 @@
package com.boydti.fawe.command; package com.boydti.fawe.command;
import static com.boydti.fawe.util.image.ImageUtil.load;
import static com.sk89q.worldedit.command.MethodCommands.getArguments;
import static com.sk89q.worldedit.util.formatting.text.TextComponent.newline;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock; import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock;
@ -19,6 +15,7 @@ import com.boydti.fawe.util.StringMan;
import com.boydti.fawe.util.TaskManager; import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.util.TextureUtil; import com.boydti.fawe.util.TextureUtil;
import com.boydti.fawe.util.image.ImageUtil; import com.boydti.fawe.util.image.ImageUtil;
import com.google.common.collect.ImmutableSet;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
@ -28,6 +25,7 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.util.CommandPermissions; import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.PermissionCondition;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
@ -39,6 +37,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.registry.state.PropertyKey; import com.sk89q.worldedit.registry.state.PropertyKey;
@ -48,6 +47,7 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer; import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TextComponent.Builder; import com.sk89q.worldedit.util.formatting.text.TextComponent.Builder;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent; import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent; import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor; import com.sk89q.worldedit.util.formatting.text.format.TextColor;
@ -56,6 +56,18 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import org.enginehub.piston.CommandManager;
import org.enginehub.piston.CommandManagerService;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch;
import org.enginehub.piston.exception.StopExecutionException;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.enginehub.piston.part.SubCommandPart;
import org.jetbrains.annotations.NotNull;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt; import java.awt.image.DataBufferInt;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -73,16 +85,12 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import javax.imageio.ImageIO;
import org.enginehub.piston.annotation.Command; import static com.boydti.fawe.util.image.ImageUtil.load;
import org.enginehub.piston.annotation.CommandContainer; import static com.sk89q.worldedit.command.MethodCommands.getArguments;
import org.enginehub.piston.annotation.param.Arg; import static com.sk89q.worldedit.util.formatting.text.TextComponent.newline;
import org.enginehub.piston.annotation.param.Switch;
import org.enginehub.piston.exception.StopExecutionException;
import org.enginehub.piston.inject.InjectedValueAccess;
import org.jetbrains.annotations.NotNull;
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class) @CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class CFICommands { public class CFICommands {
@ -132,7 +140,7 @@ public class CFICommands {
desc = "Start CFI with an empty map as a base" desc = "Start CFI with an empty map as a base"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void heightMap(Player player, int width, int length) { public void empty(Player player, @Arg(desc = "Map width (x)") int width, @Arg(desc = "Map length (z)") int length) {
HeightMapMCAGenerator generator = new HeightMapMCAGenerator(width, length, getFolder(generateName())); HeightMapMCAGenerator generator = new HeightMapMCAGenerator(width, length, getFolder(generateName()));
setup(generator, player); setup(generator, player);
} }
@ -148,6 +156,7 @@ public class CFICommands {
settings.setGenerator(generator).bind(); settings.setGenerator(generator).bind();
generator.setImageViewer(Fawe.imp().getImageViewer(player)); generator.setImageViewer(Fawe.imp().getImageViewer(player));
generator.update(); generator.update();
settings.bind();
mainMenu(player); mainMenu(player);
} }
@ -588,7 +597,7 @@ public class CFICommands {
descFooter = "Set the terrain height either based on an image heightmap, or a numeric value." descFooter = "Set the terrain height either based on an image heightmap, or a numeric value."
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void height(Player player, String imageStr) throws WorldEditException { public void height(Player player, @Arg(name = "height", desc = "Int height, or image") String imageStr) throws WorldEditException {
HeightMapMCAGenerator gen = assertSettings(player).getGenerator(); HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
if (!MathMan.isInteger(imageStr)) { if (!MathMan.isInteger(imageStr)) {
gen.setHeight(ImageUtil.getImage(imageStr)); gen.setHeight(ImageUtil.getImage(imageStr));
@ -604,7 +613,7 @@ public class CFICommands {
desc = "Change the block used for water\ne.g. Lava" desc = "Change the block used for water\ne.g. Lava"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void waterId(Player player, BlockStateHolder block) throws WorldEditException { public void waterId(Player player, @Arg(desc = "block") BlockStateHolder block) throws WorldEditException {
CFISettings settings = assertSettings(player); CFISettings settings = assertSettings(player);
settings.getGenerator().setWater(block.toImmutableState()); settings.getGenerator().setWater(block.toImmutableState());
@ -619,7 +628,7 @@ public class CFICommands {
desc = "Change the block used for the base\ne.g. Bedrock" desc = "Change the block used for the base\ne.g. Bedrock"
) )
@CommandPermissions("worldedit.anvil.cfi") @CommandPermissions("worldedit.anvil.cfi")
public void baseId(Player player, BlockStateHolder block) throws WorldEditException { public void baseId(Player player, @Arg(desc = "block") BlockStateHolder block) throws WorldEditException {
CFISettings settings = assertSettings(player); CFISettings settings = assertSettings(player);
settings.getGenerator().setBedrock(block.toImmutableState()); settings.getGenerator().setBedrock(block.toImmutableState());
player.print(TextComponent.of("Set base id!")); player.print(TextComponent.of("Set base id!"));

Datei anzeigen

@ -90,8 +90,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int worldThickness; int worldThickness;
boolean randomVariation = true; boolean randomVariation = true;
int biomePriority; int biomePriority;
char waterOrdinal = BlockID.WATER; char waterOrdinal = BlockTypes.WATER.getDefaultState().getOrdinalChar();
char bedrockOrdinal = BlockID.BEDROCK; char bedrockOrdinal = BlockTypes.BEDROCK.getDefaultState().getOrdinalChar();
boolean modifiedMain; boolean modifiedMain;
@Override @Override
@ -232,10 +232,10 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
floor = new DifferentialArray<>(new char[getArea()]); floor = new DifferentialArray<>(new char[getArea()]);
main = new DifferentialArray<>(new char[getArea()]); main = new DifferentialArray<>(new char[getArea()]);
char stone = BlockID.STONE; char stone = BlockTypes.STONE.getDefaultState().getOrdinalChar();
char grass = BlockTypes.GRASS_BLOCK.getDefaultState().with(PropertyKey.SNOWY, false).getOrdinalChar(); char grass = BlockTypes.GRASS_BLOCK.getDefaultState().getOrdinalChar();
Arrays.fill(overlay.getCharArray(), stone); Arrays.fill(main.getCharArray(), stone);
Arrays.fill(overlay.getCharArray(), grass); Arrays.fill(floor.getCharArray(), grass);
} }
public Metadatable getMetaData() { public Metadatable getMetaData() {
@ -1584,7 +1584,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
int index; int index;
int maxY = 0; int maxY = 0;
int minY = Integer.MAX_VALUE; int minY = Integer.MAX_VALUE;
byte[] heightMap = FaweCache.IMP.BYTE_BUFFER_256.get(); int[] heightMap = FaweCache.IMP.HEIGHT_STORE.get();
int globalIndex; int globalIndex;
for (int z = csz; z <= cez; z++) { for (int z = csz; z <= cez; z++) {
globalIndex = z * getWidth() + csx; globalIndex = z * getWidth() + csx;
@ -1592,7 +1592,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
for (int x = csx; x <= cex; x++, index++, globalIndex++) { for (int x = csx; x <= cex; x++, index++, globalIndex++) {
indexes[index] = globalIndex; indexes[index] = globalIndex;
int height = heights[globalIndex] & 0xFF; int height = heights[globalIndex] & 0xFF;
heightMap[index] = (byte) height; heightMap[index] = height;
maxY = Math.max(maxY, height); maxY = Math.max(maxY, height);
minY = Math.min(minY, height); minY = Math.min(minY, height);
} }
@ -1638,7 +1638,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
index = (z & 15) << 4; index = (z & 15) << 4;
for (int x = csx; x <= cex; x++, index++) { for (int x = csx; x <= cex; x++, index++) {
globalIndex = indexes[index]; globalIndex = indexes[index];
int height = heightMap[index] & 0xFF; int height = heightMap[index];
int maxMainY = height; int maxMainY = height;
int minMainY = minY; int minMainY = minY;

Datei anzeigen

@ -726,7 +726,7 @@ public class LocalSession implements TextureHolder {
} }
} }
if (world != null) { if (world != null) {
//TODO FIXME Fawe.imp().registerPacketListener(); Fawe.imp().registerPacketListener();
world.update(); world.update();
} }
} }

Datei anzeigen

@ -84,12 +84,18 @@ public class ApplyBrushCommands {
); );
builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.apply"))); builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.apply")));
builder.addParts(REGION_FACTORY, RADIUS);
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TextComponent.of("Type of brush to use")) builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TextComponent.of("Type of brush to use"))
.withCommands(manager.getAllCommands().collect(Collectors.toList())) .withCommands(manager.getAllCommands().collect(Collectors.toList()))
.required() .required()
.build()); .build());
builder.addParts(REGION_FACTORY, RADIUS);
builder.action(new org.enginehub.piston.Command.Action() {
@Override
public Object run(CommandParameters commandParameters) throws Exception {
System.out.println("Action " + commandParameters);
return null;
}
});
}); });
} }
@ -109,6 +115,7 @@ public class ApplyBrushCommands {
Player player, LocalSession localSession, Player player, LocalSession localSession,
@Arg(desc = "The type of tree to plant") @Arg(desc = "The type of tree to plant")
TreeGenerator.TreeType type) throws WorldEditException { TreeGenerator.TreeType type) throws WorldEditException {
System.out.println("FOREST");
setApplyBrush(parameters, player, localSession, new TreeGeneratorFactory(type)); setApplyBrush(parameters, player, localSession, new TreeGeneratorFactory(type));
} }

Datei anzeigen

@ -26,6 +26,8 @@ import com.boydti.fawe.command.CFICommands;
import com.boydti.fawe.command.CFICommandsRegistration; import com.boydti.fawe.command.CFICommandsRegistration;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
import com.boydti.fawe.object.changeset.CFIChangeSet;
import com.boydti.fawe.object.exception.FaweException; import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.task.ThrowableSupplier; import com.boydti.fawe.object.task.ThrowableSupplier;
import com.boydti.fawe.util.StringMan; import com.boydti.fawe.util.StringMan;
@ -140,6 +142,7 @@ import org.enginehub.piston.converter.ArgumentConverters;
import org.enginehub.piston.exception.CommandException; import org.enginehub.piston.exception.CommandException;
import org.enginehub.piston.exception.CommandExecutionException; import org.enginehub.piston.exception.CommandExecutionException;
import org.enginehub.piston.exception.ConditionFailedException; import org.enginehub.piston.exception.ConditionFailedException;
import org.enginehub.piston.exception.StopExecutionException;
import org.enginehub.piston.exception.UsageException; import org.enginehub.piston.exception.UsageException;
import org.enginehub.piston.gen.CommandRegistration; import org.enginehub.piston.gen.CommandRegistration;
import org.enginehub.piston.impl.CommandManagerServiceImpl; import org.enginehub.piston.impl.CommandManagerServiceImpl;
@ -293,6 +296,9 @@ public final class PlatformCommandManager {
return editSession; return editSession;
}); });
}); });
globalInjectedValues.injectValue(Key.of(CFICommands.CFISettings.class),
context -> context.injectedValue(Key.of(Actor.class))
.orElseThrow(() -> new IllegalStateException("No CFI Settings")).getMeta("CFISettings"));
globalInjectedValues.injectValue(Key.of(World.class), globalInjectedValues.injectValue(Key.of(World.class),
context -> { context -> {
LocalSession localSession = context.injectedValue(Key.of(LocalSession.class)) LocalSession localSession = context.injectedValue(Key.of(LocalSession.class))
@ -742,6 +748,21 @@ public final class PlatformCommandManager {
worldEdit.flushBlockBag(actor, editSession); worldEdit.flushBlockBag(actor, editSession);
} }
Optional<CFICommands.CFISettings> cfiOpt = context.injectedValue(Key.of(CFICommands.CFISettings.class));
if (cfiOpt.isPresent()) {
CFICommands.CFISettings settings = cfiOpt.get();
HeightMapMCAGenerator gen = settings.getGenerator();
if (gen != null && gen.isModified()) {
try {
gen.update();
CFIChangeSet set = new CFIChangeSet(gen, actor.getUniqueId());
session.remember(actor, gen, set, actor.getLimit());
} catch (IOException e) {
e.printStackTrace();
}
}
}
Request.reset(); Request.reset();
} }

Datei anzeigen

@ -1,5 +1,6 @@
package com.sk89q.worldedit.extension.platform.binding; package com.sk89q.worldedit.extension.platform.binding;
import com.boydti.fawe.command.CFICommands;
import com.boydti.fawe.util.TextureUtil; import com.boydti.fawe.util.TextureUtil;
import com.boydti.fawe.util.image.ImageUtil; import com.boydti.fawe.util.image.ImageUtil;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;