geforkt von Mirrors/FastAsyncWorldEdit
misc changes.
Dieser Commit ist enthalten in:
Ursprung
7aa0d9c122
Commit
a23a4e5496
@ -2,9 +2,9 @@ package com.boydti.fawe.bukkit;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.IFawe;
|
||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||
import com.boydti.fawe.beta.implementation.cache.preloader.AsyncPreloader;
|
||||
import com.boydti.fawe.beta.implementation.cache.preloader.Preloader;
|
||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||
import com.boydti.fawe.bukkit.adapter.BukkitQueueHandler;
|
||||
import com.boydti.fawe.bukkit.listener.BrushListener;
|
||||
import com.boydti.fawe.bukkit.listener.BukkitImageListener;
|
||||
@ -54,9 +54,13 @@ import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class FaweBukkit implements IFawe, Listener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(FaweBukkit.class);
|
||||
|
||||
private final Plugin plugin;
|
||||
private VaultUtil vault;
|
||||
private ItemUtil itemUtil;
|
||||
@ -78,9 +82,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
try {
|
||||
new BrushListener(plugin);
|
||||
} catch (Throwable e) {
|
||||
debug("====== BRUSH LISTENER FAILED ======");
|
||||
e.printStackTrace();
|
||||
debug("===================================");
|
||||
log.debug("Brush Listener Failed", e);
|
||||
}
|
||||
if (PaperLib.isPaper() && Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING > 1) {
|
||||
new RenderListener(plugin);
|
||||
@ -220,9 +222,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
this.itemUtil = tmp = new ItemUtil();
|
||||
} catch (Throwable e) {
|
||||
Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES = false;
|
||||
debug("===== PERSISTENT BRUSH FAILED =====");
|
||||
e.printStackTrace();
|
||||
debug("===================================");
|
||||
log.debug("Persistent Brushes Failed", e);
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
@ -230,13 +230,12 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
|
||||
/**
|
||||
* Vault isn't required, but used for setting player permissions (WorldEdit bypass)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void setupVault() {
|
||||
try {
|
||||
this.vault = new VaultUtil();
|
||||
} catch (final Throwable e) {
|
||||
} catch (final Throwable ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,7 +269,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
}
|
||||
|
||||
/**
|
||||
* A mask manager handles region restrictions e.g. PlotSquared plots / WorldGuard regions
|
||||
* A mask manager handles region restrictions e.g., PlotSquared plots / WorldGuard regions
|
||||
*/
|
||||
@Override
|
||||
public Collection<FaweMaskManager> getMaskManagers() {
|
||||
@ -280,7 +279,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
try {
|
||||
managers.add(new Worldguard(worldguardPlugin));
|
||||
managers.add(new WorldguardFlag(worldguardPlugin));
|
||||
Fawe.debug("Attempting to use plugin 'WorldGuard'");
|
||||
log.debug("Attempting to use plugin 'WorldGuard'");
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
@ -288,7 +287,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
if (townyPlugin != null && townyPlugin.isEnabled()) {
|
||||
try {
|
||||
managers.add(new TownyFeature(townyPlugin));
|
||||
Fawe.debug("Attempting to use plugin 'Towny'");
|
||||
log.debug("Attempting to use plugin 'Towny'");
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
@ -296,11 +295,11 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
if (factionsPlugin != null && factionsPlugin.isEnabled()) {
|
||||
try {
|
||||
managers.add(new FactionsFeature(factionsPlugin));
|
||||
Fawe.debug("Attempting to use plugin 'Factions'");
|
||||
log.debug("Attempting to use plugin 'Factions'");
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
managers.add(new FactionsUUIDFeature(factionsPlugin, this));
|
||||
Fawe.debug("Attempting to use plugin 'FactionsUUID'");
|
||||
log.debug("Attempting to use plugin 'FactionsUUID'");
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
@ -309,7 +308,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
if (residencePlugin != null && residencePlugin.isEnabled()) {
|
||||
try {
|
||||
managers.add(new ResidenceFeature(residencePlugin, this));
|
||||
Fawe.debug("Attempting to use plugin 'Residence'");
|
||||
log.debug("Attempting to use plugin 'Residence'");
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
@ -317,7 +316,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
|
||||
try {
|
||||
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
|
||||
Fawe.debug("Attempting to use plugin 'GriefPrevention'");
|
||||
log.debug("Attempting to use plugin 'GriefPrevention'");
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
@ -326,7 +325,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
if (aSkyBlock != null && aSkyBlock.isEnabled()) {
|
||||
try {
|
||||
managers.add(new ASkyBlockHook(aSkyBlock));
|
||||
Fawe.debug("Attempting to use plugin 'ASkyBlock' found. Using it now.");
|
||||
log.debug("Attempting to use plugin 'ASkyBlock' found. Using it now.");
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -334,7 +333,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
if (Settings.IMP.EXPERIMENTAL.FREEBUILD) {
|
||||
try {
|
||||
managers.add(new FreeBuildRegion());
|
||||
Fawe.debug("Attempting to use plugin '<internal.freebuild>'");
|
||||
log.debug("Attempting to use plugin '<internal.freebuild>'");
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.boydti.fawe.bukkit.adapter;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||
import com.boydti.fawe.bukkit.listener.ChunkListener;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@ -40,7 +40,7 @@ public class BukkitQueueHandler extends QueueHandler {
|
||||
if (timingsEnabled) {
|
||||
if (alertTimingsChange) {
|
||||
alertTimingsChange = false;
|
||||
Fawe.debug("Having `parallel-threads` > 1 interferes with the timings.");
|
||||
getLogger(BukkitQueueHandler.class).debug("Having `parallel-threads` > 1 interferes with the timings.");
|
||||
}
|
||||
fieldTimingsEnabled.set(null, false);
|
||||
methodCheck.invoke(null);
|
||||
@ -69,4 +69,4 @@ public class BukkitQueueHandler extends QueueHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||
import com.boydti.fawe.beta.implementation.blocks.CharGetBlocks;
|
||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||
import com.boydti.fawe.bukkit.adapter.DelegateLock;
|
||||
import com.boydti.fawe.object.collection.AdaptedMap;
|
||||
import com.boydti.fawe.object.collection.BitArray4096;
|
||||
@ -22,6 +24,19 @@ import com.sk89q.worldedit.internal.Constants;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.server.v1_14_R1.BiomeBase;
|
||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_14_R1.Chunk;
|
||||
@ -45,12 +60,6 @@ import org.bukkit.craftbukkit.v1_14_R1.block.CraftBlock;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||
public ChunkSection[] sections;
|
||||
public Chunk nmsChunk;
|
||||
@ -363,7 +372,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
|
||||
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
||||
if (idTag == null || posTag == null || rotTag == null) {
|
||||
Fawe.debug("Unknown entity tag: " + nativeTag);
|
||||
getLogger(BukkitGetBlocks_1_14.class).debug("Unknown entity tag: " + nativeTag);
|
||||
continue;
|
||||
}
|
||||
final double x = posTag.getDouble(0);
|
||||
|
@ -19,7 +19,8 @@
|
||||
|
||||
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
@ -67,6 +68,20 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.server.v1_14_R1.Block;
|
||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_14_R1.BlockStateBoolean;
|
||||
@ -130,23 +145,6 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public final class Spigot_v1_14_R4 extends CachedBukkitAdapter implements BukkitImplAdapter<NBTBase>{
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@ -197,7 +195,7 @@ public final class Spigot_v1_14_R4 extends CachedBukkitAdapter implements Bukkit
|
||||
try {
|
||||
tileEntity.load(tag);
|
||||
} catch (Throwable e) {
|
||||
Fawe.debug("Invalid tag " + tag + " | " + tileEntity);
|
||||
//Fawe.debug("Invalid tag " + tag + " | " + tileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,7 +417,7 @@ public final class Spigot_v1_14_R4 extends CachedBukkitAdapter implements Bukkit
|
||||
worldServer.addEntity(createdEntity, SpawnReason.CUSTOM);
|
||||
return createdEntity.getBukkitEntity();
|
||||
} else {
|
||||
Fawe.debug("Invalid entity " + state.getType().getId());
|
||||
logger.debug("Invalid entity " + state.getType().getId());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.boydti.fawe.bukkit.filter;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||
@ -34,7 +34,7 @@ public class WorldGuardFilter extends CuboidRegionFilter {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
if (max.getBlockX() - min.getBlockX() > 1024 || max.getBlockZ() - min.getBlockZ() > 1024) {
|
||||
Fawe.debug("Large or complex region shapes cannot be optimized. Filtering will be slower");
|
||||
getLogger(WorldGuardFilter.class).debug("Large or complex region shapes cannot be optimized. Filtering will be slower");
|
||||
large = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.boydti.fawe.bukkit.listener;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.bukkit.FaweBukkit;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
@ -61,7 +63,7 @@ public abstract class ChunkListener implements Listener {
|
||||
TaskManager.IMP.repeat(() -> {
|
||||
Location tmpLoc = lastCancelPos;
|
||||
if (tmpLoc != null) {
|
||||
Fawe.debug("[FAWE `tick-limiter`] Detected and cancelled physics lag source at "
|
||||
getLogger(ChunkListener.class).debug("[FAWE `tick-limiter`] Detected and cancelled physics lag source at "
|
||||
+ tmpLoc);
|
||||
}
|
||||
rateLimit--;
|
||||
@ -351,7 +353,6 @@ public abstract class ChunkListener implements Listener {
|
||||
lastCancelPos = block.getLocation();
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else {
|
||||
count[1] = 0;
|
||||
}
|
||||
@ -391,7 +392,7 @@ public abstract class ChunkListener implements Listener {
|
||||
double vertical = Math.abs(velocity.getY());
|
||||
if (Math.abs(velocity.getX()) > vertical
|
||||
|| Math.abs(velocity.getZ()) > vertical) {
|
||||
Fawe.debug(
|
||||
getLogger(ChunkListener.class).warn(
|
||||
"[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at "
|
||||
+ ent.getLocation());
|
||||
ent.remove();
|
||||
@ -422,11 +423,10 @@ public abstract class ChunkListener implements Listener {
|
||||
cancelNearby(cx, cz);
|
||||
if (rateLimit <= 0) {
|
||||
rateLimit = 20;
|
||||
Fawe.debug(
|
||||
getLogger(ChunkListener.class).warn(
|
||||
"[FAWE `tick-limiter`] Detected and cancelled item lag source at " + loc);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,9 +125,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
@Override
|
||||
public boolean add(Plugin plugin) {
|
||||
if (plugin.getName().startsWith("AsyncWorldEdit")) {
|
||||
Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible");
|
||||
log.debug("Disabling `" + plugin.getName() + "` as it is incompatible");
|
||||
} else if (plugin.getName().startsWith("BetterShutdown")) {
|
||||
Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible (Improperly shaded classes from com.sk89q.minecraft.util.commands)");
|
||||
log.debug("Disabling `" + plugin.getName() + "` as it is incompatible (Improperly shaded classes from com.sk89q.minecraft.util.commands)");
|
||||
} else {
|
||||
return super.add(plugin);
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.management.InstanceAlreadyExistsException;
|
||||
import javax.management.NotificationEmitter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* [ WorldEdit action]
|
||||
@ -62,19 +64,22 @@ import javax.management.NotificationEmitter;
|
||||
* - The chunk is modified directly rather than through the API
|
||||
* \ Removes some overhead, and means some processing can be done async
|
||||
* - Lighting updates are performed on the chunk level rather than for every block
|
||||
* \ e.g. A blob of stone: only the visible blocks need to have the lighting calculated
|
||||
* \ e.g., A blob of stone: only the visible blocks need to have the lighting calculated
|
||||
* - Block changes are sent with a chunk packet
|
||||
* \ A chunk packet is generally quicker to create and smaller for large world edits
|
||||
* - No physics updates
|
||||
* \ Physics updates are slow, and are usually performed on each block
|
||||
* - Block data shortcuts
|
||||
* \ Some known blocks don't need to have the data set or accessed (e.g. air is never going to have data)
|
||||
* \ Some known blocks don't need to have the data set or accessed (e.g., air is never going to have data)
|
||||
* - Remove redundant extents
|
||||
* \ Up to 11 layers of extents can be removed
|
||||
* - History bypassing
|
||||
* \ FastMode bypasses history and means blocks in the world don't need to be checked and recorded
|
||||
*/
|
||||
public class Fawe {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Fawe.class);
|
||||
|
||||
/**
|
||||
* The FAWE instance;
|
||||
*/
|
||||
@ -183,7 +188,7 @@ public class Fawe {
|
||||
visualQueue = new VisualQueue(3);
|
||||
WEManager.IMP.managers.addAll(Fawe.this.IMP.getMaskManagers());
|
||||
WEManager.IMP.managers.add(new PlotSquaredFeature());
|
||||
Fawe.debug("Plugin 'PlotSquared' found. Using it now.");
|
||||
log.debug("Plugin 'PlotSquared' found. Using it now.");
|
||||
} catch (Throwable ignored) {}
|
||||
try {
|
||||
imp().startMetrics();
|
||||
@ -324,7 +329,7 @@ public class Fawe {
|
||||
public static void setupInjector() {
|
||||
/*
|
||||
* Modify the sessions
|
||||
* - EditSession supports custom queue and a lot of optimizations
|
||||
* - EditSession supports a custom queue, and a lot of optimizations
|
||||
* - LocalSession supports VirtualPlayers and undo on disk
|
||||
*/
|
||||
if (!Settings.IMP.EXPERIMENTAL.DISABLE_NATIVES) {
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.boydti.fawe;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.beta.Trimable;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
@ -27,10 +30,7 @@ import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -50,8 +50,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public enum FaweCache implements Trimable {
|
||||
IMP
|
||||
; // singleton
|
||||
@ -141,7 +139,7 @@ public enum FaweCache implements Trimable {
|
||||
synchronized (this) {
|
||||
pool = REGISTERED_POOLS.get(clazz);
|
||||
if (pool == null) {
|
||||
Fawe.debug("Not registered " + clazz);
|
||||
getLogger(FaweCache.class).debug("Not registered " + clazz);
|
||||
Supplier<T> supplier = IOUtil.supplier(clazz::newInstance);
|
||||
pool = supplier::get;
|
||||
REGISTERED_POOLS.put(clazz, pool);
|
||||
@ -162,7 +160,7 @@ public enum FaweCache implements Trimable {
|
||||
synchronized (this) {
|
||||
cache = REGISTERED_SINGLETONS.get(clazz);
|
||||
if (cache == null) {
|
||||
Fawe.debug("Not registered " + clazz);
|
||||
getLogger(FaweCache.class).debug("Not registered " + clazz);
|
||||
cache = new CleanableThreadLocal<>(IOUtil.supplier(clazz::newInstance));
|
||||
REGISTERED_SINGLETONS.put(clazz, cache);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public interface Filter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Make changes to the block here<br> - e.g. block.setId(...)<br> - Note: Performance is
|
||||
* Make changes to the block here<br> - e.g., block.setId(...)<br> - Note: Performance is
|
||||
* critical here<br>
|
||||
*
|
||||
* @param block
|
||||
@ -50,7 +50,6 @@ public interface Filter {
|
||||
* Do something with the IChunk after block filtering.
|
||||
*
|
||||
* @param chunk
|
||||
* @return
|
||||
*/
|
||||
default void finishChunk(IChunk chunk) {
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ import com.boydti.fawe.beta.implementation.processors.MultiBatchProcessor;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
@ -84,20 +82,12 @@ public interface IBatchProcessor {
|
||||
default boolean trimNBT(IChunkSet set, Function<BlockVector3, Boolean> contains) {
|
||||
Set<CompoundTag> ents = set.getEntities();
|
||||
if (!ents.isEmpty()) {
|
||||
for (Iterator<CompoundTag> iter = ents.iterator(); iter.hasNext();) {
|
||||
CompoundTag ent = iter.next();
|
||||
if (!contains.apply(ent.getEntityPosition().toBlockPoint())) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
ents.removeIf(ent -> !contains.apply(ent.getEntityPosition().toBlockPoint()));
|
||||
}
|
||||
Map<BlockVector3, CompoundTag> tiles = set.getTiles();
|
||||
if (!tiles.isEmpty()) {
|
||||
for (Iterator<Map.Entry<BlockVector3, CompoundTag>> iter = tiles.entrySet().iterator(); iter.hasNext();) {
|
||||
if (!contains.apply(iter.next().getKey())) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
tiles.entrySet().removeIf(blockVector3CompoundTagEntry -> !contains
|
||||
.apply(blockVector3CompoundTagEntry.getKey()));
|
||||
}
|
||||
return !tiles.isEmpty() || !ents.isEmpty();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
||||
int getZ();
|
||||
|
||||
/**
|
||||
* If the chunk is a delegate, returns it's parent's root
|
||||
* If the chunk is a delegate, returns its parent's root
|
||||
*
|
||||
* @return root IChunk
|
||||
*/
|
||||
@ -49,6 +49,7 @@ public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
||||
*
|
||||
* @return true if no changes are queued for this chunk
|
||||
*/
|
||||
@Override
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
@ -56,7 +57,7 @@ public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
||||
*
|
||||
* @param filter the filter
|
||||
* @param block The filter block
|
||||
* @param region The region allowed to filter (may be null)
|
||||
* @param region The region allowed to filter (maybe null)
|
||||
*/
|
||||
void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region, boolean full);
|
||||
|
||||
@ -70,10 +71,13 @@ public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
||||
// void flood(Flood flood, FilterBlockMask mask, ChunkFilterBlock block);
|
||||
|
||||
/* set - queues a change */
|
||||
@Override
|
||||
boolean setBiome(int x, int y, int z, BiomeType biome);
|
||||
|
||||
@Override
|
||||
boolean setTile(int x, int y, int z, CompoundTag tag);
|
||||
|
||||
@Override
|
||||
boolean setBlock(int x, int y, int z, BlockStateHolder block);
|
||||
|
||||
@Override
|
||||
|
@ -1,10 +1,8 @@
|
||||
package com.boydti.fawe.beta;
|
||||
|
||||
import com.boydti.fawe.beta.Trimable;
|
||||
|
||||
/**
|
||||
* IGetBlocks may be cached by the WorldChunkCache so that it can be used between multiple
|
||||
* IQueueExtents - avoids conversion between palette and raw data on every block get
|
||||
* IQueueExtents - avoids conversion between a palette and raw data on every block get
|
||||
*/
|
||||
public interface IChunkCache<T> extends Trimable {
|
||||
T get(int chunkX, int chunkZ);
|
||||
|
@ -43,6 +43,7 @@ public interface IChunkGet extends IBlocks, Trimable, InputExtent {
|
||||
|
||||
<T extends Future<T>> T call(IChunkSet set, Runnable finalize);
|
||||
|
||||
@Override
|
||||
char[] load(int layer);
|
||||
|
||||
CompoundTag getEntity(UUID uuid);
|
||||
|
@ -4,22 +4,15 @@ import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.implementation.IChunkExtent;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.implementation.processors.IBatchProcessorHolder;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.Flushable;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* TODO: implement Extent (need to refactor Extent first) Interface for a queue based extent which
|
||||
@ -58,7 +51,6 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
||||
* - Faster than getting it using NMS and allows for wrapping
|
||||
* @param x
|
||||
* @param z
|
||||
* @param supplier
|
||||
* @return
|
||||
*/
|
||||
IChunkGet getCachedGet(int x, int z);
|
||||
@ -67,7 +59,6 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
||||
* Get the cached chunk set object
|
||||
* @param x
|
||||
* @param z
|
||||
* @param supplier
|
||||
* @return
|
||||
*/
|
||||
IChunkSet getCachedSet(int x, int z);
|
||||
@ -101,7 +92,7 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
||||
T create(boolean isFull);
|
||||
|
||||
/**
|
||||
* Wrap the chunk object (i.e. for region restrictions / limits etc.)
|
||||
* Wrap the chunk object (i.e., for region restrictions / limits etc.)
|
||||
*
|
||||
* @param root
|
||||
* @return wrapped chunk
|
||||
|
@ -1,15 +1,15 @@
|
||||
package com.boydti.fawe.beta;
|
||||
|
||||
/**
|
||||
* Interface for objects that can be trimmed (memory related)<br> - Trimming will reduce it's memory
|
||||
* Interface for objects that can be trimmed (memory related)<br> - Trimming will reduce its memory
|
||||
* footprint
|
||||
*/
|
||||
public interface Trimable {
|
||||
|
||||
/**
|
||||
* Trim the object, reducing it's memory footprint
|
||||
* Trims the object, reducing its memory footprint
|
||||
*
|
||||
* @param aggressive if trimming should be aggressive e.g. Not return early when the first
|
||||
* @param aggressive if trimming should be aggressive e.g., Not return early when the first
|
||||
* element cannot be trimmed
|
||||
* @return if this object is empty at the end of the trim, and can therefore be deleted
|
||||
*/
|
||||
|
@ -386,7 +386,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
||||
/**
|
||||
* Create a wrapped set object
|
||||
* - The purpose of wrapping is to allow different extents to intercept / alter behavior
|
||||
* - E.g. caching, optimizations, filtering
|
||||
* - e.g., caching, optimizations, filtering
|
||||
* @return
|
||||
*/
|
||||
private IChunkSet newWrappedSet() {
|
||||
@ -396,7 +396,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
||||
/**
|
||||
* Create a wrapped get object
|
||||
* - The purpose of wrapping is to allow different extents to intercept / alter behavior
|
||||
* - E.g. caching, optimizations, filtering
|
||||
* - e.g., caching, optimizations, filtering
|
||||
* @return
|
||||
*/
|
||||
private IChunkGet newWrappedGet() {
|
||||
|
@ -1,13 +1,9 @@
|
||||
package com.boydti.fawe.beta.implementation.chunk;
|
||||
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.beta.IQueueChunk;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.FilterBlockMask;
|
||||
import com.boydti.fawe.beta.Flood;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -16,20 +12,16 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Future;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public enum NullChunk implements IQueueChunk {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public void init(IQueueExtent extent, int x, int z) {}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return 0;
|
||||
|
@ -54,6 +54,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
limit.THROW_MAX_CHECKS(region.getArea());
|
||||
try {
|
||||
@ -66,6 +67,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities() {
|
||||
limit.THROW_MAX_CHECKS();
|
||||
try {
|
||||
@ -78,6 +80,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Entity createEntity(Location location, BaseEntity entity) {
|
||||
limit.THROW_MAX_CHANGES();
|
||||
@ -507,6 +510,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
limit.THROW_MAX_CHECKS();
|
||||
try {
|
||||
@ -532,6 +536,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(int x, int y, int z) {
|
||||
limit.THROW_MAX_CHECKS();
|
||||
try {
|
||||
@ -544,6 +549,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
limit.THROW_MAX_CHECKS();
|
||||
try {
|
||||
@ -556,6 +562,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiomeType(int x, int z) {
|
||||
limit.THROW_MAX_CHECKS();
|
||||
try {
|
||||
@ -568,6 +575,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
|
||||
limit.THROW_MAX_CHANGES();
|
||||
@ -582,6 +590,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
||||
limit.THROW_MAX_CHANGES();
|
||||
if (block.hasNbtData()) limit.MAX_BLOCKSTATES();
|
||||
@ -595,6 +604,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||
limit.THROW_MAX_CHANGES();
|
||||
limit.MAX_BLOCKSTATES();
|
||||
@ -608,6 +618,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
limit.THROW_MAX_CHANGES();
|
||||
try {
|
||||
@ -620,6 +631,7 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
limit.THROW_MAX_CHANGES();
|
||||
try {
|
||||
|
@ -1,37 +1,33 @@
|
||||
package com.boydti.fawe.beta.implementation.queue;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.IQueueChunk;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.CharFilterBlock;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.IBatchProcessor;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkCache;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.boydti.fawe.beta.IQueueChunk;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.IChunkCache;
|
||||
import com.boydti.fawe.beta.implementation.chunk.NullChunk;
|
||||
import com.boydti.fawe.beta.implementation.blocks.CharSetBlocks;
|
||||
import com.boydti.fawe.beta.implementation.chunk.ChunkHolder;
|
||||
import com.boydti.fawe.beta.implementation.chunk.NullChunk;
|
||||
import com.boydti.fawe.beta.implementation.chunk.ReferenceChunk;
|
||||
import com.boydti.fawe.beta.implementation.processors.BatchProcessorHolder;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.CharFilterBlock;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor;
|
||||
import com.boydti.fawe.beta.implementation.processors.ExtentBatchProcessorHolder;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.MemUtil;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
||||
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
* Single threaded implementation for IQueueExtent (still abstract) - Does not implement creation of
|
||||
* chunks (that has to implemented by the platform e.g. Bukkit)
|
||||
* chunks (that has to implemented by the platform e.g., Bukkit)
|
||||
* <p>
|
||||
* This queue is reusable {@link #init(IChunkCache)}
|
||||
*/
|
||||
|
@ -163,7 +163,7 @@ public class AnvilCommands {
|
||||
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.deleteallunvisited")
|
||||
public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Arg(name = "filedurationmillis", desc = "int", def = "60000") int fileDurationMillis) throws WorldEditException {
|
||||
public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Arg(desc = "int", def = "60000") int fileDurationMillis) throws WorldEditException {
|
||||
// DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
|
||||
// DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
|
||||
// if (result != null) {
|
||||
@ -182,7 +182,7 @@ public class AnvilCommands {
|
||||
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.deleteallunclaimed")
|
||||
public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Arg(name = "filedurationmillis", desc = "int", def = "60000") int fileDurationMillis, @Switch(name = 'd', desc = "TODO") boolean debug) throws WorldEditException {
|
||||
public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Arg(desc = "int", def = "60000") int fileDurationMillis, @Switch(name = 'd', desc = "TODO") boolean debug) throws WorldEditException {
|
||||
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
|
||||
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
|
||||
// if (debug) {
|
||||
@ -205,7 +205,7 @@ public class AnvilCommands {
|
||||
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.deleteunclaimed")
|
||||
public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Arg(name = "filedurationmillis", desc = "int", def = "60000") int fileDurationMillis, @Switch(name = 'd', desc = "TODO") boolean debug) throws WorldEditException {
|
||||
public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Arg(desc = "int", def = "60000") int fileDurationMillis, @Switch(name = 'd', desc = "TODO") boolean debug) throws WorldEditException {
|
||||
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
|
||||
// if (debug) {
|
||||
// filter.enableDebug();
|
||||
@ -221,7 +221,7 @@ public class AnvilCommands {
|
||||
aliases = {"deloldreg" },
|
||||
desc = "Delete regions which haven't been accessed in a certain amount of time",
|
||||
descFooter = "You can use seconds (s), minutes (m), hours (h), days (d), weeks (w), years (y)\n" +
|
||||
"(months are not a unit of time) E.g. 8h5m12s\n"
|
||||
"(months are not a unit of time) e.g., 8h5m12s\n"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.deletealloldregions")
|
||||
public void deleteAllOldRegions(Player player, String folder, String time) throws WorldEditException {
|
||||
|
@ -1,5 +1,9 @@
|
||||
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.FaweAPI;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock;
|
||||
@ -15,7 +19,6 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.boydti.fawe.util.image.ImageUtil;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
@ -25,7 +28,6 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
@ -37,7 +39,6 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
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.Vector3;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
@ -47,7 +48,6 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
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.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
@ -56,18 +56,6 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
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.DataBufferInt;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -85,17 +73,22 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
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 javax.imageio.ImageIO;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
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.jetbrains.annotations.NotNull;
|
||||
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class CFICommands {
|
||||
|
||||
private final WorldEdit worldEdit;
|
||||
private final @NonNull TextComponent doubleNewLine = TextComponent.of("\n\n");
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -252,14 +245,14 @@ public class CFICommands {
|
||||
desc = "Set the floor and main block"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void column(Player player, @Arg(name = "pattern", desc = "Pattern") Pattern patternArg, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void column(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setColumn(load(image), patternArg, !disableWhiteOnly);
|
||||
} else if (maskOpt != null) {
|
||||
gen.setColumn(maskOpt, patternArg);
|
||||
gen.setColumn(load(image), pattern, !disableWhiteOnly);
|
||||
} else if (mask != null) {
|
||||
gen.setColumn(mask, pattern);
|
||||
} else {
|
||||
gen.setColumn(patternArg);
|
||||
gen.setColumn(pattern);
|
||||
}
|
||||
player.print("Set column!");
|
||||
assertSettings(player).resetComponent();
|
||||
@ -271,21 +264,21 @@ public class CFICommands {
|
||||
desc = "Set the floor (default: grass)"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void floorCmd(Player player, @Arg(name = "pattern", desc = "Pattern") Pattern patternArg, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
floor(player, patternArg, image, maskOpt, disableWhiteOnly);
|
||||
public void floorCmd(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
floor(player, pattern, image, mask, disableWhiteOnly);
|
||||
player.print("Set floor!");
|
||||
assertSettings(player).resetComponent();
|
||||
component(player);
|
||||
}
|
||||
|
||||
private void floor(Player player, @Arg(name = "pattern", desc = "Pattern") Pattern patternArg, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||
private void floor(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||
HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setFloor(load(image), patternArg, !disableWhiteOnly);
|
||||
} else if (maskOpt != null) {
|
||||
gen.setFloor(maskOpt, patternArg);
|
||||
gen.setFloor(load(image), pattern, !disableWhiteOnly);
|
||||
} else if (mask != null) {
|
||||
gen.setFloor(mask, pattern);
|
||||
} else {
|
||||
gen.setFloor(patternArg);
|
||||
gen.setFloor(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,21 +287,21 @@ public class CFICommands {
|
||||
desc = "Set the main block (default: stone)"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void mainCmd(Player player, @Arg(name = "pattern", desc = "Pattern") Pattern patternArg, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
main(player, patternArg, image, maskOpt, disableWhiteOnly);
|
||||
public void mainCmd(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
main(player, pattern, image, maskOpt, disableWhiteOnly);
|
||||
player.print("Set main!");
|
||||
assertSettings(player).resetComponent();
|
||||
component(player);
|
||||
}
|
||||
|
||||
public void main(Player player, @Arg(name = "pattern", desc = "Pattern") Pattern patternArg, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void main(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setMain(load(image), patternArg, !disableWhiteOnly);
|
||||
gen.setMain(load(image), pattern, !disableWhiteOnly);
|
||||
} else if (maskOpt != null) {
|
||||
gen.setMain(maskOpt, patternArg);
|
||||
gen.setMain(maskOpt, pattern);
|
||||
} else {
|
||||
gen.setMain(patternArg);
|
||||
gen.setMain(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,17 +310,17 @@ public class CFICommands {
|
||||
aliases = {"setoverlay"},
|
||||
desc = "Set the overlay block",
|
||||
descFooter = "Change the block directly above the floor (default: air)\n" +
|
||||
"e.g. Tallgrass"
|
||||
"e.g., Tallgrass"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void overlay(Player player, @Arg(name = "pattern", desc = "Pattern") Pattern patternArg, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void overlay(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setOverlay(load(image), patternArg, !disableWhiteOnly);
|
||||
} else if (maskOpt != null) {
|
||||
gen.setOverlay(maskOpt, patternArg);
|
||||
gen.setOverlay(load(image), pattern, !disableWhiteOnly);
|
||||
} else if (mask != null) {
|
||||
gen.setOverlay(mask, pattern);
|
||||
} else {
|
||||
gen.setOverlay(patternArg);
|
||||
gen.setOverlay(pattern);
|
||||
}
|
||||
player.print("Set overlay!");
|
||||
component(player);
|
||||
@ -342,18 +335,18 @@ public class CFICommands {
|
||||
" - A good value for radius and iterations would be 1 8."
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void smoothCmd(Player player, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
smooth(player, radius, iterations, image, maskOpt, disableWhiteOnly);
|
||||
public void smoothCmd(Player player, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
smooth(player, radius, iterations, image, mask, disableWhiteOnly);
|
||||
assertSettings(player).resetComponent();
|
||||
component(player);
|
||||
}
|
||||
|
||||
private void smooth(Player player, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
private void smooth(Player player, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||
if (image != null) {
|
||||
gen.smooth(load(image), !disableWhiteOnly, radius, iterations);
|
||||
} else {
|
||||
gen.smooth(maskOpt, radius, iterations);
|
||||
gen.smooth(mask, radius, iterations);
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,11 +355,11 @@ public class CFICommands {
|
||||
desc = "Create some snow"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void snow(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void snow(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||
floor(player, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, maskOpt, disableWhiteOnly);
|
||||
main(player, BlockTypes.SNOW_BLOCK, image, maskOpt, disableWhiteOnly);
|
||||
smooth(player, 1, 8, image, maskOpt, disableWhiteOnly);
|
||||
floor(player, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly);
|
||||
main(player, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly);
|
||||
smooth(player, 1, 8, image, mask, disableWhiteOnly);
|
||||
player.print(TextComponent.of("Added snow!"));
|
||||
assertSettings(player).resetComponent();
|
||||
component(player);
|
||||
@ -390,7 +383,7 @@ public class CFICommands {
|
||||
name = "paletteblocks",
|
||||
desc = "Set the blocks used for coloring",
|
||||
descFooter = "Allow only specific blocks to be used for coloring\n" +
|
||||
"`blocks` is a list of blocks e.g. stone,bedrock,wool\n" +
|
||||
"`blocks` is a list of blocks e.g., stone,bedrock,wool\n" +
|
||||
"`#clipboard` will only use the blocks present in your clipboard."
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
@ -516,7 +509,7 @@ public class CFICommands {
|
||||
" - The distance is the spacing between each schematic"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void schem(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask") Mask mask, String schematic, int rarity, int distance, boolean rotate)throws IOException, WorldEditException {
|
||||
public void schem(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(desc = "Mask") Mask mask, String schematic, int rarity, int distance, boolean rotate)throws IOException, WorldEditException {
|
||||
HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||
|
||||
World world = player.getWorld();
|
||||
@ -542,14 +535,14 @@ public class CFICommands {
|
||||
" - If a mask is used, the biome will be set anywhere the mask applies"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void biome(Player player, @Arg(name = "biome", desc = "Biome type") BiomeType biomeType, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void biome(Player player, @Arg(desc = "Biome type") BiomeType biome, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setBiome(load(image), biomeType, !disableWhiteOnly);
|
||||
} else if (maskOpt != null) {
|
||||
gen.setBiome(maskOpt, biomeType);
|
||||
gen.setBiome(load(image), biome, !disableWhiteOnly);
|
||||
} else if (mask != null) {
|
||||
gen.setBiome(mask, biome);
|
||||
} else {
|
||||
gen.setBiome(biomeType);
|
||||
gen.setBiome(biome);
|
||||
}
|
||||
player.print(TextComponent.of("Set biome!"));
|
||||
assertSettings(player).resetComponent();
|
||||
@ -573,8 +566,8 @@ public class CFICommands {
|
||||
descFooter = "Use a specific pattern and settings to generate ore"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void ore(Player player, @Arg(name = "mask", desc = "Mask") Mask mask, @Arg(name = "pattern", desc = "Pattern") Pattern patternArg, int size, int frequency, int rariry, int minY, int maxY) throws WorldEditException {
|
||||
assertSettings(player).getGenerator().addOre(mask, patternArg, size, frequency, rariry, minY, maxY);
|
||||
public void ore(Player player, @Arg(desc = "Mask") Mask mask, @Arg(desc = "Pattern") Pattern pattern, int size, int frequency, int rarity, int minY, int maxY) throws WorldEditException {
|
||||
assertSettings(player).getGenerator().addOre(mask, pattern, size, frequency, rarity, minY, maxY);
|
||||
player.print(TextComponent.of("Added ore!"));
|
||||
populate(player);
|
||||
}
|
||||
@ -584,7 +577,7 @@ public class CFICommands {
|
||||
desc = "Generate the vanilla ores"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void ores(Player player, @Arg(name = "mask", desc = "Mask") Mask mask) throws WorldEditException {
|
||||
public void ores(Player player, @Arg(desc = "Mask") Mask mask) throws WorldEditException {
|
||||
assertSettings(player).getGenerator().addDefaultOres(mask);
|
||||
player.print(TextComponent.of("Added ores!"));
|
||||
populate(player);
|
||||
@ -609,7 +602,7 @@ public class CFICommands {
|
||||
|
||||
@Command(
|
||||
name = "water",
|
||||
desc = "Change the block used for water\ne.g. Lava"
|
||||
desc = "Change the block used for water\n e.g., Lava"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void waterId(Player player, @Arg(desc = "block") BlockStateHolder block) throws WorldEditException {
|
||||
@ -642,8 +635,8 @@ public class CFICommands {
|
||||
" - A value of 0 is the default and will not modify the height"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void worldthickness(Player player, @Arg(name = "height", desc = "brush height") int heightArg) throws WorldEditException {
|
||||
assertSettings(player).getGenerator().setWorldThickness(heightArg);
|
||||
public void worldthickness(Player player, @Arg(desc = "brush height") int height) throws WorldEditException {
|
||||
assertSettings(player).getGenerator().setWorldThickness(height);
|
||||
player.print("Set world thickness!");
|
||||
component(player);
|
||||
}
|
||||
@ -655,8 +648,8 @@ public class CFICommands {
|
||||
" - A value of 0 is the default and will only set the top block"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void floorthickness(Player player, @Arg(name = "height", desc = "brush height") int heightArg) throws WorldEditException {
|
||||
assertSettings(player).getGenerator().setFloorThickness(heightArg);
|
||||
public void floorthickness(Player player, @Arg( desc = "brush height") int height) throws WorldEditException {
|
||||
assertSettings(player).getGenerator().setFloorThickness(height);
|
||||
player.print("Set floor thickness!");
|
||||
component(player);
|
||||
}
|
||||
@ -696,8 +689,8 @@ public class CFICommands {
|
||||
" - By default water is disabled (with a value of 0)"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void waterheight(Player player, @Arg(name = "height", desc = "brush height") int heightArg) throws WorldEditException {
|
||||
assertSettings(player).getGenerator().setWaterHeight(heightArg);
|
||||
public void waterheight(Player player, @Arg(desc = "brush height") int height) throws WorldEditException {
|
||||
assertSettings(player).getGenerator().setWaterHeight(height);
|
||||
player.print("Set water height!");
|
||||
component(player);
|
||||
}
|
||||
@ -709,7 +702,7 @@ public class CFICommands {
|
||||
)
|
||||
// ![79,174,212,5:3,5:4,18,161,20]
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void glass(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
public void glass(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
CFISettings settings = assertSettings(player);
|
||||
settings.getGenerator().setColorWithGlass(load(image));
|
||||
player.print("Set color with glass!");
|
||||
@ -726,13 +719,13 @@ public class CFICommands {
|
||||
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void color(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
public void color(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
CFISettings settings = assertSettings(player);
|
||||
HeightMapMCAGenerator gen = settings.getGenerator();
|
||||
if (imageMask != null) {
|
||||
gen.setColor(load(image), load(imageMask), !disableWhiteOnly);
|
||||
} else if (maskOpt != null) {
|
||||
gen.setColor(load(image), maskOpt);
|
||||
} else if (mask != null) {
|
||||
gen.setColor(load(image), mask);
|
||||
} else {
|
||||
gen.setColor(load(image));
|
||||
}
|
||||
@ -750,9 +743,9 @@ public class CFICommands {
|
||||
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void blockbiome(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
public void blockbiome(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
CFISettings settings = assertSettings(player);
|
||||
settings.getGenerator().setBlockAndBiomeColor(load(image), maskOpt, load(imageMask), !disableWhiteOnly);
|
||||
settings.getGenerator().setBlockAndBiomeColor(load(image), mask, load(imageMask), !disableWhiteOnly);
|
||||
player.print(TextComponent.of("Set color with blocks and biomes!"));
|
||||
settings.resetColoring();
|
||||
mainMenu(player);
|
||||
@ -766,7 +759,7 @@ public class CFICommands {
|
||||
" - If you changed the block to something other than grass you will not see anything."
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void biomecolor(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
public void biomecolor(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
CFISettings settings = assertSettings(player);
|
||||
settings.getGenerator().setBiomeColor(load(image));
|
||||
player.print(TextComponent.of("Set color with biomes!"));
|
||||
@ -821,17 +814,28 @@ public class CFICommands {
|
||||
String blockList = materials.size() > 100 ? materials.size() + " blocks" : StringMan.join(materials, ',');
|
||||
|
||||
int biomePriority = gen.getBiomePriority();
|
||||
|
||||
//TODO fix this so it can execute commands and show tooltips.
|
||||
@NotNull Builder builder = TextComponent.builder(">> Current Settings <<").append(newline())
|
||||
.append("Randomization ").append("[" + Boolean.toString(rand).toUpperCase() + "]")//.cmdTip("/cfi randomization " + (!rand))
|
||||
.append(newline())
|
||||
.append("Mask ").append("[" + mask + "]")//.cmdTip("/cfi mask")
|
||||
.append(newline())
|
||||
.append("Blocks ").append("[" + blocks + "]")//.tooltip(blockList).command("/cfi paletteBlocks")
|
||||
.append(newline())
|
||||
.append("BiomePriority ").append("[" + biomePriority + "]")//.cmdTip("/cfi biomepriority")
|
||||
.append(newline());
|
||||
TextComponent.empty().clickEvent(ClickEvent.runCommand(
|
||||
"/cfi randomization " + !rand)).hoverEvent(HoverEvent.showText(
|
||||
TextComponent.of("/cfi randomization " + !rand)));
|
||||
@NotNull Builder builder = TextComponent.builder(">> Current Settings <<");
|
||||
builder.append(newline());
|
||||
builder.append(TextComponent.of("Randomization [" + Boolean.toString(rand).toUpperCase() + "]")
|
||||
.clickEvent(ClickEvent.runCommand(
|
||||
"/cfi randomization " + !rand)).hoverEvent(HoverEvent.showText(
|
||||
TextComponent.of("/cfi randomization " + !rand))));
|
||||
builder.append(newline());
|
||||
builder.append(TextComponent.of("Mask [" + mask + "]").clickEvent(ClickEvent.runCommand(
|
||||
"/cfi mask")).hoverEvent(HoverEvent.showText(
|
||||
TextComponent.of("/cfi mask"))));
|
||||
builder.append(newline());
|
||||
builder.append(TextComponent.of("Blocks [" + blocks + "]").clickEvent(ClickEvent.runCommand(
|
||||
"/cfi mask")).hoverEvent(HoverEvent.showText(
|
||||
TextComponent.of("/cfi mask"))));
|
||||
builder.append(newline());
|
||||
builder.append(TextComponent.of("Biome Priority [" + biomePriority + "]").clickEvent(ClickEvent.runCommand(
|
||||
"/cfi mask")).hoverEvent(HoverEvent.showText(
|
||||
TextComponent.of("/cfi biomepriority"))));
|
||||
builder.append(newline());
|
||||
|
||||
if (settings.image != null) {
|
||||
StringBuilder colorArgs = new StringBuilder(" " + settings.imageArg);
|
||||
@ -845,6 +849,7 @@ public class CFICommands {
|
||||
colorArgs.append(" -w");
|
||||
}
|
||||
|
||||
//TODO
|
||||
builder.append("Image: ")
|
||||
.append("[" + settings.imageArg + "]")//.cmdTip("/cfi " + Commands.getAlias(CFICommands.class, "image"))
|
||||
.append(newline()).append(newline())
|
||||
@ -857,7 +862,7 @@ public class CFICommands {
|
||||
.append("You MUST provide an image: ")
|
||||
.append("[None]");//.cmdTip("/cfi " + Commands.getAlias(Command.class, "image")).append(newline());
|
||||
}
|
||||
builder.append("< [Back]");//.cmdTip(alias()).send(fp);
|
||||
builder.append("< [Back]");//.cmdTip(alias()).send(player);
|
||||
player.print(builder.build());
|
||||
}
|
||||
|
||||
@ -866,14 +871,14 @@ public class CFICommands {
|
||||
desc = "Select a mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void mask(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context){
|
||||
public void mask(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context){
|
||||
CFISettings settings = assertSettings(player);
|
||||
String[] split = getArguments(context).split(" ");
|
||||
int index = 2;
|
||||
settings.imageMask = imageMask;
|
||||
settings.imageMaskArg = imageMask != null ? split[index++] : null;
|
||||
settings.mask = maskOpt;
|
||||
settings.maskArg = maskOpt != null ? split[index++] : null;
|
||||
settings.mask = mask;
|
||||
settings.maskArg = mask != null ? split[index++] : null;
|
||||
settings.whiteOnly = !disableWhiteOnly;
|
||||
|
||||
String s = "/cfi mask http://";
|
||||
@ -901,16 +906,16 @@ public class CFICommands {
|
||||
desc = "Select a pattern"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void pattern(Player player, @Arg(name = "pattern", desc = "Pattern", def = "") Pattern patternArg, InjectedValueAccess context)throws CommandException {
|
||||
public void pattern(Player player, @Arg(desc = "Pattern", def = "") Pattern pattern, InjectedValueAccess context)throws CommandException {
|
||||
CFISettings settings = assertSettings(player);
|
||||
String[] split = getArguments(context).split(" ");
|
||||
int index = 2;
|
||||
settings.pattern = patternArg;
|
||||
settings.patternArg = patternArg == null ? null : split[index++];
|
||||
settings.pattern = pattern;
|
||||
settings.patternArg = pattern == null ? null : split[index++];
|
||||
|
||||
StringBuilder cmd = new StringBuilder("/cfi pattern ");
|
||||
|
||||
if (patternArg != null) {
|
||||
if (pattern != null) {
|
||||
settings.getCategory().accept(player);
|
||||
} else {
|
||||
String s = cmd + " stone";
|
||||
@ -1043,8 +1048,7 @@ public class CFICommands {
|
||||
.append("Pattern ").append(TextComponent.of("[" + pattern + "]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi pattern")))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi pattern")))
|
||||
.append(newline())
|
||||
.append(newline())
|
||||
.append(doubleNewLine)
|
||||
.append(">> Components <<")
|
||||
.append(newline())
|
||||
.append(TextComponent.of("[Height]")
|
||||
@ -1067,39 +1071,58 @@ public class CFICommands {
|
||||
|
||||
if (pattern != null) {
|
||||
String disabled = "You must specify a pattern";
|
||||
msg.append(TextComponent.of("[WaterId]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline())
|
||||
.append(TextComponent.of("[BedrockId]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
|
||||
.append(TextComponent.of("[Floor]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
|
||||
.append(TextComponent.of("[Main]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
|
||||
.append(TextComponent.of("[Column]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline())
|
||||
.append(TextComponent.of("[Overlay]", TextColor.RED).hoverEvent(HoverEvent.showText(TextComponent.of(disabled)))).append(newline()).append(newline());
|
||||
msg.append(TextComponent.of("[WaterId]", TextColor.RED)
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of(disabled))));
|
||||
msg.append(newline());
|
||||
msg.append(TextComponent.of("[BedrockId]", TextColor.RED)
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of(disabled))));
|
||||
msg.append(doubleNewLine);
|
||||
msg.append(TextComponent.of("[Floor]", TextColor.RED)
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of(disabled))));
|
||||
msg.append(doubleNewLine);
|
||||
msg.append(TextComponent.of("[Main]", TextColor.RED)
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of(disabled))));
|
||||
msg.append(doubleNewLine);
|
||||
msg.append(TextComponent.of("[Column]", TextColor.RED)
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of(disabled))));
|
||||
msg.append(doubleNewLine);
|
||||
msg.append(TextComponent.of("[Overlay]", TextColor.RED)
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of(disabled))));
|
||||
msg.append(doubleNewLine);
|
||||
} else {
|
||||
StringBuilder compArgs = new StringBuilder();
|
||||
compArgs.append(" " + settings.patternArg + maskArgs);
|
||||
|
||||
msg
|
||||
.append(TextComponent.of("[WaterId]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi waterId " + pattern)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi waterId " + pattern)))
|
||||
.append(" - Water id for whole map")
|
||||
.append(newline())
|
||||
.append(TextComponent.of("[BedrockId]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi baseId " + pattern)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi baseId " + pattern)))
|
||||
.append(TextComponent.of(" - Bedrock id for whole map"))
|
||||
.append(newline())
|
||||
.append(TextComponent.of("[Floor]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi floor " + compArgs)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi floor " + compArgs)))
|
||||
.append(TextComponent.of(" - Set the floor in the masked areas")).append(newline())
|
||||
.append(TextComponent.of("[Main]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi main " + compArgs)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi main " + compArgs)))
|
||||
.append(TextComponent.of(" - Set the main block in the masked areas")).append(newline())
|
||||
.append(TextComponent.of("[Column]").hoverEvent(HoverEvent.showText(TextComponent.of("/cfi column" + compArgs)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi column" + compArgs))).append(" - Set the columns in the masked areas").append(newline())
|
||||
.append(TextComponent.of("[Overlay]").hoverEvent(HoverEvent.showText(TextComponent.of("/cfi overlay" + compArgs)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi overlay" + compArgs))).append(" - Set the overlay in the masked areas").append(newline());
|
||||
msg.append(TextComponent.of("[WaterId]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi waterId " + pattern)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi waterId " + pattern)));
|
||||
msg.append(" - Water id for whole map");
|
||||
msg.append(newline());
|
||||
msg.append(TextComponent.of("[BedrockId]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi baseId " + pattern)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi baseId " + pattern)));
|
||||
msg.append(TextComponent.of(" - Bedrock id for whole map"));
|
||||
msg.append(newline());
|
||||
msg.append(TextComponent.of("[Floor]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi floor " + compArgs)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi floor " + compArgs)));
|
||||
msg.append(TextComponent.of(" - Set the floor in the masked areas"));
|
||||
msg.append(newline());
|
||||
msg.append(TextComponent.of("[Main]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi main " + compArgs)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi main " + compArgs)));
|
||||
msg.append(TextComponent.of(" - Set the main block in the masked areas"));
|
||||
msg.append(newline());
|
||||
msg.append(TextComponent.of("[Column]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi column" + compArgs)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi column" + compArgs)));
|
||||
msg.append(" - Set the columns in the masked areas");
|
||||
msg.append(newline());
|
||||
msg.append(TextComponent.of("[Overlay]")
|
||||
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi overlay" + compArgs)))
|
||||
.clickEvent(ClickEvent.runCommand("/cfi overlay" + compArgs)));
|
||||
msg.append(" - Set the overlay in the masked areas");
|
||||
msg.append(newline());
|
||||
}
|
||||
|
||||
msg.append(newline())
|
||||
@ -1263,17 +1286,19 @@ public class CFICommands {
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(option))));
|
||||
}
|
||||
producer.newline();
|
||||
producer.newline().append(TextComponent.of("<> [View]", TextColor.DARK_AQUA)
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "download"))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("View full res image"))));
|
||||
|
||||
producer.newline().append(TextComponent.of(">< [Cancel]", TextColor.RED)
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "cancel"))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("cancel"))));
|
||||
|
||||
producer.newline().append(TextComponent.of(">> [Done]", TextColor.DARK_GREEN)
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "done"))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("done"))));
|
||||
producer.newline();
|
||||
producer.append(TextComponent.of("<> [View]", TextColor.DARK_AQUA)
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "download"))
|
||||
.hoverEvent(HoverEvent
|
||||
.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("View full res image"))));
|
||||
producer.newline();
|
||||
producer.append(TextComponent.of(">< [Cancel]", TextColor.RED)
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "cancel"))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("cancel"))));
|
||||
producer.newline();
|
||||
producer.append(TextComponent.of(">> [Done]", TextColor.DARK_GREEN)
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, prefix + "done"))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("done"))));
|
||||
|
||||
actor.print(producer.create());
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.config;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.configuration.MemorySection;
|
||||
import com.boydti.fawe.configuration.file.YamlConfiguration;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -114,7 +115,7 @@ public enum BBC {
|
||||
BRUSH_TARGET_MASK_SET("Set target mask to %s0", "WorldEdit.Brush"),
|
||||
BRUSH_TARGET_OFFSET_SET("Set target offset to %s0", "WorldEdit.Brush"),
|
||||
BRUSH_EQUIPPED("Equipped brush %s0", "WorldEdit.Brush"),
|
||||
BRUSH_TRY_OTHER("There are other more suitable brushes e.g.\n - //br height [radius=5] [#clipboard|file=null] [rotation=0] [yscale=1.00]", "WorldEdit.Brush"),
|
||||
BRUSH_TRY_OTHER("There are other more suitable brushes e.g.,\n - //br height [radius=5] [#clipboard|file=null] [rotation=0] [yscale=1.00]", "WorldEdit.Brush"),
|
||||
BRUSH_COPY("Left click the base of an object to copy, right click to paste. Increase the brush radius if necessary.", "WorldEdit.Brush"),
|
||||
BRUSH_HEIGHT_INVALID("Invalid height map file (%s0)", "WorldEdit.Brush"),
|
||||
BRUSH_SMOOTH("Note: Use the blend brush if you want to smooth overhangs or caves.", "WorldEdit.Brush"),
|
||||
@ -484,7 +485,7 @@ public enum BBC {
|
||||
return;
|
||||
}
|
||||
if (actor == null) {
|
||||
Fawe.debug(this.format(args));
|
||||
getLogger(BBC.class).debug(this.format(args));
|
||||
} else {
|
||||
try {
|
||||
Method method = actor.getClass().getMethod("print", String.class);
|
||||
@ -501,7 +502,7 @@ public enum BBC {
|
||||
return;
|
||||
}
|
||||
if (player == null) {
|
||||
Fawe.debug(this.format(args));
|
||||
getLogger(BBC.class).debug(this.format(args));
|
||||
} else {
|
||||
player.print(this.format(args));
|
||||
}
|
||||
|
@ -20,9 +20,13 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Config {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(Config.class);
|
||||
|
||||
public Config() {
|
||||
save(new PrintWriter(new ByteArrayOutputStream(0)), getClass(), this, 0);
|
||||
}
|
||||
@ -48,7 +52,7 @@ public class Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
Fawe.debug("Failed to get config option: " + key);
|
||||
log.debug("Failed to get config option: " + key);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -80,7 +84,7 @@ public class Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
Fawe.debug("Failed to set config option: " + key + ": " + value + " | " + instance + " | " + root.getSimpleName() + ".yml");
|
||||
log.debug("Failed to set config option: " + key + ": " + value + " | " + instance + " | " + root.getSimpleName() + ".yml");
|
||||
}
|
||||
|
||||
public boolean load(File file) {
|
||||
@ -339,8 +343,8 @@ public class Config {
|
||||
Field field = instance.getClass().getField(toFieldName(split[split.length - 1]));
|
||||
setAccessible(field);
|
||||
return field;
|
||||
} catch (Throwable e) {
|
||||
Fawe.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(instance.getClass().getSimpleName()));
|
||||
} catch (Throwable ignored) {
|
||||
log.debug("Invalid config field: " + StringMan.join(split, ".") + " for " + toNodeName(instance.getClass().getSimpleName()));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,16 @@
|
||||
package com.boydti.fawe.database;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.Config;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class DBHandler {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(Config.class);
|
||||
|
||||
public final static DBHandler IMP = new DBHandler();
|
||||
|
||||
private Map<String, RollbackDatabase> databases = new ConcurrentHashMap<>(8, 0.9f, 1);
|
||||
@ -21,11 +26,7 @@ public class DBHandler {
|
||||
databases.put(worldName, database);
|
||||
return database;
|
||||
} catch (Throwable e) {
|
||||
Fawe.debug("============ NO JDBC DRIVER! ============");
|
||||
Fawe.debug("TODO: Bundle driver with FAWE (or disable database)");
|
||||
Fawe.debug("=========================================");
|
||||
e.printStackTrace();
|
||||
Fawe.debug("=========================================");
|
||||
log.error("No JDBC driver found!\n TODO: Bundle driver with FAWE (or disable database)", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,14 @@ import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.IntStream;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RollbackDatabase.class);
|
||||
|
||||
private final String prefix;
|
||||
private final File dbLocation;
|
||||
private final String worldName;
|
||||
@ -113,27 +118,55 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
public void purge(int diff) {
|
||||
long now = System.currentTimeMillis() / 1000;
|
||||
final int then = (int) (now - diff);
|
||||
addTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(PURGE)) {
|
||||
stmt.setInt(1, then);
|
||||
stmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
addTask(() -> {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(PURGE)) {
|
||||
stmt.setInt(1, then);
|
||||
stmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getPotentialEdits(UUID uuid, long minTime, BlockVector3 pos1, BlockVector3 pos2, RunnableVal<DiskStorageHistory> onEach, Runnable whenDone, boolean delete, boolean ascending) {
|
||||
final World world = FaweAPI.getWorld(this.worldName);
|
||||
addTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String stmtStr = ascending ? uuid == null ? GET_EDITS_ASC : GET_EDITS_USER_ASC :
|
||||
uuid == null ? GET_EDITS : GET_EDITS_USER;
|
||||
try (PreparedStatement stmt = connection.prepareStatement(stmtStr)) {
|
||||
addTask(() -> {
|
||||
String stmtStr = ascending ? uuid == null ? GET_EDITS_ASC : GET_EDITS_USER_ASC :
|
||||
uuid == null ? GET_EDITS : GET_EDITS_USER;
|
||||
try (PreparedStatement stmt = connection.prepareStatement(stmtStr)) {
|
||||
stmt.setInt(1, pos1.getBlockX());
|
||||
stmt.setInt(2, pos2.getBlockX());
|
||||
stmt.setByte(3, (byte) (pos1.getBlockY() - 128));
|
||||
stmt.setByte(4, (byte) (pos2.getBlockY() - 128));
|
||||
stmt.setInt(5, pos1.getBlockZ());
|
||||
stmt.setInt(6, pos2.getBlockZ());
|
||||
stmt.setInt(7, (int) (minTime / 1000));
|
||||
if (uuid != null) {
|
||||
byte[] uuidBytes = ByteBuffer.allocate(16).putLong(uuid.getMostSignificantBits()).putLong(uuid.getLeastSignificantBits()).array();
|
||||
stmt.setBytes(8, uuidBytes);
|
||||
}
|
||||
ResultSet result = stmt.executeQuery();
|
||||
if (!result.next()) {
|
||||
TaskManager.IMP.taskNow(whenDone, false);
|
||||
return;
|
||||
}
|
||||
do {
|
||||
byte[] uuidBytes = result.getBytes(1);
|
||||
int index = result.getInt(2);
|
||||
ByteBuffer bb = ByteBuffer.wrap(uuidBytes);
|
||||
long high = bb.getLong();
|
||||
long low = bb.getLong();
|
||||
DiskStorageHistory history = new DiskStorageHistory(world, new UUID(high, low), index);
|
||||
if (history.getBDFile().exists()) {
|
||||
onEach.run(history);
|
||||
}
|
||||
} while (result.next());
|
||||
TaskManager.IMP.taskNow(whenDone, false);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (delete && uuid != null) {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(DELETE_EDITS_USER)) {
|
||||
stmt.setInt(1, pos1.getBlockX());
|
||||
stmt.setInt(2, pos2.getBlockX());
|
||||
stmt.setByte(3, (byte) (pos1.getBlockY() - 128));
|
||||
@ -141,45 +174,11 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
stmt.setInt(5, pos1.getBlockZ());
|
||||
stmt.setInt(6, pos2.getBlockZ());
|
||||
stmt.setInt(7, (int) (minTime / 1000));
|
||||
if (uuid != null) {
|
||||
byte[] uuidBytes = ByteBuffer.allocate(16).putLong(uuid.getMostSignificantBits()).putLong(uuid.getLeastSignificantBits()).array();
|
||||
stmt.setBytes(8, uuidBytes);
|
||||
}
|
||||
ResultSet result = stmt.executeQuery();
|
||||
if (!result.next()) {
|
||||
TaskManager.IMP.taskNow(whenDone, false);
|
||||
return;
|
||||
}
|
||||
do {
|
||||
byte[] uuidBytes = result.getBytes(1);
|
||||
int index = result.getInt(2);
|
||||
ByteBuffer bb = ByteBuffer.wrap(uuidBytes);
|
||||
long high = bb.getLong();
|
||||
long low = bb.getLong();
|
||||
DiskStorageHistory history = new DiskStorageHistory(world, new UUID(high, low), index);
|
||||
if (history.getBDFile().exists()) {
|
||||
onEach.run(history);
|
||||
}
|
||||
} while (result.next());
|
||||
TaskManager.IMP.taskNow(whenDone, false);
|
||||
byte[] uuidBytes = ByteBuffer.allocate(16).putLong(uuid.getMostSignificantBits()).putLong(uuid.getLeastSignificantBits()).array();
|
||||
stmt.setBytes(8, uuidBytes);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (delete && uuid != null) {
|
||||
try (PreparedStatement stmt = connection.prepareStatement(DELETE_EDITS_USER)) {
|
||||
stmt.setInt(1, pos1.getBlockX());
|
||||
stmt.setInt(2, pos2.getBlockX());
|
||||
stmt.setByte(3, (byte) (pos1.getBlockY() - 128));
|
||||
stmt.setByte(4, (byte) (pos2.getBlockY() - 128));
|
||||
stmt.setInt(5, pos1.getBlockZ());
|
||||
stmt.setInt(6, pos2.getBlockZ());
|
||||
stmt.setInt(7, (int) (minTime / 1000));
|
||||
byte[] uuidBytes = ByteBuffer.allocate(16).putLong(uuid.getMostSignificantBits()).putLong(uuid.getLeastSignificantBits()).array();
|
||||
stmt.setBytes(8, uuidBytes);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -216,10 +215,8 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
return false;
|
||||
}
|
||||
|
||||
RollbackOptimizedHistory[] copy = new RollbackOptimizedHistory[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
copy[i] = historyChanges.poll();
|
||||
}
|
||||
RollbackOptimizedHistory[] copy = IntStream.range(0, size)
|
||||
.mapToObj(i -> historyChanges.poll()).toArray(RollbackOptimizedHistory[]::new);
|
||||
|
||||
try (PreparedStatement stmt = connection.prepareStatement(INSERT_EDIT)) {
|
||||
for (RollbackOptimizedHistory change : copy) {
|
||||
@ -276,7 +273,7 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
dbLocation.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Fawe.debug("&cUnable to create database!");
|
||||
log.debug("Unable to create the database!");
|
||||
}
|
||||
}
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
@ -330,7 +327,6 @@ public class RollbackDatabase extends AsyncNotifyQueue {
|
||||
* Checks if a connection is open with the database
|
||||
*
|
||||
* @return true if the connection is open
|
||||
* @throws SQLException if the connection cannot be checked
|
||||
*/
|
||||
public boolean checkConnection() {
|
||||
try {
|
||||
|
@ -18,9 +18,12 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CorruptSchematicStreamer {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(CorruptSchematicStreamer.class);
|
||||
private final InputStream stream;
|
||||
private final UUID uuid;
|
||||
private LinearClipboard fc;
|
||||
@ -65,10 +68,9 @@ public class CorruptSchematicStreamer {
|
||||
matchIndex = 0;
|
||||
}
|
||||
}
|
||||
Fawe.debug(" - Recover " + matchTag + " = success");
|
||||
log.debug(" - Recover " + matchTag + " = success");
|
||||
} catch (Throwable e) {
|
||||
Fawe.debug(" - Recover " + matchTag + " = partial failure");
|
||||
e.printStackTrace();
|
||||
log.error(" - Recover " + matchTag + " = partial failure", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +80,7 @@ public class CorruptSchematicStreamer {
|
||||
}
|
||||
BlockVector3 dimensions = guessDimensions(volume.get(), width.get(), height.get(), length.get());
|
||||
if (width.get() == 0 || height.get() == 0 || length.get() == 0) {
|
||||
Fawe.debug("No dimensions found! Estimating based on factors:" + dimensions);
|
||||
log.debug("No dimensions found! Estimating based on factors:" + dimensions);
|
||||
}
|
||||
if (Settings.IMP.CLIPBOARD.USE_DISK) {
|
||||
fc = new DiskOptimizedClipboard(dimensions, uuid);
|
||||
|
@ -173,10 +173,12 @@ public class MCAChunk implements IChunk {
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return chunkX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ() {
|
||||
return chunkZ;
|
||||
}
|
||||
@ -435,6 +437,7 @@ public class MCAChunk implements IChunk {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEntity(CompoundTag entityTag) {
|
||||
setModified();
|
||||
long least = entityTag.getLong("UUIDLeast");
|
||||
@ -464,6 +467,7 @@ public class MCAChunk implements IChunk {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<CompoundTag> getEntities() {
|
||||
return new HashSet<>(entities.values());
|
||||
}
|
||||
@ -505,6 +509,7 @@ public class MCAChunk implements IChunk {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getEntityRemoves() {
|
||||
return new HashSet<>();
|
||||
}
|
||||
@ -542,6 +547,7 @@ public class MCAChunk implements IChunk {
|
||||
Arrays.fill(this.biomes, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeEntity(UUID uuid) {
|
||||
entities.remove(uuid);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.jnbt.anvil;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.Trimable;
|
||||
import com.boydti.fawe.beta.implementation.IChunkExtent;
|
||||
@ -18,7 +19,6 @@ import com.sk89q.worldedit.world.World;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -40,7 +40,7 @@ import java.util.zip.InflaterInputStream;
|
||||
|
||||
/**
|
||||
* Chunk format: http://minecraft.gamepedia.com/Chunk_format#Entity_format
|
||||
* e.g.: `.Level.Entities.#` (Starts with a . as the root tag is unnamed)
|
||||
* e.g., `.Level.Entities.#` (Starts with a . as the root tag is unnamed)
|
||||
* Note: This class isn't thread safe. You can use it in an async thread, but not multiple at the same time
|
||||
*/
|
||||
public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, IChunkExtent {
|
||||
@ -291,7 +291,7 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
|
||||
if (offset < offsets.length) {
|
||||
offsets[offset] = i;
|
||||
} else {
|
||||
Fawe.debug("Ignoring invalid offset " + offset);
|
||||
getLogger(MCAFile.class).debug("Ignoring invalid offset " + offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -707,4 +707,4 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,9 +51,9 @@ public class ClipboardSpline extends Spline {
|
||||
* to the first node, 0.25 to the second, 0.5 to the third, ... .<br>
|
||||
* By providing this method with the amount of nodes used by the interpolation implementation the distribution of the
|
||||
* nodes is converted to a proportional distribution based on the length between two adjacent nodes calculated by {@link Interpolation#arcLength(double, double)}.<br>
|
||||
* This means that the distance between two positions used to paste the clipboard (e.g. 0.75 - 0.5 = 0.25) on the curve
|
||||
* will always amount to that part of the length (e.g. 40 units) of the curve. In this example it would amount to
|
||||
* 0.25 * 40 = 10 units of curve length between these two positions.
|
||||
* This means that the distance between two positions used to paste the clipboard (e.g., 0.75 - 0.5 = 0.25) on the curve
|
||||
* will always amount to that part of the length (e.g., 40 units) of the curve. In this example it would amount to
|
||||
* 0.25 × 40 = 10 units of curve length between these two positions.
|
||||
* <p>
|
||||
* Be advised that currently subsequent changes to the interpolation parameters may not be supported.
|
||||
* @param editSession The EditSession which will be used when pasting the clipboard content
|
||||
@ -115,4 +115,4 @@ public class ClipboardSpline extends Spline {
|
||||
|
||||
return operation instanceof ForwardExtentCopy ? ((ForwardExtentCopy) operation).getAffected() : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public abstract class Spline {
|
||||
* to the first node, 0.25 to the second, 0.5 to the third, ... .<br>
|
||||
* By providing this method with the amount of nodes used by the interpolation implementation the distribution of the
|
||||
* nodes is converted to a proportional distribution based on the length between two adjacent nodes calculated by {@link Interpolation#arcLength(double, double)}.<br>
|
||||
* This means that the distance between two positions used to paste the clipboard (e.g. 0.75 - 0.5 = 0.25) on the curve
|
||||
* This means that the distance between two positions used to paste the clipboard (e.g., 0.75 - 0.5 = 0.25) on the curve
|
||||
* will always amount to that part of the length (e.g. 40 units) of the curve. In this example it would amount to
|
||||
* 0.25 * 40 = 10 units of curve length between these two positions.
|
||||
* <p>
|
||||
@ -73,7 +73,7 @@ public abstract class Spline {
|
||||
* Set the forward direction of the structure.<br>
|
||||
* This direction is used to determine the rotation of the clipboard to align to the curve. The horizontal slope
|
||||
* of the curve for a specific point is calculated by {@link Interpolation#get1stDerivative(double)}.
|
||||
* Subsequently this angle between this vector and the gradient vector is calculated and the clipboard content
|
||||
* Subsequently, this angle between this vector, and the gradient vector is calculated, and the clipboard content
|
||||
* is rotated by that angle to follow the curve slope.
|
||||
* <p>
|
||||
* The default direction is a (1;0) vector (pointing in the positive x-direction).
|
||||
@ -87,7 +87,7 @@ public abstract class Spline {
|
||||
* Get the forward direction of the structure.<br>
|
||||
* This direction is used to determine the rotation of the clipboard to align to the curve. The horizontal slope
|
||||
* of the curve for a specific point is calculated by {@link Interpolation#get1stDerivative(double)}.
|
||||
* Subsequently this angle between this vector and the gradient vector is calculated and the clipboard content
|
||||
* Subsequently, this angle between this vector, and the gradient vector is calculated, and the clipboard content
|
||||
* is rotated by that angle to follow the curve slope.
|
||||
* <p>
|
||||
* The default direction is a (1;0) vector (pointing in the positive x-direction).
|
||||
@ -192,4 +192,4 @@ public abstract class Spline {
|
||||
this.flexLength = flexLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.boydti.fawe.object.brush.visualization.cfi;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IBlocks;
|
||||
@ -1982,7 +1984,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
|
||||
@Override
|
||||
public IChunkGet get(int x, int z) {
|
||||
Fawe.debug("Should not be using buffering with HMMG");
|
||||
getLogger(HeightMapMCAGenerator.class).debug("Should not be using buffering with HMMG");
|
||||
return new FallbackChunkGet(this, x, z);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.boydti.fawe.object.change;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@ -9,9 +11,6 @@ import com.sk89q.worldedit.history.change.Change;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class CFIChange implements Change {
|
||||
private final File file;
|
||||
|
||||
@ -25,7 +24,7 @@ public class CFIChange implements Change {
|
||||
if (found != null) {
|
||||
return found.get();
|
||||
}
|
||||
Fawe.debug("FAWE does not support: " + context.getExtent() + " for " + getClass() + " (bug Empire92)");
|
||||
getLogger(CFIChange.class).debug("FAWE does not support: " + context.getExtent() + " for " + getClass() + " (bug Empire92)");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.change;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
@ -15,7 +16,6 @@ import com.sk89q.worldedit.history.change.Change;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@ -59,7 +59,7 @@ public class MutableEntityChange implements Change {
|
||||
most = ((LongTag) map.get("PersistentIDMSB")).getValue();
|
||||
least = ((LongTag) map.get("PersistentIDLSB")).getValue();
|
||||
} else {
|
||||
Fawe.debug("Skipping entity without uuid.");
|
||||
getLogger(MutableEntityChange.class).debug("Skipping entity without uuid.");
|
||||
return;
|
||||
}
|
||||
List<DoubleTag> pos = (List<DoubleTag>) map.get("Pos").getValue();
|
||||
@ -74,7 +74,7 @@ public class MutableEntityChange implements Change {
|
||||
Map<String, Tag> map = tag.getValue();
|
||||
Tag posTag = map.get("Pos");
|
||||
if (posTag == null) {
|
||||
Fawe.debug("Missing pos tag: " + tag);
|
||||
getLogger(MutableEntityChange.class).debug("Missing pos tag: " + tag);
|
||||
return;
|
||||
}
|
||||
List<DoubleTag> pos = (List<DoubleTag>) posTag.getValue();
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.boydti.fawe.object.changeset;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
@ -270,7 +272,7 @@ public abstract class FaweChangeSet implements ChangeSet, IBatchProcessor {
|
||||
} else if (change.getClass() == EntityRemove.class) {
|
||||
add((EntityRemove) change);
|
||||
} else {
|
||||
Fawe.debug("Unknown change: " + change.getClass());
|
||||
getLogger(FaweChangeSet.class).debug("Unknown change: " + change.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* with the License. You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.schematic;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
@ -59,6 +60,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
return read(UUID.randomUUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clipboard read(UUID clipboardId) throws IOException {
|
||||
NamedTag rootTag = inputStream.readNamedTag();
|
||||
|
||||
@ -158,7 +160,7 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
|
||||
int height = region.getHeight();
|
||||
int length = region.getLength();
|
||||
if (width > WARN_SIZE || height > WARN_SIZE || length > WARN_SIZE) {
|
||||
Fawe.debug("A structure longer than 32 is unsupported by minecraft (but probably still works)");
|
||||
getLogger(MinecraftStructure.class).debug("A structure longer than 32 is unsupported by minecraft (but probably still works)");
|
||||
}
|
||||
Map<String, Object> structure = FaweCache.IMP.asMap("version", 1, "author", owner);
|
||||
// ignored: version / owner
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.boydti.fawe.regions.general.integrations.plotquared;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.regions.FaweMask;
|
||||
import com.boydti.fawe.regions.FaweMaskManager;
|
||||
import com.boydti.fawe.regions.general.RegionFilter;
|
||||
@ -25,24 +25,31 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionIntersection;
|
||||
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PlotSquaredFeature extends FaweMaskManager {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PlotSquaredFeature.class);
|
||||
|
||||
public PlotSquaredFeature() {
|
||||
super("PlotSquared");
|
||||
Fawe.debug("Optimizing PlotSquared");
|
||||
log.debug("Optimizing PlotSquared");
|
||||
if (com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_HOOK) {
|
||||
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
|
||||
setupBlockQueue();
|
||||
setupSchematicHandler();
|
||||
setupChunkManager();
|
||||
try {
|
||||
setupBlockQueue();
|
||||
setupSchematicHandler();
|
||||
setupChunkManager();
|
||||
} catch (Throwable ignored) {
|
||||
log.debug("Please update PlotSquared: http://ci.athion.net/job/PlotSquared/");
|
||||
}
|
||||
if (Settings.PLATFORM.equalsIgnoreCase("bukkit")) {
|
||||
new FaweTrim();
|
||||
}
|
||||
@ -57,7 +64,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
new ReplaceAll();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
Fawe.debug("You need to update PlotSquared to access the CFI and REPLACEALL commands");
|
||||
log.debug("You need to update PlotSquared to access the CFI and REPLACEALL commands");
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -66,35 +73,23 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
return UUIDHandler.getName(uuid);
|
||||
}
|
||||
|
||||
private void setupBlockQueue() {
|
||||
try {
|
||||
// If it's going to fail, throw an error now rather than later
|
||||
QueueProvider provider = QueueProvider.of(FaweLocalBlockQueue.class, null);
|
||||
GlobalBlockQueue.IMP.setProvider(provider);
|
||||
HybridPlotManager.REGENERATIVE_CLEAR = false;
|
||||
Fawe.debug(" - QueueProvider: " + FaweLocalBlockQueue.class);
|
||||
Fawe.debug(" - HybridPlotManager.REGENERATIVE_CLEAR: " + HybridPlotManager.REGENERATIVE_CLEAR);
|
||||
} catch (Throwable e) {
|
||||
Fawe.debug("Please update PlotSquared: http://ci.athion.net/job/PlotSquared/");
|
||||
}
|
||||
private void setupBlockQueue() throws RuntimeException {
|
||||
// If it's going to fail, throw an error now rather than later
|
||||
QueueProvider provider = QueueProvider.of(FaweLocalBlockQueue.class, null);
|
||||
GlobalBlockQueue.IMP.setProvider(provider);
|
||||
HybridPlotManager.REGENERATIVE_CLEAR = false;
|
||||
log.debug(" - QueueProvider: " + FaweLocalBlockQueue.class);
|
||||
log.debug(" - HybridPlotManager.REGENERATIVE_CLEAR: " + HybridPlotManager.REGENERATIVE_CLEAR);
|
||||
}
|
||||
|
||||
private void setupChunkManager() {
|
||||
try {
|
||||
ChunkManager.manager = new FaweChunkManager(ChunkManager.manager);
|
||||
Fawe.debug(" - ChunkManager: " + ChunkManager.manager);
|
||||
} catch (Throwable e) {
|
||||
Fawe.debug("Please update PlotSquared: http://ci.athion.net/job/PlotSquared/");
|
||||
}
|
||||
private void setupChunkManager() throws RuntimeException {
|
||||
ChunkManager.manager = new FaweChunkManager(ChunkManager.manager);
|
||||
log.debug(" - ChunkManager: " + ChunkManager.manager);
|
||||
}
|
||||
|
||||
private void setupSchematicHandler() {
|
||||
try {
|
||||
SchematicHandler.manager = new FaweSchematicHandler();
|
||||
Fawe.debug(" - SchematicHandler: " + SchematicHandler.manager);
|
||||
} catch (Throwable e) {
|
||||
Fawe.debug("Please update PlotSquared: http://ci.athion.net/job/PlotSquared/");
|
||||
}
|
||||
private void setupSchematicHandler() throws RuntimeException {
|
||||
SchematicHandler.manager = new FaweSchematicHandler();
|
||||
log.debug(" - SchematicHandler: " + SchematicHandler.manager);
|
||||
}
|
||||
|
||||
public boolean isAllowed(Player player, Plot plot, MaskType type) {
|
||||
@ -128,9 +123,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
||||
PlotArea area = pp.getApplicablePlotArea();
|
||||
int min = area != null ? area.MIN_BUILD_HEIGHT : 0;
|
||||
int max = area != null ? Math.min(255, area.MAX_BUILD_HEIGHT) : 255;
|
||||
final HashSet<com.boydti.fawe.object.RegionWrapper> faweRegions = new HashSet<>();
|
||||
final HashSet<RegionWrapper> faweRegions = new HashSet<>();
|
||||
for (CuboidRegion current : regions) {
|
||||
faweRegions.add(new com.boydti.fawe.object.RegionWrapper(current.getMinimumX(), current.getMaximumX(), min, max, current.getMinimumZ(), current.getMaximumZ()));
|
||||
faweRegions.add(new RegionWrapper(current.getMinimumX(), current.getMaximumX(), min, max, current.getMinimumZ(), current.getMaximumZ()));
|
||||
}
|
||||
final CuboidRegion region = regions.iterator().next();
|
||||
final BlockVector3 pos1 = BlockVector3.at(region.getMinimumX(), min, region.getMinimumZ());
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.object.brush.BrushSettings;
|
||||
import com.google.gson.Gson;
|
||||
@ -12,7 +13,6 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
@ -51,8 +51,7 @@ public final class BrushCache {
|
||||
brushCache.put(key, tool);
|
||||
return tool;
|
||||
} catch (Exception throwable) {
|
||||
throwable.printStackTrace();
|
||||
Fawe.debug("Invalid brush for " + player + " holding " + item.getType() + ": " + json.getValue());
|
||||
getLogger(BrushCache.class).debug("Invalid brush for " + player + " holding " + item.getType() + ": " + json.getValue(), throwable);
|
||||
item.setNbtData(null);
|
||||
brushCache.remove(key);
|
||||
} finally {
|
||||
|
@ -94,7 +94,7 @@ public final class DocumentationPrinter {
|
||||
stream.print(" - `[arg]` - An optional parameter \n");
|
||||
stream.print(" - `<arg1|arg2>` - Multiple parameters options \n");
|
||||
stream.print(" - `<arg=value>` - Default or suggested value \n");
|
||||
stream.print(" - `-a` - A command flag e.g. `//<command> -a [flag-value]`");
|
||||
stream.print(" - `-a` - A command flag e.g., `//<command> -a [flag-value]`");
|
||||
stream.println();
|
||||
stream.print("## See also\n");
|
||||
stream.print(" - [Masks](https://github.com/boy0001/FastAsyncWorldedit/wiki/WorldEdit---FAWE-mask-list)\n");
|
||||
|
@ -242,16 +242,16 @@ public class EditSessionBuilder {
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
if (Settings.IMP.EXTENT.DEBUG) {
|
||||
Fawe.debug("&cPotentially unsafe extent blocked: " + toReturn.getClass().getName());
|
||||
Fawe.debug("&8 - &7For area restrictions, it is recommended to use the FaweAPI");
|
||||
Fawe.debug("&8 - &7For block logging, it is recommended to use use BlocksHub");
|
||||
Fawe.debug("&8 - &7To allow this plugin add it to the FAWE `allowed-plugins` list");
|
||||
Fawe.debug("&8 - &7To hide this message set `debug` to false in the FAWE config.yml");
|
||||
if (Settings.IMP.EXTENT.DEBUG && event.getActor() != null) {
|
||||
event.getActor().printDebug("Potentially unsafe extent blocked: " + toReturn.getClass().getName());
|
||||
event.getActor().printDebug(" - For area restrictions, it is recommended to use the FaweAPI");
|
||||
event.getActor().printDebug(" - For block logging, it is recommended to use use BlocksHub");
|
||||
event.getActor().printDebug(" - To allow this plugin add it to the FAWE `allowed-plugins` list");
|
||||
event.getActor().printDebug(" - To hide this message set `debug` to false in the FAWE config.yml");
|
||||
if (toReturn.getClass().getName().contains("CoreProtect")) {
|
||||
Fawe.debug("Note on CoreProtect: ");
|
||||
Fawe.debug(" - If you disable CP's WE logger (CP config) and this still shows, please update CP");
|
||||
Fawe.debug(" - Use BlocksHub and set `debug` false in the FAWE config");
|
||||
event.getActor().printDebug("Note on CoreProtect: ");
|
||||
event.getActor().printDebug(" - If you disable CP's WE logger (CP config) and this still shows, please update CP");
|
||||
event.getActor().printDebug(" - Use BlocksHub and set `debug` false in the FAWE config");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -10,35 +11,36 @@ import java.util.Base64;
|
||||
|
||||
public enum Jars {
|
||||
|
||||
MM_v1_7_3("https://github.com/InventivetalentDev/MapManager/releases/download/1.7.3-SNAPSHOT/MapManager_v1.7.3-SNAPSHOT.jar",
|
||||
"M3YLUQZZ66K2DMVDCYLEU38U3ZKRKHRAXQGGPVKFO6G=", 554831),
|
||||
MM_v1_7_3(
|
||||
"https://github.com/InventivetalentDev/MapManager/releases/download/1.7.3-SNAPSHOT/MapManager_v1.7.3-SNAPSHOT.jar",
|
||||
"M3YLUQZZ66K2DMVDCYLEU38U3ZKRKHRAXQGGPVKFO6G=", 554831),
|
||||
|
||||
PL_v3_7_3("https://github.com/InventivetalentDev/PacketListenerAPI/releases/download/3.7.3-SNAPSHOT/PacketListenerAPI_v3.7.3-SNAPSHOT.jar",
|
||||
"ETDBRZLN5PRVDFR/MSQDPM6JJER3WQOKHCN8FUXO5ZM=", 167205),
|
||||
PL_v3_7_3(
|
||||
"https://github.com/InventivetalentDev/PacketListenerAPI/releases/download/3.7.3-SNAPSHOT/PacketListenerAPI_v3.7.3-SNAPSHOT.jar",
|
||||
"ETDBRZLN5PRVDFR/MSQDPM6JJER3WQOKHCN8FUXO5ZM=", 167205),
|
||||
|
||||
;
|
||||
|
||||
public final String url;
|
||||
public final int filesize;
|
||||
public final int fileSize;
|
||||
public final String digest;
|
||||
|
||||
/**
|
||||
* @param url
|
||||
* Where this jar can be found and downloaded
|
||||
* @param digest
|
||||
* The SHA-256 hexadecimal digest
|
||||
* @param filesize
|
||||
* Size of this jar in bytes
|
||||
* @param url Where this jar can be found and downloaded
|
||||
* @param digest The SHA-256 hexadecimal digest
|
||||
* @param fileSize Size of this jar in bytes
|
||||
*/
|
||||
Jars(String url, String digest, int filesize) {
|
||||
Jars(String url, String digest, int fileSize) {
|
||||
this.url = url;
|
||||
this.digest = digest.toUpperCase();
|
||||
this.filesize = filesize;
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
/** download a jar, verify hash, return byte[] containing the jar */
|
||||
/**
|
||||
* Download a jar, verify hash, return byte[] containing the jar
|
||||
*/
|
||||
public byte[] download() throws IOException {
|
||||
byte[] jarBytes = new byte[this.filesize];
|
||||
byte[] jarBytes = new byte[this.fileSize];
|
||||
URL url = new URL(this.url);
|
||||
try (DataInputStream dis = new DataInputStream(url.openConnection().getInputStream())) {
|
||||
dis.readFully(jarBytes);
|
||||
@ -51,14 +53,13 @@ public enum Jars {
|
||||
String jarDigest = Base64.getEncoder().encodeToString(jarDigestBytes).toUpperCase();
|
||||
|
||||
if (this.digest.equals(jarDigest)) {
|
||||
Fawe.debug("++++ HASH CHECK ++++");
|
||||
Fawe.debug(this.url);
|
||||
Fawe.debug(this.digest);
|
||||
getLogger(Jars.class).debug("++++ HASH CHECK ++++");
|
||||
getLogger(Jars.class).debug(this.url);
|
||||
getLogger(Jars.class).debug(this.digest);
|
||||
return jarBytes;
|
||||
} else {
|
||||
|
||||
Fawe.debug(jarDigest + " | " + url);
|
||||
throw new IllegalStateException("downloaded jar does not match the hash");
|
||||
getLogger(Jars.class).debug(jarDigest + " | " + url);
|
||||
throw new IllegalStateException("The downloaded jar does not match the hash");
|
||||
}
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// Shouldn't ever happen, Minecraft won't even run on such a JRE
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
@ -24,18 +27,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.history.changeset.ChangeSet;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
import net.jpountz.lz4.LZ4BlockOutputStream;
|
||||
import net.jpountz.lz4.LZ4Compressor;
|
||||
import net.jpountz.lz4.LZ4Factory;
|
||||
import net.jpountz.lz4.LZ4FastDecompressor;
|
||||
import net.jpountz.lz4.LZ4InputStream;
|
||||
import net.jpountz.lz4.LZ4Utils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
@ -84,8 +76,15 @@ import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.Inflater;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.imageio.ImageIO;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
import net.jpountz.lz4.LZ4BlockOutputStream;
|
||||
import net.jpountz.lz4.LZ4Compressor;
|
||||
import net.jpountz.lz4.LZ4Factory;
|
||||
import net.jpountz.lz4.LZ4FastDecompressor;
|
||||
import net.jpountz.lz4.LZ4InputStream;
|
||||
import net.jpountz.lz4.LZ4Utils;
|
||||
|
||||
public class MainUtil {
|
||||
|
||||
@ -374,7 +373,7 @@ public class MainUtil {
|
||||
|
||||
public static URL upload(String urlStr, boolean save, String uuid, String file, String extension, final RunnableVal<OutputStream> writeTask) {
|
||||
if (writeTask == null) {
|
||||
Fawe.debug("&cWrite task cannot be null");
|
||||
getLogger(MainUtil.class).debug("Write task cannot be null");
|
||||
return null;
|
||||
}
|
||||
String filename = (file == null ? "plot" : file) + (extension != null ? "." + extension : "");
|
||||
@ -422,7 +421,7 @@ public class MainUtil {
|
||||
content = scanner.next().trim();
|
||||
}
|
||||
if (!content.startsWith("<")) {
|
||||
Fawe.debug(content);
|
||||
getLogger(MainUtil.class).debug(content);
|
||||
}
|
||||
if (responseCode == 200) {
|
||||
return url;
|
||||
@ -600,8 +599,7 @@ public class MainUtil {
|
||||
return newFile;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Fawe.debug("&cCould not save " + resource);
|
||||
getLogger(MainUtil.class).debug("Could not save " + resource, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
@ -66,7 +68,7 @@ public abstract class TaskManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a buch of tasks in parallel using the shared thread pool
|
||||
* Run a bunch of tasks in parallel using the shared thread pool
|
||||
*
|
||||
* @param runnables
|
||||
*/
|
||||
@ -80,8 +82,8 @@ public abstract class TaskManager {
|
||||
/**
|
||||
* Run a bunch of tasks in parallel
|
||||
*
|
||||
* @param runnables The tasks to run
|
||||
* @param numThreads Number of threads (null = config.yml parallel threads)
|
||||
* @param runnables the tasks to run
|
||||
* @param numThreads number of threads (null = config.yml parallel threads)
|
||||
*/
|
||||
@Deprecated
|
||||
public void parallel(Collection<Runnable> runnables, @Nullable Integer numThreads) {
|
||||
@ -136,7 +138,6 @@ public abstract class TaskManager {
|
||||
/**
|
||||
* Disable async catching for a specific task
|
||||
*
|
||||
* @param queue
|
||||
* @param run
|
||||
*/
|
||||
public void runUnsafe(Runnable run) {
|
||||
@ -231,10 +232,9 @@ public abstract class TaskManager {
|
||||
* Break up a task and run it in fragments of 5ms.<br>
|
||||
* - Each task will run on the main thread.<br>
|
||||
*
|
||||
* @param objects - The list of objects to run the task for
|
||||
* @param task - The task to run on each object
|
||||
* @param whenDone - When the object task completes
|
||||
* @param <T>
|
||||
* @param objects the list of objects to run the task for
|
||||
* @param task the task to run on each object
|
||||
* @param whenDone when the object task completes
|
||||
*/
|
||||
public <T> void objectTask(Collection<T> objects, final RunnableVal<T> task, final Runnable whenDone) {
|
||||
final Iterator<T> iterator = objects.iterator();
|
||||
@ -264,7 +264,7 @@ public abstract class TaskManager {
|
||||
running.wait(timeout);
|
||||
if (running.get() && System.currentTimeMillis() - start > Settings.IMP.QUEUE.DISCARD_AFTER_MS) {
|
||||
new RuntimeException("FAWE is taking a long time to execute a task (might just be a symptom): ").printStackTrace();
|
||||
Fawe.debug("For full debug information use: /fawe threads");
|
||||
getLogger(TaskManager.class).debug("For full debug information use: /fawe threads");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -291,11 +291,9 @@ public abstract class TaskManager {
|
||||
/**
|
||||
* Run a task on the main thread when the TPS is high enough, and wait for execution to finish:<br>
|
||||
* - Useful if you need to access something from the Bukkit API from another thread<br>
|
||||
* - Usualy wait time is around 25ms<br>
|
||||
* - Usually wait time is around 25ms<br>
|
||||
*
|
||||
* @param function
|
||||
* @param timeout - How long to wait for execution
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public <T> T syncWhenFree(@NotNull final RunnableVal<T> function) {
|
||||
@ -313,11 +311,9 @@ public abstract class TaskManager {
|
||||
/**
|
||||
* Quickly run a task on the main thread, and wait for execution to finish:<br>
|
||||
* - Useful if you need to access something from the Bukkit API from another thread<br>
|
||||
* - Usualy wait time is around 25ms<br>
|
||||
* - Usually wait time is around 25ms<br>
|
||||
*
|
||||
* @param function
|
||||
* @param timeout - How long to wait for execution
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public <T> T sync(@NotNull final RunnableVal<T> function) {
|
||||
@ -330,7 +326,6 @@ public abstract class TaskManager {
|
||||
* - Usually wait time is around 25ms<br>
|
||||
*
|
||||
* @param function
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public <T> T sync(final Supplier<T> function) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
@ -18,8 +20,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntArraySet;
|
||||
import it.unimi.dsi.fastutil.longs.LongArrayList;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -607,8 +607,8 @@ public class TextureUtil implements TextureHolder {
|
||||
}
|
||||
}
|
||||
if (files.length == 0) {
|
||||
Fawe.debug(
|
||||
"Please create a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions/1.13.jar` jar or mods in it. If the file exists, please make sure the server has read access to the directory");
|
||||
getLogger(TextureUtil.class).debug(
|
||||
"Please create a `FastAsyncWorldEdit/textures` folder with `.minecraft/versions/1.14.jar` jar or mods in it. If the file exists, please make sure the server has read access to the directory");
|
||||
} else {
|
||||
for (File file : files) {
|
||||
ZipFile zipFile = new ZipFile(file);
|
||||
|
@ -33,9 +33,9 @@ public class ImageUtil {
|
||||
BufferedImage scaledImage = image;
|
||||
int width, height;
|
||||
if (higherQuality) {
|
||||
// Use multi-step technique: start with original size, then
|
||||
// scale down in multiple passes with drawImage()
|
||||
// until the target size is reached
|
||||
/* Use multi-step technique: start with original size, then
|
||||
scale down in multiple passes with drawImage()
|
||||
until the target size is reached. */
|
||||
width = scaledImage.getWidth();
|
||||
height = scaledImage.getHeight();
|
||||
} else {
|
||||
|
@ -80,7 +80,7 @@ public class TaskBuilder extends Metadatable {
|
||||
|
||||
/**
|
||||
* Run some sync tasks in parallel<br>
|
||||
* - All sync parallel tasks which occur directly after each other will be run at the same time
|
||||
* - All sync parallel tasks, which occur directly after each other will be run at the same time
|
||||
*
|
||||
* @param run
|
||||
* @return this
|
||||
@ -200,7 +200,7 @@ public class TaskBuilder extends Metadatable {
|
||||
|
||||
/**
|
||||
* Have all async tasks run on a new thread<br>
|
||||
* - As opposed to trying to using the current thread
|
||||
* - As opposed to trying to use the current thread
|
||||
*/
|
||||
public void buildAsync() {
|
||||
TaskManager.IMP.async(this::build);
|
||||
|
@ -20,10 +20,8 @@
|
||||
package com.sk89q.jnbt;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -269,7 +267,7 @@ public class CompoundTag extends Tag {
|
||||
*
|
||||
* <p>If the key does not exist or its value is not a list tag,
|
||||
* then an empty list will be returned. If the given key references
|
||||
* a list but the list of of a different type, then an empty
|
||||
* a list but the list of a different type, then an empty
|
||||
* list will also be returned.</p>
|
||||
*
|
||||
* @param key the key
|
||||
@ -295,7 +293,7 @@ public class CompoundTag extends Tag {
|
||||
/**
|
||||
* Get a {@code long[]} named with the given key.
|
||||
*
|
||||
* <p>If the key does not exist or its value is not an long array tag,
|
||||
* <p>If the key does not exist or its value is not a long array tag,
|
||||
* then an empty array will be returned.</p>
|
||||
*
|
||||
* @param key the key
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
package com.sk89q.jnbt;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class CommandException extends Exception {
|
||||
|
||||
/**
|
||||
* Gets the command that was called, which will include the sub-command
|
||||
* (i.e. "/br sphere").
|
||||
* (i.e., "/br sphere").
|
||||
*
|
||||
* @param prefix the command shebang character (such as "/") -- may be empty
|
||||
* @param spacedSuffix a suffix to put at the end (optional) -- may be null
|
||||
|
@ -62,11 +62,11 @@ public class YAMLNode {
|
||||
|
||||
/**
|
||||
* Gets a property at a location. This will either return an Object
|
||||
* or null, with null meaning that no configuration value exists at
|
||||
* or null, with null meaning no configuration value exists at
|
||||
* that location. This could potentially return a default value (not yet
|
||||
* implemented) as defined by a plugin, if this is a plugin-tied
|
||||
* configuration.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return object or null
|
||||
*/
|
||||
@ -107,7 +107,7 @@ public class YAMLNode {
|
||||
/**
|
||||
* Prepare a value for serialization, in case it's not a native type
|
||||
* (and we don't want to serialize objects as YAML objects).
|
||||
*
|
||||
*
|
||||
* @param value the value to serialize
|
||||
* @return the new object
|
||||
*/
|
||||
@ -146,7 +146,7 @@ public class YAMLNode {
|
||||
/**
|
||||
* Set the property at a location. This will override existing
|
||||
* configuration data to have it conform to key/value mappings.
|
||||
*
|
||||
*
|
||||
* @param path the path
|
||||
* @param value the new value
|
||||
*/
|
||||
@ -185,7 +185,7 @@ public class YAMLNode {
|
||||
* Adds a new node to the given path. The returned object is a reference
|
||||
* to the new node. This method will replace an existing node at
|
||||
* the same path. See {@code setProperty}.
|
||||
*
|
||||
*
|
||||
* @param path the path
|
||||
* @return a node for the path
|
||||
*/
|
||||
@ -197,11 +197,11 @@ public class YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string at a location. This will either return an String
|
||||
* Gets a string at a location. This will either return a String
|
||||
* or null, with null meaning that no configuration value exists at
|
||||
* that location. If the object at the particular location is not actually
|
||||
* a string, it will be converted to its string representation.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return string or null
|
||||
*/
|
||||
@ -214,10 +214,10 @@ public class YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a vector at a location. This will either return an Vector
|
||||
* Gets a vector at a location. This will either return a Vector
|
||||
* or a null. If the object at the particular location is not
|
||||
* actually a string, it will be converted to its string representation.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return string or default
|
||||
*/
|
||||
@ -239,10 +239,10 @@ public class YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a 2D vector at a location. This will either return an Vector
|
||||
* Gets a 2D vector at a location. This will either return a Vector
|
||||
* or a null. If the object at the particular location is not
|
||||
* actually a string, it will be converted to its string representation.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return string or default
|
||||
*/
|
||||
@ -263,10 +263,10 @@ public class YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string at a location. This will either return an Vector
|
||||
* Gets a string at a location. This will either return a Vector
|
||||
* or the default value. If the object at the particular location is not
|
||||
* actually a string, it will be converted to its string representation.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value
|
||||
* @return string or default
|
||||
@ -281,10 +281,10 @@ public class YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string at a location. This will either return an String
|
||||
* Gets a string at a location. This will either return a String
|
||||
* or the default value. If the object at the particular location is not
|
||||
* actually a string, it will be converted to its string representation.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value
|
||||
* @return string or default
|
||||
@ -303,7 +303,7 @@ public class YAMLNode {
|
||||
* or null. If the object at the particular location is not
|
||||
* actually a integer, the default value will be returned. However, other
|
||||
* number types will be casted to an integer.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return integer or null
|
||||
*/
|
||||
@ -321,7 +321,7 @@ public class YAMLNode {
|
||||
* or the default value. If the object at the particular location is not
|
||||
* actually a integer, the default value will be returned. However, other
|
||||
* number types will be casted to an integer.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value
|
||||
* @return int or default
|
||||
@ -337,11 +337,11 @@ public class YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a double at a location. This will either return an double
|
||||
* Gets a double at a location. This will either return a double
|
||||
* or null. If the object at the particular location is not
|
||||
* actually a double, the default value will be returned. However, other
|
||||
* number types will be casted to an double.
|
||||
*
|
||||
* number types will be casted to a double.
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return double or null
|
||||
*/
|
||||
@ -355,11 +355,11 @@ public class YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a double at a location. This will either return an double
|
||||
* Gets a double at a location. This will either return a double
|
||||
* or the default value. If the object at the particular location is not
|
||||
* actually a double, the default value will be returned. However, other
|
||||
* number types will be casted to an double.
|
||||
*
|
||||
* number types will be casted to a double.
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value
|
||||
* @return double or default
|
||||
@ -375,10 +375,10 @@ public class YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a boolean at a location. This will either return an boolean
|
||||
* Gets a boolean at a location. This will either return a boolean
|
||||
* or null. If the object at the particular location is not
|
||||
* actually a boolean, the default value will be returned.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return boolean or null
|
||||
*/
|
||||
@ -392,10 +392,10 @@ public class YAMLNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a boolean at a location. This will either return an boolean
|
||||
* Gets a boolean at a location. This will either return a boolean
|
||||
* or the default value. If the object at the particular location is not
|
||||
* actually a boolean, the default value will be returned.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value
|
||||
* @return boolean or default
|
||||
@ -413,7 +413,7 @@ public class YAMLNode {
|
||||
/**
|
||||
* Get a list of keys at a location. If the map at the particular location
|
||||
* does not exist or it is not a map, null will be returned.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return list of keys
|
||||
*/
|
||||
@ -433,7 +433,7 @@ public class YAMLNode {
|
||||
/**
|
||||
* Gets a list of objects at a location. If the list is not defined,
|
||||
* null will be returned. The node must be an actual list.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return boolean or default
|
||||
*/
|
||||
@ -456,7 +456,7 @@ public class YAMLNode {
|
||||
* and an empty list will be returned instead. If an item in the list
|
||||
* is not a string, it will be converted to a string. The node must be
|
||||
* an actual list and not just a string.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value or null for an empty list as default
|
||||
* @return list of strings
|
||||
@ -486,7 +486,7 @@ public class YAMLNode {
|
||||
* default will be returned. 'null' can be passed for the default
|
||||
* and an empty list will be returned instead. The node must be
|
||||
* an actual list and not just an integer.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value or null for an empty list as default
|
||||
* @return list of integers
|
||||
@ -515,7 +515,7 @@ public class YAMLNode {
|
||||
* default will be returned. 'null' can be passed for the default
|
||||
* and an empty list will be returned instead. The node must be
|
||||
* an actual list and cannot be just a double.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value or null for an empty list as default
|
||||
* @return list of integers
|
||||
@ -544,7 +544,7 @@ public class YAMLNode {
|
||||
* default will be returned. 'null' can be passed for the default
|
||||
* and an empty list will be returned instead. The node must be
|
||||
* an actual list and cannot be just a boolean,
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value or null for an empty list as default
|
||||
* @return list of integers
|
||||
@ -573,7 +573,7 @@ public class YAMLNode {
|
||||
* default will be returned. 'null' can be passed for the default
|
||||
* and an empty list will be returned instead. The node must be
|
||||
* an actual node and cannot be just a vector,
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value or null for an empty list as default
|
||||
* @return list of integers
|
||||
@ -603,7 +603,7 @@ public class YAMLNode {
|
||||
* default will be returned. 'null' can be passed for the default
|
||||
* and an empty list will be returned instead. The node must be
|
||||
* an actual node and cannot be just a vector,
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value or null for an empty list as default
|
||||
* @return list of integers
|
||||
@ -633,7 +633,7 @@ public class YAMLNode {
|
||||
* default will be returned. 'null' can be passed for the default
|
||||
* and an empty list will be returned instead. The node must be
|
||||
* an actual node and cannot be just a vector,
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value or null for an empty list as default
|
||||
* @return list of integers
|
||||
@ -663,7 +663,7 @@ public class YAMLNode {
|
||||
* default will be returned. 'null' can be passed for the default
|
||||
* and an empty list will be returned instead. The node must be
|
||||
* an actual node and cannot be just a boolean,
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @param def default value or null for an empty list as default
|
||||
* @return list of integers
|
||||
@ -690,7 +690,7 @@ public class YAMLNode {
|
||||
* Get a configuration node at a path. If the node doesn't exist or the
|
||||
* path does not lead to a node, null will be returned. A node has
|
||||
* key/value mappings.
|
||||
*
|
||||
*
|
||||
* @param path the path
|
||||
* @return node or null
|
||||
*/
|
||||
@ -708,7 +708,7 @@ public class YAMLNode {
|
||||
/**
|
||||
* Get a list of nodes at a location. If the map at the particular location
|
||||
* does not exist or it is not a map, null will be returned.
|
||||
*
|
||||
*
|
||||
* @param path path to node (dot notation)
|
||||
* @return map of nodes
|
||||
*/
|
||||
@ -736,7 +736,7 @@ public class YAMLNode {
|
||||
|
||||
/**
|
||||
* Casts a value to an integer. May return null.
|
||||
*
|
||||
*
|
||||
* @param o the object
|
||||
* @return an integer or null
|
||||
*/
|
||||
@ -788,7 +788,7 @@ public class YAMLNode {
|
||||
/**
|
||||
* Remove the property at a location. This will override existing
|
||||
* configuration data to have it conform to key/value mappings.
|
||||
*
|
||||
*
|
||||
* @param path a path
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -445,6 +445,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* @return whether the queue is enabled
|
||||
* @deprecated Use {@link EditSession#getReorderMode()} with MULTI_STAGE instead.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isQueueEnabled() {
|
||||
return true;
|
||||
@ -456,6 +457,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
* Uses {@link ReorderMode#MULTI_STAGE}
|
||||
* @deprecated Use {@link EditSession#setReorderMode(ReorderMode)} with MULTI_STAGE instead.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public void enableQueue() {
|
||||
super.enableQueue();
|
||||
@ -464,6 +466,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
/**
|
||||
* Disable the queue. This will close the queue.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public void disableQueue() {
|
||||
super.disableQueue();
|
||||
@ -1537,7 +1540,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
/**
|
||||
* Drain nearby pools of water or lava, optionally removed waterlogged states from blocks.
|
||||
*
|
||||
* @param origin the origin to drain from, which will search a 3x3 area
|
||||
* @param origin the origin to drain from, which will search a 3×3 area
|
||||
* @param radius the radius of the removal, where a value should be 0 or greater
|
||||
* @param waterlogged true to make waterlogged blocks non-waterlogged as well
|
||||
* @return number of blocks affected
|
||||
@ -1566,7 +1569,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
}
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1));
|
||||
|
||||
// Around the origin in a 3x3 block
|
||||
// Around the origin in a 3×3 block
|
||||
for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) {
|
||||
if (mask.test(position)) {
|
||||
visitor.visit(position);
|
||||
@ -1607,7 +1610,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
||||
BlockReplace replace = new BlockReplace(this, fluid.getDefaultState());
|
||||
NonRisingVisitor visitor = new NonRisingVisitor(mask, replace);
|
||||
|
||||
// Around the origin in a 3x3 block
|
||||
// Around the origin in a 3×3 block
|
||||
for (BlockVector3 position : CuboidRegion.fromCenter(origin, 1)) {
|
||||
if (liquidMask.test(position)) {
|
||||
visitor.visit(position);
|
||||
|
@ -39,7 +39,6 @@ import com.boydti.fawe.util.StringMan;
|
||||
import com.boydti.fawe.util.TextureHolder;
|
||||
import com.boydti.fawe.util.TextureUtil;
|
||||
import com.boydti.fawe.wrappers.WorldWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sk89q.jchronic.Chronic;
|
||||
import com.sk89q.jchronic.Options;
|
||||
import com.sk89q.jchronic.utils.Span;
|
||||
@ -88,10 +87,8 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
@ -889,7 +886,7 @@ public class LocalSession implements TextureHolder {
|
||||
|
||||
/**
|
||||
* Get the position use for commands that take a center point
|
||||
* (i.e. //forestgen, etc.).
|
||||
* (i.e., //forestgen, etc.).
|
||||
*
|
||||
* @param actor the actor
|
||||
* @return the position to use
|
||||
|
@ -157,7 +157,7 @@ public class BrushCommands {
|
||||
aliases = {"bb", "blend"},
|
||||
desc = "Smooths and blends terrain",
|
||||
descFooter = "Smooths and blends terrain\n" +
|
||||
"Pic: https://i.imgur.com/cNUQUkj.png -> https://i.imgur.com/hFOFsNf.png"
|
||||
"Pic: https://i.imgur.com/cNUQUkj.png → https://i.imgur.com/hFOFsNf.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.blendball")
|
||||
public void blendBallBrush(InjectedValueAccess context,
|
||||
@ -203,7 +203,7 @@ public class BrushCommands {
|
||||
|
||||
@Command(
|
||||
name = "circle",
|
||||
desc = "Creates a circle which revolves around your facing direction"
|
||||
desc = "Creates a circle, which revolves around your facing direction"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.sphere")
|
||||
public void circleBrush(Player player, InjectedValueAccess context,
|
||||
@ -285,7 +285,7 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.sweep")
|
||||
public void sweepBrush(Player player, InjectedValueAccess context,
|
||||
@Arg(name = "copies", desc = "int", def = "-1") int copies) throws WorldEditException {
|
||||
@Arg(desc = "int", def = "-1") int copies) throws WorldEditException {
|
||||
player.print(BBC.BRUSH_SPLINE.s());
|
||||
set(context, new SweepBrush(copies));
|
||||
}
|
||||
@ -324,10 +324,11 @@ public class BrushCommands {
|
||||
@CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0,
|
||||
public void surfaceSpline(Player player, InjectedValueAccess context, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius, @Arg(name = "tension", desc = "double", def = "0") double tension,
|
||||
@Arg(name = "bias", desc = "double", def = "0") double bias,
|
||||
@Arg(name = "continuity", desc = "double", def = "0") double continuity,
|
||||
@Arg(name = "quality", desc = "double", def = "10") double quality) throws WorldEditException {
|
||||
Expression radius,
|
||||
@Arg(desc = "double", def = "0") double tension,
|
||||
@Arg(desc = "double", def = "0") double bias,
|
||||
@Arg(desc = "double", def = "0") double continuity,
|
||||
@Arg(desc = "double", def = "10") double quality) throws WorldEditException {
|
||||
player.print(BBC.BRUSH_SPLINE.format(radius));
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
set(context,
|
||||
@ -343,13 +344,13 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.rock")
|
||||
public void blobBrush(InjectedValueAccess context, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Vector3", def = "10")
|
||||
@Arg(desc = "Vector3", def = "10")
|
||||
Vector3 radius,
|
||||
@Arg(name = "sphericity", desc = "double", def = "100")
|
||||
@Arg(desc = "double", def = "100")
|
||||
double sphericity,
|
||||
@Arg(name = "frequency", desc = "double", def = "30")
|
||||
@Arg(desc = "double", def = "30")
|
||||
double frequency,
|
||||
@Arg(name = "amplitude", desc = "double", def = "50")
|
||||
@Arg(desc = "double", def = "50")
|
||||
double amplitude) throws WorldEditException {
|
||||
double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ());
|
||||
worldEdit.checkMaxBrushRadius(max);
|
||||
@ -424,10 +425,10 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.stencil")
|
||||
public void stencilBrush(LocalSession session, InjectedValueAccess context, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(name = "image", desc = "String", def = "") String image,
|
||||
@Arg(desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(desc = "String", def = "") String image,
|
||||
@Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation,
|
||||
@Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||
@Arg(desc = "double", def = "1") double yscale,
|
||||
@Switch(name = 'w', desc = "Apply at maximum saturation") boolean onlyWhite,
|
||||
@Switch(name = 'r', desc = "Apply random rotation") boolean randomRotate) throws WorldEditException, FileNotFoundException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
@ -454,7 +455,7 @@ public class BrushCommands {
|
||||
descFooter = "Use a height map to paint any surface.\n")
|
||||
@CommandPermissions("worldedit.brush.stencil")
|
||||
public void imageBrush(LocalSession session, InjectedValueAccess context,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
@Arg(desc = "Expression", def = "5")
|
||||
Expression radius,
|
||||
ProvideBindings.ImageUri imageUri,
|
||||
@Arg(def = "1", desc = "scale height") @Range(min = Double.MIN_NORMAL)
|
||||
@ -487,7 +488,7 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.surface")
|
||||
public void surfaceBrush(InjectedValueAccess context, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
@Arg(desc = "Expression", def = "5")
|
||||
Expression radius) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
set(context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
|
||||
@ -501,16 +502,16 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.scatter")
|
||||
public void scatterBrush(InjectedValueAccess context, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(name = "points", desc = "double", def = "5") double pointsOpt,
|
||||
@Arg(name = "distance", desc = "double", def = "1") double distanceOpt,
|
||||
@Arg(desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(desc = "double", def = "5") double points,
|
||||
@Arg(desc = "double", def = "1") double distance,
|
||||
@Switch(name = 'o', desc = "Overlay the block") boolean overlay) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
Brush brush;
|
||||
if (overlay) {
|
||||
brush = new ScatterOverlayBrush((int) pointsOpt, (int) distanceOpt);
|
||||
brush = new ScatterOverlayBrush((int) points, (int) distance);
|
||||
} else {
|
||||
brush = new ScatterBrush((int) pointsOpt, (int) distanceOpt);
|
||||
brush = new ScatterBrush((int) points, (int) distance);
|
||||
}
|
||||
set(context, brush).setSize(radius).setFill(fill);
|
||||
}
|
||||
@ -523,8 +524,8 @@ public class BrushCommands {
|
||||
@CommandPermissions("worldedit.brush.populateschematic")
|
||||
public void scatterSchemBrush(Player player, InjectedValueAccess context, Mask mask,
|
||||
@Arg(name = "clipboard", desc = "Clipboard uri") String clipboardStr,
|
||||
@Arg(name = "radius", desc = "Expression", def = "30") Expression radius,
|
||||
@Arg(name = "density", desc = "double", def = "50") double density,
|
||||
@Arg(desc = "Expression", def = "30") Expression radius,
|
||||
@Arg(desc = "double", def = "50") double density,
|
||||
@Switch(name = 'r', desc = "Apply random rotation") boolean rotate) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
try {
|
||||
@ -555,7 +556,7 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.layer")
|
||||
public void surfaceLayer(InjectedValueAccess context,
|
||||
@Arg(name = "radius", desc = "Expression") Expression radius, List<BlockState> blockLayers) throws WorldEditException {
|
||||
@Arg(desc = "Expression") Expression radius, List<BlockState> blockLayers) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
set(context, new LayerBrush(blockLayers.toArray(new BlockState[0]))).setSize(radius);
|
||||
}
|
||||
@ -570,12 +571,12 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.splatter")
|
||||
public void splatterBrush(InjectedValueAccess context, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(name = "points", desc = "double", def = "1") double pointsOpt,
|
||||
@Arg(name = "recursion", desc = "double", def = "5") double recursion,
|
||||
@Arg(name = "solid", desc = "boolean", def = "true") boolean solid) throws WorldEditException {
|
||||
@Arg(desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(desc = "double", def = "1") double points,
|
||||
@Arg(desc = "double", def = "5") double recursion,
|
||||
@Arg(desc = "boolean", def = "true") boolean solid) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
set(context, new SplatterBrush((int) pointsOpt, (int) recursion, solid)).setSize(radius).setFill(fill);
|
||||
set(context, new SplatterBrush((int) points, (int) recursion, solid)).setSize(radius).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -590,7 +591,7 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.scattercommand")
|
||||
public void scatterCommandBrush(Player player, InjectedValueAccess context,
|
||||
@Arg(name = "radius", desc = "Expression") Expression radius, double points,
|
||||
@Arg(desc = "Expression") Expression radius, double points,
|
||||
double distance, List<String> commandStr) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
set(context,
|
||||
@ -732,7 +733,7 @@ public class BrushCommands {
|
||||
"Snow Pic: https://i.imgur.com/Hrzn0I4.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public void heightBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
public void heightBrush(LocalSession session, @Arg(desc = "Expression", def = "5") Expression radius, @Arg(desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
terrainBrush(session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
}
|
||||
|
||||
@ -744,13 +745,13 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public void cliffBrush(LocalSession session,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
@Arg(desc = "Expression", def = "5")
|
||||
Expression radius,
|
||||
@Arg(name = "image", desc = "String", def = "")
|
||||
@Arg(desc = "String", def = "")
|
||||
String image,
|
||||
@Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360)
|
||||
int rotation,
|
||||
@Arg(name = "yscale", desc = "double", def = "1")
|
||||
@Arg(desc = "double", def = "1")
|
||||
double yscale,
|
||||
@Switch(name = 'r', desc = "Enables random off-axis rotation")
|
||||
boolean randomRotate,
|
||||
@ -767,7 +768,7 @@ public class BrushCommands {
|
||||
desc = "This brush raises or lowers land towards the clicked point"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public void flattenBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||
public void flattenBrush(LocalSession session, @Arg(desc = "Expression", def = "5") Expression radius, @Arg(desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360) int rotation, @Arg(desc = "double", def = "1") double yscale,
|
||||
@Switch(name = 'r', desc = "Enables random off-axis rotation")
|
||||
boolean randomRotate,
|
||||
@Switch(name = 'l', desc = "Will work on snow layers")
|
||||
@ -778,7 +779,7 @@ public class BrushCommands {
|
||||
}
|
||||
|
||||
private void terrainBrush(LocalSession session,
|
||||
@Arg(name = "radius", desc = "Expression") Expression radius, String image, int rotation,
|
||||
@Arg(desc = "Expression") Expression radius, String image, int rotation,
|
||||
double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth,
|
||||
Shape shape, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
@ -826,7 +827,7 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.copy")
|
||||
public void copy(Player player, LocalSession session, InjectedValueAccess context,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
@Arg(desc = "Expression", def = "5") Expression radius,
|
||||
@Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate,
|
||||
@Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
@ -847,7 +848,7 @@ public class BrushCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.command")
|
||||
public void command(InjectedValueAccess context,
|
||||
@Arg(name = "radius", desc = "Expression") Expression radius,
|
||||
@Arg(desc = "Expression") Expression radius,
|
||||
@Arg(desc = "Command to run") List<String> input) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
String cmd = StringMan.join(input, " ");
|
||||
|
@ -189,7 +189,7 @@ public class GeneralCommands {
|
||||
} else {
|
||||
session.setUseServerCUI(true);
|
||||
session.updateServerCUI(player);
|
||||
player.print("Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32.");
|
||||
player.print("Server CUI enabled. This only supports cuboid regions, with a maximum size of 32×32×32.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ public class GeneralCommands {
|
||||
@Command(
|
||||
name = "gmask",
|
||||
aliases = {"/gmask"},
|
||||
descFooter = "The global destination mask applies to all edits you do and masks based on the destination blocks (i.e. the blocks in the world).",
|
||||
descFooter = "The global destination mask applies to all edits you do and masks based on the destination blocks (i.e., the blocks in the world).",
|
||||
desc = "Set the global mask"
|
||||
)
|
||||
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
|
||||
@ -308,7 +308,7 @@ public class GeneralCommands {
|
||||
@Command(
|
||||
name = "/gtexture",
|
||||
aliases = {"gtexture"},
|
||||
descFooter = "The global destination mask applies to all edits you do and masks based on the destination blocks (i.e. the blocks in the world).",
|
||||
descFooter = "The global destination mask applies to all edits you do and masks based on the destination blocks (i.e., the blocks in the world).",
|
||||
desc = "Set the global mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.global-texture")
|
||||
@ -368,7 +368,7 @@ public class GeneralCommands {
|
||||
name = "/gsmask",
|
||||
aliases = {"gsmask", "globalsourcemask", "/globalsourcemask"},
|
||||
desc = "Set the global source mask",
|
||||
descFooter = "The global source mask applies to all edits you do and masks based on the source blocks (e.g. the blocks in your clipboard)"
|
||||
descFooter = "The global source mask applies to all edits you do and masks based on the source blocks (e.g., the blocks in your clipboard)"
|
||||
)
|
||||
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
|
||||
public void gsmask(Player player, LocalSession session, EditSession editSession, @Arg(desc = "The mask to set", def = "") Mask maskOpt) throws WorldEditException {
|
||||
|
@ -130,8 +130,8 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.image")
|
||||
@Logging(PLACEMENT)
|
||||
public void image(Actor actor, LocalSession session, EditSession editSession, String argStr, @Arg(name = "randomize", desc = "boolean", def = "true") boolean randomize,
|
||||
@Arg(desc = "TODO", def = "100") int threshold, @Arg(name = "dimensions", desc = "BlockVector2", def = "") BlockVector2 dimensions) throws WorldEditException, IOException {
|
||||
public void image(Actor actor, LocalSession session, EditSession editSession, String argStr, @Arg(desc = "boolean", def = "true") boolean randomize,
|
||||
@Arg(desc = "TODO", def = "100") int threshold, @Arg(desc = "BlockVector2", def = "") BlockVector2 dimensions) throws WorldEditException, IOException {
|
||||
TextureUtil tu = Fawe.get().getCachedTextureUtil(randomize, 0, threshold);
|
||||
URL url = new URL(argStr);
|
||||
if (!url.getHost().equalsIgnoreCase("i.imgur.com") && !url.getHost().equalsIgnoreCase("empcraft.com")) {
|
||||
@ -171,7 +171,7 @@ public class GenerationCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.ore")
|
||||
@Logging(PLACEMENT)
|
||||
public void ore(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, Pattern material, @Arg(name="size", desc="Ore vein size") @Range(min = 0) int size, int freq, @Range(min = 0, max = 100) int rarity, @Range(min = 0, max = 255) int minY, @Range(min = 0, max = 255) int maxY, InjectedValueAccess context) throws WorldEditException {
|
||||
public void ore(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, Mask mask, Pattern material, @Arg(desc="Ore vein size") @Range(min = 0) int size, int freq, @Range(min = 0, max = 100) int rarity, @Range(min = 0, max = 255) int minY, @Range(min = 0, max = 255) int maxY, InjectedValueAccess context) throws WorldEditException {
|
||||
actor.checkConfirmationRegion(() -> {
|
||||
editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY);
|
||||
BBC.VISITOR_BLOCK.send(actor, editSession.getBlockChangeCount());
|
||||
@ -190,7 +190,7 @@ public class GenerationCommands {
|
||||
BlockVector2 radius,
|
||||
@Arg(desc = "The height of the cylinder", def = "1")
|
||||
int height,
|
||||
@Range(min = 1) @Arg(name = "thickness", desc = "double", def = "1") double thickness, InjectedValueAccess context) throws WorldEditException {
|
||||
@Range(min = 1) @Arg(desc = "double", def = "1") double thickness, InjectedValueAccess context) throws WorldEditException {
|
||||
double max = MathMan.max(radius.getBlockX(), radius.getBlockZ());
|
||||
worldEdit.checkMaxRadius(max);
|
||||
BlockVector3 pos = session.getPlacementPosition(actor);
|
||||
@ -274,15 +274,15 @@ public class GenerationCommands {
|
||||
@CommandPermissions("worldedit.generation.forest")
|
||||
@Logging(POSITION)
|
||||
public int forestGen(Actor actor, LocalSession session, EditSession editSession,
|
||||
@Arg(name = "size", desc = "The size of the forest, in blocks", def = "10")
|
||||
int sizeOpt,
|
||||
@Arg(desc = "The size of the forest, in blocks", def = "10")
|
||||
int size,
|
||||
@Arg(desc = "The type of forest", def = "tree")
|
||||
TreeType type,
|
||||
@Range(min = 0, max = 100) @Arg(desc = "The density of the forest, between 0 and 100", def = "5")
|
||||
double density) throws WorldEditException {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be between 0 and 100");
|
||||
density /= 100;
|
||||
int affected = editSession.makeForest(session.getPlacementPosition(actor), sizeOpt, density, type);
|
||||
int affected = editSession.makeForest(session.getPlacementPosition(actor), size, density, type);
|
||||
actor.print(affected + " trees created.");
|
||||
return affected;
|
||||
}
|
||||
@ -294,8 +294,8 @@ public class GenerationCommands {
|
||||
@CommandPermissions("worldedit.generation.pumpkins")
|
||||
@Logging(POSITION)
|
||||
public int pumpkins(Actor actor, LocalSession session, EditSession editSession,
|
||||
@Arg(name = "size", desc = "The size of the patch", def = "10")
|
||||
int sizeOpt,
|
||||
@Arg(desc = "The size of the patch", def = "10")
|
||||
int size,
|
||||
@Arg(desc = "//TODO", def = "10")
|
||||
int apothem,
|
||||
@Arg(desc = "//TODO ", def = "0.02")
|
||||
|
@ -67,7 +67,7 @@ import org.enginehub.piston.annotation.param.Arg;
|
||||
// descFooter = "Patterns determine what blocks are placed\n" +
|
||||
// " - Use [brackets] for arguments\n" +
|
||||
// " - Use , to OR multiple\n" +
|
||||
// "e.g. #surfacespread[10][#existing],andesite\n" +
|
||||
// "e.g., #surfacespread[10][#existing],andesite\n" +
|
||||
// "More Info: https://git.io/vSPmA"
|
||||
//)
|
||||
@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
@ -78,7 +78,7 @@ public class PatternCommands {
|
||||
aliases = {"#*", "*", ".*"},
|
||||
desc = "Use the block that is already there"
|
||||
)
|
||||
public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties
|
||||
public Pattern existing(Extent extent, @Arg(desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties
|
||||
if (properties == null) return new ExistingPattern(extent);
|
||||
return new PropertyPattern(extent).addRegex(".*[" + properties + "]");
|
||||
}
|
||||
@ -119,16 +119,16 @@ public class PatternCommands {
|
||||
name = "#anglecolor",
|
||||
desc = "A darker block based on the existing terrain angle"
|
||||
)
|
||||
public Pattern anglecolor(Extent extent, LocalSession session, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) {
|
||||
return new AngleColorPattern(extent, session, distanceOpt);
|
||||
public Pattern anglecolor(Extent extent, LocalSession session, @Arg(desc = "int", def = "1") int distance) {
|
||||
return new AngleColorPattern(extent, session, distance);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#angledata",
|
||||
desc = "Block data based on the existing terrain angle"
|
||||
)
|
||||
public Pattern angledata(Extent extent, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) {
|
||||
return new DataAnglePattern(extent, distanceOpt);
|
||||
public Pattern angledata(Extent extent, @Arg(desc = "int", def = "1") int distance) {
|
||||
return new DataAnglePattern(extent, distance);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -153,7 +153,7 @@ public class PatternCommands {
|
||||
name = "#desaturate",
|
||||
desc = "Desaturated color of the existing block"
|
||||
)
|
||||
public Pattern desaturate(Extent extent, LocalSession session, @Arg(name = "percent", desc = "double", def = "100") double percent) {
|
||||
public Pattern desaturate(Extent extent, LocalSession session, @Arg(desc = "double", def = "100") double percent) {
|
||||
return new DesaturatePattern(extent, percent / 100d, session);
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ public class PatternCommands {
|
||||
name = "#fullcopy",
|
||||
desc = "Places your full clipboard at each block"
|
||||
)
|
||||
public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Arg(name = "location", desc = "String", def = "#copy") String location, @Arg(name = "rotate", desc = "boolean", def = "false") boolean rotate, @Arg(name = "flip", desc = "boolean", def = "false") boolean flip) throws EmptyClipboardException, InputParseException, IOException {
|
||||
public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Arg(desc = "String", def = "#copy") String location, @Arg(desc = "boolean", def = "false") boolean rotate, @Arg(desc = "boolean", def = "false") boolean flip) throws EmptyClipboardException, InputParseException, IOException {
|
||||
List<ClipboardHolder> clipboards;
|
||||
switch (location.toLowerCase()) {
|
||||
case "#copy":
|
||||
@ -313,14 +313,14 @@ public class PatternCommands {
|
||||
name = "#offset",
|
||||
desc = "Offset a pattern"
|
||||
)
|
||||
public Pattern offset(@Arg(name = "x", desc = "x offset") double x, @Arg(name = "y", desc = "y offset") double y, @Arg(name = "z", desc = "z offset") double z, @Arg(desc = "Pattern")Pattern pattern) {
|
||||
public Pattern offset(@Arg(desc = "x offset") double x, @Arg(desc = "y offset") double y, @Arg(desc = "z offset") double z, @Arg(desc = "Pattern")Pattern pattern) {
|
||||
|
||||
return new OffsetPattern(pattern, (int) x, (int) y, (int) z);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "#surfacespread",
|
||||
desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given ranomized offset `[0, <distance>)`. e.g. Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard"
|
||||
desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given randomized offset `[0, <distance>)`. e.g., Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard"
|
||||
)
|
||||
public Pattern surfacespread(@Arg(desc = "spread distance (blocks)") double distance, @Arg(desc = "Pattern")Pattern pattern) {
|
||||
|
||||
@ -331,7 +331,7 @@ public class PatternCommands {
|
||||
name = "#solidspread",
|
||||
desc = "Randomly spread solid blocks"
|
||||
)
|
||||
public Pattern solidspread(@Arg(name = "x", desc = "x offset") double x, @Arg(name = "y", desc = "y offset") double y, @Arg(name = "z", desc = "z offset") double z, @Arg(desc = "Pattern")Pattern pattern) {
|
||||
public Pattern solidspread(@Arg(desc = "x offset") double x, @Arg(desc = "y offset") double y, @Arg(desc = "z offset") double z, @Arg(desc = "Pattern")Pattern pattern) {
|
||||
|
||||
return new SolidRandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
|
||||
}
|
||||
@ -341,7 +341,7 @@ public class PatternCommands {
|
||||
aliases = {"#randomoffset"},
|
||||
desc = "Randomly spread blocks"
|
||||
)
|
||||
public Pattern spread(@Arg(name = "x", desc = "x offset") double x, @Arg(name = "y", desc = "y offset") double y, @Arg(name = "z", desc = "z offset") double z, @Arg(desc = "Pattern")Pattern pattern) {
|
||||
public Pattern spread(@Arg(desc = "x offset") double x, @Arg(desc = "y offset") double y, @Arg(desc = "z offset") double z, @Arg(desc = "Pattern")Pattern pattern) {
|
||||
|
||||
return new RandomOffsetPattern(pattern, (int) x, (int) y, (int) z);
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class UtilityCommands {
|
||||
descFooter = "Patterns determine what blocks are placed\n" +
|
||||
" - Use [brackets] for arguments\n" +
|
||||
" - Use , to OR multiple\n" +
|
||||
"e.g. #surfacespread[10][#existing],andesite\n" +
|
||||
"e.g., #surfacespread[10][#existing],andesite\n" +
|
||||
"More Info: https://git.io/vSPmA"
|
||||
)
|
||||
@CommandQueued(false)
|
||||
@ -237,7 +237,7 @@ public class UtilityCommands {
|
||||
" - Use [brackets] for arguments\n" +
|
||||
" - Use , to OR multiple\n" +
|
||||
" - Use & to AND multiple\n" +
|
||||
"e.g. >[stone,dirt],#light[0][5],$jungle\n" +
|
||||
"e.g., >[stone,dirt],#light[0][5],$jungle\n" +
|
||||
"More Info: https://git.io/v9r4K"
|
||||
)
|
||||
@CommandQueued(false)
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.command.tool;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
@ -83,7 +84,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
// TODO:
|
||||
// Serialize methods
|
||||
// serialize BrushSettings (primary and secondary only if different)
|
||||
// set transient values e.g. context
|
||||
// set transient values e.g., context
|
||||
|
||||
public enum BrushAction {
|
||||
PRIMARY,
|
||||
@ -126,7 +127,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}.getType();
|
||||
Map<String, Object> root = gson.fromJson(json, type);
|
||||
if (root == null) {
|
||||
Fawe.debug("Failed to load " + json);
|
||||
getLogger(BrushTool.class).debug("Failed to load " + json);
|
||||
return new BrushTool();
|
||||
}
|
||||
Map<String, Object> primary = (Map<String, Object>) root.get("primary");
|
||||
|
@ -354,7 +354,7 @@ public interface Player extends Entity, Actor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the World the player is editing in (may not match the world they are in)<br/> - e.g. If
|
||||
* Get the World the player is editing in (may not match the world they are in)<br/> - e.g., If
|
||||
* they are editing a CFI world.<br/>
|
||||
*
|
||||
* @return Editing world
|
||||
@ -439,12 +439,12 @@ public interface Player extends Entity, Actor {
|
||||
getSession().setClipboard(holder);
|
||||
}
|
||||
} catch (Exception event) {
|
||||
Fawe.debug("====== INVALID CLIPBOARD ======");
|
||||
printError("====== INVALID CLIPBOARD ======");
|
||||
event.printStackTrace();
|
||||
Fawe.debug("===============---=============");
|
||||
Fawe.debug("This shouldn't result in any failure");
|
||||
Fawe.debug("File: " + file.getName() + " (len:" + file.length() + ")");
|
||||
Fawe.debug("===============---=============");
|
||||
printError("===============---=============");
|
||||
printError("This shouldn't result in any failure");
|
||||
printError("File: " + file.getName() + " (len:" + file.length() + ")");
|
||||
printError("===============---=============");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.sk89q.worldedit.extension.platform.binding;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.StringMan;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
@ -56,7 +59,7 @@ public class Bindings {
|
||||
Annotation annotation = annotations[0] == binding ? annotations[1] : annotations[0];
|
||||
key = Key.of(ret, annotation);
|
||||
} else {
|
||||
Fawe.debug("Cannot annotate: " + method + " with " + StringMan.getString(annotations));
|
||||
getLogger(Bindings.class).debug("Cannot annotate: " + method + " with " + StringMan.getString(annotations));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -20,14 +20,15 @@
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.IBatchProcessor;
|
||||
import com.boydti.fawe.object.HistoryExtent;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.extent.LightingExtent;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
@ -81,6 +82,7 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
|
||||
Queue based methods
|
||||
TODO NOT IMPLEMENTED: IQueueExtent and such need to implement these
|
||||
*/
|
||||
@Override
|
||||
public boolean isQueueEnabled() {
|
||||
return extent.isQueueEnabled();
|
||||
}
|
||||
@ -97,7 +99,7 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
|
||||
Extent next = ((AbstractDelegateExtent) extent).getExtent();
|
||||
new ExtentTraverser(this).setNext(next);
|
||||
} else {
|
||||
Fawe.debug("Cannot disable queue");
|
||||
getLogger(AbstractDelegateExtent.class).debug("Cannot disable queue");
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,9 +199,7 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
|
||||
return extent.setBiome(position.getX(), 0, position.getZ(), biome);
|
||||
}
|
||||
|
||||
/*
|
||||
Light
|
||||
*/
|
||||
@Override
|
||||
public int getSkyLight(int x, int y, int z) {
|
||||
if (extent instanceof LightingExtent) {
|
||||
return ((LightingExtent) extent).getSkyLight(x, y, z);
|
||||
@ -207,12 +207,14 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight(int x, int y, int z) {
|
||||
if (extent instanceof LightingExtent) {
|
||||
return ((LightingExtent) extent).getBlockLight(x, y, z);
|
||||
}
|
||||
return getBrightness(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public int getOpacity(int x, int y, int z) {
|
||||
if (extent instanceof LightingExtent) {
|
||||
return ((LightingExtent) extent).getOpacity(x, y, z);
|
||||
|
@ -211,6 +211,7 @@ public class PassthroughExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
// special
|
||||
@Override
|
||||
public Extent disableHistory() {
|
||||
return super.disableHistory();
|
||||
}
|
||||
@ -235,14 +236,17 @@ public class PassthroughExtent extends AbstractDelegateExtent {
|
||||
return getExtent().cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQueueEnabled() {
|
||||
return getExtent().isQueueEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableQueue() {
|
||||
getExtent().enableQueue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableQueue() {
|
||||
getExtent().disableQueue();
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ public interface ClipboardFormat {
|
||||
Set<String> getFileExtensions();
|
||||
|
||||
/**
|
||||
* Set the actor's clipboard
|
||||
* Sets the actor's clipboard.
|
||||
* @param actor
|
||||
* @param uri
|
||||
* @param uri the URI of the schematic to hold
|
||||
* @param inputStream the input stream
|
||||
* @throws IOException thrown on I/O error
|
||||
*/
|
||||
|
@ -20,11 +20,8 @@
|
||||
package com.sk89q.worldedit.extent.clipboard.io;
|
||||
|
||||
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
@ -48,12 +45,7 @@ public interface ClipboardReader extends Closeable {
|
||||
}
|
||||
|
||||
default Clipboard read(UUID uuid) throws IOException {
|
||||
return read(uuid, new Function<BlockVector3, Clipboard>() {
|
||||
@Override
|
||||
public Clipboard apply(BlockVector3 dimensions) {
|
||||
return new DiskOptimizedClipboard(dimensions);
|
||||
}
|
||||
});
|
||||
return read(uuid, DiskOptimizedClipboard::new);
|
||||
}
|
||||
|
||||
default Clipboard read(UUID uuid, Function<BlockVector3, Clipboard> createOutput) throws IOException {
|
||||
|
@ -19,7 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.clipboard.io;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.jnbt.streamer.InfoReader;
|
||||
import com.boydti.fawe.jnbt.streamer.IntValueReader;
|
||||
@ -51,7 +53,6 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||
import com.sk89q.worldedit.world.block.BlockID;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypeSwitch;
|
||||
import com.sk89q.worldedit.world.block.BlockTypeSwitchBuilder;
|
||||
@ -59,9 +60,6 @@ import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
import net.jpountz.lz4.LZ4BlockOutputStream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
@ -69,8 +67,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
import net.jpountz.lz4.LZ4BlockOutputStream;
|
||||
|
||||
/**
|
||||
* Reads schematic files based that are compatible with MCEdit and other editors.
|
||||
@ -180,21 +178,12 @@ public class SchematicReader implements ClipboardReader {
|
||||
|
||||
StreamDelegate tilesDelegate = schematic.add("TileEntities");
|
||||
tilesDelegate.withInfo((length, type) -> tiles = new ArrayList<>(length));
|
||||
tilesDelegate.withElem(new ValueReader<Map<String, Object>>() {
|
||||
@Override
|
||||
public void apply(int index, Map<String, Object> tile) {
|
||||
tiles.add(tile);
|
||||
}
|
||||
});
|
||||
tilesDelegate.withElem((ValueReader<Map<String, Object>>) (index, tile) -> tiles.add(tile));
|
||||
|
||||
StreamDelegate entitiesDelegate = schematic.add("Entities");
|
||||
entitiesDelegate.withInfo((length, type) -> entities = new ArrayList<>(length));
|
||||
entitiesDelegate.withElem(new ValueReader<Map<String, Object>>() {
|
||||
@Override
|
||||
public void apply(int index, Map<String, Object> entity) {
|
||||
entities.add(entity);
|
||||
}
|
||||
});
|
||||
entitiesDelegate.withElem(
|
||||
(ValueReader<Map<String, Object>>) (index, entity) -> entities.add(entity));
|
||||
return root;
|
||||
}
|
||||
|
||||
@ -370,7 +359,7 @@ public class SchematicReader implements ClipboardReader {
|
||||
Location loc = ent.getEntityLocation(clipboard);
|
||||
clipboard.createEntity(loc, state);
|
||||
} else {
|
||||
Fawe.debug("Invalid entity: " + id);
|
||||
getLogger(SchematicReader.class).debug("Invalid entity: " + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -396,10 +385,10 @@ public class SchematicReader implements ClipboardReader {
|
||||
Direction left = facing.getLeft();
|
||||
Direction right = facing.getRight();
|
||||
|
||||
BlockStateHolder forwardBlock = fc.getBlock(x + forward.getBlockX(), y + forward.getBlockY(), z + forward.getBlockZ());
|
||||
BlockState forwardBlock = fc.getBlock(x + forward.getBlockX(), y + forward.getBlockY(), z + forward.getBlockZ());
|
||||
BlockType forwardType = forwardBlock.getBlockType();
|
||||
if (forwardType.hasProperty(PropertyKey.SHAPE) && forwardType.hasProperty(PropertyKey.FACING)) {
|
||||
Direction forwardFacing = (Direction) forwardBlock.getState(PropertyKey.FACING);
|
||||
Direction forwardFacing = forwardBlock.getState(PropertyKey.FACING);
|
||||
if (forwardFacing == left) {
|
||||
BlockState rightBlock = fc.getBlock(x + right.toBlockVector().getBlockX(), y + right.toBlockVector().getBlockY(), z + right.toBlockVector().getBlockZ());
|
||||
BlockType rightType = rightBlock.getBlockType();
|
||||
|
@ -335,7 +335,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
Location loc = ent.getEntityLocation(clipboard);
|
||||
clipboard.createEntity(loc, state);
|
||||
} else {
|
||||
Fawe.debug("Invalid entity: " + id);
|
||||
log.debug("Invalid entity: " + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
@ -150,7 +150,7 @@ public class MaskIntersection extends AbstractMask {
|
||||
while (changed |= combineMasks(pairingFunction(), failedCombines) && --maxIteration > 0);
|
||||
|
||||
if (maxIteration == 0) {
|
||||
Fawe.debug("Failed optimize MaskIntersection");
|
||||
getLogger(MaskIntersection.class).debug("Failed optimize MaskIntersection");
|
||||
for (Mask mask : masks) {
|
||||
System.out.println(mask.getClass() + " / " + mask);
|
||||
}
|
||||
|
@ -31,12 +31,12 @@ import java.util.List;
|
||||
public final class Polygons {
|
||||
|
||||
private Polygons() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the polygon shape of a cylinder which can then be used for e.g. intersection detection.
|
||||
*
|
||||
* Calculates the polygon shape of a cylinder, which can then be used for e.g., intersection detection.
|
||||
*
|
||||
* @param center the center point of the cylinder
|
||||
* @param radius the radius of the cylinder
|
||||
* @param maxPoints max points to be used for the calculation
|
||||
@ -60,5 +60,5 @@ public final class Polygons {
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
package com.sk89q.worldedit.registry.state;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.util.ReflectionUtil;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@ -102,19 +98,18 @@ public enum PropertyKey {
|
||||
|
||||
/**
|
||||
* Get or create the property key
|
||||
* @param id The name of the property (e.g. `waterlogged`)
|
||||
* @param id The name of the property (e.g., `waterlogged`)
|
||||
* @return PropertyKey enum
|
||||
*/
|
||||
public static final PropertyKey getOrCreate(String id) {
|
||||
public static PropertyKey getOrCreate(String id) {
|
||||
PropertyKey property = PropertyKey.get(id);
|
||||
if (property == null) {
|
||||
Fawe.debug("Registering property " + id);
|
||||
property = ReflectionUtils.addEnum(PropertyKey.class, id.toUpperCase(Locale.ROOT));
|
||||
if (property.getId() == null) {
|
||||
try {
|
||||
ReflectionUtils.setFailsafeFieldValue(PropertyKey.class.getDeclaredField("id"), property, property.name().toLowerCase());
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new RuntimeException("Could not register property with an id of " + id , e);
|
||||
}
|
||||
}
|
||||
keys.put(property.name().toLowerCase(), property);
|
||||
|
@ -82,7 +82,7 @@ public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
||||
|
||||
/**
|
||||
* Returns a temporary BlockState for a given type and string
|
||||
* @param state String e.g. minecraft:water[level=4]
|
||||
* @param state String e.g., minecraft:water[level=4]
|
||||
* @return BlockState
|
||||
*/
|
||||
public static BlockState get(String state) throws InputParseException {
|
||||
@ -92,8 +92,8 @@ public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
||||
/**
|
||||
* Returns a temporary BlockState for a given type and string
|
||||
* - It's faster if a BlockType is provided compared to parsing the string
|
||||
* @param type BlockType e.g. BlockTypes.STONE (or null)
|
||||
* @param state String e.g. minecraft:water[level=4]
|
||||
* @param type BlockType e.g., BlockTypes.STONE (or null)
|
||||
* @param state String e.g., minecraft:water[level=4]
|
||||
* @return BlockState
|
||||
*/
|
||||
public static BlockState get(@Nullable BlockType type, String state) throws InputParseException {
|
||||
@ -103,8 +103,8 @@ public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
||||
/**
|
||||
* Returns a temporary BlockState for a given type and string
|
||||
* - It's faster if a BlockType is provided compared to parsing the string
|
||||
* @param type BlockType e.g. BlockTypes.STONE (or null)
|
||||
* @param state String e.g. minecraft:water[level=4]
|
||||
* @param type BlockType e.g., BlockTypes.STONE (or null)
|
||||
* @param state String e.g., minecraft:water[level=4]
|
||||
* @return BlockState
|
||||
*/
|
||||
public static BlockState get(@Nullable BlockType type, String state, BlockState defaultState) throws InputParseException {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren