Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
fix conflicts
Dieser Commit ist enthalten in:
Commit
283351fea5
@ -4,9 +4,27 @@ import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
||||
import com.sk89q.worldedit.util.command.parametric.ExceptionConverter;
|
||||
import com.sk89q.worldedit.internal.command.exception.ExceptionConverter;
|
||||
import com.thevoxelbox.voxelsniper.api.command.VoxelCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.*;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelBrushCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelBrushToolCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelCenterCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelChunkCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelDefaultCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelGoToCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelHeightCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelInkCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelInkReplaceCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelListCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelPaintCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelPerformerCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelReplaceCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelSniperCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelUndoCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelUndoUserCommand;
|
||||
import com.thevoxelbox.voxelsniper.command.VoxelVoxelCommand;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -14,9 +32,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class VoxelSniperListener implements Listener {
|
||||
|
||||
|
@ -17,7 +17,7 @@ public CloneStampBrush() {
|
||||
/**
|
||||
* The clone method is used to grab a snapshot of the selected area dictated blockPositionY targetBlock.x y z v.brushSize v.voxelHeight and v.cCen.
|
||||
* <p/>
|
||||
* x y z -- initial center of the selection v.brushSize -- the radius of the cylinder v.voxelHeight -- the heigth of the cylinder c.cCen -- the offset on
|
||||
* x y z -- initial center of the selection v.brushSize -- the radius of the cylinder v.voxelHeight -- the height of the cylinder c.cCen -- the offset on
|
||||
* the Y axis of the selection ( bottom of the cylinder ) as blockPositionY: Bottom_Y = targetBlock.y + v.cCen;
|
||||
*
|
||||
* @param v Sniper Caller
|
||||
@ -71,7 +71,7 @@ public CloneStampBrush() {
|
||||
}
|
||||
}
|
||||
}
|
||||
v.sendMessage(ChatColor.GREEN + String.valueOf(this.clone.size()) + ChatColor.AQUA + " blocks copied sucessfully.");
|
||||
v.sendMessage(ChatColor.GREEN + String.valueOf(this.clone.size()) + ChatColor.AQUA + " blocks copied successfully.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,7 +174,7 @@ public class ErodeBrush extends Brush {
|
||||
vm.brushName(this.getName());
|
||||
vm.size();
|
||||
vm.custom(ChatColor.AQUA + "Erosion minimum exposed faces set to " + this.currentPreset.getErosionFaces());
|
||||
vm.custom(ChatColor.BLUE + "Fill minumum touching faces set to " + this.currentPreset.getFillFaces());
|
||||
vm.custom(ChatColor.BLUE + "Fill minimum touching faces set to " + this.currentPreset.getFillFaces());
|
||||
vm.custom(ChatColor.DARK_BLUE + "Erosion recursion amount set to " + this.currentPreset.getErosionRecursion());
|
||||
vm.custom(ChatColor.DARK_GREEN + "Fill recursion amount set to " + this.currentPreset.getFillRecursion());
|
||||
}
|
||||
@ -252,9 +252,9 @@ public class ErodeBrush extends Brush {
|
||||
/**
|
||||
* Generates a concat string of all options.
|
||||
*
|
||||
* @param seperator Seperator for delimiting entries.
|
||||
* @param separator Separator for delimiting entries.
|
||||
*/
|
||||
public static String getValuesString(String seperator) {
|
||||
public static String getValuesString(String separator) {
|
||||
StringBuilder valuesString = new StringBuilder();
|
||||
|
||||
boolean delimiterHelper = true;
|
||||
@ -262,7 +262,7 @@ public class ErodeBrush extends Brush {
|
||||
if (delimiterHelper) {
|
||||
delimiterHelper = false;
|
||||
} else {
|
||||
valuesString.append(seperator);
|
||||
valuesString.append(separator);
|
||||
}
|
||||
valuesString.append(preset.name());
|
||||
}
|
||||
|
@ -102,10 +102,10 @@ public class Rot3DBrush extends Brush {
|
||||
|
||||
private void rotate(final SnipeData v) {
|
||||
// basically 1) make it a sphere we are rotating in, not a cylinder
|
||||
// 2) do three rotations in a row, one in each dimension, unless some dimensions are set to zero or udnefined or whatever, then skip those.
|
||||
// --> Why not utilize Sniper'world new oportunities and have arrow rotate all 3, powder rotate x, goldsisc y, otherdisc z. Or something like that. Or
|
||||
// 2) do three rotations in a row, one in each dimension, unless some dimensions are set to zero or undefined or whatever, then skip those.
|
||||
// --> Why not utilize Sniper'world new opportunities and have arrow rotate all 3, powder rotate x, goldsisc y, otherdisc z. Or something like that. Or
|
||||
// we
|
||||
// could just use arrow and powder and just differenciate between left and right click that gis 4 different situations
|
||||
// could just use arrow and powder and just differentiate between left and right click that gis 4 different situations
|
||||
// --> Well, there would be 7 different possibilities... X, Y, Z, XY, XZ, YZ, XYZ, and different numbers of parameters for each, so I think each having
|
||||
// and item is too confusing. How about this: arrow = rotate one dimension, based on the face you click, and takes 1 param... powder: rotates all three
|
||||
// at once, and takes 3 params.
|
||||
|
@ -27,8 +27,8 @@ public class SnowConeBrush extends Brush {
|
||||
}
|
||||
|
||||
final int brushSizeDoubled = 2 * brushSize;
|
||||
final int[][] snowcone = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold block IDs
|
||||
final int[][] snowconeData = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold data values for snowcone
|
||||
final int[][] snowCone = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold block IDs
|
||||
final int[][] snowConeData = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold data values for snowCone
|
||||
final int[][] yOffset = new int[brushSizeDoubled + 1][brushSizeDoubled + 1];
|
||||
// prime the arrays
|
||||
|
||||
@ -44,12 +44,12 @@ public class SnowConeBrush extends Brush {
|
||||
}
|
||||
}
|
||||
}
|
||||
snowcone[x][z] = this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z);
|
||||
snowconeData[x][z] = this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).getPropertyId();
|
||||
snowCone[x][z] = this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z);
|
||||
snowConeData[x][z] = this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).getPropertyId();
|
||||
}
|
||||
}
|
||||
|
||||
// figure out new snowheights
|
||||
// figure out new snowHeights
|
||||
for (int x = 0; x <= brushSizeDoubled; x++) {
|
||||
final double xSquared = Math.pow(x - brushSize, 2);
|
||||
|
||||
@ -61,35 +61,35 @@ public class SnowConeBrush extends Brush {
|
||||
if (snowData >= 0) { // no funny business
|
||||
switch (snowData) {
|
||||
case 0:
|
||||
if (BlockTypes.get(snowcone[x][z]).getMaterial().isAir()) {
|
||||
snowcone[x][z] = BlockTypes.SNOW.getInternalId();
|
||||
snowconeData[x][z] = 0;
|
||||
if (BlockTypes.get(snowCone[x][z]).getMaterial().isAir()) {
|
||||
snowCone[x][z] = BlockTypes.SNOW.getInternalId();
|
||||
snowConeData[x][z] = 0;
|
||||
}
|
||||
break;
|
||||
case 7: // Turn largest snowtile into snowblock
|
||||
if (snowcone[x][z] == BlockTypes.SNOW.getInternalId()) {
|
||||
snowcone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId();
|
||||
snowconeData[x][z] = 0;
|
||||
case 7: // Turn largest snowTile into snow block
|
||||
if (snowCone[x][z] == BlockTypes.SNOW.getInternalId()) {
|
||||
snowCone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId();
|
||||
snowConeData[x][z] = 0;
|
||||
}
|
||||
break;
|
||||
default: // Increase snowtile size, if smaller than target
|
||||
default: // Increase snowTile size, if smaller than target
|
||||
|
||||
if (snowData > snowconeData[x][z]) {
|
||||
if (snowData > snowConeData[x][z]) {
|
||||
BlockType blockType =
|
||||
BlockTypes.get(snowcone[x][z]);
|
||||
BlockTypes.get(snowCone[x][z]);
|
||||
if (blockType.getMaterial().isAir()) {
|
||||
snowconeData[x][z] = snowData;
|
||||
snowcone[x][z] = BlockTypes.SNOW.getInternalId();
|
||||
snowConeData[x][z] = snowData;
|
||||
snowCone[x][z] = BlockTypes.SNOW.getInternalId();
|
||||
|
||||
snowconeData[x][z] = snowData;
|
||||
snowConeData[x][z] = snowData;
|
||||
} else if (blockType == BlockTypes.SNOW_BLOCK) {
|
||||
snowconeData[x][z] = snowData;
|
||||
snowConeData[x][z] = snowData;
|
||||
}
|
||||
} else if (yOffset[x][z] > 0 && snowcone[x][z] == BlockTypes.SNOW.getInternalId()) {
|
||||
snowconeData[x][z]++;
|
||||
if (snowconeData[x][z] == 7) {
|
||||
snowconeData[x][z] = 0;
|
||||
snowcone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId();
|
||||
} else if (yOffset[x][z] > 0 && snowCone[x][z] == BlockTypes.SNOW.getInternalId()) {
|
||||
snowConeData[x][z]++;
|
||||
if (snowConeData[x][z] == 7) {
|
||||
snowConeData[x][z] = 0;
|
||||
snowCone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -103,11 +103,11 @@ public class SnowConeBrush extends Brush {
|
||||
for (int x = 0; x <= brushSizeDoubled; x++) {
|
||||
for (int z = 0; z <= brushSizeDoubled; z++) {
|
||||
|
||||
if (this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z) != snowcone[x][z] || this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).getPropertyId() != snowconeData[x][z]) {
|
||||
if (this.getBlockIdAt(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z) != snowCone[x][z] || this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).getPropertyId() != snowConeData[x][z]) {
|
||||
undo.put(this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z));
|
||||
}
|
||||
this.setBlockIdAt(blockPositionZ - brushSize + z, blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], snowcone[x][z]);
|
||||
this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).setPropertyId(snowconeData[x][z]);
|
||||
this.setBlockIdAt(blockPositionZ - brushSize + z, blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], snowCone[x][z]);
|
||||
this.clampY(blockPositionX - brushSize + x, blockPositionY - yOffset[x][z], blockPositionZ - brushSize + z).setPropertyId(snowConeData[x][z]);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ import java.util.logging.Logger;
|
||||
*
|
||||
* new extra: n = no undo
|
||||
*
|
||||
* The main benefit of this system is that it provides the least possible number of characters in the paramaters
|
||||
* The main benefit of this system is that it provides the least possible number of characters in the parameters
|
||||
* while guaranteeing that all sensible combinations will be made. Additionally, the names will be VERY consistent
|
||||
*
|
||||
* EX Old System: /b b isrcup (use /v, /vi, /vr and /vir, update graphics and no physics)
|
||||
* EX New System: /b b ccup (two characters shorter, good because snipers have been complaing about keystrokes)
|
||||
* EX New System: /b b ccup (two characters shorter, good because snipers have been complaining about keystrokes)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -43,12 +43,12 @@ public class VoxelBrushCommand extends VoxelCommand {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
snipeData.getVoxelMessage().size();
|
||||
return true;
|
||||
} catch (NumberFormatException ingored) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
|
||||
Class<? extends IBrush> brush = plugin.getBrushManager().getBrushForHandle(args[0]);
|
||||
if (brush != null) {
|
||||
IBrush orignalBrush = sniper.getBrush(currentToolId);
|
||||
IBrush originalBrush = sniper.getBrush(currentToolId);
|
||||
sniper.setBrush(currentToolId, brush);
|
||||
|
||||
if (args.length > 1) {
|
||||
@ -63,7 +63,7 @@ public class VoxelBrushCommand extends VoxelCommand {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
SniperBrushChangedEvent event = new SniperBrushChangedEvent(sniper, currentToolId, orignalBrush, sniper.getBrush(currentToolId));
|
||||
SniperBrushChangedEvent event = new SniperBrushChangedEvent(sniper, currentToolId, originalBrush, sniper.getBrush(currentToolId));
|
||||
sniper.displayInfo();
|
||||
return true;
|
||||
} else {
|
||||
|
@ -458,10 +458,10 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
final Plugin preciousstonesPlugin = Bukkit.getServer().getPluginManager().getPlugin("PreciousStones");
|
||||
if (preciousstonesPlugin != null && preciousstonesPlugin.isEnabled()) {
|
||||
final Plugin preciousStonesPlugin = Bukkit.getServer().getPluginManager().getPlugin("PreciousStones");
|
||||
if (preciousStonesPlugin != null && preciousStonesPlugin.isEnabled()) {
|
||||
try {
|
||||
managers.add(new PreciousStonesFeature(preciousstonesPlugin, this));
|
||||
managers.add(new PreciousStonesFeature(preciousStonesPlugin, this));
|
||||
Fawe.debug("Plugin 'PreciousStones' found. Using it now.");
|
||||
} catch (final Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
@ -284,7 +284,7 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
||||
}
|
||||
final int[] blockToPalette = FaweCache.BLOCK_TO_PALETTE.get();
|
||||
final int[] paletteToBlock = FaweCache.PALETTE_TO_BLOCK.get();
|
||||
final long[] blockstates = FaweCache.BLOCK_STATES.get();
|
||||
final long[] blockStates = FaweCache.BLOCK_STATES.get();
|
||||
final int[] blocksCopy = FaweCache.SECTION_BLOCKS.get();
|
||||
try {
|
||||
int num_palette = 0;
|
||||
@ -317,9 +317,9 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
||||
|
||||
final int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
||||
if (num_palette == 1) {
|
||||
for (int i = 0; i < blockBitArrayEnd; i++) blockstates[i] = 0;
|
||||
for (int i = 0; i < blockBitArrayEnd; i++) blockStates[i] = 0;
|
||||
} else {
|
||||
final BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry);
|
||||
final BitArray4096 bitArray = new BitArray4096(blockStates, bitsPerEntry);
|
||||
bitArray.fromRaw(blocksCopy);
|
||||
}
|
||||
|
||||
@ -327,7 +327,7 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
||||
final DataPaletteBlock<IBlockData> dataPaletteBlocks = section.getBlocks();
|
||||
// private DataPalette<T> h;
|
||||
// protected DataBits a;
|
||||
final long[] bits = Arrays.copyOfRange(blockstates, 0, blockBitArrayEnd);
|
||||
final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd);
|
||||
final DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
||||
final DataPalette<IBlockData> palette;
|
||||
// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
||||
|
@ -199,9 +199,9 @@ public class BukkitWorld extends AbstractWorld {
|
||||
|
||||
// We have to restore the block if it was outside
|
||||
if (!region.contains(pt)) {
|
||||
editSession.setBlock(pt, history[index]);
|
||||
editSession.smartSetBlock(pt, history[index]);
|
||||
} else { // Otherwise fool with history
|
||||
editSession.setBlock().add(new BlockChange(pt, history[index], editSession.getFullBlock(pt)));
|
||||
editSession.getChangeSet().add(new BlockChange(pt, history[index], editSession.getFullBlock(pt)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -420,8 +420,21 @@ public class BukkitWorld extends AbstractWorld {
|
||||
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
|
||||
}
|
||||
|
||||
private static volatile boolean hasWarnedImplError = false;
|
||||
|
||||
@Override
|
||||
public com.sk89q.worldedit.world.block.BlockState getBlock(BlockVector3 position) {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
try {
|
||||
return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position)).toImmutableState();
|
||||
} catch (Exception e) {
|
||||
if (!hasWarnedImplError) {
|
||||
hasWarnedImplError = true;
|
||||
logger.warn("Unable to retrieve block via impl adapter", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import com.bekvon.bukkit.residence.commands.command;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -45,7 +44,6 @@ import org.enginehub.piston.inject.MapBackedValueStore;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Handles all events thrown in relation to a Player
|
||||
@ -75,8 +73,9 @@ public class WorldEditListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerCommandSend(PlayerCommandSendEvent event) {
|
||||
InjectedValueStore store = null;
|
||||
// Command processing used to show up in timings
|
||||
CommandManager commandManager = plugin.getWorldEdit().getPlatformManager().getPlatformCommandManager().getCommandManager();
|
||||
InjectedValueStore store = null;
|
||||
Iterator<String> iter = event.getCommands().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String name = iter.next();
|
||||
|
@ -217,7 +217,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
public void setupRegistries() {
|
||||
// Biome
|
||||
for (Biome biome : Biome.values()) {
|
||||
BiomeType.REGISTRY.register("minecraft:" + biome.name().toLowerCase(Locale.ROOT), new BiomeType("minecraft:" + biome.name().toLowerCase(Locale.ROOT)));
|
||||
String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT);
|
||||
BiomeType.REGISTRY.register("minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName));
|
||||
}
|
||||
// Block & Item
|
||||
for (Material material : Material.values()) {
|
||||
@ -254,7 +255,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
for (org.bukkit.entity.EntityType entityType : org.bukkit.entity.EntityType.values()) {
|
||||
String mcid = entityType.getName();
|
||||
if (mcid != null) {
|
||||
EntityType.REGISTRY.register("minecraft:" + mcid.toLowerCase(Locale.ROOT), new EntityType("minecraft:" + mcid.toLowerCase(Locale.ROOT)));
|
||||
String lowerCaseMcId = mcid.toLowerCase(Locale.ROOT);
|
||||
EntityType.REGISTRY.register("minecraft:" + lowerCaseMcId, new EntityType("minecraft:" + lowerCaseMcId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -426,7 +428,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
// code of WorldEdit expects it
|
||||
String[] split = new String[args.length + 1];
|
||||
System.arraycopy(args, 0, split, 1, args.length);
|
||||
split[0] = cmd.getName();
|
||||
split[0] = "/" + cmd.getName();
|
||||
|
||||
CommandEvent event = new CommandEvent(wrapCommandSender(sender), Joiner.on(" ").join(split));
|
||||
getWorldEdit().getEventBus().post(event);
|
||||
@ -441,11 +443,12 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
// code of WorldEdit expects it
|
||||
String[] split = new String[args.length + 1];
|
||||
System.arraycopy(args, 0, split, 1, args.length);
|
||||
split[0] = cmd.getName();
|
||||
split[0] = "/" + cmd.getName();
|
||||
|
||||
CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), Joiner.on(" ").join(split));
|
||||
String arguments = Joiner.on(" ").join(split);
|
||||
CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), arguments);
|
||||
getWorldEdit().getEventBus().post(event);
|
||||
return event.getSuggestions();
|
||||
return CommandUtil.fixSuggestions(arguments, event.getSuggestions());
|
||||
}
|
||||
*/
|
||||
|
||||
@ -581,13 +584,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
||||
|
||||
CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), event.getBuffer());
|
||||
getWorldEdit().getEventBus().post(suggestEvent);
|
||||
List<String> suggestions = suggestEvent.getSuggestions();
|
||||
if (suggestions != null && !suggestions.isEmpty()) {
|
||||
event.setCompletions(suggestions);
|
||||
|
||||
event.setCompletions(CommandUtil.fixSuggestions(event.getBuffer(), suggestEvent.getSuggestions()));
|
||||
event.setHandled(true);
|
||||
}
|
||||
//event.setCompletions(CommandUtil.fixSuggestions(event.getBuffer(), suggestEvent.getSuggestions()));
|
||||
//event.setHandled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class BukkitImplLoader {
|
||||
"** will be blank, and so on. There will be no support for entity\n" +
|
||||
"** and block property-related functions.\n" +
|
||||
"**\n" +
|
||||
"** Please see http://wiki.sk89q.com/wiki/WorldEdit/Bukkit_adapters\n" +
|
||||
"** Please see https://worldedit.rtfd.io/en/latest/faq/#bukkit-adapters\n" +
|
||||
"**********************************************\n";
|
||||
|
||||
/**
|
||||
|
@ -112,11 +112,11 @@ public final class FaweCache implements Trimable {
|
||||
*/
|
||||
public int[] paletteToBlock;
|
||||
|
||||
public int blockstatesLength;
|
||||
public int blockStatesLength;
|
||||
/**
|
||||
* Reusable buffer array, MUST check blockstatesLength for actual length
|
||||
* Reusable buffer array, MUST check blockStatesLength for actual length
|
||||
*/
|
||||
public long[] blockstates;
|
||||
public long[] blockStates;
|
||||
}
|
||||
|
||||
private static final IterableThreadLocal<Palette> PALETTE_CACHE = new IterableThreadLocal<Palette>() {
|
||||
@ -149,7 +149,7 @@ public final class FaweCache implements Trimable {
|
||||
private static Palette toPalette(int layerOffset, int[] blocksInts, char[] blocksChars) {
|
||||
int[] blockToPalette = BLOCK_TO_PALETTE.get();
|
||||
int[] paletteToBlock = PALETTE_TO_BLOCK.get();
|
||||
long[] blockstates = BLOCK_STATES.get();
|
||||
long[] blockStates = BLOCK_STATES.get();
|
||||
int[] blocksCopy = SECTION_BLOCKS.get();
|
||||
|
||||
int blockIndexStart = layerOffset << 12;
|
||||
@ -193,10 +193,10 @@ public final class FaweCache implements Trimable {
|
||||
int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
||||
if (num_palette == 1) {
|
||||
// Set a value, because minecraft needs it for some reason
|
||||
blockstates[0] = 0;
|
||||
blockStates[0] = 0;
|
||||
blockBitArrayEnd = 1;
|
||||
} else {
|
||||
BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry);
|
||||
BitArray4096 bitArray = new BitArray4096(blockStates, bitsPerEntry);
|
||||
bitArray.fromRaw(blocksCopy);
|
||||
}
|
||||
|
||||
@ -205,8 +205,8 @@ public final class FaweCache implements Trimable {
|
||||
palette.paletteToBlockLength = num_palette;
|
||||
palette.paletteToBlock = paletteToBlock;
|
||||
|
||||
palette.blockstatesLength = blockBitArrayEnd;
|
||||
palette.blockstates = blockstates;
|
||||
palette.blockStatesLength = blockBitArrayEnd;
|
||||
palette.blockStates = blockStates;
|
||||
|
||||
return palette;
|
||||
} catch (Throwable e) {
|
||||
|
@ -24,8 +24,8 @@ public class FaweVersion {
|
||||
public static FaweVersion tryParse(String version, String commit, String date) {
|
||||
try {
|
||||
return new FaweVersion(version, commit, date);
|
||||
} catch (Exception ignore) {
|
||||
ignore.printStackTrace();
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
return new FaweVersion(0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +1,25 @@
|
||||
package com.boydti.fawe.command;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RegionWrapper;
|
||||
import com.boydti.fawe.object.RunnableVal4;
|
||||
import com.boydti.fawe.object.changeset.AnvilHistory;
|
||||
import com.boydti.fawe.object.clipboard.remap.ClipboardRemapper;
|
||||
import com.boydti.fawe.object.mask.FaweBlockMatcher;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
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.entity.Player;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import java.io.IOException;
|
||||
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 java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@Command(aliases = {"/anvil"}, desc = "Manipulate billions of blocks: [More Info](https://github.com/boy0001/FastAsyncWorldedit/wiki/Anvil-API)")
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class AnvilCommands {
|
||||
|
||||
/**
|
||||
@ -247,11 +235,10 @@ public class AnvilCommands {
|
||||
|
||||
desc = "Trim chunks in a Plot World",
|
||||
descFooter = "Unclaimed chunks will be deleted\n" +
|
||||
"Unmodified chunks will be deleted\n" +
|
||||
"Use -v to also delete unvisited chunks\n"
|
||||
"Unmodified chunks will be deleted\n"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.trimallplots")
|
||||
public void trimAllPlots(Player player, @Switch(name='v', desc = "TODO") boolean deleteUnvisited) throws WorldEditException {
|
||||
public void trimAllPlots(Player player, @Switch(name='v', desc = "Delete unvisited chunks") boolean deleteUnvisited) throws WorldEditException {
|
||||
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
|
||||
// int visitTime = deleteUnvisited ? 1 : -1;
|
||||
// PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000);
|
||||
@ -266,7 +253,6 @@ public class AnvilCommands {
|
||||
|
||||
@Command(
|
||||
name = "deletebiomechunks",
|
||||
|
||||
desc = "Delete chunks matching a specific biome"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.trimallair")
|
||||
@ -280,7 +266,6 @@ public class AnvilCommands {
|
||||
|
||||
@Command(
|
||||
name = "trimallair",
|
||||
|
||||
desc = "Trim all air in the world"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.trimallair")
|
||||
@ -621,8 +606,7 @@ public class AnvilCommands {
|
||||
@Command(
|
||||
name = "paste",
|
||||
desc = "Paste chunks from your anvil clipboard",
|
||||
descFooter =
|
||||
"Paste the chunks from your anvil clipboard.\n" +
|
||||
descFooter = "Paste the chunks from your anvil clipboard.\n" +
|
||||
"The -c flag will align the paste to the chunks."
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.pastechunks")
|
||||
|
@ -1,14 +1,16 @@
|
||||
package com.boydti.fawe.command;
|
||||
|
||||
import static com.boydti.fawe.util.image.ImageUtil.load;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.SingleFilterBlock;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Commands;
|
||||
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.RunnableVal;
|
||||
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
|
||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||
import com.boydti.fawe.util.CleanTextureUtil;
|
||||
import com.boydti.fawe.util.FilteredTextureUtil;
|
||||
@ -25,17 +27,19 @@ import java.nio.file.Path;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.exception.StopExecutionException;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.minecraft.util.commands.CommandException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.MethodCommands;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
@ -51,14 +55,11 @@ import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
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 javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -74,10 +75,13 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.IntStream;
|
||||
import javax.imageio.ImageIO;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
||||
import static com.boydti.fawe.util.image.ImageUtil.load;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class CFICommands extends MethodCommands {
|
||||
@ -117,7 +121,7 @@ public class CFICommands extends MethodCommands {
|
||||
desc = "Start CFI with a height map as a base"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void heightmap(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(name = "yscale", desc = "double", def = "1") double yscale) {
|
||||
public void heightmap(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "yscale", desc = "double", def = "1") double yscale) {
|
||||
if (yscale != 0) {
|
||||
int[] raw = ((DataBufferInt) image.load().getRaster().getDataBuffer()).getData();
|
||||
int[] table = IntStream.range(0, 256).map(i -> Math.min(255, (int) (i * yscale)))
|
||||
@ -139,7 +143,7 @@ public class CFICommands extends MethodCommands {
|
||||
desc = "Start CFI with an empty map as a base"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void heightmap(FawePlayer fp, int width, int length) {
|
||||
public void heightMap(FawePlayer fp, int width, int length) {
|
||||
HeightMapMCAGenerator generator = new HeightMapMCAGenerator(width, length, getFolder(generateName()));
|
||||
setup(generator, fp);
|
||||
}
|
||||
@ -250,7 +254,7 @@ public class CFICommands extends MethodCommands {
|
||||
desc = "Set the floor and main block"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void column(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void column(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setColumn(load(image), pattern, !disableWhiteOnly);
|
||||
@ -269,14 +273,14 @@ public class CFICommands extends MethodCommands {
|
||||
desc = "Set the floor (default: grass)"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void floorCmd(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void floorCmd(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
floor(fp, pattern, image, mask, disableWhiteOnly);
|
||||
fp.sendMessage("Set floor!");
|
||||
assertSettings(fp).resetComponent();
|
||||
component(fp);
|
||||
}
|
||||
|
||||
private void floor(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) {
|
||||
private void floor(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) {
|
||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setFloor(load(image), pattern, !disableWhiteOnly);
|
||||
@ -292,14 +296,14 @@ public class CFICommands extends MethodCommands {
|
||||
desc = "Set the main block (default: stone)"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void mainCmd(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void mainCmd(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
main(fp, pattern, image, mask, disableWhiteOnly);
|
||||
fp.sendMessage("Set main!");
|
||||
assertSettings(fp).resetComponent();
|
||||
component(fp);
|
||||
}
|
||||
|
||||
public void main(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void main(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setMain(load(image), pattern, !disableWhiteOnly);
|
||||
@ -318,7 +322,7 @@ public class CFICommands extends MethodCommands {
|
||||
"e.g. Tallgrass"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void overlay(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void overlay(FawePlayer fp, Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setOverlay(load(image), pattern, !disableWhiteOnly);
|
||||
@ -340,13 +344,13 @@ public class CFICommands extends MethodCommands {
|
||||
" - A good value for radius and iterations would be 1 8."
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void smoothCmd(FawePlayer fp, int radius, int iterations, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void smoothCmd(FawePlayer fp, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
smooth(fp, radius, iterations, image, mask, disableWhiteOnly);
|
||||
assertSettings(fp).resetComponent();
|
||||
component(fp);
|
||||
}
|
||||
|
||||
private void smooth(FawePlayer fp, int radius, int iterations, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
private void smooth(FawePlayer fp, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||
if (image != null) {
|
||||
gen.smooth(load(image), !disableWhiteOnly, radius, iterations);
|
||||
@ -360,7 +364,7 @@ public class CFICommands extends MethodCommands {
|
||||
desc = "Create some snow"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void snow(FawePlayer fp, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void snow(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||
floor(fp, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly);
|
||||
main(fp, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly);
|
||||
@ -503,7 +507,7 @@ public class CFICommands extends MethodCommands {
|
||||
" - The distance is the spacing between each schematic"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void schem(FawePlayer fp, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, Mask mask, String schematic, int rarity, int distance, boolean rotate)throws IOException, WorldEditException {
|
||||
public void schem(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, Mask mask, String schematic, int rarity, int distance, boolean rotate)throws IOException, WorldEditException {
|
||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||
|
||||
World world = fp.getWorld();
|
||||
@ -529,7 +533,7 @@ public class CFICommands extends MethodCommands {
|
||||
" - If a mask is used, the biome will be set anywhere the mask applies"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void biome(FawePlayer fp, BiomeType biome, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
public void biome(FawePlayer fp, BiomeType biome, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly){
|
||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||
if (image != null) {
|
||||
gen.setBiome(load(image), biome, !disableWhiteOnly);
|
||||
@ -696,7 +700,7 @@ public class CFICommands extends MethodCommands {
|
||||
)
|
||||
// ![79,174,212,5:3,5:4,18,161,20]
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void glass(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
public void glass(FawePlayer fp, @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 mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
CFISettings settings = assertSettings(fp);
|
||||
settings.getGenerator().setColorWithGlass(load(image));
|
||||
msg("Set color with glass!").send(fp);
|
||||
@ -713,7 +717,7 @@ public class CFICommands extends MethodCommands {
|
||||
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void color(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
public void color(FawePlayer fp, @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 mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
CFISettings settings = assertSettings(fp);
|
||||
HeightMapMCAGenerator gen = settings.getGenerator();
|
||||
if (imageMask != null) {
|
||||
@ -737,7 +741,7 @@ public class CFICommands extends MethodCommands {
|
||||
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void blockbiome(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
public void blockbiome(FawePlayer fp, @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 mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
CFISettings settings = assertSettings(fp);
|
||||
settings.getGenerator().setBlockAndBiomeColor(load(image), mask, load(imageMask), !disableWhiteOnly);
|
||||
msg("Set color with blocks and biomes!").send(fp);
|
||||
@ -753,7 +757,7 @@ public class CFICommands extends MethodCommands {
|
||||
" - If you changed the block to something other than grass you will not see anything."
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void biomecolor(FawePlayer fp, FawePrimitiveBinding.ImageUri image, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
public void biomecolor(FawePlayer fp, @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 mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws WorldEditException {
|
||||
CFISettings settings = assertSettings(fp);
|
||||
settings.getGenerator().setBiomeColor(load(image));
|
||||
msg("Set color with biomes!").send(fp);
|
||||
@ -852,7 +856,7 @@ public class CFICommands extends MethodCommands {
|
||||
desc = "Select a mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void mask(FawePlayer fp, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context){
|
||||
public void mask(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context){
|
||||
CFISettings settings = assertSettings(fp);
|
||||
String[] split = getArguments(context).split(" ");
|
||||
int index = 2;
|
||||
@ -917,7 +921,7 @@ public class CFICommands extends MethodCommands {
|
||||
desc = "Select an image"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.cfi")
|
||||
public void image(FawePlayer fp, @Arg(def = "", desc = "image url or filename") FawePrimitiveBinding.ImageUri image, InjectedValueAccess context)throws CommandException {
|
||||
public void image(FawePlayer fp, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, InjectedValueAccess context)throws CommandException {
|
||||
CFISettings settings = getSettings(fp);
|
||||
String[] split = getArguments(context).split(" ");
|
||||
int index = 2;
|
||||
@ -1062,10 +1066,10 @@ public class CFICommands extends MethodCommands {
|
||||
|
||||
private HeightMapMCAGenerator generator;
|
||||
|
||||
protected FawePrimitiveBinding.ImageUri image;
|
||||
protected ProvideBindings.ImageUri image;
|
||||
protected String imageArg;
|
||||
protected Mask mask;
|
||||
protected FawePrimitiveBinding.ImageUri imageMask;
|
||||
protected ProvideBindings.ImageUri imageMask;
|
||||
protected boolean whiteOnly = true;
|
||||
protected String maskArg;
|
||||
protected String imageMaskArg;
|
||||
@ -1094,11 +1098,11 @@ public class CFICommands extends MethodCommands {
|
||||
this.maskArg = arg;
|
||||
}
|
||||
|
||||
public void setImage(FawePrimitiveBinding.ImageUri image, String arg) {
|
||||
public void setImage(ProvideBindings.ImageUri image, String arg) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public void setImageMask(FawePrimitiveBinding.ImageUri imageMask, String arg) {
|
||||
public void setImageMask(ProvideBindings.ImageUri imageMask, String arg) {
|
||||
this.imageMask = imageMask;
|
||||
this.imageMaskArg = arg;
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
package com.boydti.fawe.command;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.util.command.parametric.BindingHelper;
|
||||
|
||||
public class FaweBinding extends BindingHelper {
|
||||
private final WorldEdit worldEdit;
|
||||
|
||||
public FaweBinding(WorldEdit worldEdit) {
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
||||
|
||||
public WorldEdit getWorldEdit() {
|
||||
return worldEdit;
|
||||
}
|
||||
}
|
||||
//package com.boydti.fawe.command;
|
||||
//
|
||||
//import com.sk89q.worldedit.WorldEdit;
|
||||
//import com.sk89q.worldedit.util.command.parametric.BindingHelper;
|
||||
//
|
||||
//public class FaweBinding extends BindingHelper {
|
||||
// private final WorldEdit worldEdit;
|
||||
//
|
||||
// public FaweBinding(WorldEdit worldEdit) {
|
||||
// this.worldEdit = worldEdit;
|
||||
// }
|
||||
//
|
||||
// public WorldEdit getWorldEdit() {
|
||||
// return worldEdit;
|
||||
// }
|
||||
//}
|
||||
|
@ -1,29 +1,29 @@
|
||||
package com.boydti.fawe.command;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.util.command.parametric.ParameterData;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class MaskBinding extends FaweBinding {
|
||||
private final WorldEdit worldEdit;
|
||||
|
||||
public MaskBinding(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSuggestions(ParameterData parameter, String prefix) {
|
||||
if (prefix.isEmpty()) {
|
||||
return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream().map(n -> n + ":")).collect(Collectors.toList());
|
||||
}
|
||||
return super.getSuggestions(parameter, prefix);
|
||||
}
|
||||
}
|
||||
//package com.boydti.fawe.command;
|
||||
//
|
||||
//import com.sk89q.worldedit.WorldEdit;
|
||||
//import com.sk89q.worldedit.util.command.parametric.ParameterData;
|
||||
//import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.HashSet;
|
||||
//import java.util.List;
|
||||
//import java.util.Set;
|
||||
//import java.util.stream.Collectors;
|
||||
//import java.util.stream.Stream;
|
||||
//
|
||||
//public class MaskBinding extends FaweBinding {
|
||||
// private final WorldEdit worldEdit;
|
||||
//
|
||||
// public MaskBinding(WorldEdit worldEdit) {
|
||||
// super(worldEdit);
|
||||
// this.worldEdit = worldEdit;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getSuggestions(ParameterData parameter, String prefix) {
|
||||
// if (prefix.isEmpty()) {
|
||||
// return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream().map(n -> n + ":")).collect(Collectors.toList());
|
||||
// }
|
||||
// return super.getSuggestions(parameter, prefix);
|
||||
// }
|
||||
//}
|
||||
|
@ -1,26 +1,26 @@
|
||||
package com.boydti.fawe.command;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.util.command.parametric.ParameterData;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class PatternBinding extends FaweBinding {
|
||||
private final WorldEdit worldEdit;
|
||||
|
||||
public PatternBinding(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSuggestions(ParameterData parameter, String prefix) {
|
||||
if (prefix.isEmpty()) {
|
||||
return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream()).collect(Collectors.toList());
|
||||
}
|
||||
return super.getSuggestions(parameter, prefix);
|
||||
}
|
||||
}
|
||||
//package com.boydti.fawe.command;
|
||||
//
|
||||
//import com.sk89q.worldedit.WorldEdit;
|
||||
//import com.sk89q.worldedit.util.command.parametric.ParameterData;
|
||||
//import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.stream.Collectors;
|
||||
//import java.util.stream.Stream;
|
||||
//
|
||||
//public class PatternBinding extends FaweBinding {
|
||||
// private final WorldEdit worldEdit;
|
||||
//
|
||||
// public PatternBinding(WorldEdit worldEdit) {
|
||||
// super(worldEdit);
|
||||
// this.worldEdit = worldEdit;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getSuggestions(ParameterData parameter, String prefix) {
|
||||
// if (prefix.isEmpty()) {
|
||||
// return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream()).collect(Collectors.toList());
|
||||
// }
|
||||
// return super.getSuggestions(parameter, prefix);
|
||||
// }
|
||||
//}
|
||||
|
@ -21,8 +21,10 @@ import java.io.IOException;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class PlotLoader {
|
||||
|
||||
@Deprecated
|
||||
public static void autoClaimFromDatabase(PlotPlayer player, PlotArea area, PlotId start, com.github.intellectualsites.plotsquared.plot.object.RunnableVal<Plot> whenDone) {
|
||||
public static void autoClaimFromDatabase(PlotPlayer player, PlotArea area, PlotId start,
|
||||
com.github.intellectualsites.plotsquared.plot.object.RunnableVal<Plot> whenDone) {
|
||||
final Plot plot = area.getNextFreePlot(player, start);
|
||||
if (plot == null) {
|
||||
whenDone.run(null);
|
||||
@ -30,15 +32,12 @@ public class PlotLoader {
|
||||
}
|
||||
whenDone.value = plot;
|
||||
plot.owner = player.getUUID();
|
||||
DBFunc.createPlotSafe(plot, whenDone, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
autoClaimFromDatabase(player, area, plot.getId(), whenDone);
|
||||
}
|
||||
});
|
||||
DBFunc.createPlotSafe(plot, whenDone,
|
||||
() -> autoClaimFromDatabase(player, area, plot.getId(), whenDone));
|
||||
}
|
||||
|
||||
public void load(FawePlayer fp, CFICommands.CFISettings settings, Function<File, Boolean> createTask) throws IOException {
|
||||
public void load(FawePlayer fp, CFICommands.CFISettings settings,
|
||||
Function<File, Boolean> createTask) throws IOException {
|
||||
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||
if (manager instanceof SinglePlotAreaManager) {
|
||||
SinglePlotAreaManager sManager = (SinglePlotAreaManager) manager;
|
||||
@ -49,7 +48,8 @@ public class PlotLoader {
|
||||
Plot plot = TaskManager.IMP.sync(new RunnableVal<Plot>() {
|
||||
@Override
|
||||
public void run(Plot o) {
|
||||
int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(area.worldname);
|
||||
int currentPlots = Settings.Limit.GLOBAL ? player.getPlotCount()
|
||||
: player.getPlotCount(area.worldname);
|
||||
int diff = player.getAllowedPlots() - currentPlots;
|
||||
if (diff < 1) {
|
||||
Captions.CANT_CLAIM_MORE_PLOTS_NUM.send(player, -diff);
|
||||
@ -73,12 +73,7 @@ public class PlotLoader {
|
||||
File folder = CFICommands.getFolder(plot.getWorldName());
|
||||
Boolean result = createTask.apply(folder);
|
||||
if (result == Boolean.TRUE) {
|
||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
@Override
|
||||
public void run(Object value) {
|
||||
plot.teleportPlayer(player);
|
||||
}
|
||||
});
|
||||
TaskManager.IMP.sync(() -> plot.teleportPlayer(player));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class Rollback extends FaweCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(final FawePlayer player, final String... args) {
|
||||
public boolean execute(FawePlayer player, String... args) {
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
|
||||
return false;
|
||||
@ -50,12 +50,11 @@ public class Rollback extends FaweCommand {
|
||||
}
|
||||
World world = player.getWorld();
|
||||
switch (args[0]) {
|
||||
default: {
|
||||
default:
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb info u:<uuid> r:<radius> t:<time>");
|
||||
return false;
|
||||
}
|
||||
case "i":
|
||||
case "info": {
|
||||
case "info":
|
||||
if (args.length < 2) {
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
||||
return false;
|
||||
@ -88,16 +87,15 @@ public class Rollback extends FaweCommand {
|
||||
player.sendMessage("&8 - &7(" + percentString + ")");
|
||||
}
|
||||
player.sendMessage("&d==================================================");
|
||||
player.sendMessage("&dSize: " + (((double) (total / 1024)) / 1000) + "MB");
|
||||
player.sendMessage("&dSize: " + (double) (total / 1024) / 1000 + "MB");
|
||||
player.sendMessage("&dTo rollback: /frb undo");
|
||||
player.sendMessage("&d==================================================");
|
||||
player.setMeta(FawePlayer.METADATA_KEYS.ROLLBACK, edits);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "undo":
|
||||
case "revert": {
|
||||
case "revert":
|
||||
if (!player.hasPermission("fawe.rollback.perform")) {
|
||||
BBC.NO_PERM.send(player, "fawe.rollback.perform");
|
||||
return false;
|
||||
@ -125,11 +123,10 @@ public class Rollback extends FaweCommand {
|
||||
};
|
||||
task.run();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void rollback(final FawePlayer player, final boolean shallow, final String[] args, final RunnableVal<List<DiskStorageHistory>> result) {
|
||||
public void rollback(FawePlayer player, boolean shallow, String[] args, RunnableVal<List<DiskStorageHistory>> result) {
|
||||
UUID user = null;
|
||||
int radius = Integer.MAX_VALUE;
|
||||
long time = Long.MAX_VALUE;
|
||||
@ -142,7 +139,7 @@ public class Rollback extends FaweCommand {
|
||||
switch (split[0].toLowerCase()) {
|
||||
case "username":
|
||||
case "user":
|
||||
case "u": {
|
||||
case "u":
|
||||
try {
|
||||
if (split[1].length() > 16) {
|
||||
user = UUID.fromString(split[1]);
|
||||
@ -156,27 +153,23 @@ public class Rollback extends FaweCommand {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "r":
|
||||
case "radius": {
|
||||
case "radius":
|
||||
if (!MathMan.isInteger(split[1])) {
|
||||
player.sendMessage("&dInvalid radius: " + split[1]);
|
||||
return;
|
||||
}
|
||||
radius = Integer.parseInt(split[1]);
|
||||
break;
|
||||
}
|
||||
case "t":
|
||||
case "time": {
|
||||
case "time":
|
||||
time = MainUtil.timeToSec(split[1]) * 1000;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
default:
|
||||
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Location origin = player.getLocation();
|
||||
List<DiskStorageHistory> edits = FaweAPI.getBDFiles(origin, user, radius, time, shallow);
|
||||
if (edits == null) {
|
||||
|
@ -14,7 +14,6 @@ import com.boydti.fawe.util.TaskManager;
|
||||
import com.boydti.fawe.util.WEManager;
|
||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||
import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
@ -45,14 +44,13 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class FawePlayer<T> extends Metadatable {
|
||||
@ -149,15 +147,11 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
private void setConfirmTask(@NotNull Runnable task, InjectedValueAccess context, String command) {
|
||||
CommandEvent event = new CommandEvent(getPlayer(), command);
|
||||
if (task != null) {
|
||||
Runnable newTask = () -> PlatformCommandManager.getInstance().handleCommandTask(() -> {
|
||||
task.run();
|
||||
return null;
|
||||
}, context, getPlayer(), getSession(), event);
|
||||
setMeta("cmdConfirm", newTask);
|
||||
} else {
|
||||
setMeta("cmdConfirm", event);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkConfirmation(@NotNull Runnable task, String command, int times, int limit, InjectedValueAccess context) throws RegionOperationException {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.boydti.fawe.object.brush;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
@ -19,7 +21,6 @@ import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.Constant;
|
||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@ -27,8 +28,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class BrushSettings {
|
||||
public enum SettingType {
|
||||
BRUSH,
|
||||
@ -64,10 +63,7 @@ public class BrushSettings {
|
||||
if (constructor == null) {
|
||||
return new BrushSettings();
|
||||
}
|
||||
String[] split = constructor.split(" ");
|
||||
|
||||
String args = constructor.replaceAll(split[0] + "[ ]?", "");
|
||||
BrushSettings bs = (BrushSettings) manager.parse(Brush.class, args, player);
|
||||
BrushSettings bs = (BrushSettings) manager.parseArgs(constructor);
|
||||
bs.constructor.put(SettingType.BRUSH, constructor);
|
||||
if (settings.containsKey(SettingType.PERMISSIONS.name())) {
|
||||
bs.permissions.addAll((Collection<? extends String>) settings.get(SettingType.PERMISSIONS.name()));
|
||||
|
@ -14,7 +14,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap.HeightMap {
|
||||
public class ScalableHeightMap implements HeightMap {
|
||||
public int size2;
|
||||
public int size;
|
||||
|
||||
@ -103,10 +103,10 @@ public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int z = 0; z < length; z++) {
|
||||
int pixel = heightFile.getRGB(x, z);
|
||||
int red = (pixel >> 16) & 0xFF;
|
||||
int green = (pixel >> 8) & 0xFF;
|
||||
int blue = (pixel >> 0) & 0xFF;
|
||||
int alpha = (pixel >> 24) & 0xFF;
|
||||
int red = pixel >> 16 & 0xFF;
|
||||
int green = pixel >> 8 & 0xFF;
|
||||
int blue = pixel >> 0 & 0xFF;
|
||||
int alpha = pixel >> 24 & 0xFF;
|
||||
int intensity = (int) (alpha * ((red + green + blue) * third) * alphaInverse);
|
||||
array[x][z] = (byte) intensity;
|
||||
}
|
||||
|
@ -11,21 +11,21 @@ public enum Perm {
|
||||
public String s;
|
||||
public String cat;
|
||||
|
||||
Perm(final String perm, final String cat) {
|
||||
Perm(String perm, String cat) {
|
||||
this.s = perm;
|
||||
this.cat = cat;
|
||||
}
|
||||
|
||||
public boolean has(final FawePlayer<?> player) {
|
||||
public boolean has(FawePlayer<?> player) {
|
||||
return this.hasPermission(player, this);
|
||||
}
|
||||
|
||||
public boolean hasPermission(final FawePlayer<?> player, final Perm perm) {
|
||||
public boolean hasPermission(FawePlayer<?> player, Perm perm) {
|
||||
return hasPermission(player, perm.s);
|
||||
}
|
||||
|
||||
public static boolean hasPermission(final FawePlayer<?> player, final String perm) {
|
||||
if ((player == null) || player.hasPermission(ADMIN.s)) {
|
||||
public static boolean hasPermission(FawePlayer<?> player, String perm) {
|
||||
if (player == null || player.hasPermission(ADMIN.s)) {
|
||||
return true;
|
||||
}
|
||||
if (player.hasPermission(perm)) {
|
||||
@ -33,8 +33,8 @@ public enum Perm {
|
||||
}
|
||||
final String[] nodes = perm.split("\\.");
|
||||
final StringBuilder n = new StringBuilder();
|
||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||
n.append(nodes[i] + ("."));
|
||||
for (int i = 0; i < nodes.length - 1; i++) {
|
||||
n.append(nodes[i]).append(".");
|
||||
if (player.hasPermission(n + "*")) {
|
||||
return true;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class RandomTextureUtil extends CachedTextureUtil {
|
||||
|
||||
private int random(int i) {
|
||||
if (i < 0) {
|
||||
int i1 = (-i);
|
||||
int i1 = -i;
|
||||
return -ThreadLocalRandom.current().nextInt(i1);
|
||||
} else {
|
||||
return ThreadLocalRandom.current().nextInt(i);
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.sk89q.util.StringUtil;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -10,17 +8,17 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.IntConsumer;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class StringMan {
|
||||
public static String replaceFromMap(final String string, final Map<String, String> replacements) {
|
||||
public static String replaceFromMap(String string, Map<String, String> replacements) {
|
||||
final StringBuilder sb = new StringBuilder(string);
|
||||
int size = string.length();
|
||||
for (final Entry<String, String> entry : replacements.entrySet()) {
|
||||
for (Entry<String, String> entry : replacements.entrySet()) {
|
||||
if (size == 0) {
|
||||
break;
|
||||
}
|
||||
@ -122,7 +120,6 @@ public class StringMan {
|
||||
boolean neg = false;
|
||||
int numIndex = 1;
|
||||
int len = string.length();
|
||||
outer:
|
||||
for (int i = len - 1; i >= 0; i--) {
|
||||
char c = string.charAt(i);
|
||||
switch (c) {
|
||||
@ -138,10 +135,10 @@ public class StringMan {
|
||||
return val;
|
||||
}
|
||||
|
||||
public static String removeFromSet(final String string, final Collection<String> replacements) {
|
||||
public static String removeFromSet(String string, Collection<String> replacements) {
|
||||
final StringBuilder sb = new StringBuilder(string);
|
||||
int size = string.length();
|
||||
for (final String key : replacements) {
|
||||
for (String key : replacements) {
|
||||
if (size == 0) {
|
||||
break;
|
||||
}
|
||||
@ -178,8 +175,9 @@ public class StringMan {
|
||||
boolean inQuotes = false;
|
||||
for (int current = 0; current < input.length(); current++) {
|
||||
char currentChar = input.charAt(current);
|
||||
boolean atLastChar = (current == input.length() - 1);
|
||||
if (!atLastChar && (bracket > 0 || (currentChar == '{' && ++bracket > 0) || (current == '}' && --bracket <= 0)))
|
||||
boolean atLastChar = current == input.length() - 1;
|
||||
if (!atLastChar && (bracket > 0 || currentChar == '{' && ++bracket > 0
|
||||
|| current == '}' && --bracket <= 0))
|
||||
continue;
|
||||
if (currentChar == '\"') inQuotes = !inQuotes; // toggle state
|
||||
if (atLastChar) result.add(input.substring(start));
|
||||
@ -195,9 +193,9 @@ public class StringMan {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int intersection(final Set<String> options, final String[] toCheck) {
|
||||
public static int intersection(Set<String> options, String[] toCheck) {
|
||||
int count = 0;
|
||||
for (final String check : toCheck) {
|
||||
for (String check : toCheck) {
|
||||
if (options.contains(check)) {
|
||||
count++;
|
||||
}
|
||||
@ -213,7 +211,7 @@ public class StringMan {
|
||||
return String.format("%1$" + n + "s", s);
|
||||
}
|
||||
|
||||
public static String getString(final Object obj) {
|
||||
public static String getString(Object obj) {
|
||||
if (obj == null) {
|
||||
return "null";
|
||||
}
|
||||
@ -221,18 +219,18 @@ public class StringMan {
|
||||
return (String) obj;
|
||||
}
|
||||
if (obj.getClass().isArray()) {
|
||||
String result = "";
|
||||
StringBuilder result = new StringBuilder();
|
||||
String prefix = "";
|
||||
|
||||
for (int i = 0; i < Array.getLength(obj); i++) {
|
||||
result += prefix + getString(Array.get(obj, i));
|
||||
result.append(prefix).append(getString(Array.get(obj, i)));
|
||||
prefix = ",";
|
||||
}
|
||||
return "{ " + result + " }";
|
||||
} else if (obj instanceof Collection<?>) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
String prefix = "";
|
||||
for (final Object element : (Collection<?>) obj) {
|
||||
for (Object element : (Collection<?>) obj) {
|
||||
result.append(prefix).append(getString(element));
|
||||
prefix = ",";
|
||||
}
|
||||
@ -242,7 +240,7 @@ public class StringMan {
|
||||
}
|
||||
}
|
||||
|
||||
public static String replaceFirst(final char c, final String s) {
|
||||
public static String replaceFirst(char c, String s) {
|
||||
if (s == null) {
|
||||
return "";
|
||||
}
|
||||
@ -253,8 +251,8 @@ public class StringMan {
|
||||
final char[] newChars = new char[chars.length];
|
||||
int used = 0;
|
||||
boolean found = false;
|
||||
for (final char cc : chars) {
|
||||
if (!found && (c == cc)) {
|
||||
for (char cc : chars) {
|
||||
if (!found && c == cc) {
|
||||
found = true;
|
||||
} else {
|
||||
newChars[used++] = cc;
|
||||
@ -268,7 +266,7 @@ public class StringMan {
|
||||
return s;
|
||||
}
|
||||
|
||||
public static String replaceAll(final String string, final Object... pairs) {
|
||||
public static String replaceAll(String string, Object... pairs) {
|
||||
final StringBuilder sb = new StringBuilder(string);
|
||||
for (int i = 0; i < pairs.length; i += 2) {
|
||||
final String key = pairs[i] + "";
|
||||
@ -284,56 +282,57 @@ public class StringMan {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static boolean isAlphanumeric(final String str) {
|
||||
public static boolean isAlphanumeric(String str) {
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
final char c = str.charAt(i);
|
||||
if ((c < 0x30) || ((c >= 0x3a) && (c <= 0x40)) || ((c > 0x5a) && (c <= 0x60)) || (c > 0x7a)) {
|
||||
if (c < 0x30 || c >= 0x3a && c <= 0x40 || c > 0x5a && c <= 0x60 ||
|
||||
c > 0x7a) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isAlphanumericUnd(final CharSequence str) {
|
||||
public static boolean isAlphanumericUnd(CharSequence str) {
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
final char c = str.charAt(i);
|
||||
if ((c < 0x30) || ((c >= 0x3a) && (c <= 0x40)) || ((c > 0x5a) && (c <= 0x60)) || (c > 0x7a) || (c == '_')) {
|
||||
if (c < 0x30 || c >= 0x3a && c <= 0x40 || c > 0x5a && c <= 0x60 || c > 0x7a) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isAlpha(final String str) {
|
||||
public static boolean isAlpha(String str) {
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
final char c = str.charAt(i);
|
||||
if ((c <= 0x40) || ((c > 0x5a) && (c <= 0x60)) || (c > 0x7a)) {
|
||||
if (c <= 0x40 || c > 0x5a && c <= 0x60 || c > 0x7a) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String join(final Collection<?> collection, final String delimiter) {
|
||||
public static String join(Collection<?> collection, String delimiter) {
|
||||
return join(collection.toArray(), delimiter);
|
||||
}
|
||||
|
||||
public static String joinOrdered(final Collection<?> collection, final String delimiter) {
|
||||
public static String joinOrdered(Collection<?> collection, String delimiter) {
|
||||
final Object[] array = collection.toArray();
|
||||
Arrays.sort(array, Comparator.comparingInt(Object::hashCode));
|
||||
return join(array, delimiter);
|
||||
}
|
||||
|
||||
public static String join(final Collection<?> collection, final char delimiter) {
|
||||
public static String join(Collection<?> collection, char delimiter) {
|
||||
return join(collection.toArray(), delimiter + "");
|
||||
}
|
||||
|
||||
public static boolean isAsciiPrintable(final char c) {
|
||||
return (c >= ' ') && (c < '');
|
||||
public static boolean isAsciiPrintable(char c) {
|
||||
return c >= ' ' && c < '';
|
||||
}
|
||||
|
||||
public static boolean isAsciiPrintable(final String s) {
|
||||
for (final char c : s.toCharArray()) {
|
||||
public static boolean isAsciiPrintable(String s) {
|
||||
for (char c : s.toCharArray()) {
|
||||
if (!isAsciiPrintable(c)) {
|
||||
return false;
|
||||
}
|
||||
@ -427,7 +426,7 @@ public class StringMan {
|
||||
return p[n];
|
||||
}
|
||||
|
||||
public static <T> String join(Collection<T> arr, final String delimiter, Function<T, String> funx) {
|
||||
public static <T> String join(Collection<T> arr, String delimiter, Function<T, String> funx) {
|
||||
final StringBuilder result = new StringBuilder();
|
||||
int i = 0;
|
||||
for (T obj : arr) {
|
||||
@ -440,7 +439,7 @@ public class StringMan {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String join(final Object[] array, final String delimiter) {
|
||||
public static String join(Object[] array, String delimiter) {
|
||||
switch (array.length) {
|
||||
case 0:
|
||||
return "";
|
||||
@ -489,16 +488,13 @@ public class StringMan {
|
||||
return negative ? -value : value;
|
||||
}
|
||||
|
||||
public static String join(final int[] array, final String delimiter) {
|
||||
final Integer[] wrapped = new Integer[array.length];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
wrapped[i] = array[i];
|
||||
}
|
||||
public static String join(int[] array, String delimiter) {
|
||||
final Integer[] wrapped = Arrays.stream(array).boxed().toArray(Integer[]::new);
|
||||
return join(wrapped, delimiter);
|
||||
}
|
||||
|
||||
public static boolean isEqualToAny(final String a, final String... args) {
|
||||
for (final String arg : args) {
|
||||
public static boolean isEqualToAny(String a, String... args) {
|
||||
for (String arg : args) {
|
||||
if (StringMan.isEqual(a, arg)) {
|
||||
return true;
|
||||
}
|
||||
@ -506,8 +502,8 @@ public class StringMan {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEqualIgnoreCaseToAny(final String a, final String... args) {
|
||||
for (final String arg : args) {
|
||||
public static boolean isEqualIgnoreCaseToAny(String a, String... args) {
|
||||
for (String arg : args) {
|
||||
if (StringMan.isEqualIgnoreCase(a, arg)) {
|
||||
return true;
|
||||
}
|
||||
@ -515,15 +511,17 @@ public class StringMan {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEqual(final String a, final String b) {
|
||||
return ((a == b) || ((a != null) && (b != null) && (a.length() == b.length()) && (a.hashCode() == b.hashCode()) && a.equals(b)));
|
||||
public static boolean isEqual(String a, String b) {
|
||||
return a == b || a != null && b != null && a.length() == b.length()
|
||||
&& a.hashCode() == b.hashCode()
|
||||
&& a.equals(b);
|
||||
}
|
||||
|
||||
public static boolean isEqualIgnoreCase(final String a, final String b) {
|
||||
public static boolean isEqualIgnoreCase(String a, String b) {
|
||||
return ((a == b) || ((a != null) && (b != null) && (a.length() == b.length()) && a.equalsIgnoreCase(b)));
|
||||
}
|
||||
|
||||
public static String repeat(final String s, final int n) {
|
||||
public static String repeat(String s, int n) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < n; i++) {
|
||||
sb.append(s);
|
||||
|
@ -258,12 +258,12 @@ public abstract class TaskManager {
|
||||
});
|
||||
}
|
||||
|
||||
public void wait(AtomicBoolean running, int timout) {
|
||||
public void wait(AtomicBoolean running, int timeout) {
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
synchronized (running) {
|
||||
while (running.get()) {
|
||||
running.wait(timout);
|
||||
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");
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.boydti.fawe.util.image;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.command.FawePrimitiveBinding;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.util.command.parametric.ParameterException;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.Graphics2D;
|
||||
@ -161,19 +161,19 @@ public class ImageUtil {
|
||||
return (alpha << 24) + (red << 16) + (green << 8) + (blue << 0);
|
||||
}
|
||||
|
||||
public static BufferedImage load(@Nullable FawePrimitiveBinding.ImageUri uri) throws ParameterException {
|
||||
public static BufferedImage load(@Nullable ProvideBindings.ImageUri uri) throws InputParseException {
|
||||
return uri == null ? null : uri.load();
|
||||
}
|
||||
|
||||
public static BufferedImage load(URI uri) throws ParameterException {
|
||||
public static BufferedImage load(URI uri) throws InputParseException {
|
||||
try {
|
||||
return MainUtil.readImage(getInputStream(uri));
|
||||
} catch (IOException e) {
|
||||
throw new ParameterException(e);
|
||||
throw new InputParseException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static InputStream getInputStream(URI uri) throws ParameterException {
|
||||
public static InputStream getInputStream(URI uri) throws InputParseException {
|
||||
try {
|
||||
String uriStr = uri.toString();
|
||||
if (uriStr.startsWith("file:/")) {
|
||||
@ -182,11 +182,11 @@ public class ImageUtil {
|
||||
}
|
||||
return new URL(uriStr).openStream();
|
||||
} catch (IOException e) {
|
||||
throw new ParameterException(e);
|
||||
throw new InputParseException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static BufferedImage getImage(String arg) throws ParameterException {
|
||||
public static BufferedImage getImage(String arg) throws InputParseException {
|
||||
try {
|
||||
if (arg.startsWith("http")) {
|
||||
if (arg.contains("imgur.com") && !arg.contains("i.imgur.com")) {
|
||||
@ -203,14 +203,14 @@ public class ImageUtil {
|
||||
File file = MainUtil.getFile(MainUtil.getFile(Fawe.imp().getDirectory(), com.boydti.fawe.config.Settings.IMP.PATHS.HEIGHTMAP), arg);
|
||||
return MainUtil.readImage(file);
|
||||
} else {
|
||||
throw new ParameterException("Invalid image " + arg);
|
||||
throw new InputParseException("Invalid image " + arg);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new ParameterException(e);
|
||||
throw new InputParseException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static URI getImageURI(String arg) throws ParameterException {
|
||||
public static URI getImageURI(String arg) throws InputParseException {
|
||||
try {
|
||||
if (arg.startsWith("http")) {
|
||||
if (arg.contains("imgur.com") && !arg.contains("i.imgur.com")) {
|
||||
@ -221,17 +221,17 @@ public class ImageUtil {
|
||||
arg = arg.replaceFirst("file:/+", "");
|
||||
File file = MainUtil.getFile(MainUtil.getFile(Fawe.imp().getDirectory(), com.boydti.fawe.config.Settings.IMP.PATHS.HEIGHTMAP), arg);
|
||||
if (!file.exists()) {
|
||||
throw new ParameterException("File not found " + file);
|
||||
throw new InputParseException("File not found " + file);
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
throw new ParameterException("File is a directory " + file);
|
||||
throw new InputParseException("File is a directory " + file);
|
||||
}
|
||||
return file.toURI();
|
||||
} else {
|
||||
throw new ParameterException("Invalid image " + arg);
|
||||
throw new InputParseException("Invalid image " + arg);
|
||||
}
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
throw new ParameterException(e);
|
||||
throw new InputParseException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,26 @@
|
||||
package com.boydti.fawe.web;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import java.io.*;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class SchemSync implements Runnable {
|
||||
|
||||
private final static char PORT = 62522;
|
||||
|
||||
private final File tokensFile;
|
||||
@ -38,7 +41,8 @@ public class SchemSync implements Runnable {
|
||||
}
|
||||
|
||||
public SchemSync() {
|
||||
this.tokensFile = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.TOKENS, "tokens.txt");
|
||||
this.tokensFile = MainUtil
|
||||
.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.TOKENS, "tokens.txt");
|
||||
this.worldEdit = WorldEdit.getInstance();
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
this.working = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
||||
@ -66,27 +70,33 @@ public class SchemSync implements Runnable {
|
||||
try (Socket clientSocket = this.clientSocket = serverSocket.accept()) {
|
||||
try (InputStream in = clientSocket.getInputStream()) {
|
||||
int read = in.read(header);
|
||||
if (read != header.length) close(Error.INVALID_HEADER_LENGTH);
|
||||
if (read != header.length) {
|
||||
close(Error.INVALID_HEADER_LENGTH);
|
||||
}
|
||||
|
||||
ByteBuffer buf = ByteBuffer.wrap(header);
|
||||
UUID uuid = new UUID(buf.getLong(), buf.getLong());
|
||||
UUID expectedToken = tokens.get(uuid);
|
||||
if (expectedToken == null) close(Error.TOKEN_REJECTED);
|
||||
if (expectedToken == null) {
|
||||
close(Error.TOKEN_REJECTED);
|
||||
}
|
||||
|
||||
UUID receivedToken = new UUID(buf.getLong(), buf.getLong());
|
||||
if (!receivedToken.equals(expectedToken)) continue;
|
||||
if (!receivedToken.equals(expectedToken)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try (DataInputStream dis = new DataInputStream(in)) {
|
||||
File dir = new File(working, uuid.toString());
|
||||
|
||||
int data = dis.readByte() & 0xFF;
|
||||
switch (data) {
|
||||
case 0: {// list
|
||||
try (DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream())) {
|
||||
case 0: // list
|
||||
try (DataOutputStream out = new DataOutputStream(
|
||||
clientSocket.getOutputStream())) {
|
||||
out.write(1);
|
||||
UtilityCommands.allFiles(dir.listFiles(), true, new Consumer<File>() {
|
||||
@Override
|
||||
public void accept(File file) {
|
||||
UtilityCommands.allFiles(dir.listFiles(), true,
|
||||
file -> {
|
||||
try {
|
||||
String path = dir.toURI()
|
||||
.relativize(file.toURI()).getPath();
|
||||
@ -94,12 +104,10 @@ public class SchemSync implements Runnable {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {// get
|
||||
case 1: // get
|
||||
String input = dis.readUTF();
|
||||
File file = new File(dir, input);
|
||||
if (!MainUtil.isInSubDirectory(dir, file)) {
|
||||
@ -114,8 +122,8 @@ public class SchemSync implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (FaweException ignore) {
|
||||
}
|
||||
} catch (FaweException ignore) {}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -26,6 +26,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class CommandContext {
|
||||
|
||||
@ -254,11 +256,8 @@ public class CommandContext {
|
||||
}
|
||||
|
||||
public String getString(int start, int end) {
|
||||
StringBuilder buffer = new StringBuilder(parsedArgs.get(start));
|
||||
for (int i = start + 1; i < end + 1; ++i) {
|
||||
buffer.append(" ").append(parsedArgs.get(i));
|
||||
}
|
||||
return buffer.toString();
|
||||
return IntStream.range(start + 1, end + 1).mapToObj(i -> " " + parsedArgs.get(i))
|
||||
.collect(Collectors.joining("", parsedArgs.get(start), ""));
|
||||
}
|
||||
|
||||
public int getInteger(int index) throws NumberFormatException {
|
||||
|
@ -20,9 +20,6 @@
|
||||
package com.sk89q.minecraft.util.commands;
|
||||
|
||||
import com.sk89q.util.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
@ -33,6 +30,9 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Manager for handling commands. This allows you to easily process commands,
|
||||
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.minecraft.util.commands;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class SimpleInjector implements Injector {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SimpleInjector.class);
|
||||
private Object[] args;
|
||||
private Class<?>[] argClasses;
|
||||
|
||||
public SimpleInjector(Object... args) {
|
||||
this.args = args;
|
||||
argClasses = new Class[args.length];
|
||||
for (int i = 0; i < args.length; ++i) {
|
||||
argClasses[i] = args[i].getClass();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInstance(Class<?> clazz) {
|
||||
try {
|
||||
Constructor<?> ctr = clazz.getConstructor(argClasses);
|
||||
ctr.setAccessible(true);
|
||||
return ctr.newInstance(args);
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
|
||||
log.error("Error initializing commands class " + clazz, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.command.FawePrimitiveBinding;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
@ -65,6 +67,7 @@ import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.factory.TreeGeneratorFactory;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
@ -74,6 +77,7 @@ import com.sk89q.worldedit.command.tool.brush.CylinderBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.GravityBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.HollowCylinderBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.HollowSphereBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.OperationFactoryBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.SmoothBrush;
|
||||
import com.sk89q.worldedit.command.tool.brush.SphereBrush;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
@ -83,28 +87,27 @@ import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.function.Contextual;
|
||||
import com.sk89q.worldedit.function.factory.Deform;
|
||||
import com.sk89q.worldedit.function.factory.Paint;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.mask.SingleBlockTypeMask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.factory.RegionFactory;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
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.BlockTypes;
|
||||
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.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -113,9 +116,13 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
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.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
|
||||
/**
|
||||
* Commands to set brush shape.
|
||||
@ -191,13 +198,15 @@ public class BrushCommands extends MethodCommands {
|
||||
aliases = {"recurse", "r"},
|
||||
desc = "Set all connected blocks",
|
||||
descFooter = "Set all connected blocks\n" +
|
||||
"The -d flag Will apply in depth first order\n" +
|
||||
"Note: Set a mask to recurse along specific blocks"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.recursive")
|
||||
public BrushSettings recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
||||
Expression radius, @Switch(name='d', desc = "TODO") boolean depthFirst, InjectedValueAccess context) throws WorldEditException {
|
||||
Expression radius,
|
||||
@Switch(name='d', desc = "Apply in depth first order")
|
||||
boolean depthFirst,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
new RecurseBrush(depthFirst))
|
||||
@ -210,15 +219,17 @@ public class BrushCommands extends MethodCommands {
|
||||
name = "line",
|
||||
aliases = {"l"},
|
||||
desc = "Create lines",
|
||||
descFooter = "Create lines.\n" +
|
||||
"The -h flag creates only a shell\n" +
|
||||
"The -s flag selects the clicked point after drawing\n" +
|
||||
"The -f flag creates a flat line"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.line")
|
||||
public BrushSettings lineBrush(Player player, LocalSession session, Pattern fill,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius, @Switch(name='h', desc = "TODO") boolean shell, @Switch(name='s', desc = "TODO") boolean select, @Switch(name='f', desc = "TODO") boolean flat, InjectedValueAccess context) throws WorldEditException {
|
||||
Expression radius,
|
||||
@Switch(name='h', desc = "Create only a shell")
|
||||
boolean shell,
|
||||
@Switch(name='s', desc = "Selects the clicked point after drawing")
|
||||
boolean select,
|
||||
@Switch(name='f', desc = "Create a flat line")
|
||||
boolean flat, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
new LineBrush(shell, select, flat))
|
||||
@ -265,17 +276,19 @@ public class BrushCommands extends MethodCommands {
|
||||
@Command(
|
||||
name = "catenary",
|
||||
aliases = {"cat", "gravityline", "saggedline"},
|
||||
desc = "Create a hanging line between two points",
|
||||
descFooter = "Create a hanging line between two points.\n" +
|
||||
"The lengthFactor controls how long the line is\n" +
|
||||
"The -h flag creates only a shell\n" +
|
||||
"The -s flag selects the clicked point after drawing\n" +
|
||||
"The -d flag sags the catenary toward the facing direction\n"
|
||||
desc = "Create a hanging line between two points"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.spline")
|
||||
public BrushSettings catenaryBrush(LocalSession session, Pattern fill, @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(min=1) double lengthFactor,
|
||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
||||
Expression radius, @Switch(name='h', desc = "TODO") boolean shell, @Switch(name='s', desc = "TODO") boolean select, @Switch(name='d', desc = "TODO") boolean facingDirection, InjectedValueAccess context) throws WorldEditException {
|
||||
Expression radius,
|
||||
@Switch(name='h', desc = "Create only a shell")
|
||||
boolean shell,
|
||||
@Switch(name='s', desc = "Select the clicked point after drawing")
|
||||
boolean select,
|
||||
@Switch(name='d', desc = "sags the catenary toward the facing direction")
|
||||
boolean facingDirection,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
Brush brush = new CatenaryBrush(shell, select, facingDirection, lengthFactor);
|
||||
return set(session, context,
|
||||
@ -384,18 +397,16 @@ public class BrushCommands extends MethodCommands {
|
||||
@Command(
|
||||
name = "stencil",
|
||||
desc = "Use a height map to paint a surface",
|
||||
descFooter = "Use a height map to paint any surface.\n" +
|
||||
"The -w flag will only apply at maximum saturation\n" +
|
||||
"The -r flag will apply random rotation"
|
||||
descFooter = "Use a height map to paint any surface.\n"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.stencil")
|
||||
public BrushSettings stencilBrush(Player player, LocalSession session, Pattern fill,
|
||||
@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) final int rotation,
|
||||
@Arg(name = "yscale", desc = "double", def = "1") final double yscale,
|
||||
@Switch(name='w', desc = "TODO") boolean onlyWhite,
|
||||
@Switch(name='r', desc = "TODO") boolean randomRotate,
|
||||
@Arg(def = "0", desc = "rotation") @Range(min=0, max=360) int rotation,
|
||||
@Arg(name = "yscale", 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,
|
||||
InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
InputStream stream = getHeightmapStream(image);
|
||||
@ -418,16 +429,13 @@ public class BrushCommands extends MethodCommands {
|
||||
name = "image",
|
||||
aliases = {"color"},
|
||||
desc = "Use a height map to paint a surface",
|
||||
descFooter = "Use a height map to paint any surface.\n" +
|
||||
"The -a flag will use image alpha\n" +
|
||||
"The -f blends the image with the existing terrain"
|
||||
)
|
||||
descFooter = "Use a height map to paint any surface.\n")
|
||||
@CommandPermissions("worldedit.brush.stencil")
|
||||
public BrushSettings imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||
FawePrimitiveBinding.ImageUri imageUri,
|
||||
@Arg(def = "1", desc = "scale height") @Range(min=Double.MIN_NORMAL) final double yscale,
|
||||
@Switch(name='a', desc = "TODO") boolean alpha,
|
||||
@Switch(name='f', desc = "TODO") boolean fadeOut,
|
||||
@Arg(def = "1", desc = "scale height") @Range(min=Double.MIN_NORMAL) double yscale,
|
||||
@Switch(name='a', desc = "Use image Alpha") boolean alpha,
|
||||
@Switch(name='f', desc = "Blend the image with existing terrain") boolean fadeOut,
|
||||
InjectedValueAccess context) throws WorldEditException, IOException {
|
||||
BufferedImage image = imageUri.load();
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
@ -454,7 +462,10 @@ public class BrushCommands extends MethodCommands {
|
||||
"The -r flag will apply random rotation"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.surface")
|
||||
public BrushSettings surfaceBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, InjectedValueAccess context) throws WorldEditException {
|
||||
public BrushSettings surfaceBrush(LocalSession session, Pattern fill,
|
||||
@Arg(name = "radius", desc = "Expression", def = "5")
|
||||
Expression radius,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
|
||||
}
|
||||
@ -504,8 +515,7 @@ public class BrushCommands extends MethodCommands {
|
||||
}
|
||||
|
||||
return set(session, context,
|
||||
new PopulateSchem(mask, holders, (int) density, rotate))
|
||||
.setSize(radius);
|
||||
new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -521,9 +531,7 @@ public class BrushCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.brush.layer")
|
||||
public BrushSettings surfaceLayer(LocalSession session, Expression radius, List<BlockState> layers, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
new LayerBrush(layers.toArray(new BlockState[0])))
|
||||
.setSize(radius);
|
||||
return set(session, context, new LayerBrush(layers.toArray(new BlockState[0]))).setSize(radius);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -537,10 +545,7 @@ public class BrushCommands extends MethodCommands {
|
||||
@CommandPermissions("worldedit.brush.splatter")
|
||||
public BrushSettings splatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "1") double points, @Arg(name = "recursion", desc = "double", def = "5") double recursion, @Arg(name = "solid", desc = "boolean", def = "true") boolean solid, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
return set(session, context,
|
||||
new SplatterBrush((int) points, (int) recursion, solid))
|
||||
.setSize(radius)
|
||||
.setFill(fill);
|
||||
return set(session, context, new SplatterBrush((int) points, (int) recursion, solid)).setSize(radius).setFill(fill);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -596,7 +601,6 @@ public class BrushCommands extends MethodCommands {
|
||||
aliases = { "copy" },
|
||||
desc = "Choose the clipboard brush (Recommended: `/br copypaste`)",
|
||||
descFooter = "Chooses the clipboard brush.\n" +
|
||||
"The -a flag makes it not paste air.\n" +
|
||||
"Without the -p flag, the paste will appear centered at the target location. " +
|
||||
"With the flag, then the paste will appear relative to where you had " +
|
||||
"stood relative to the copied area when you copied it."
|
||||
@ -700,7 +704,7 @@ public class BrushCommands extends MethodCommands {
|
||||
"Snow Pic: https://i.imgur.com/Hrzn0I4.png"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") final String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final 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 BrushSettings heightBrush(Player player, 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 {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
}
|
||||
|
||||
@ -714,21 +718,23 @@ public class BrushCommands extends MethodCommands {
|
||||
" - The `-s` flag disables smoothing"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings cliffBrush(Player player, 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) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final 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 BrushSettings cliffBrush(Player player, 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, @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 {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "flatten",
|
||||
aliases = {"flatmap", "flat"},
|
||||
descFooter = "Flatten brush flattens terrain\n" +
|
||||
" - The `-r` flag enables random off-axis rotation\n" +
|
||||
" - The `-l` flag will work on snow layers\n" +
|
||||
" - The `-s` flag disables smoothing",
|
||||
desc = "This brush raises or lowers land towards the clicked point"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.height")
|
||||
public BrushSettings flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") final String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min=0, max=360) final int rotation, @Arg(name = "yscale", desc = "double", def = "1") final 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 BrushSettings flattenBrush(Player player, 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,
|
||||
@Switch(name='r', desc = "Enables random off-axis rotation")
|
||||
boolean randomRotate,
|
||||
@Switch(name='l', desc = "Will work on snow layers")
|
||||
boolean layers,
|
||||
@Switch(name='s', desc = "Disables smoothing")
|
||||
boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
|
||||
}
|
||||
|
||||
@ -759,7 +765,7 @@ public class BrushCommands extends MethodCommands {
|
||||
|
||||
private InputStream getHeightmapStream(String filename) throws FileNotFoundException {
|
||||
if (filename == null) return null;
|
||||
String filenamePng = (filename.endsWith(".png") ? filename : filename + ".png");
|
||||
String filenamePng = filename.endsWith(".png") ? filename : filename + ".png";
|
||||
File file = new File(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng);
|
||||
if (file.exists()) return new FileInputStream(file);
|
||||
URI uri = ImageUtil.getImageURI(filename);
|
||||
@ -773,13 +779,11 @@ public class BrushCommands extends MethodCommands {
|
||||
desc = "Copy Paste brush",
|
||||
descFooter = "Left click the base of an object to copy.\n" +
|
||||
"Right click to paste\n" +
|
||||
"The -r flag Will apply random rotation on paste\n" +
|
||||
"The -a flag Will apply auto view based rotation on paste\n" +
|
||||
"Note: Works well with the clipboard scroll action\n" +
|
||||
"Video: https://www.youtube.com/watch?v=RPZIaTbqoZw"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.copy")
|
||||
public BrushSettings copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch(name='r', desc = "TODO") boolean randomRotate, @Switch(name='a', desc = "TODO") boolean autoRotate, InjectedValueAccess context) throws WorldEditException {
|
||||
public BrushSettings copy(Player player, LocalSession session, @Arg(name = "radius", 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, InjectedValueAccess context) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
player.print(BBC.BRUSH_COPY.f(radius));
|
||||
|
||||
@ -861,7 +865,8 @@ public class BrushCommands extends MethodCommands {
|
||||
}
|
||||
|
||||
public BrushSettings set(LocalSession session, InjectedValueAccess context, Brush brush) throws InvalidToolBindException {
|
||||
Player plr = context.injectedValue(Key.of(Player.class)).orElseThrow(() -> new IllegalStateException("No player"));
|
||||
Player plr = context.injectedValue(Key.of(Player.class))
|
||||
.orElseThrow(() -> new IllegalStateException("No player"));
|
||||
BrushSettings bs = new BrushSettings();
|
||||
BrushTool tool = session.getBrushTool(plr, false);
|
||||
if (tool != null) {
|
||||
@ -873,11 +878,65 @@ public class BrushCommands extends MethodCommands {
|
||||
}
|
||||
}
|
||||
}
|
||||
String[] perms = getPermissions(context);
|
||||
bs.addPermissions(perms);
|
||||
String args = getArguments(context);
|
||||
bs.addSetting(BrushSettings.SettingType.BRUSH, args.substring(args.indexOf(' ') + 1));
|
||||
return bs.setBrush(brush);
|
||||
return bs;
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "forest",
|
||||
desc = "Forest brush, creates a forest in the area"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.forest")
|
||||
public void forest(Player player, LocalSession localSession,
|
||||
@Arg(desc = "The shape of the region")
|
||||
RegionFactory shape,
|
||||
@Arg(desc = "The size of the brush", def = "5")
|
||||
double radius,
|
||||
@Arg(desc = "The density of the brush", def = "20")
|
||||
double density,
|
||||
@Arg(desc = "The type of tree to use")
|
||||
TreeGenerator.TreeType type) throws WorldEditException {
|
||||
setOperationBasedBrush(player, localSession, radius,
|
||||
new Paint(new TreeGeneratorFactory(type), density / 100), shape, "worldedit.brush.forest");
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "raise",
|
||||
desc = "Raise brush, raise all blocks by one"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.raise")
|
||||
public void raise(Player player, LocalSession localSession,
|
||||
@Arg(desc = "The shape of the region")
|
||||
RegionFactory shape,
|
||||
@Arg(desc = "The size of the brush", def = "5")
|
||||
double radius) throws WorldEditException {
|
||||
setOperationBasedBrush(player, localSession, radius,
|
||||
new Deform("y-=1"), shape, "worldedit.brush.raise");
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "lower",
|
||||
desc = "Lower brush, lower all blocks by one"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.lower")
|
||||
public void lower(Player player, LocalSession localSession,
|
||||
@Arg(desc = "The shape of the region")
|
||||
RegionFactory shape,
|
||||
@Arg(desc = "The size of the brush", def = "5")
|
||||
double radius) throws WorldEditException {
|
||||
setOperationBasedBrush(player, localSession, radius,
|
||||
new Deform("y+=1"), shape, "worldedit.brush.lower");
|
||||
}
|
||||
|
||||
static void setOperationBasedBrush(Player player, LocalSession session, double radius,
|
||||
Contextual<? extends Operation> factory,
|
||||
RegionFactory shape,
|
||||
String permission) throws WorldEditException {
|
||||
WorldEdit.getInstance().checkMaxBrushRadius(radius);
|
||||
BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
||||
tool.setSize(radius);
|
||||
tool.setFill(null);
|
||||
tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission);
|
||||
|
||||
player.print("Set brush to " + factory);
|
||||
}
|
||||
}
|
||||
|
@ -11,14 +11,17 @@ import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.object.io.PGZIPOutputStream;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -47,22 +50,24 @@ import java.util.zip.GZIPInputStream;
|
||||
* Tool commands.
|
||||
*/
|
||||
|
||||
//@Command(aliases = {"brush", "br", "/b"}, desc = "Tool commands")
|
||||
public class BrushOptionsCommands extends MethodCommands {
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class BrushOptionsCommands {
|
||||
|
||||
public BrushOptionsCommands(WorldEdit we) {
|
||||
super(we);
|
||||
private WorldEdit worldEdit;
|
||||
|
||||
public BrushOptionsCommands(WorldEdit worldEdit) {
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "savebrush",
|
||||
aliases = {"save"},
|
||||
desc = "Save your current brush",
|
||||
descFooter = "Save your current brush\n" +
|
||||
"use the -g flag to save globally"
|
||||
descFooter = "Save your current brush use the -g flag to save globally"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.save")
|
||||
public void saveBrush(Player player, LocalSession session, String name, @Switch(name='g', desc = "TODO") boolean root) throws WorldEditException, IOException {
|
||||
public void saveBrush(Player player, LocalSession session, String name,
|
||||
@Switch(name = 'g', desc = "TODO") boolean root) throws WorldEditException, IOException {
|
||||
BrushTool tool = session.getBrushTool(player);
|
||||
if (tool != null) {
|
||||
root |= name.startsWith("../");
|
||||
@ -80,7 +85,8 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
parent.mkdirs();
|
||||
}
|
||||
file.createNewFile();
|
||||
try (DataOutputStream out = new DataOutputStream(new PGZIPOutputStream(new FileOutputStream(file)))) {
|
||||
try (DataOutputStream out = new DataOutputStream(
|
||||
new PGZIPOutputStream(new FileOutputStream(file)))) {
|
||||
out.writeUTF(tool.toString());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
@ -94,10 +100,11 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
@Command(
|
||||
name = "loadbrush",
|
||||
aliases = {"load"},
|
||||
desc = "load a brush"
|
||||
desc = "Load a brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.load")
|
||||
public void loadBrush(Player player, LocalSession session, String name) throws WorldEditException, IOException {
|
||||
public void loadBrush(Player player, LocalSession session, String name)
|
||||
throws WorldEditException, IOException {
|
||||
name = FileSystems.getDefault().getPath(name).getFileName().toString();
|
||||
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
||||
name = name.endsWith(".jsgz") ? name : name + ".jsgz";
|
||||
@ -106,16 +113,12 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
file = new File(folder, name);
|
||||
}
|
||||
if (!file.exists()) {
|
||||
File[] files = folder.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
File[] files = folder.listFiles(pathname -> false);
|
||||
BBC.BRUSH_NOT_FOUND.send(player, name);
|
||||
return;
|
||||
}
|
||||
try (DataInputStream in = new DataInputStream(new GZIPInputStream(new FileInputStream(file)))) {
|
||||
try (DataInputStream in = new DataInputStream(
|
||||
new GZIPInputStream(new FileInputStream(file)))) {
|
||||
String json = in.readUTF();
|
||||
BrushTool tool = BrushTool.fromString(player, session, json);
|
||||
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
@ -130,12 +133,13 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
@Command(
|
||||
name = "/listbrush",
|
||||
desc = "List saved brushes",
|
||||
|
||||
descFooter = "List all brushes in the brush directory\n" +
|
||||
" -p <page> prints the requested page\n"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.list")
|
||||
public void list(Actor actor, InjectedValueAccess args, @Switch(name='p', desc = "TODO") @Arg(name = "page", desc = "int", def = "1") int page) throws WorldEditException {
|
||||
public void list(Actor actor, InjectedValueAccess args,
|
||||
@Switch(name = 'p', desc = "Prints the requested page")
|
||||
int page) throws WorldEditException {
|
||||
String baseCmd = Commands.getAlias(BrushCommands.class, "brush") + " " + Commands.getAlias(BrushOptionsCommands.class, "loadbrush");
|
||||
File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
||||
UtilityCommands.list(dir, actor, args, page, null, true, baseCmd);
|
||||
@ -152,7 +156,7 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
aliases = {"/none"},
|
||||
desc = "Unbind a bound tool from your current item"
|
||||
)
|
||||
public void none(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
|
||||
public void none(Player player, LocalSession session) throws WorldEditException {
|
||||
session.setTool(player, null);
|
||||
BBC.TOOL_NONE.send(player);
|
||||
}
|
||||
@ -163,10 +167,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Toggle the super pickaxe function"
|
||||
)
|
||||
@CommandPermissions("worldedit.superpickaxe")
|
||||
public void togglePickaxe(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
|
||||
String newState = args.getString(0, null);
|
||||
public void togglePickaxe(Player player, LocalSession session,
|
||||
@Arg(desc = "state", def = "on") String state) throws WorldEditException {
|
||||
if (session.hasSuperPickAxe()) {
|
||||
if ("on".equals(newState)) {
|
||||
if ("on".equals(state)) {
|
||||
BBC.SUPERPICKAXE_ENABLED.send(player);
|
||||
return;
|
||||
}
|
||||
@ -174,7 +178,7 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
session.disableSuperPickAxe();
|
||||
BBC.SUPERPICKAXE_DISABLED.send(player);
|
||||
} else {
|
||||
if ("off".equals(newState)) {
|
||||
if ("off".equals(state)) {
|
||||
|
||||
BBC.SUPERPICKAXE_DISABLED.send(player);
|
||||
return;
|
||||
@ -190,14 +194,15 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
descFooter = "Set the right click brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.primary")
|
||||
public void primary(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
|
||||
public void primary(Player player, LocalSession session, InjectedValueAccess args)
|
||||
throws WorldEditException {
|
||||
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
session.setTool(item, null, player);
|
||||
String cmd = "brush " + args.getJoinedStrings(0);
|
||||
CommandEvent event = new CommandEvent(player, cmd);
|
||||
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
||||
BrushTool newTool = session.getBrushTool(item.getType(), player, false);
|
||||
BrushTool newTool = session.getBrushTool(item, player, false);
|
||||
if (newTool != null && tool != null) {
|
||||
newTool.setSecondary(tool.getSecondary());
|
||||
}
|
||||
@ -209,14 +214,15 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
descFooter = "Set the left click brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.secondary")
|
||||
public void secondary(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
|
||||
public void secondary(Player player, LocalSession session, InjectedValueAccess args)
|
||||
throws WorldEditException {
|
||||
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
session.setTool(item, null, player);
|
||||
String cmd = "brush " + args.getJoinedStrings(0);
|
||||
CommandEvent event = new CommandEvent(player, cmd);
|
||||
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
||||
BrushTool newTool = session.getBrushTool(item.getType(), player, false);
|
||||
BrushTool newTool = session.getBrushTool(item, player, false);
|
||||
if (newTool != null && tool != null) {
|
||||
newTool.setPrimary(tool.getPrimary());
|
||||
}
|
||||
@ -232,7 +238,8 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
"2 = Glass showing what blocks will be changed"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.visualize")
|
||||
public void visual(Player player, LocalSession session, @Range(min = 0, max = 2)int mode) throws WorldEditException {
|
||||
public void visual(Player player, LocalSession session, @Range(min = 0, max = 2) int mode)
|
||||
throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
BBC.BRUSH_NONE.send(player);
|
||||
@ -250,7 +257,8 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Toggle between different target modes"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.target")
|
||||
public void target(Player player, LocalSession session, @Arg(name = "mode", desc = "int", def = "0") int mode) throws WorldEditException {
|
||||
public void target(Player player, LocalSession session,
|
||||
@Arg(name = "mode", desc = "int", def = "0") int mode) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
BBC.BRUSH_NONE.send(player);
|
||||
@ -268,7 +276,8 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Set the targeting mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.targetmask")
|
||||
public void targetMask(Player player, EditSession editSession, LocalSession session, InjectedValueAccess context) throws WorldEditException {
|
||||
public void targetMask(Player player, EditSession editSession, LocalSession session,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
BBC.BRUSH_NONE.send(player);
|
||||
@ -290,7 +299,8 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Set the targeting mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.targetoffset")
|
||||
public void targetOffset(Player player, EditSession editSession, LocalSession session, int offset) throws WorldEditException {
|
||||
public void targetOffset(Player player, EditSession editSession, LocalSession session,
|
||||
int offset) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
BBC.BRUSH_NONE.send(player);
|
||||
@ -305,7 +315,11 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Toggle between different target modes"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.scroll")
|
||||
public void scroll(Player player, EditSession editSession, LocalSession session, @Optional @Switch(name='h', desc = "TODO") boolean offHand, InjectedValueAccess args) throws WorldEditException {
|
||||
public void scroll(Player player, EditSession editSession, LocalSession session,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
@Arg(desc="Target Modes")
|
||||
String modes, InjectedValueAccess args) throws WorldEditException {
|
||||
BrushTool bt = session.getBrushTool(player, false);
|
||||
if (bt == null) {
|
||||
BBC.BRUSH_NONE.send(player);
|
||||
@ -314,12 +328,11 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
|
||||
ScrollAction action = ScrollAction.fromArguments(bt, player, session, args.getJoinedStrings(0), true);
|
||||
settings.setScrollAction(action);
|
||||
if (args.getString(0).equalsIgnoreCase("none")) {
|
||||
if (modes.equalsIgnoreCase("none")) {
|
||||
BBC.BRUSH_SCROLL_ACTION_UNSET.send(player);
|
||||
} else if (action != null) {
|
||||
String full = args.getJoinedStrings(0);
|
||||
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
|
||||
BBC.BRUSH_SCROLL_ACTION_SET.send(player, full);
|
||||
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, modes);
|
||||
BBC.BRUSH_SCROLL_ACTION_SET.send(player, modes);
|
||||
}
|
||||
bt.update();
|
||||
}
|
||||
@ -330,7 +343,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Set the brush destination mask"
|
||||
)
|
||||
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
|
||||
public void mask(Player player, LocalSession session, EditSession editSession, @Optional @Switch(name='h', desc = "TODO") boolean offHand, InjectedValueAccess context) throws WorldEditException {
|
||||
public void mask(Player player, LocalSession session, EditSession editSession,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand, InjectedValueAccess context)
|
||||
throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.f());
|
||||
@ -361,7 +377,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
descFooter = "Set the brush source mask"
|
||||
)
|
||||
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
|
||||
public void smask(Player player, LocalSession session, EditSession editSession, @Optional @Switch(name='h', desc = "TODO") boolean offHand, InjectedValueAccess context) throws WorldEditException {
|
||||
public void smask(Player player, LocalSession session, EditSession editSession,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.f());
|
||||
@ -377,9 +396,11 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
parserContext.setWorld(player.getWorld());
|
||||
parserContext.setSession(session);
|
||||
parserContext.setExtent(editSession);
|
||||
Mask mask = worldEdit.getMaskFactory().parseFromInput(context.getJoinedStrings(0), parserContext);
|
||||
Mask mask = worldEdit.getMaskFactory()
|
||||
.parseFromInput(context.getJoinedStrings(0), parserContext);
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.addSetting(BrushSettings.SettingType.SOURCE_MASK, context.getString(context.argsLength() - 1));
|
||||
settings.addSetting(BrushSettings.SettingType.SOURCE_MASK,
|
||||
context.getString(context.argsLength() - 1));
|
||||
settings.setSourceMask(mask);
|
||||
tool.update();
|
||||
BBC.BRUSH_SOURCE_MASK.send(player);
|
||||
@ -390,7 +411,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Set the brush transform"
|
||||
)
|
||||
@CommandPermissions({"worldedit.brush.options.transform", "worldedit.transform.brush"})
|
||||
public void transform(Player player, LocalSession session, EditSession editSession, @Optional @Switch(name='h', desc = "TODO") boolean offHand, InjectedValueAccess context) throws WorldEditException {
|
||||
public void transform(Player player, LocalSession session, EditSession editSession,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.f());
|
||||
@ -420,7 +444,11 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Set the brush material"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.options.material")
|
||||
public void material(Player player, EditSession editSession, LocalSession session, Pattern pattern, @Switch(name='h', desc = "TODO") boolean offHand, InjectedValueAccess context) throws WorldEditException {
|
||||
public void material(Player player, EditSession editSession, LocalSession session,
|
||||
Pattern pattern,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.f());
|
||||
@ -443,8 +471,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Set the brush range"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.options.range")
|
||||
public void range(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
|
||||
int range = Math.max(0, Math.min(256, args.getInteger(0)));
|
||||
public void range(Player player, LocalSession session,
|
||||
@Arg(desc = "Range")
|
||||
int range) throws WorldEditException {
|
||||
range = Math.max(0, Math.min(256, range));
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(BBC.BRUSH_NONE.f());
|
||||
@ -459,8 +489,11 @@ public class BrushOptionsCommands extends MethodCommands {
|
||||
desc = "Set the brush size"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.options.size")
|
||||
public void size(Player player, LocalSession session, InjectedValueAccess args, @Switch(name='h', desc = "TODO") boolean offHand) throws WorldEditException {
|
||||
int radius = args.getInteger(0);
|
||||
public void size(Player player, LocalSession session,
|
||||
@Arg(desc = "The size of the brush", def = "5")
|
||||
int radius,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand) throws WorldEditException {
|
||||
worldEdit.checkMaxBrushRadius(radius);
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
|
@ -99,14 +99,16 @@ import java.util.zip.ZipOutputStream;
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ClipboardCommands {
|
||||
|
||||
private WorldEdit worldEdit;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param worldEdit reference to WorldEdit
|
||||
*/
|
||||
public ClipboardCommands(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
checkNotNull(worldEdit);
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
||||
|
||||
|
||||
@ -262,7 +264,7 @@ public class ClipboardCommands {
|
||||
|
||||
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
|
||||
copy.setSourceFunction(new BlockReplace(editSession, leavePattern));
|
||||
copy.setCopyingEntities(copyEntities);
|
||||
copy.setCopyingEntities(!skipEntities);
|
||||
copy.setRemovingEntities(true);
|
||||
copy.setCopyingBiomes(copyBiomes);
|
||||
Mask sourceMask = editSession.getSourceMask();
|
||||
|
@ -19,6 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.requireIV;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
@ -34,6 +37,7 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import java.util.List;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.CommandManagerService;
|
||||
@ -42,11 +46,6 @@ import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
import org.enginehub.piston.part.SubCommandPart;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
import static com.sk89q.worldedit.internal.command.CommandUtil.requireIV;
|
||||
|
||||
/**
|
||||
* Extracted from {@link SelectionCommands} to allow importing of {@link Command}.
|
||||
*/
|
||||
|
@ -254,7 +254,7 @@ public class GenerationCommands {
|
||||
@Switch(name = 'r', desc = "Raise the bottom of the sphere to the placement position")
|
||||
boolean raised,
|
||||
@Switch(name = 'h', desc = "Make a hollow sphere")
|
||||
boolean hollow) throws WorldEditException {
|
||||
boolean hollow, InjectedValueAccess context) throws WorldEditException {
|
||||
BlockVector3 pos = session.getPlacementPosition(player);
|
||||
BlockVector3 finalPos = raised ? pos.add(0, radii.getY(), 0) : pos;
|
||||
fp.checkConfirmationRadius(() -> {
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
@ -33,7 +35,6 @@ import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||
import com.boydti.fawe.regions.FaweMaskManager;
|
||||
import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -41,11 +42,10 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
@ -53,14 +53,13 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
|
||||
/**
|
||||
* Commands to undo, redo, and clear history.
|
||||
*/
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
//@Command(aliases = {}, desc = "Commands to undo, redo, and clear history: [More Info](http://wiki.sk89q.com/wiki/WorldEdit/Features#History)")
|
||||
public class HistoryCommands extends MethodCommands {
|
||||
|
||||
private final WorldEdit worldEdit;
|
||||
@ -83,7 +82,7 @@ public class HistoryCommands extends MethodCommands {
|
||||
" - Import from disk: /frb #import"
|
||||
)
|
||||
@CommandPermissions("worldedit.history.rollback")
|
||||
public void faweRollback(final Player player, LocalSession session, final String user, @Arg(def = "0", desc = "radius") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time, @Switch(name='r', desc = "TODO") boolean restore) throws WorldEditException {
|
||||
public void faweRollback(Player player, LocalSession session, String user, @Arg(def = "0", desc = "radius") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time, @Switch(name='r', desc = "TODO") boolean restore) throws WorldEditException {
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
|
||||
return;
|
||||
@ -209,7 +208,7 @@ public class HistoryCommands extends MethodCommands {
|
||||
" - Import from disk: /frb #import"
|
||||
)
|
||||
@CommandPermissions("worldedit.history.rollback")
|
||||
public void restore(final Player player, LocalSession session, final String user, @Arg(def = "0", desc = "radius") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time) throws WorldEditException {
|
||||
public void restore(Player player, LocalSession session, String user, @Arg(def = "0", desc = "radius") @Range(min = 0) int radius, @Arg(name = "time", desc = "String", def = "0") String time) throws WorldEditException {
|
||||
faweRollback(player, session, user, radius, time, true);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ package com.sk89q.worldedit.command;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -32,7 +31,6 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
@ -41,7 +39,6 @@ import org.enginehub.piston.annotation.param.Switch;
|
||||
/**
|
||||
* Commands for moving the player around.
|
||||
*/
|
||||
@Command(aliases = {}, desc = "Commands for moving the player around: [More Info](https://goo.gl/uQTUiT)")
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class NavigationCommands {
|
||||
|
||||
|
@ -53,8 +53,7 @@ public class PatternCommands extends MethodCommands {
|
||||
@Command(
|
||||
name = "#existing",
|
||||
aliases = {"#*", "*", ".*"},
|
||||
desc = "Use the block that is already there",
|
||||
descFooter = "[properties]"
|
||||
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
|
||||
if (properties == null) return new ExistingPattern(extent);
|
||||
|
@ -31,18 +31,17 @@ import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.filters.DistrFilter;
|
||||
import com.boydti.fawe.beta.filters.SetFilter;
|
||||
import com.boydti.fawe.beta.implementation.QueueHandler;
|
||||
import com.boydti.fawe.beta.filters.DistrFilter;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.object.visitor.Fast2DIterator;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -62,6 +61,7 @@ import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.LayerVisitor;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
@ -78,7 +78,6 @@ import com.sk89q.worldedit.regions.RegionOperationException;
|
||||
import com.sk89q.worldedit.regions.Regions;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
@ -94,11 +93,11 @@ 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.inject.InjectedValueAccess;
|
||||
|
||||
/**
|
||||
* Commands that operate on regions.
|
||||
*/
|
||||
//@Command(aliases = {}, desc = "Commands that operate on regions: [More Info](http://wiki.sk89q.com/wiki/WorldEdit/Region_operations)")
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class RegionCommands extends MethodCommands {
|
||||
|
||||
@ -114,6 +113,39 @@ public class RegionCommands extends MethodCommands {
|
||||
this.worldEdit = worldEdit;
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
name = "debugtest",
|
||||
desc = "debugtest"
|
||||
)
|
||||
@CommandPermissions("fawe.admin.debug")
|
||||
public void debugtest(Player player, @Selection Region region) throws WorldEditException {
|
||||
QueueHandler queueHandler = Fawe.get().getQueueHandler();
|
||||
World world = player.getWorld();
|
||||
DistrFilter filter = new DistrFilter();
|
||||
long start = System.currentTimeMillis();
|
||||
queueHandler.apply(world, region, filter);
|
||||
long diff = System.currentTimeMillis() - start;
|
||||
System.out.println(diff);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "db2",
|
||||
desc = "db2"
|
||||
)
|
||||
@CommandPermissions("fawe.admin.debug")
|
||||
public void db2(Player player, @Selection Region region, String blockStr) throws WorldEditException {
|
||||
QueueHandler queueHandler = Fawe.get().getQueueHandler();
|
||||
World world = player.getWorld();
|
||||
BlockState block = BlockState.get(blockStr);
|
||||
SetFilter filter = new SetFilter(block);
|
||||
long start = System.currentTimeMillis();
|
||||
queueHandler.apply(world, region, filter);
|
||||
long diff = System.currentTimeMillis() - start;
|
||||
System.out.println(diff);
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
name = "/fixlighting",
|
||||
desc = "Get the light at a position"
|
||||
@ -210,7 +242,7 @@ public class RegionCommands extends MethodCommands {
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to place")
|
||||
Pattern pattern,
|
||||
@Range(min = 0) @Arg(desc = "The thickness of the line", def = "0")
|
||||
@Arg(desc = "The thickness of the line", def = "0")
|
||||
int thickness,
|
||||
@Switch(name = 'h', desc = "Generate only a shell")
|
||||
boolean shell) throws WorldEditException {
|
||||
@ -218,6 +250,8 @@ public class RegionCommands extends MethodCommands {
|
||||
player.printError("//line only works with cuboid selections");
|
||||
return 0;
|
||||
}
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
|
||||
CuboidRegion cuboidregion = (CuboidRegion) region;
|
||||
BlockVector3 pos1 = cuboidregion.getPos1();
|
||||
BlockVector3 pos2 = cuboidregion.getPos2();
|
||||
@ -238,15 +272,15 @@ public class RegionCommands extends MethodCommands {
|
||||
@Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to place")
|
||||
Pattern pattern,
|
||||
@Range(min = 0) @Arg(desc = "The thickness of the curve", def = "0")
|
||||
@Arg(desc = "The thickness of the curve", def = "0")
|
||||
int thickness,
|
||||
@Switch(name = 'h', desc = "Generate only a shell")
|
||||
boolean shell,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
boolean shell, InjectedValueAccess context) throws WorldEditException {
|
||||
if (!(region instanceof ConvexPolyhedralRegion)) {
|
||||
player.printError("//curve only works with convex polyhedral selections");
|
||||
return;
|
||||
}
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
|
||||
player.checkConfirmationRegion(() -> {
|
||||
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
|
||||
@ -265,12 +299,20 @@ public class RegionCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.replace")
|
||||
@Logging(REGION)
|
||||
public void replace(FawePlayer player, EditSession editSession, @Selection Region region, @Arg(name = "from", desc = "Mask", def = "") Mask from, Pattern to, InjectedValueAccess context) throws WorldEditException {
|
||||
public void replace(FawePlayer player, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The mask representing blocks to replace", def = "")
|
||||
Mask from,
|
||||
@Arg(desc = "The pattern of blocks to replace with")
|
||||
Pattern to, InjectedValueAccess context) throws WorldEditException {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
int affected = editSession.replaceBlocks(region, from == null ? new ExistingBlockMask(editSession) : from, to);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
if (!player.hasPermission("fawe.tips"))
|
||||
BBC.TIP_REPLACE_ID.or(BBC.TIP_REPLACE_LIGHT, BBC.TIP_REPLACE_MARKER, BBC.TIP_TAB_COMPLETE, BBC.TIP_REPLACE_REGEX, BBC.TIP_REPLACE_REGEX_2, BBC.TIP_REPLACE_REGEX_3, BBC.TIP_REPLACE_REGEX_4, BBC.TIP_REPLACE_REGEX_5).send(player);
|
||||
if (!player.hasPermission("fawe.tips")) {
|
||||
BBC.TIP_REPLACE_ID
|
||||
.or(BBC.TIP_REPLACE_LIGHT, BBC.TIP_REPLACE_MARKER, BBC.TIP_TAB_COMPLETE,
|
||||
BBC.TIP_REPLACE_REGEX, BBC.TIP_REPLACE_REGEX_2, BBC.TIP_REPLACE_REGEX_3,
|
||||
BBC.TIP_REPLACE_REGEX_4, BBC.TIP_REPLACE_REGEX_5).send(player);
|
||||
}
|
||||
}, getArguments(context), region, context);
|
||||
}
|
||||
|
||||
@ -339,14 +381,16 @@ public class RegionCommands extends MethodCommands {
|
||||
}, getArguments(context), region, context);
|
||||
}
|
||||
|
||||
@org.enginehub.piston.annotation.Command(
|
||||
@Command(
|
||||
name = "/center",
|
||||
aliases = { "/middle" },
|
||||
desc = "Set the center block(s)"
|
||||
)
|
||||
@Logging(REGION)
|
||||
@CommandPermissions("worldedit.region.center")
|
||||
public void center(Player player, EditSession editSession, @Selection Region region, Pattern pattern) throws WorldEditException {
|
||||
public void center(Player player, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
int affected = editSession.center(region, pattern);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
}
|
||||
@ -370,7 +414,9 @@ public class RegionCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.walls")
|
||||
@Logging(REGION)
|
||||
public void walls(FawePlayer player, EditSession editSession, @Selection Region region, Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||
public void walls(FawePlayer player, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
int affected = editSession.makeWalls(region, pattern);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
@ -384,7 +430,9 @@ public class RegionCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.faces")
|
||||
@Logging(REGION)
|
||||
public void faces(FawePlayer player, EditSession editSession, @Selection Region region, Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||
public void faces(FawePlayer player, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The pattern of blocks to set")
|
||||
Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||
player.checkConfirmationRegion(() -> {
|
||||
int affected = editSession.makeCuboidFaces(region, pattern);
|
||||
BBC.VISITOR_BLOCK.send(player, affected);
|
||||
@ -398,7 +446,12 @@ public class RegionCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.smooth")
|
||||
@Logging(REGION)
|
||||
public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, @Arg(name = "iterations", desc = "int", def = "1") int iterations, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='s', desc = "TODO") boolean snow, InjectedValueAccess context) throws WorldEditException {
|
||||
public void smooth(FawePlayer player, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "# of iterations to perform", def = "1")
|
||||
int iterations,
|
||||
@Arg(desc = "The mask of blocks to use as the height map", def = "")
|
||||
Mask mask,
|
||||
@Switch(name='s', desc = "TODO") boolean snow, InjectedValueAccess context) throws WorldEditException {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
@ -464,7 +517,7 @@ public class RegionCommands extends MethodCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.region.move")
|
||||
@Logging(ORIENTATION_REGION)
|
||||
public void move(FawePlayer player, LocalSession session, EditSession editSession,
|
||||
public void move(FawePlayer player, EditSession editSession, LocalSession session,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "# of blocks to move", def = "1")
|
||||
int count,
|
||||
@ -477,11 +530,14 @@ public class RegionCommands extends MethodCommands {
|
||||
boolean moveSelection,
|
||||
@Switch(name = 'a', desc = "Ignore air blocks")
|
||||
boolean ignoreAirBlocks,
|
||||
@Switch(name='b', desc = "TODO") boolean copyBiomes,
|
||||
|
||||
@Switch(name='e', desc = "TODO") boolean skipEntities,
|
||||
@Switch(name='a', desc = "TODO") boolean skipAir,
|
||||
@Switch(name='b', desc = "TODO")
|
||||
boolean copyBiomes,
|
||||
@Switch(name='e', desc = "TODO")
|
||||
boolean skipEntities,
|
||||
@Switch(name='a', desc = "TODO")
|
||||
boolean skipAir,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
checkCommandArgument(count >= 1, "Count must be >= 1");
|
||||
player.checkConfirmationRegion(() -> {
|
||||
int affected = editSession.moveRegion(region, direction, count, !skipAir, !skipEntities, copyBiomes, replace);
|
||||
|
||||
@ -537,7 +593,8 @@ public class RegionCommands extends MethodCommands {
|
||||
@Switch(name = 'b', desc = "//TODO") boolean copyBiomes,
|
||||
@Switch(name = 'e', desc = "//TODO") boolean skipEntities,
|
||||
@Switch(name = 'a', desc = "Ignore air blocks")
|
||||
boolean ignoreAirBlocks, @Switch(name='m', desc = "TODO") Mask sourceMask, InjectedValueAccess context) throws WorldEditException {
|
||||
boolean ignoreAirBlocks,
|
||||
@Switch(name='m', desc = "TODO") Mask sourceMask, InjectedValueAccess context) throws WorldEditException {
|
||||
player.checkConfirmationStack(() -> {
|
||||
if (sourceMask != null) {
|
||||
editSession.addSourceMask(sourceMask);
|
||||
@ -564,11 +621,9 @@ public class RegionCommands extends MethodCommands {
|
||||
@Command(
|
||||
name = "/deform",
|
||||
desc = "Deforms a selected region with an expression",
|
||||
descFooter =
|
||||
"Deforms a selected region with an expression\n" +
|
||||
"The expression is executed for each block and is expected\n" +
|
||||
descFooter = "The expression is executed for each block and is expected\n" +
|
||||
"to modify the variables x, y and z to point to a new block\n" +
|
||||
"to fetch. See also tinyurl.com/wesyntax."
|
||||
"to fetch. See also https://tinyurl.com/weexpr"
|
||||
)
|
||||
@CommandPermissions("worldedit.region.deform")
|
||||
@Logging(ALL)
|
||||
@ -686,6 +741,7 @@ public class RegionCommands extends MethodCommands {
|
||||
TreeType type,
|
||||
@Arg(desc = "The density of the forest", def = "5")
|
||||
double density) throws WorldEditException {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
|
||||
int affected = editSession.makeForest(region, density / 100, type);
|
||||
BBC.COMMAND_TREE.send(player, affected);
|
||||
}
|
||||
@ -699,6 +755,7 @@ public class RegionCommands extends MethodCommands {
|
||||
public void flora(FawePlayer player, EditSession editSession, @Selection Region region,
|
||||
@Arg(desc = "The density of the forest", def = "5")
|
||||
double density, InjectedValueAccess context) throws WorldEditException {
|
||||
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
|
||||
player.checkConfirmationRegion(() -> {
|
||||
FloraGenerator generator = new FloraGenerator(editSession);
|
||||
GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator);
|
||||
|
@ -27,7 +27,7 @@ import com.boydti.fawe.object.clipboard.URIClipboardHolder;
|
||||
import com.boydti.fawe.object.mask.IdMask;
|
||||
import com.boydti.fawe.object.regions.selector.FuzzyRegionSelector;
|
||||
import com.boydti.fawe.object.regions.selector.PolyhedralRegionSelector;
|
||||
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -38,7 +38,6 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
@ -470,7 +469,7 @@ public class SelectionCommands {
|
||||
public void count(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The mask of blocks to match")
|
||||
Mask mask) throws WorldEditException {
|
||||
int count = editSession.countBlock(session.getSelection(player.getWorld()), mask);
|
||||
int count = editSession.countBlocks(session.getSelection(player.getWorld()), mask);
|
||||
BBC.SELECTION_COUNT.send(player, count);
|
||||
}
|
||||
|
||||
|
@ -29,24 +29,29 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
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;
|
||||
import com.sk89q.worldedit.world.snapshot.InvalidSnapshotException;
|
||||
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
||||
import com.sk89q.worldedit.world.storage.MissingWorldException;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
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.ArgFlag;
|
||||
|
||||
/**
|
||||
* Snapshot commands.
|
||||
*/
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
//@Command(aliases = {"snapshot", "snap"}, desc = "List, load and view information related to snapshots")
|
||||
public class SnapshotCommands {
|
||||
|
||||
private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss z");
|
||||
@ -63,8 +68,8 @@ public class SnapshotCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.snapshots.list")
|
||||
public void list(Player player,
|
||||
@Arg(desc = "# of snapshots to list", def = "5")
|
||||
int num) throws WorldEditException {
|
||||
@ArgFlag(name = 'p', desc = "Page of results to return", def = "1")
|
||||
int page) throws WorldEditException {
|
||||
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
@ -77,15 +82,7 @@ public class SnapshotCommands {
|
||||
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName());
|
||||
|
||||
if (!snapshots.isEmpty()) {
|
||||
|
||||
num = Math.min(40, Math.max(5, num));
|
||||
|
||||
BBC.SNAPSHOT_LIST_HEADER.send(player, player.getWorld().getName());
|
||||
for (byte i = 0; i < Math.min(num, snapshots.size()); i++) {
|
||||
player.print((i + 1) + ". " + snapshots.get(i).getName());
|
||||
}
|
||||
|
||||
BBC.SNAPSHOT_LIST_FOOTER.send(player);
|
||||
player.print(new SnapshotListBox(player.getWorld().getName(), snapshots).create(page));
|
||||
} else {
|
||||
BBC.SNAPSHOT_NOT_AVAILABLE.send(player);
|
||||
|
||||
@ -245,4 +242,26 @@ public class SnapshotCommands {
|
||||
}
|
||||
}
|
||||
|
||||
private static class SnapshotListBox extends PaginationBox {
|
||||
private final List<Snapshot> snapshots;
|
||||
|
||||
SnapshotListBox(String world, List<Snapshot> snapshots) {
|
||||
super("Snapshots for: " + world, "/snap list -p %page%");
|
||||
this.snapshots = snapshots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getComponent(int number) {
|
||||
final Snapshot snapshot = snapshots.get(number);
|
||||
return TextComponent.of(number + 1 + ". ", TextColor.GOLD)
|
||||
.append(TextComponent.of(snapshot.getName(), TextColor.LIGHT_PURPLE)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to use")))
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/snap use " + snapshot.getName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComponentsSize() {
|
||||
return snapshots.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,6 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -31,9 +27,14 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.tool.AreaPickaxe;
|
||||
import com.sk89q.worldedit.command.tool.RecursivePickaxe;
|
||||
import com.sk89q.worldedit.command.tool.SinglePickaxe;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
||||
//@Command(aliases = {"superpickaxe", "pickaxe", "sp"}, desc = "Super-pickaxe commands: [More Info](https://goo.gl/aBtGHo)")
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class SuperPickaxeCommands {
|
||||
private final WorldEdit we;
|
||||
|
||||
@ -74,8 +75,8 @@ public class SuperPickaxeCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "recur",
|
||||
aliases = {"recursive"},
|
||||
name = "recursive",
|
||||
aliases = { "recur" },
|
||||
desc = "Enable the recursive super pickaxe pickaxe mode"
|
||||
)
|
||||
@CommandPermissions("worldedit.superpickaxe.recursive")
|
||||
|
@ -10,29 +10,20 @@ import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.object.extent.ScaleTransform;
|
||||
import com.boydti.fawe.object.extent.TransformExtent;
|
||||
import com.boydti.fawe.util.ExtentTraverser;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
||||
import java.util.Set;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
||||
@Command(aliases = {"transforms"},
|
||||
desc = "Help for the various transforms. [More Info](https://git.io/v9KHO)",
|
||||
descFooter = "Transforms modify how a block is placed\n" +
|
||||
" - Use [brackets] for arguments\n" +
|
||||
" - Use , to OR multiple\n" +
|
||||
" - Use & to AND multiple\n" +
|
||||
"More Info: https://git.io/v9KHO"
|
||||
)
|
||||
public class TransformCommands extends MethodCommands {
|
||||
public TransformCommands(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
}
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class TransformCommands {
|
||||
|
||||
@Command(
|
||||
name = "#linear",
|
||||
@ -42,7 +33,7 @@ public class TransformCommands extends MethodCommands {
|
||||
public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||
if (other instanceof RandomTransform) {
|
||||
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
|
||||
return new LinearTransform(extents.toArray(new ResettableExtent[extents.size()]));
|
||||
return new LinearTransform(extents.toArray(new ResettableExtent[0]));
|
||||
}
|
||||
return other;
|
||||
}
|
||||
@ -55,7 +46,7 @@ public class TransformCommands extends MethodCommands {
|
||||
public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||
if (other instanceof RandomTransform) {
|
||||
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
|
||||
return new Linear3DTransform(extents.toArray(new ResettableExtent[extents.size()]));
|
||||
return new Linear3DTransform(extents.toArray(new ResettableExtent[0]));
|
||||
}
|
||||
return other;
|
||||
}
|
||||
@ -98,8 +89,8 @@ public class TransformCommands extends MethodCommands {
|
||||
desc = "All changes will be rotate around the initial position"
|
||||
)
|
||||
public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||
ExtentTraverser traverser = new ExtentTraverser(other).find(TransformExtent.class);
|
||||
BlockTransformExtent affine = (TransformExtent) (traverser != null ? traverser.get() : null);
|
||||
ExtentTraverser<TransformExtent> traverser = new ExtentTraverser(other).find(TransformExtent.class);
|
||||
BlockTransformExtent affine = traverser != null ? traverser.get() : null;
|
||||
if (affine == null) {
|
||||
other = affine = new TransformExtent(other);
|
||||
}
|
||||
@ -108,6 +99,6 @@ public class TransformCommands extends MethodCommands {
|
||||
transform = transform.rotateY(y);
|
||||
transform = transform.rotateZ(z);
|
||||
affine.setTransform(transform);
|
||||
return (ResettableExtent) other;
|
||||
return other;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ package com.sk89q.worldedit.command;
|
||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.DelegateConsumer;
|
||||
@ -32,7 +31,6 @@ import com.boydti.fawe.util.MainUtil;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.chat.Message;
|
||||
import com.boydti.fawe.util.image.ImageUtil;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
@ -63,16 +61,13 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
||||
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.internal.expression.Expression;
|
||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.command.CommandMapping;
|
||||
import com.sk89q.worldedit.util.command.Dispatcher;
|
||||
import com.sk89q.worldedit.internal.annotation.Range;
|
||||
import com.sk89q.worldedit.util.formatting.component.SubtleFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
@ -99,12 +94,12 @@ import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||
import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
|
||||
/**
|
||||
* Utility commands.
|
||||
*/
|
||||
@CommandContainer(superTypes = {CommandPermissionsConditionGenerator.Registration.class, CommandQueuedConditionGenerator.Registration.class})
|
||||
//@Command(aliases = {}, desc = "Various utility commands: [More Info](http://wiki.sk89q.com/wiki/WorldEdit/Utilities)")
|
||||
public class UtilityCommands {
|
||||
|
||||
private final WorldEdit we;
|
||||
@ -774,7 +769,7 @@ public class UtilityCommands {
|
||||
return page;
|
||||
}
|
||||
|
||||
public static int getFiles(File dir, Actor actor, InjectedValueAccess args, @Range(min = 0) int page, int perPage, String formatName, boolean playerFolder, Consumer<File> forEachFile) {
|
||||
public static int getFiles(File dir, Actor actor, InjectedValueAccess args, @org.jetbrains.annotations.Range(from = 0, to = ) int page, int perPage, String formatName, boolean playerFolder, Consumer<File> forEachFile) {
|
||||
Consumer<File> rootFunction = forEachFile;
|
||||
//schem list all <path>
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class DefaultTransformParser extends FaweParser<ResettableExtent> {
|
||||
public DefaultTransformParser(WorldEdit worldEdit) {
|
||||
super(worldEdit);
|
||||
this.dispatcher = new SimpleDispatcher();
|
||||
this.register(new TransformCommands(worldEdit));
|
||||
this.register(new TransformCommands());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.platform;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.command.AnvilCommands;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
@ -30,22 +31,55 @@ import com.boydti.fawe.util.TaskManager;
|
||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
//import com.sk89q.worldedit.command.BiomeCommandsRegistration;
|
||||
//import com.sk89q.worldedit.command.ChunkCommandsRegistration;
|
||||
//import com.sk89q.worldedit.command.ClipboardCommandsRegistration;
|
||||
//import com.sk89q.worldedit.command.GeneralCommandsRegistration;
|
||||
//import com.sk89q.worldedit.command.HistoryCommandsRegistration;
|
||||
//import com.sk89q.worldedit.command.NavigationCommandsRegistration;
|
||||
//import com.sk89q.worldedit.command.SchematicCommandsRegistration;
|
||||
//import com.sk89q.worldedit.command.SnapshotCommandsRegistration;
|
||||
//import com.sk89q.worldedit.command.SuperPickaxeCommandsRegistration;
|
||||
//import com.sk89q.worldedit.command.WorldEditCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.ApplyBrushCommands;
|
||||
import com.sk89q.worldedit.command.BiomeCommands;
|
||||
import com.sk89q.worldedit.command.BiomeCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.BrushCommands;
|
||||
import com.sk89q.worldedit.command.BrushCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.BrushOptionsCommands;
|
||||
import com.sk89q.worldedit.command.ChunkCommands;
|
||||
import com.sk89q.worldedit.command.ChunkCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.ClipboardCommands;
|
||||
import com.sk89q.worldedit.command.ClipboardCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.ExpandCommands;
|
||||
import com.sk89q.worldedit.command.GeneralCommands;
|
||||
import com.sk89q.worldedit.command.GeneralCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.GenerationCommands;
|
||||
import com.sk89q.worldedit.command.GenerationCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.HistoryCommands;
|
||||
import com.sk89q.worldedit.command.HistoryCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.NavigationCommands;
|
||||
import com.sk89q.worldedit.command.NavigationCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.PaintBrushCommands;
|
||||
import com.sk89q.worldedit.command.RegionCommands;
|
||||
import com.sk89q.worldedit.command.RegionCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.SchematicCommands;
|
||||
import com.sk89q.worldedit.command.SchematicCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.ScriptingCommands;
|
||||
import com.sk89q.worldedit.command.ScriptingCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.SelectionCommands;
|
||||
import com.sk89q.worldedit.command.SelectionCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.SnapshotCommands;
|
||||
import com.sk89q.worldedit.command.SnapshotCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.SnapshotUtilCommands;
|
||||
import com.sk89q.worldedit.command.SnapshotUtilCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.SuperPickaxeCommands;
|
||||
import com.sk89q.worldedit.command.SuperPickaxeCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.ToolCommands;
|
||||
import com.sk89q.worldedit.command.ToolCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.ToolUtilCommands;
|
||||
import com.sk89q.worldedit.command.ToolUtilCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.TransformCommands;
|
||||
import com.sk89q.worldedit.command.UtilityCommands;
|
||||
import com.sk89q.worldedit.command.UtilityCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.WorldEditCommands;
|
||||
import com.sk89q.worldedit.command.WorldEditCommandsRegistration;
|
||||
import com.sk89q.worldedit.command.argument.Arguments;
|
||||
import com.sk89q.worldedit.command.argument.BooleanConverter;
|
||||
import com.sk89q.worldedit.command.argument.CommaSeparatedValuesConverter;
|
||||
@ -71,6 +105,7 @@ import com.sk89q.worldedit.extension.platform.binding.CommandBindings;
|
||||
import com.sk89q.worldedit.extension.platform.binding.ConsumeBindings;
|
||||
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||
import com.sk89q.worldedit.internal.command.CommandArgParser;
|
||||
import com.sk89q.worldedit.internal.command.CommandLoggingHandler;
|
||||
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
||||
@ -126,9 +161,11 @@ import org.enginehub.piston.part.SubCommandPart;
|
||||
import org.enginehub.piston.suggestion.Suggestion;
|
||||
import org.enginehub.piston.util.HelpGenerator;
|
||||
import org.enginehub.piston.util.ValueProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Handles the registration and invocation of commands.
|
||||
*
|
||||
@ -152,14 +189,9 @@ public final class PlatformCommandManager {
|
||||
private final InjectedValueStore globalInjectedValues;
|
||||
private final DynamicStreamHandler dynamicHandler = new DynamicStreamHandler();
|
||||
private final WorldEditExceptionConverter exceptionConverter;
|
||||
private final CommandRegistrationHandler registration;
|
||||
public final CommandRegistrationHandler registration;
|
||||
private static PlatformCommandManager INSTANCE;
|
||||
|
||||
/*
|
||||
Command types
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
@ -203,7 +235,7 @@ public final class PlatformCommandManager {
|
||||
DirectionConverter.register(worldEdit, commandManager);
|
||||
FactoryConverter.register(worldEdit, commandManager);
|
||||
for (int count = 2; count <= 3; count++) {
|
||||
commandManager.registerConverter(Key.of(double.class, com.sk89q.worldedit.extension.platform.Annotations.radii(count)),
|
||||
commandManager.registerConverter(Key.of(double.class, Annotations.radii(count)),
|
||||
CommaSeparatedValuesConverter.wrapAndLimit(ArgumentConverters.get(
|
||||
TypeToken.of(double.class)
|
||||
), count)
|
||||
@ -218,8 +250,9 @@ public final class PlatformCommandManager {
|
||||
RegionFactoryConverter.register(commandManager);
|
||||
}
|
||||
|
||||
private void registerAlwaysInjectedValues() {
|
||||
globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), context -> Optional.of(context));
|
||||
public void register(Object classWithMethods) {
|
||||
globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), Optional::of);
|
||||
// TODO NOT IMPLEMENTED - register the following using a custom processor / annotations
|
||||
register(new AnnotatedBindings(worldEdit));
|
||||
register(new CommandBindings(worldEdit));
|
||||
register(new ConsumeBindings(worldEdit));
|
||||
@ -227,10 +260,6 @@ public final class PlatformCommandManager {
|
||||
register(new ProvideBindings(worldEdit));
|
||||
}
|
||||
|
||||
public void register(Object classWithMethods) {
|
||||
// TODO NOT IMPLEMENTED - register the following using a custom processor / annotations
|
||||
}
|
||||
|
||||
private <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
||||
CommandRegistration<CI> registration, CI instance) {
|
||||
registerSubCommands(name, aliases, desc, registration, instance, m -> {});
|
||||
@ -266,121 +295,141 @@ public final class PlatformCommandManager {
|
||||
public void registerAllCommands() {
|
||||
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
|
||||
// TODO NOT IMPLEMENTED dunno why these have issues generating
|
||||
// registerSubCommands(
|
||||
// "schematic",
|
||||
// ImmutableList.of("schem", "/schematic", "/schem"),
|
||||
// "Schematic commands for saving/loading areas",
|
||||
// SchematicCommandsRegistration.builder(),
|
||||
// new SchematicCommands(worldEdit)
|
||||
// );
|
||||
// registerSubCommands(
|
||||
// "snapshot",
|
||||
// ImmutableList.of("snap"),
|
||||
// "Snapshot commands for restoring backups",
|
||||
// SnapshotCommandsRegistration.builder(),
|
||||
// new SnapshotCommands(worldEdit)
|
||||
// );
|
||||
// registerSubCommands(
|
||||
// "superpickaxe",
|
||||
// ImmutableList.of("pickaxe", "sp"),
|
||||
// "Super-pickaxe commands",
|
||||
// SuperPickaxeCommandsRegistration.builder(),
|
||||
// new SuperPickaxeCommands(worldEdit)
|
||||
// );
|
||||
// registerSubCommands(
|
||||
// "brush",
|
||||
// ImmutableList.of("br", "/brush", "/br"),
|
||||
// "Brushing commands",
|
||||
// BrushCommandsRegistration.builder(),
|
||||
// new BrushCommands(worldEdit),
|
||||
// (Consumer<CommandManager>) manager -> {
|
||||
// PaintBrushCommands.register(commandManagerService, manager, registration);
|
||||
// ApplyBrushCommands.register(commandManagerService, manager, registration);
|
||||
// }
|
||||
// );
|
||||
// registerSubCommands(
|
||||
// "worldedit",
|
||||
// ImmutableList.of("we"),
|
||||
// "WorldEdit commands",
|
||||
// WorldEditCommandsRegistration.builder(),
|
||||
// new WorldEditCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// BiomeCommandsRegistration.builder(),
|
||||
// new BiomeCommands()
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// ChunkCommandsRegistration.builder(),
|
||||
// new ChunkCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// ClipboardCommandsRegistration.builder(),
|
||||
// new ClipboardCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// GeneralCommandsRegistration.builder(),
|
||||
// new GeneralCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// GenerationCommandsRegistration.builder(),
|
||||
// new GenerationCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// HistoryCommandsRegistration.builder(),
|
||||
// new HistoryCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// NavigationCommandsRegistration.builder(),
|
||||
// new NavigationCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// RegionCommandsRegistration.builder(),
|
||||
// new RegionCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// ScriptingCommandsRegistration.builder(),
|
||||
// new ScriptingCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// SelectionCommandsRegistration.builder(),
|
||||
// new SelectionCommands(worldEdit)
|
||||
// );
|
||||
// ExpandCommands.register(registration, commandManager, commandManagerService);
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// SnapshotUtilCommandsRegistration.builder(),
|
||||
// new SnapshotUtilCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// ToolCommandsRegistration.builder(),
|
||||
// new ToolCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// ToolUtilCommandsRegistration.builder(),
|
||||
// new ToolUtilCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// UtilityCommandsRegistration.builder(),
|
||||
// new UtilityCommands(worldEdit)
|
||||
// );
|
||||
// this.registration.register(
|
||||
// commandManager,
|
||||
// AnvilCommandsRegistration.builder(),
|
||||
// new AnvilCommands(worldEdit)
|
||||
// );
|
||||
registerSubCommands(
|
||||
"schematic",
|
||||
ImmutableList.of("schem", "/schematic", "/schem"),
|
||||
"Schematic commands for saving/loading areas",
|
||||
SchematicCommandsRegistration.builder(),
|
||||
new SchematicCommands(worldEdit)
|
||||
);
|
||||
registerSubCommands(
|
||||
"snapshot",
|
||||
ImmutableList.of("snap"),
|
||||
"Snapshot commands for restoring backups",
|
||||
SnapshotCommandsRegistration.builder(),
|
||||
new SnapshotCommands(worldEdit)
|
||||
);
|
||||
registerSubCommands(
|
||||
"superpickaxe",
|
||||
ImmutableList.of("pickaxe", "sp"),
|
||||
"Super-pickaxe commands",
|
||||
SuperPickaxeCommandsRegistration.builder(),
|
||||
new SuperPickaxeCommands(worldEdit)
|
||||
);
|
||||
registerSubCommands(
|
||||
"brush",
|
||||
ImmutableList.of("br", "/brush", "/br"),
|
||||
"Brushing commands",
|
||||
BrushCommandsRegistration.builder(),
|
||||
new BrushCommands(worldEdit),
|
||||
manager -> {
|
||||
PaintBrushCommands.register(commandManagerService, manager, registration);
|
||||
ApplyBrushCommands.register(commandManagerService, manager, registration);
|
||||
}
|
||||
);
|
||||
registerSubCommands(
|
||||
"brush",
|
||||
ImmutableList.of("br", "/b"),
|
||||
"Tool commands",
|
||||
BrushOptionsCommandsRegistration.builder(),
|
||||
new BrushOptionsCommands(worldEdit)
|
||||
);
|
||||
registerSubCommands(
|
||||
"worldedit",
|
||||
ImmutableList.of("we"),
|
||||
"WorldEdit commands",
|
||||
WorldEditCommandsRegistration.builder(),
|
||||
new WorldEditCommands(worldEdit)
|
||||
);
|
||||
registerSubCommands(
|
||||
"/anvil",
|
||||
ImmutableList.of(),
|
||||
"Manipulate billions of blocks https://github.com/boy0001/FastAsyncWorldedit/wiki/Anvil-API",
|
||||
AnvilCommandsRegistration.builder(),
|
||||
new AnvilCommands(worldEdit)
|
||||
);
|
||||
registerSubCommands(
|
||||
"transforms",
|
||||
ImmutableList.of(),
|
||||
"Transforms modify how a block is placed\n" +
|
||||
" - Use [brackets] for arguments\n" +
|
||||
" - Use , to OR multiple\n" +
|
||||
" - Use & to AND multiple\n" +
|
||||
"More Info: https://git.io/v9KHO",
|
||||
TransformCommandsRegistration.builder(),
|
||||
new TransformCommands()
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
BiomeCommandsRegistration.builder(),
|
||||
new BiomeCommands()
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
ChunkCommandsRegistration.builder(),
|
||||
new ChunkCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
ClipboardCommandsRegistration.builder(),
|
||||
new ClipboardCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
GeneralCommandsRegistration.builder(),
|
||||
new GeneralCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
GenerationCommandsRegistration.builder(),
|
||||
new GenerationCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
HistoryCommandsRegistration.builder(),
|
||||
new HistoryCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
NavigationCommandsRegistration.builder(),
|
||||
new NavigationCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
RegionCommandsRegistration.builder(),
|
||||
new RegionCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
ScriptingCommandsRegistration.builder(),
|
||||
new ScriptingCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
SelectionCommandsRegistration.builder(),
|
||||
new SelectionCommands(worldEdit)
|
||||
);
|
||||
ExpandCommands.register(registration, commandManager, commandManagerService);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
SnapshotUtilCommandsRegistration.builder(),
|
||||
new SnapshotUtilCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
ToolCommandsRegistration.builder(),
|
||||
new ToolCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
ToolUtilCommandsRegistration.builder(),
|
||||
new ToolUtilCommands(worldEdit)
|
||||
);
|
||||
this.registration.register(
|
||||
commandManager,
|
||||
UtilityCommandsRegistration.builder(),
|
||||
new UtilityCommands(worldEdit)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -488,7 +537,7 @@ public final class PlatformCommandManager {
|
||||
dynamicHandler.setHandler(null);
|
||||
}
|
||||
|
||||
private Stream<Substring> parseArgs(String input) {
|
||||
public Stream<Substring> parseArgs(String input) {
|
||||
return new CommandArgParser(CommandArgParser.spaceSplit(input.substring(1))).parseArgs();
|
||||
}
|
||||
|
||||
@ -587,17 +636,20 @@ public final class PlatformCommandManager {
|
||||
Request.request().setWorld(((World) extent));
|
||||
}
|
||||
}
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
|
||||
MemoizingValueAccess context = initializeInjectedValues(event::getArguments, actor);
|
||||
|
||||
ThrowableSupplier<Throwable> task =
|
||||
() -> commandManager.execute(context,Lists.newArrayList(split));
|
||||
() -> commandManager.execute(context, ImmutableList.copyOf(split));
|
||||
|
||||
handleCommandTask(task, context, session, event);
|
||||
}
|
||||
|
||||
public Object handleCommandTask(ThrowableSupplier<Throwable> task, InjectedValueAccess context, @Nullable LocalSession session, CommandEvent event) {
|
||||
Actor actor = context.injectedValue(Key.of(Actor.class)).orElseThrow(() -> new IllegalStateException("No player"));
|
||||
Request.reset();
|
||||
Actor actor = context.injectedValue(Key.of(Actor.class)).orElseThrow(() -> new IllegalStateException("No player"));
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
@ -651,8 +703,7 @@ public final class PlatformCommandManager {
|
||||
} else {
|
||||
System.out.println("Invalid context " + context);
|
||||
}
|
||||
Optional<EditSession> editSessionOpt =
|
||||
context.injectedValue(Key.of(EditSession.class));
|
||||
Optional<EditSession> editSessionOpt = context.injectedValue(Key.of(EditSession.class));
|
||||
|
||||
if (editSessionOpt.isPresent()) {
|
||||
EditSession editSession = editSessionOpt.get();
|
||||
|
@ -70,7 +70,7 @@ public class CommandScriptLoader {
|
||||
BrushCommands processor = new BrushCommands(WorldEdit.getInstance());
|
||||
for (FunctionParametricCallable cmd : cmds) {
|
||||
ProcessedCallable processed = new ProcessedCallable(cmd, processor);
|
||||
PlatformCommandManager.getInstance().registerCommand(aliases, cmd.getCommand(), processed);
|
||||
PlatformCommandManager.getInstance().registration.register(aliases, cmd.getCommand(), processed);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -49,7 +49,6 @@ public class NashornCraftScriptEngine implements CraftScriptEngine {
|
||||
synchronized (NashornCraftScriptEngine.class) {
|
||||
if (FACTORY == null) FACTORY = new NashornScriptEngineFactory();
|
||||
}
|
||||
;
|
||||
ScriptEngine engine = FACTORY.getScriptEngine("--language=es6");
|
||||
SimpleBindings bindings = new SimpleBindings();
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class RhinoCraftScriptEngine implements CraftScriptEngine {
|
||||
|
||||
@Override
|
||||
public Object evaluate(String script, String filename, Map<String, Object> args)
|
||||
throws ScriptException, Throwable {
|
||||
throws Throwable {
|
||||
RhinoContextFactory factory = new RhinoContextFactory(timeLimit);
|
||||
Context cx = factory.enterContext();
|
||||
ScriptableObject scriptable = new ImporterTopLevel(cx);
|
||||
|
@ -90,7 +90,7 @@ configure(subprojects + project("core:ap")) {
|
||||
|
||||
def textExtrasVersion = "3.0.2"
|
||||
project("core") {
|
||||
def textVersion = "3.0.1"
|
||||
def textVersion = "3.0.2"
|
||||
def pistonVersion = '0.4.3-SNAPSHOT'
|
||||
|
||||
dependencies {
|
||||
@ -98,6 +98,7 @@ project("core") {
|
||||
shade "net.kyori:text-serializer-gson:$textVersion"
|
||||
shade "net.kyori:text-serializer-legacy:$textVersion"
|
||||
shade "net.kyori:text-serializer-plain:$textVersion"
|
||||
shade "net.kyori:text-feature-pagination:$textVersion"
|
||||
shade('com.sk89q:jchronic:0.2.4a') {
|
||||
exclude(group: "junit", module: "junit")
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren