geforkt von Mirrors/FastAsyncWorldEdit
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.boydti.fawe.object.FawePlayer;
|
||||||
import com.sk89q.minecraft.util.commands.CommandException;
|
import com.sk89q.minecraft.util.commands.CommandException;
|
||||||
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
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.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.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
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.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
public class VoxelSniperListener implements Listener {
|
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.
|
* 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/>
|
* <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;
|
* the Y axis of the selection ( bottom of the cylinder ) as blockPositionY: Bottom_Y = targetBlock.y + v.cCen;
|
||||||
*
|
*
|
||||||
* @param v Sniper Caller
|
* @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
|
@Override
|
||||||
|
@ -174,7 +174,7 @@ public class ErodeBrush extends Brush {
|
|||||||
vm.brushName(this.getName());
|
vm.brushName(this.getName());
|
||||||
vm.size();
|
vm.size();
|
||||||
vm.custom(ChatColor.AQUA + "Erosion minimum exposed faces set to " + this.currentPreset.getErosionFaces());
|
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_BLUE + "Erosion recursion amount set to " + this.currentPreset.getErosionRecursion());
|
||||||
vm.custom(ChatColor.DARK_GREEN + "Fill recursion amount set to " + this.currentPreset.getFillRecursion());
|
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.
|
* 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();
|
StringBuilder valuesString = new StringBuilder();
|
||||||
|
|
||||||
boolean delimiterHelper = true;
|
boolean delimiterHelper = true;
|
||||||
@ -262,7 +262,7 @@ public class ErodeBrush extends Brush {
|
|||||||
if (delimiterHelper) {
|
if (delimiterHelper) {
|
||||||
delimiterHelper = false;
|
delimiterHelper = false;
|
||||||
} else {
|
} else {
|
||||||
valuesString.append(seperator);
|
valuesString.append(separator);
|
||||||
}
|
}
|
||||||
valuesString.append(preset.name());
|
valuesString.append(preset.name());
|
||||||
}
|
}
|
||||||
|
@ -102,10 +102,10 @@ public class Rot3DBrush extends Brush {
|
|||||||
|
|
||||||
private void rotate(final SnipeData v) {
|
private void rotate(final SnipeData v) {
|
||||||
// basically 1) make it a sphere we are rotating in, not a cylinder
|
// 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.
|
// 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 oportunities and have arrow rotate all 3, powder rotate x, goldsisc y, otherdisc z. Or something like that. Or
|
// --> 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
|
// 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
|
// --> 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
|
// 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.
|
// at once, and takes 3 params.
|
||||||
|
@ -27,8 +27,8 @@ public class SnowConeBrush extends Brush {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int brushSizeDoubled = 2 * brushSize;
|
final int brushSizeDoubled = 2 * brushSize;
|
||||||
final int[][] snowcone = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold block IDs
|
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[][] snowConeData = new int[brushSizeDoubled + 1][brushSizeDoubled + 1]; // Will hold data values for snowCone
|
||||||
final int[][] yOffset = new int[brushSizeDoubled + 1][brushSizeDoubled + 1];
|
final int[][] yOffset = new int[brushSizeDoubled + 1][brushSizeDoubled + 1];
|
||||||
// prime the arrays
|
// 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);
|
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();
|
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++) {
|
for (int x = 0; x <= brushSizeDoubled; x++) {
|
||||||
final double xSquared = Math.pow(x - brushSize, 2);
|
final double xSquared = Math.pow(x - brushSize, 2);
|
||||||
|
|
||||||
@ -61,35 +61,35 @@ public class SnowConeBrush extends Brush {
|
|||||||
if (snowData >= 0) { // no funny business
|
if (snowData >= 0) { // no funny business
|
||||||
switch (snowData) {
|
switch (snowData) {
|
||||||
case 0:
|
case 0:
|
||||||
if (BlockTypes.get(snowcone[x][z]).getMaterial().isAir()) {
|
if (BlockTypes.get(snowCone[x][z]).getMaterial().isAir()) {
|
||||||
snowcone[x][z] = BlockTypes.SNOW.getInternalId();
|
snowCone[x][z] = BlockTypes.SNOW.getInternalId();
|
||||||
snowconeData[x][z] = 0;
|
snowConeData[x][z] = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7: // Turn largest snowtile into snowblock
|
case 7: // Turn largest snowTile into snow block
|
||||||
if (snowcone[x][z] == BlockTypes.SNOW.getInternalId()) {
|
if (snowCone[x][z] == BlockTypes.SNOW.getInternalId()) {
|
||||||
snowcone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId();
|
snowCone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId();
|
||||||
snowconeData[x][z] = 0;
|
snowConeData[x][z] = 0;
|
||||||
}
|
}
|
||||||
break;
|
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 =
|
BlockType blockType =
|
||||||
BlockTypes.get(snowcone[x][z]);
|
BlockTypes.get(snowCone[x][z]);
|
||||||
if (blockType.getMaterial().isAir()) {
|
if (blockType.getMaterial().isAir()) {
|
||||||
snowconeData[x][z] = snowData;
|
snowConeData[x][z] = snowData;
|
||||||
snowcone[x][z] = BlockTypes.SNOW.getInternalId();
|
snowCone[x][z] = BlockTypes.SNOW.getInternalId();
|
||||||
|
|
||||||
snowconeData[x][z] = snowData;
|
snowConeData[x][z] = snowData;
|
||||||
} else if (blockType == BlockTypes.SNOW_BLOCK) {
|
} 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()) {
|
} else if (yOffset[x][z] > 0 && snowCone[x][z] == BlockTypes.SNOW.getInternalId()) {
|
||||||
snowconeData[x][z]++;
|
snowConeData[x][z]++;
|
||||||
if (snowconeData[x][z] == 7) {
|
if (snowConeData[x][z] == 7) {
|
||||||
snowconeData[x][z] = 0;
|
snowConeData[x][z] = 0;
|
||||||
snowcone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId();
|
snowCone[x][z] = BlockTypes.SNOW_BLOCK.getInternalId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -103,11 +103,11 @@ public class SnowConeBrush extends Brush {
|
|||||||
for (int x = 0; x <= brushSizeDoubled; x++) {
|
for (int x = 0; x <= brushSizeDoubled; x++) {
|
||||||
for (int z = 0; z <= brushSizeDoubled; z++) {
|
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));
|
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.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.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
|
* 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
|
* 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 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);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
snipeData.getVoxelMessage().size();
|
snipeData.getVoxelMessage().size();
|
||||||
return true;
|
return true;
|
||||||
} catch (NumberFormatException ingored) {
|
} catch (NumberFormatException ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Class<? extends IBrush> brush = plugin.getBrushManager().getBrushForHandle(args[0]);
|
Class<? extends IBrush> brush = plugin.getBrushManager().getBrushForHandle(args[0]);
|
||||||
if (brush != null) {
|
if (brush != null) {
|
||||||
IBrush orignalBrush = sniper.getBrush(currentToolId);
|
IBrush originalBrush = sniper.getBrush(currentToolId);
|
||||||
sniper.setBrush(currentToolId, brush);
|
sniper.setBrush(currentToolId, brush);
|
||||||
|
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
@ -63,7 +63,7 @@ public class VoxelBrushCommand extends VoxelCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SniperBrushChangedEvent event = new SniperBrushChangedEvent(sniper, currentToolId, orignalBrush, sniper.getBrush(currentToolId));
|
SniperBrushChangedEvent event = new SniperBrushChangedEvent(sniper, currentToolId, originalBrush, sniper.getBrush(currentToolId));
|
||||||
sniper.displayInfo();
|
sniper.displayInfo();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -458,10 +458,10 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Plugin preciousstonesPlugin = Bukkit.getServer().getPluginManager().getPlugin("PreciousStones");
|
final Plugin preciousStonesPlugin = Bukkit.getServer().getPluginManager().getPlugin("PreciousStones");
|
||||||
if (preciousstonesPlugin != null && preciousstonesPlugin.isEnabled()) {
|
if (preciousStonesPlugin != null && preciousStonesPlugin.isEnabled()) {
|
||||||
try {
|
try {
|
||||||
managers.add(new PreciousStonesFeature(preciousstonesPlugin, this));
|
managers.add(new PreciousStonesFeature(preciousStonesPlugin, this));
|
||||||
Fawe.debug("Plugin 'PreciousStones' found. Using it now.");
|
Fawe.debug("Plugin 'PreciousStones' found. Using it now.");
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -284,7 +284,7 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
|||||||
}
|
}
|
||||||
final int[] blockToPalette = FaweCache.BLOCK_TO_PALETTE.get();
|
final int[] blockToPalette = FaweCache.BLOCK_TO_PALETTE.get();
|
||||||
final int[] paletteToBlock = FaweCache.PALETTE_TO_BLOCK.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();
|
final int[] blocksCopy = FaweCache.SECTION_BLOCKS.get();
|
||||||
try {
|
try {
|
||||||
int num_palette = 0;
|
int num_palette = 0;
|
||||||
@ -317,9 +317,9 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
|||||||
|
|
||||||
final int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
final int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
||||||
if (num_palette == 1) {
|
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 {
|
} else {
|
||||||
final BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry);
|
final BitArray4096 bitArray = new BitArray4096(blockStates, bitsPerEntry);
|
||||||
bitArray.fromRaw(blocksCopy);
|
bitArray.fromRaw(blocksCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ public class BukkitQueue extends SimpleCharQueueExtent {
|
|||||||
final DataPaletteBlock<IBlockData> dataPaletteBlocks = section.getBlocks();
|
final DataPaletteBlock<IBlockData> dataPaletteBlocks = section.getBlocks();
|
||||||
// private DataPalette<T> h;
|
// private DataPalette<T> h;
|
||||||
// protected DataBits a;
|
// 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 DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
||||||
final DataPalette<IBlockData> palette;
|
final DataPalette<IBlockData> palette;
|
||||||
// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
||||||
|
@ -25,24 +25,24 @@ import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
|||||||
|
|
||||||
public class BukkitTextAdapter {
|
public class BukkitTextAdapter {
|
||||||
|
|
||||||
public static String reduceToText(Component component) {
|
public static String reduceToText(Component component) {
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
appendTextTo(text, component);
|
appendTextTo(text, component);
|
||||||
return text.toString();
|
return text.toString();
|
||||||
}
|
|
||||||
|
|
||||||
private static void appendTextTo(StringBuilder builder, Component component) {
|
|
||||||
if (component instanceof TextComponent) {
|
|
||||||
builder.append(((TextComponent) component).content());
|
|
||||||
} else if (component instanceof TranslatableComponent) {
|
|
||||||
builder.append(((TranslatableComponent) component).key());
|
|
||||||
}
|
}
|
||||||
for (Component child : component.children()) {
|
|
||||||
appendTextTo(builder, child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private BukkitTextAdapter() {
|
private static void appendTextTo(StringBuilder builder, Component component) {
|
||||||
}
|
if (component instanceof TextComponent) {
|
||||||
|
builder.append(((TextComponent) component).content());
|
||||||
|
} else if (component instanceof TranslatableComponent) {
|
||||||
|
builder.append(((TranslatableComponent) component).key());
|
||||||
|
}
|
||||||
|
for (Component child : component.children()) {
|
||||||
|
appendTextTo(builder, child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private BukkitTextAdapter() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -199,9 +199,9 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
|
|
||||||
// We have to restore the block if it was outside
|
// We have to restore the block if it was outside
|
||||||
if (!region.contains(pt)) {
|
if (!region.contains(pt)) {
|
||||||
editSession.setBlock(pt, history[index]);
|
editSession.smartSetBlock(pt, history[index]);
|
||||||
} else { // Otherwise fool with history
|
} 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();
|
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static volatile boolean hasWarnedImplError = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public com.sk89q.worldedit.world.block.BlockState getBlock(BlockVector3 position) {
|
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());
|
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
|
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import com.bekvon.bukkit.residence.commands.command;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
@ -45,7 +44,6 @@ import org.enginehub.piston.inject.MapBackedValueStore;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all events thrown in relation to a Player
|
* Handles all events thrown in relation to a Player
|
||||||
@ -75,8 +73,9 @@ public class WorldEditListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerCommandSend(PlayerCommandSendEvent event) {
|
public void onPlayerCommandSend(PlayerCommandSendEvent event) {
|
||||||
InjectedValueStore store = null;
|
// Command processing used to show up in timings
|
||||||
CommandManager commandManager = plugin.getWorldEdit().getPlatformManager().getPlatformCommandManager().getCommandManager();
|
CommandManager commandManager = plugin.getWorldEdit().getPlatformManager().getPlatformCommandManager().getCommandManager();
|
||||||
|
InjectedValueStore store = null;
|
||||||
Iterator<String> iter = event.getCommands().iterator();
|
Iterator<String> iter = event.getCommands().iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
String name = iter.next();
|
String name = iter.next();
|
||||||
|
@ -217,7 +217,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
public void setupRegistries() {
|
public void setupRegistries() {
|
||||||
// Biome
|
// Biome
|
||||||
for (Biome biome : Biome.values()) {
|
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
|
// Block & Item
|
||||||
for (Material material : Material.values()) {
|
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()) {
|
for (org.bukkit.entity.EntityType entityType : org.bukkit.entity.EntityType.values()) {
|
||||||
String mcid = entityType.getName();
|
String mcid = entityType.getName();
|
||||||
if (mcid != null) {
|
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
|
// code of WorldEdit expects it
|
||||||
String[] split = new String[args.length + 1];
|
String[] split = new String[args.length + 1];
|
||||||
System.arraycopy(args, 0, split, 1, args.length);
|
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));
|
CommandEvent event = new CommandEvent(wrapCommandSender(sender), Joiner.on(" ").join(split));
|
||||||
getWorldEdit().getEventBus().post(event);
|
getWorldEdit().getEventBus().post(event);
|
||||||
@ -441,11 +443,12 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
// code of WorldEdit expects it
|
// code of WorldEdit expects it
|
||||||
String[] split = new String[args.length + 1];
|
String[] split = new String[args.length + 1];
|
||||||
System.arraycopy(args, 0, split, 1, args.length);
|
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);
|
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());
|
CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), event.getBuffer());
|
||||||
getWorldEdit().getEventBus().post(suggestEvent);
|
getWorldEdit().getEventBus().post(suggestEvent);
|
||||||
List<String> suggestions = suggestEvent.getSuggestions();
|
|
||||||
if (suggestions != null && !suggestions.isEmpty()) {
|
event.setCompletions(CommandUtil.fixSuggestions(event.getBuffer(), suggestEvent.getSuggestions()));
|
||||||
event.setCompletions(suggestions);
|
event.setHandled(true);
|
||||||
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" +
|
"** will be blank, and so on. There will be no support for entity\n" +
|
||||||
"** and block property-related functions.\n" +
|
"** and block property-related functions.\n" +
|
||||||
"**\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";
|
"**********************************************\n";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,11 +112,11 @@ public final class FaweCache implements Trimable {
|
|||||||
*/
|
*/
|
||||||
public int[] paletteToBlock;
|
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>() {
|
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) {
|
private static Palette toPalette(int layerOffset, int[] blocksInts, char[] blocksChars) {
|
||||||
int[] blockToPalette = BLOCK_TO_PALETTE.get();
|
int[] blockToPalette = BLOCK_TO_PALETTE.get();
|
||||||
int[] paletteToBlock = PALETTE_TO_BLOCK.get();
|
int[] paletteToBlock = PALETTE_TO_BLOCK.get();
|
||||||
long[] blockstates = BLOCK_STATES.get();
|
long[] blockStates = BLOCK_STATES.get();
|
||||||
int[] blocksCopy = SECTION_BLOCKS.get();
|
int[] blocksCopy = SECTION_BLOCKS.get();
|
||||||
|
|
||||||
int blockIndexStart = layerOffset << 12;
|
int blockIndexStart = layerOffset << 12;
|
||||||
@ -193,10 +193,10 @@ public final class FaweCache implements Trimable {
|
|||||||
int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
||||||
if (num_palette == 1) {
|
if (num_palette == 1) {
|
||||||
// Set a value, because minecraft needs it for some reason
|
// Set a value, because minecraft needs it for some reason
|
||||||
blockstates[0] = 0;
|
blockStates[0] = 0;
|
||||||
blockBitArrayEnd = 1;
|
blockBitArrayEnd = 1;
|
||||||
} else {
|
} else {
|
||||||
BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry);
|
BitArray4096 bitArray = new BitArray4096(blockStates, bitsPerEntry);
|
||||||
bitArray.fromRaw(blocksCopy);
|
bitArray.fromRaw(blocksCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +205,8 @@ public final class FaweCache implements Trimable {
|
|||||||
palette.paletteToBlockLength = num_palette;
|
palette.paletteToBlockLength = num_palette;
|
||||||
palette.paletteToBlock = paletteToBlock;
|
palette.paletteToBlock = paletteToBlock;
|
||||||
|
|
||||||
palette.blockstatesLength = blockBitArrayEnd;
|
palette.blockStatesLength = blockBitArrayEnd;
|
||||||
palette.blockstates = blockstates;
|
palette.blockStates = blockStates;
|
||||||
|
|
||||||
return palette;
|
return palette;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -24,8 +24,8 @@ public class FaweVersion {
|
|||||||
public static FaweVersion tryParse(String version, String commit, String date) {
|
public static FaweVersion tryParse(String version, String commit, String date) {
|
||||||
try {
|
try {
|
||||||
return new FaweVersion(version, commit, date);
|
return new FaweVersion(version, commit, date);
|
||||||
} catch (Exception ignore) {
|
} catch (Exception exception) {
|
||||||
ignore.printStackTrace();
|
exception.printStackTrace();
|
||||||
return new FaweVersion(0, 0, 0, 0, 0);
|
return new FaweVersion(0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,25 @@
|
|||||||
package com.boydti.fawe.command;
|
package com.boydti.fawe.command;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweAPI;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
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 com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||||
|
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
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.regions.Region;
|
||||||
import com.sk89q.worldedit.world.World;
|
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
|
import java.io.IOException;
|
||||||
import org.enginehub.piston.annotation.Command;
|
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.Arg;
|
||||||
import org.enginehub.piston.annotation.param.Switch;
|
import org.enginehub.piston.annotation.param.Switch;
|
||||||
|
|
||||||
import java.io.IOException;
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
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)")
|
|
||||||
public class AnvilCommands {
|
public class AnvilCommands {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -247,11 +235,10 @@ public class AnvilCommands {
|
|||||||
|
|
||||||
desc = "Trim chunks in a Plot World",
|
desc = "Trim chunks in a Plot World",
|
||||||
descFooter = "Unclaimed chunks will be deleted\n" +
|
descFooter = "Unclaimed chunks will be deleted\n" +
|
||||||
"Unmodified chunks will be deleted\n" +
|
"Unmodified chunks will be deleted\n"
|
||||||
"Use -v to also delete unvisited chunks\n"
|
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.trimallplots")
|
@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
|
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
|
||||||
// int visitTime = deleteUnvisited ? 1 : -1;
|
// int visitTime = deleteUnvisited ? 1 : -1;
|
||||||
// PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000);
|
// PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000);
|
||||||
@ -266,7 +253,6 @@ public class AnvilCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "deletebiomechunks",
|
name = "deletebiomechunks",
|
||||||
|
|
||||||
desc = "Delete chunks matching a specific biome"
|
desc = "Delete chunks matching a specific biome"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.trimallair")
|
@CommandPermissions("worldedit.anvil.trimallair")
|
||||||
@ -280,7 +266,6 @@ public class AnvilCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "trimallair",
|
name = "trimallair",
|
||||||
|
|
||||||
desc = "Trim all air in the world"
|
desc = "Trim all air in the world"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.trimallair")
|
@CommandPermissions("worldedit.anvil.trimallair")
|
||||||
@ -310,7 +295,7 @@ public class AnvilCommands {
|
|||||||
name = "replaceallpattern",
|
name = "replaceallpattern",
|
||||||
aliases = {"reap", "repallpat"},
|
aliases = {"reap", "repallpat"},
|
||||||
desc = "Replace all blocks in the selection with another"
|
desc = "Replace all blocks in the selection with another"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.replaceall")
|
@CommandPermissions("worldedit.anvil.replaceall")
|
||||||
public void replaceAllPattern(Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch(name='d', desc = "TODO") boolean useData, @Switch(name='m', desc = "TODO") boolean useMap) throws WorldEditException {
|
public void replaceAllPattern(Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern to, @Switch(name='d', desc = "TODO") boolean useData, @Switch(name='m', desc = "TODO") boolean useMap) throws WorldEditException {
|
||||||
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
|
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
|
||||||
@ -339,7 +324,7 @@ public class AnvilCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "countall",
|
name = "countall",
|
||||||
desc = "Count all blocks in a world"
|
desc = "Count all blocks in a world"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.countall")
|
@CommandPermissions("worldedit.anvil.countall")
|
||||||
public void countAll(Player player, EditSession editSession, String folder, String arg, @Switch(name='d', desc = "TODO") boolean useData) throws WorldEditException {
|
public void countAll(Player player, EditSession editSession, String folder, String arg, @Switch(name='d', desc = "TODO") boolean useData) throws WorldEditException {
|
||||||
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true);
|
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true);
|
||||||
@ -413,7 +398,7 @@ public class AnvilCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "count",
|
name = "count",
|
||||||
desc = "Count blocks in a selection"
|
desc = "Count blocks in a selection"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.count")
|
@CommandPermissions("worldedit.anvil.count")
|
||||||
public void count(Player player, EditSession editSession, @Selection Region selection, String arg, @Switch(name='d', desc = "TODO") boolean useData) throws WorldEditException {
|
public void count(Player player, EditSession editSession, @Selection Region selection, String arg, @Switch(name='d', desc = "TODO") boolean useData) throws WorldEditException {
|
||||||
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true); TODO NOT IMPLEMENTED
|
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true); TODO NOT IMPLEMENTED
|
||||||
@ -621,8 +606,7 @@ public class AnvilCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "paste",
|
name = "paste",
|
||||||
desc = "Paste chunks from your anvil clipboard",
|
desc = "Paste chunks from your anvil clipboard",
|
||||||
descFooter =
|
descFooter = "Paste the chunks from your anvil clipboard.\n" +
|
||||||
"Paste the chunks from your anvil clipboard.\n" +
|
|
||||||
"The -c flag will align the paste to the chunks."
|
"The -c flag will align the paste to the chunks."
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.pastechunks")
|
@CommandPermissions("worldedit.anvil.pastechunks")
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
package com.boydti.fawe.command;
|
package com.boydti.fawe.command;
|
||||||
|
|
||||||
|
import static com.boydti.fawe.util.image.ImageUtil.load;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweAPI;
|
import com.boydti.fawe.FaweAPI;
|
||||||
import com.boydti.fawe.beta.IQueueExtent;
|
import com.boydti.fawe.beta.IQueueExtent;
|
||||||
import com.boydti.fawe.beta.SingleFilterBlock;
|
import com.boydti.fawe.beta.SingleFilterBlock;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.config.Commands;
|
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.FawePlayer;
|
||||||
import com.boydti.fawe.object.RunnableVal;
|
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.object.clipboard.MultiClipboardHolder;
|
||||||
import com.boydti.fawe.util.CleanTextureUtil;
|
import com.boydti.fawe.util.CleanTextureUtil;
|
||||||
import com.boydti.fawe.util.FilteredTextureUtil;
|
import com.boydti.fawe.util.FilteredTextureUtil;
|
||||||
@ -25,17 +27,19 @@ import java.nio.file.Path;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.exception.StopExecutionException;
|
import org.enginehub.piston.exception.StopExecutionException;
|
||||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||||
import com.sk89q.minecraft.util.commands.CommandException;
|
import com.sk89q.minecraft.util.commands.CommandException;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
|
||||||
import com.sk89q.worldedit.EmptyClipboardException;
|
import com.sk89q.worldedit.EmptyClipboardException;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.command.MethodCommands;
|
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.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
@ -51,14 +55,11 @@ import com.sk89q.worldedit.registry.state.PropertyKey;
|
|||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import org.enginehub.piston.annotation.param.Switch;
|
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.DataBufferInt;
|
import java.awt.image.DataBufferInt;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -74,10 +75,13 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
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.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
|
import org.enginehub.piston.annotation.param.Switch;
|
||||||
import static com.boydti.fawe.util.image.ImageUtil.load;
|
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||||
|
|
||||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
public class CFICommands extends MethodCommands {
|
public class CFICommands extends MethodCommands {
|
||||||
@ -117,11 +121,11 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Start CFI with a height map as a base"
|
desc = "Start CFI with a height map as a base"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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) {
|
if (yscale != 0) {
|
||||||
int[] raw = ((DataBufferInt) image.load().getRaster().getDataBuffer()).getData();
|
int[] raw = ((DataBufferInt) image.load().getRaster().getDataBuffer()).getData();
|
||||||
int[] table = IntStream.range(0, 256).map(i -> Math.min(255, (int) (i * yscale)))
|
int[] table = IntStream.range(0, 256).map(i -> Math.min(255, (int) (i * yscale)))
|
||||||
.toArray();
|
.toArray();
|
||||||
for (int i = 0; i < raw.length; i++) {
|
for (int i = 0; i < raw.length; i++) {
|
||||||
int color = raw[i];
|
int color = raw[i];
|
||||||
int red = table[(color >> 16) & 0xFF];
|
int red = table[(color >> 16) & 0xFF];
|
||||||
@ -139,7 +143,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Start CFI with an empty map as a base"
|
desc = "Start CFI with an empty map as a base"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void heightmap(FawePlayer fp, int width, int length) {
|
public void heightMap(FawePlayer fp, int width, int length) {
|
||||||
HeightMapMCAGenerator generator = new HeightMapMCAGenerator(width, length, getFolder(generateName()));
|
HeightMapMCAGenerator generator = new HeightMapMCAGenerator(width, length, getFolder(generateName()));
|
||||||
setup(generator, fp);
|
setup(generator, fp);
|
||||||
}
|
}
|
||||||
@ -169,9 +173,9 @@ public class CFICommands extends MethodCommands {
|
|||||||
Message msg;
|
Message msg;
|
||||||
if (settings.getGenerator().getImageViewer() != null) {
|
if (settings.getGenerator().getImageViewer() != null) {
|
||||||
msg = msg("CFI supports using brushes during creation").newline()
|
msg = msg("CFI supports using brushes during creation").newline()
|
||||||
.text(" - Place the map on a wall of item frames").newline()
|
.text(" - Place the map on a wall of item frames").newline()
|
||||||
.text(" - Use any WorldEdit brush on the item frames").newline()
|
.text(" - Use any WorldEdit brush on the item frames").newline()
|
||||||
.text(" - Example: ").text("Video").linkTip("https://goo.gl/PK4DMG").newline();
|
.text(" - Example: ").text("Video").linkTip("https://goo.gl/PK4DMG").newline();
|
||||||
} else {
|
} else {
|
||||||
msg = msg("This is not supported with your platform/version").newline();
|
msg = msg("This is not supported with your platform/version").newline();
|
||||||
}
|
}
|
||||||
@ -250,7 +254,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Set the floor and main block"
|
desc = "Set the floor and main block"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
gen.setColumn(load(image), pattern, !disableWhiteOnly);
|
gen.setColumn(load(image), pattern, !disableWhiteOnly);
|
||||||
@ -269,14 +273,14 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Set the floor (default: grass)"
|
desc = "Set the floor (default: grass)"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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);
|
floor(fp, pattern, image, mask, disableWhiteOnly);
|
||||||
fp.sendMessage("Set floor!");
|
fp.sendMessage("Set floor!");
|
||||||
assertSettings(fp).resetComponent();
|
assertSettings(fp).resetComponent();
|
||||||
component(fp);
|
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();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
gen.setFloor(load(image), pattern, !disableWhiteOnly);
|
gen.setFloor(load(image), pattern, !disableWhiteOnly);
|
||||||
@ -292,14 +296,14 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Set the main block (default: stone)"
|
desc = "Set the main block (default: stone)"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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);
|
main(fp, pattern, image, mask, disableWhiteOnly);
|
||||||
fp.sendMessage("Set main!");
|
fp.sendMessage("Set main!");
|
||||||
assertSettings(fp).resetComponent();
|
assertSettings(fp).resetComponent();
|
||||||
component(fp);
|
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();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
gen.setMain(load(image), pattern, !disableWhiteOnly);
|
gen.setMain(load(image), pattern, !disableWhiteOnly);
|
||||||
@ -318,7 +322,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
"e.g. Tallgrass"
|
"e.g. Tallgrass"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
gen.setOverlay(load(image), pattern, !disableWhiteOnly);
|
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."
|
" - A good value for radius and iterations would be 1 8."
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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);
|
smooth(fp, radius, iterations, image, mask, disableWhiteOnly);
|
||||||
assertSettings(fp).resetComponent();
|
assertSettings(fp).resetComponent();
|
||||||
component(fp);
|
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();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
gen.smooth(load(image), !disableWhiteOnly, radius, iterations);
|
gen.smooth(load(image), !disableWhiteOnly, radius, iterations);
|
||||||
@ -360,7 +364,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Create some snow"
|
desc = "Create some snow"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
floor(fp, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly);
|
floor(fp, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly);
|
||||||
main(fp, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly);
|
main(fp, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly);
|
||||||
@ -395,16 +399,16 @@ public class CFICommands extends MethodCommands {
|
|||||||
public void paletteblocks(FawePlayer fp, Player player, LocalSession session, @Arg(name = "arg", desc = "String", def = "") String arg) throws EmptyClipboardException, InputParseException, FileNotFoundException {
|
public void paletteblocks(FawePlayer fp, Player player, LocalSession session, @Arg(name = "arg", desc = "String", def = "") String arg) throws EmptyClipboardException, InputParseException, FileNotFoundException {
|
||||||
if (arg == null) {
|
if (arg == null) {
|
||||||
msg("What blocks do you want to color with?").newline()
|
msg("What blocks do you want to color with?").newline()
|
||||||
.text("[All]").cmdTip(alias() + " PaletteBlocks *").text(" - All available blocks")
|
.text("[All]").cmdTip(alias() + " PaletteBlocks *").text(" - All available blocks")
|
||||||
.newline()
|
.newline()
|
||||||
.text("[Clipboard]").cmdTip(alias() + " PaletteBlocks #clipboard").text(" - The blocks in your clipboard")
|
.text("[Clipboard]").cmdTip(alias() + " PaletteBlocks #clipboard").text(" - The blocks in your clipboard")
|
||||||
.newline()
|
.newline()
|
||||||
.text("[List]").suggestTip(alias() + " PaletteBlocks stone,gravel").text(" - A comma separated list of blocks")
|
.text("[List]").suggestTip(alias() + " PaletteBlocks stone,gravel").text(" - A comma separated list of blocks")
|
||||||
.newline()
|
.newline()
|
||||||
.text("[Complexity]").cmdTip(alias() + " Complexity").text(" - Block textures within a complexity range")
|
.text("[Complexity]").cmdTip(alias() + " Complexity").text(" - Block textures within a complexity range")
|
||||||
.newline()
|
.newline()
|
||||||
.text("< [Back]").cmdTip(alias() + " " + Commands.getAlias(CFICommands.class, "coloring"))
|
.text("< [Back]").cmdTip(alias() + " " + Commands.getAlias(CFICommands.class, "coloring"))
|
||||||
.send(fp);
|
.send(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HeightMapMCAGenerator generator = assertSettings(fp).getGenerator();
|
HeightMapMCAGenerator generator = assertSettings(fp).getGenerator();
|
||||||
@ -503,7 +507,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
" - The distance is the spacing between each schematic"
|
" - The distance is the spacing between each schematic"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
|
|
||||||
World world = fp.getWorld();
|
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"
|
" - If a mask is used, the biome will be set anywhere the mask applies"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
gen.setBiome(load(image), biome, !disableWhiteOnly);
|
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]
|
// ![79,174,212,5:3,5:4,18,161,20]
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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);
|
CFISettings settings = assertSettings(fp);
|
||||||
settings.getGenerator().setColorWithGlass(load(image));
|
settings.getGenerator().setColorWithGlass(load(image));
|
||||||
msg("Set color with glass!").send(fp);
|
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"
|
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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);
|
CFISettings settings = assertSettings(fp);
|
||||||
HeightMapMCAGenerator gen = settings.getGenerator();
|
HeightMapMCAGenerator gen = settings.getGenerator();
|
||||||
if (imageMask != null) {
|
if (imageMask != null) {
|
||||||
@ -737,7 +741,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
|
"The -w (disableWhiteOnly) will randomly apply depending on the pixel luminance"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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);
|
CFISettings settings = assertSettings(fp);
|
||||||
settings.getGenerator().setBlockAndBiomeColor(load(image), mask, load(imageMask), !disableWhiteOnly);
|
settings.getGenerator().setBlockAndBiomeColor(load(image), mask, load(imageMask), !disableWhiteOnly);
|
||||||
msg("Set color with blocks and biomes!").send(fp);
|
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."
|
" - If you changed the block to something other than grass you will not see anything."
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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);
|
CFISettings settings = assertSettings(fp);
|
||||||
settings.getGenerator().setBiomeColor(load(image));
|
settings.getGenerator().setBiomeColor(load(image));
|
||||||
msg("Set color with biomes!").send(fp);
|
msg("Set color with biomes!").send(fp);
|
||||||
@ -810,14 +814,14 @@ public class CFICommands extends MethodCommands {
|
|||||||
int biomePriority = gen.getBiomePriority();
|
int biomePriority = gen.getBiomePriority();
|
||||||
|
|
||||||
Message msg = msg(">> Current Settings <<").newline()
|
Message msg = msg(">> Current Settings <<").newline()
|
||||||
.text("Randomization ").text("[" + (Boolean.toString(rand).toUpperCase()) + "]").cmdTip(alias() + " randomization " + (!rand))
|
.text("Randomization ").text("[" + (Boolean.toString(rand).toUpperCase()) + "]").cmdTip(alias() + " randomization " + (!rand))
|
||||||
.newline()
|
.newline()
|
||||||
.text("Mask ").text("[" + mask + "]").cmdTip(alias() + " mask")
|
.text("Mask ").text("[" + mask + "]").cmdTip(alias() + " mask")
|
||||||
.newline()
|
.newline()
|
||||||
.text("Blocks ").text("[" + blocks + "]").tooltip(blockList).command(alias() + " paletteBlocks")
|
.text("Blocks ").text("[" + blocks + "]").tooltip(blockList).command(alias() + " paletteBlocks")
|
||||||
.newline()
|
.newline()
|
||||||
.text("BiomePriority ").text("[" + biomePriority + "]").cmdTip(alias() + " biomepriority")
|
.text("BiomePriority ").text("[" + biomePriority + "]").cmdTip(alias() + " biomepriority")
|
||||||
.newline();
|
.newline();
|
||||||
|
|
||||||
if (settings.image != null) {
|
if (settings.image != null) {
|
||||||
StringBuilder colorArgs = new StringBuilder();
|
StringBuilder colorArgs = new StringBuilder();
|
||||||
@ -833,16 +837,16 @@ public class CFICommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg.text("Image: ")
|
msg.text("Image: ")
|
||||||
.text("[" + settings.imageArg + "]").cmdTip(alias() + " " + Commands.getAlias(CFICommands.class, "image"))
|
.text("[" + settings.imageArg + "]").cmdTip(alias() + " " + Commands.getAlias(CFICommands.class, "image"))
|
||||||
.newline().newline()
|
.newline().newline()
|
||||||
.text("&cLet's Color: ")
|
.text("&cLet's Color: ")
|
||||||
.cmdOptions(alias() + " ", colorArgs.toString(), "Biomes", "Blocks", "BlockAndBiome", "Glass")
|
.cmdOptions(alias() + " ", colorArgs.toString(), "Biomes", "Blocks", "BlockAndBiome", "Glass")
|
||||||
.newline();
|
.newline();
|
||||||
} else {
|
} else {
|
||||||
msg.newline().text("You can color a world using an image like ")
|
msg.newline().text("You can color a world using an image like ")
|
||||||
.text("[This]").linkTip("http://i.imgur.com/vJYinIU.jpg").newline()
|
.text("[This]").linkTip("http://i.imgur.com/vJYinIU.jpg").newline()
|
||||||
.text("&cYou MUST provide an image: ")
|
.text("&cYou MUST provide an image: ")
|
||||||
.text("[None]").cmdTip(alias() + " " + Commands.getAlias(Command.class, "image")).newline();
|
.text("[None]").cmdTip(alias() + " " + Commands.getAlias(Command.class, "image")).newline();
|
||||||
}
|
}
|
||||||
msg.text("< [Back]").cmdTip(alias()).send(fp);
|
msg.text("< [Back]").cmdTip(alias()).send(fp);
|
||||||
}
|
}
|
||||||
@ -852,7 +856,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Select a mask"
|
desc = "Select a mask"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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);
|
CFISettings settings = assertSettings(fp);
|
||||||
String[] split = getArguments(context).split(" ");
|
String[] split = getArguments(context).split(" ");
|
||||||
int index = 2;
|
int index = 2;
|
||||||
@ -917,7 +921,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Select an image"
|
desc = "Select an image"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@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);
|
CFISettings settings = getSettings(fp);
|
||||||
String[] split = getArguments(context).split(" ");
|
String[] split = getArguments(context).split(" ");
|
||||||
int index = 2;
|
int index = 2;
|
||||||
@ -928,10 +932,10 @@ public class CFICommands extends MethodCommands {
|
|||||||
StringBuilder cmd = new StringBuilder(alias() + " image ");
|
StringBuilder cmd = new StringBuilder(alias() + " image ");
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
msg("Please provide an image:").newline()
|
msg("Please provide an image:").newline()
|
||||||
.text("From a URL: ").text("[Click Here]").suggestTip(cmd + "http://")
|
.text("From a URL: ").text("[Click Here]").suggestTip(cmd + "http://")
|
||||||
.newline()
|
.newline()
|
||||||
.text("From a file: ").text("[Click Here]").suggestTip(cmd + "file://")
|
.text("From a file: ").text("[Click Here]").suggestTip(cmd + "file://")
|
||||||
.send(fp);
|
.send(fp);
|
||||||
} else {
|
} else {
|
||||||
if (settings.hasGenerator()) {
|
if (settings.hasGenerator()) {
|
||||||
coloring(fp);
|
coloring(fp);
|
||||||
@ -953,10 +957,10 @@ public class CFICommands extends MethodCommands {
|
|||||||
settings.popMessages(fp);
|
settings.popMessages(fp);
|
||||||
settings.setCategory(this::populate);
|
settings.setCategory(this::populate);
|
||||||
msg("What would you like to populate?").newline()
|
msg("What would you like to populate?").newline()
|
||||||
.text("(You will need to type these commands)").newline()
|
.text("(You will need to type these commands)").newline()
|
||||||
.cmdOptions(alias() + " ", "", "Ores", "Ore", "Caves", "Schematics", "Smooth")
|
.cmdOptions(alias() + " ", "", "Ores", "Ore", "Caves", "Schematics", "Smooth")
|
||||||
.newline().text("< [Back]").cmdTip(alias())
|
.newline().text("< [Back]").cmdTip(alias())
|
||||||
.send(fp);
|
.send(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -997,49 +1001,49 @@ public class CFICommands extends MethodCommands {
|
|||||||
String snow = Commands.getAlias(CFICommands.class, "snow");
|
String snow = Commands.getAlias(CFICommands.class, "snow");
|
||||||
|
|
||||||
Message msg = msg(">> Current Settings <<").newline()
|
Message msg = msg(">> Current Settings <<").newline()
|
||||||
.text("Mask ").text("[" + mask + "]").cmdTip(alias() + " mask")
|
.text("Mask ").text("[" + mask + "]").cmdTip(alias() + " mask")
|
||||||
.newline()
|
.newline()
|
||||||
.text("Pattern ").text("[" + pattern + "]").cmdTip(alias() + " pattern")
|
.text("Pattern ").text("[" + pattern + "]").cmdTip(alias() + " pattern")
|
||||||
.newline()
|
.newline()
|
||||||
.newline()
|
.newline()
|
||||||
.text(">> Components <<")
|
.text(">> Components <<")
|
||||||
.newline()
|
.newline()
|
||||||
.text("[Height]").suggestTip(alias() + " " + alias("height") + " 120").text(" - Terrain height for whole map")
|
.text("[Height]").suggestTip(alias() + " " + alias("height") + " 120").text(" - Terrain height for whole map")
|
||||||
.newline()
|
.newline()
|
||||||
.text("[WaterHeight]").suggestTip(alias() + " " + alias("waterheight") + " 60").text(" - Sea level for whole map")
|
.text("[WaterHeight]").suggestTip(alias() + " " + alias("waterheight") + " 60").text(" - Sea level for whole map")
|
||||||
.newline()
|
.newline()
|
||||||
.text("[FloorThickness]").suggestTip(alias() + " " + alias("floorthickness") + " 60").text(" - Floor thickness of entire map")
|
.text("[FloorThickness]").suggestTip(alias() + " " + alias("floorthickness") + " 60").text(" - Floor thickness of entire map")
|
||||||
.newline()
|
.newline()
|
||||||
.text("[WorldThickness]").suggestTip(alias() + " " + alias("worldthickness") + " 60").text(" - World thickness of entire map")
|
.text("[WorldThickness]").suggestTip(alias() + " " + alias("worldthickness") + " 60").text(" - World thickness of entire map")
|
||||||
.newline()
|
.newline()
|
||||||
.text("[Snow]").suggestTip(alias() + " " + alias("snow") + maskArgs).text(" - Set snow in the masked areas")
|
.text("[Snow]").suggestTip(alias() + " " + alias("snow") + maskArgs).text(" - Set snow in the masked areas")
|
||||||
.newline();
|
.newline();
|
||||||
|
|
||||||
if (pattern != null) {
|
if (pattern != null) {
|
||||||
String disabled = "You must specify a pattern";
|
String disabled = "You must specify a pattern";
|
||||||
msg
|
msg
|
||||||
.text("[&cWaterId]").tooltip(disabled).newline()
|
.text("[&cWaterId]").tooltip(disabled).newline()
|
||||||
.text("[&cBedrockId]").tooltip(disabled).newline()
|
.text("[&cBedrockId]").tooltip(disabled).newline()
|
||||||
.text("[&cFloor]").tooltip(disabled).newline()
|
.text("[&cFloor]").tooltip(disabled).newline()
|
||||||
.text("[&cMain]").tooltip(disabled).newline()
|
.text("[&cMain]").tooltip(disabled).newline()
|
||||||
.text("[&cColumn]").tooltip(disabled).newline()
|
.text("[&cColumn]").tooltip(disabled).newline()
|
||||||
.text("[&cOverlay]").tooltip(disabled).newline();
|
.text("[&cOverlay]").tooltip(disabled).newline();
|
||||||
} else {
|
} else {
|
||||||
StringBuilder compArgs = new StringBuilder();
|
StringBuilder compArgs = new StringBuilder();
|
||||||
compArgs.append(" " + settings.patternArg + maskArgs);
|
compArgs.append(" " + settings.patternArg + maskArgs);
|
||||||
|
|
||||||
msg
|
msg
|
||||||
.text("[WaterId]").cmdTip(alias() + " waterId " + pattern).text(" - Water id for whole map").newline()
|
.text("[WaterId]").cmdTip(alias() + " waterId " + pattern).text(" - Water id for whole map").newline()
|
||||||
.text("[BedrockId]").cmdTip(alias() + " baseId " + pattern).text(" - Bedrock id for whole map").newline()
|
.text("[BedrockId]").cmdTip(alias() + " baseId " + pattern).text(" - Bedrock id for whole map").newline()
|
||||||
.text("[Floor]").cmdTip(alias() + " floor" + compArgs).text(" - Set the floor in the masked areas").newline()
|
.text("[Floor]").cmdTip(alias() + " floor" + compArgs).text(" - Set the floor in the masked areas").newline()
|
||||||
.text("[Main]").cmdTip(alias() + " main" + compArgs).text(" - Set the main block in the masked areas").newline()
|
.text("[Main]").cmdTip(alias() + " main" + compArgs).text(" - Set the main block in the masked areas").newline()
|
||||||
.text("[Column]").cmdTip(alias() + " column" + compArgs).text(" - Set the columns in the masked areas").newline()
|
.text("[Column]").cmdTip(alias() + " column" + compArgs).text(" - Set the columns in the masked areas").newline()
|
||||||
.text("[Overlay]").cmdTip(alias() + " overlay" + compArgs).text(" - Set the overlay in the masked areas").newline();
|
.text("[Overlay]").cmdTip(alias() + " overlay" + compArgs).text(" - Set the overlay in the masked areas").newline();
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.newline()
|
msg.newline()
|
||||||
.text("< [Back]").cmdTip(alias())
|
.text("< [Back]").cmdTip(alias())
|
||||||
.send(fp);
|
.send(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1062,10 +1066,10 @@ public class CFICommands extends MethodCommands {
|
|||||||
|
|
||||||
private HeightMapMCAGenerator generator;
|
private HeightMapMCAGenerator generator;
|
||||||
|
|
||||||
protected FawePrimitiveBinding.ImageUri image;
|
protected ProvideBindings.ImageUri image;
|
||||||
protected String imageArg;
|
protected String imageArg;
|
||||||
protected Mask mask;
|
protected Mask mask;
|
||||||
protected FawePrimitiveBinding.ImageUri imageMask;
|
protected ProvideBindings.ImageUri imageMask;
|
||||||
protected boolean whiteOnly = true;
|
protected boolean whiteOnly = true;
|
||||||
protected String maskArg;
|
protected String maskArg;
|
||||||
protected String imageMaskArg;
|
protected String imageMaskArg;
|
||||||
@ -1094,11 +1098,11 @@ public class CFICommands extends MethodCommands {
|
|||||||
this.maskArg = arg;
|
this.maskArg = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImage(FawePrimitiveBinding.ImageUri image, String arg) {
|
public void setImage(ProvideBindings.ImageUri image, String arg) {
|
||||||
this.image = image;
|
this.image = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImageMask(FawePrimitiveBinding.ImageUri imageMask, String arg) {
|
public void setImageMask(ProvideBindings.ImageUri imageMask, String arg) {
|
||||||
this.imageMask = imageMask;
|
this.imageMask = imageMask;
|
||||||
this.imageMaskArg = arg;
|
this.imageMaskArg = arg;
|
||||||
}
|
}
|
||||||
@ -1188,8 +1192,8 @@ public class CFICommands extends MethodCommands {
|
|||||||
|
|
||||||
protected static Message msg(String text) {
|
protected static Message msg(String text) {
|
||||||
return new Message().newline()
|
return new Message().newline()
|
||||||
.text(BBC.getPrefix())
|
.text(BBC.getPrefix())
|
||||||
.text(text);
|
.text(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void mainMenu(FawePlayer fp) {
|
protected static void mainMenu(FawePlayer fp) {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package com.boydti.fawe.command;
|
//package com.boydti.fawe.command;
|
||||||
|
//
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
//import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.util.command.parametric.BindingHelper;
|
//import com.sk89q.worldedit.util.command.parametric.BindingHelper;
|
||||||
|
//
|
||||||
public class FaweBinding extends BindingHelper {
|
//public class FaweBinding extends BindingHelper {
|
||||||
private final WorldEdit worldEdit;
|
// private final WorldEdit worldEdit;
|
||||||
|
//
|
||||||
public FaweBinding(WorldEdit worldEdit) {
|
// public FaweBinding(WorldEdit worldEdit) {
|
||||||
this.worldEdit = worldEdit;
|
// this.worldEdit = worldEdit;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public WorldEdit getWorldEdit() {
|
// public WorldEdit getWorldEdit() {
|
||||||
return worldEdit;
|
// return worldEdit;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
package com.boydti.fawe.command;
|
//package com.boydti.fawe.command;
|
||||||
|
//
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
//import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.util.command.parametric.ParameterData;
|
//import com.sk89q.worldedit.util.command.parametric.ParameterData;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
//import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
//
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
//import java.util.HashSet;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Set;
|
//import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
//import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
//import java.util.stream.Stream;
|
||||||
|
//
|
||||||
public class MaskBinding extends FaweBinding {
|
//public class MaskBinding extends FaweBinding {
|
||||||
private final WorldEdit worldEdit;
|
// private final WorldEdit worldEdit;
|
||||||
|
//
|
||||||
public MaskBinding(WorldEdit worldEdit) {
|
// public MaskBinding(WorldEdit worldEdit) {
|
||||||
super(worldEdit);
|
// super(worldEdit);
|
||||||
this.worldEdit = worldEdit;
|
// this.worldEdit = worldEdit;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public List<String> getSuggestions(ParameterData parameter, String prefix) {
|
// public List<String> getSuggestions(ParameterData parameter, String prefix) {
|
||||||
if (prefix.isEmpty()) {
|
// if (prefix.isEmpty()) {
|
||||||
return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream().map(n -> n + ":")).collect(Collectors.toList());
|
// return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream().map(n -> n + ":")).collect(Collectors.toList());
|
||||||
}
|
// }
|
||||||
return super.getSuggestions(parameter, prefix);
|
// return super.getSuggestions(parameter, prefix);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
package com.boydti.fawe.command;
|
//package com.boydti.fawe.command;
|
||||||
|
//
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
//import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.util.command.parametric.ParameterData;
|
//import com.sk89q.worldedit.util.command.parametric.ParameterData;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
//import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
//import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
//import java.util.stream.Stream;
|
||||||
|
//
|
||||||
public class PatternBinding extends FaweBinding {
|
//public class PatternBinding extends FaweBinding {
|
||||||
private final WorldEdit worldEdit;
|
// private final WorldEdit worldEdit;
|
||||||
|
//
|
||||||
public PatternBinding(WorldEdit worldEdit) {
|
// public PatternBinding(WorldEdit worldEdit) {
|
||||||
super(worldEdit);
|
// super(worldEdit);
|
||||||
this.worldEdit = worldEdit;
|
// this.worldEdit = worldEdit;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public List<String> getSuggestions(ParameterData parameter, String prefix) {
|
// public List<String> getSuggestions(ParameterData parameter, String prefix) {
|
||||||
if (prefix.isEmpty()) {
|
// if (prefix.isEmpty()) {
|
||||||
return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream()).collect(Collectors.toList());
|
// return Stream.concat(Stream.of("#"), BlockTypes.getNameSpaces().stream()).collect(Collectors.toList());
|
||||||
}
|
// }
|
||||||
return super.getSuggestions(parameter, prefix);
|
// return super.getSuggestions(parameter, prefix);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -21,8 +21,10 @@ import java.io.IOException;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class PlotLoader {
|
public class PlotLoader {
|
||||||
|
|
||||||
@Deprecated
|
@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);
|
final Plot plot = area.getNextFreePlot(player, start);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
whenDone.run(null);
|
whenDone.run(null);
|
||||||
@ -30,15 +32,12 @@ public class PlotLoader {
|
|||||||
}
|
}
|
||||||
whenDone.value = plot;
|
whenDone.value = plot;
|
||||||
plot.owner = player.getUUID();
|
plot.owner = player.getUUID();
|
||||||
DBFunc.createPlotSafe(plot, whenDone, new Runnable() {
|
DBFunc.createPlotSafe(plot, whenDone,
|
||||||
@Override
|
() -> autoClaimFromDatabase(player, area, plot.getId(), whenDone));
|
||||||
public void run() {
|
|
||||||
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();
|
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||||
if (manager instanceof SinglePlotAreaManager) {
|
if (manager instanceof SinglePlotAreaManager) {
|
||||||
SinglePlotAreaManager sManager = (SinglePlotAreaManager) manager;
|
SinglePlotAreaManager sManager = (SinglePlotAreaManager) manager;
|
||||||
@ -49,7 +48,8 @@ public class PlotLoader {
|
|||||||
Plot plot = TaskManager.IMP.sync(new RunnableVal<Plot>() {
|
Plot plot = TaskManager.IMP.sync(new RunnableVal<Plot>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Plot o) {
|
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;
|
int diff = player.getAllowedPlots() - currentPlots;
|
||||||
if (diff < 1) {
|
if (diff < 1) {
|
||||||
Captions.CANT_CLAIM_MORE_PLOTS_NUM.send(player, -diff);
|
Captions.CANT_CLAIM_MORE_PLOTS_NUM.send(player, -diff);
|
||||||
@ -73,12 +73,7 @@ public class PlotLoader {
|
|||||||
File folder = CFICommands.getFolder(plot.getWorldName());
|
File folder = CFICommands.getFolder(plot.getWorldName());
|
||||||
Boolean result = createTask.apply(folder);
|
Boolean result = createTask.apply(folder);
|
||||||
if (result == Boolean.TRUE) {
|
if (result == Boolean.TRUE) {
|
||||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
TaskManager.IMP.sync(() -> plot.teleportPlayer(player));
|
||||||
@Override
|
|
||||||
public void run(Object value) {
|
|
||||||
plot.teleportPlayer(player);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class Rollback extends FaweCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final FawePlayer player, final String... args) {
|
public boolean execute(FawePlayer player, String... args) {
|
||||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||||
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
|
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
|
||||||
return false;
|
return false;
|
||||||
@ -50,12 +50,11 @@ public class Rollback extends FaweCommand {
|
|||||||
}
|
}
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
switch (args[0]) {
|
switch (args[0]) {
|
||||||
default: {
|
default:
|
||||||
BBC.COMMAND_SYNTAX.send(player, "/frb info u:<uuid> r:<radius> t:<time>");
|
BBC.COMMAND_SYNTAX.send(player, "/frb info u:<uuid> r:<radius> t:<time>");
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
case "i":
|
case "i":
|
||||||
case "info": {
|
case "info":
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
||||||
return false;
|
return false;
|
||||||
@ -88,16 +87,15 @@ public class Rollback extends FaweCommand {
|
|||||||
player.sendMessage("&8 - &7(" + percentString + ")");
|
player.sendMessage("&8 - &7(" + percentString + ")");
|
||||||
}
|
}
|
||||||
player.sendMessage("&d==================================================");
|
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("&dTo rollback: /frb undo");
|
||||||
player.sendMessage("&d==================================================");
|
player.sendMessage("&d==================================================");
|
||||||
player.setMeta(FawePlayer.METADATA_KEYS.ROLLBACK, edits);
|
player.setMeta(FawePlayer.METADATA_KEYS.ROLLBACK, edits);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case "undo":
|
case "undo":
|
||||||
case "revert": {
|
case "revert":
|
||||||
if (!player.hasPermission("fawe.rollback.perform")) {
|
if (!player.hasPermission("fawe.rollback.perform")) {
|
||||||
BBC.NO_PERM.send(player, "fawe.rollback.perform");
|
BBC.NO_PERM.send(player, "fawe.rollback.perform");
|
||||||
return false;
|
return false;
|
||||||
@ -124,12 +122,11 @@ public class Rollback extends FaweCommand {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
task.run();
|
task.run();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
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;
|
UUID user = null;
|
||||||
int radius = Integer.MAX_VALUE;
|
int radius = Integer.MAX_VALUE;
|
||||||
long time = Long.MAX_VALUE;
|
long time = Long.MAX_VALUE;
|
||||||
@ -142,7 +139,7 @@ public class Rollback extends FaweCommand {
|
|||||||
switch (split[0].toLowerCase()) {
|
switch (split[0].toLowerCase()) {
|
||||||
case "username":
|
case "username":
|
||||||
case "user":
|
case "user":
|
||||||
case "u": {
|
case "u":
|
||||||
try {
|
try {
|
||||||
if (split[1].length() > 16) {
|
if (split[1].length() > 16) {
|
||||||
user = UUID.fromString(split[1]);
|
user = UUID.fromString(split[1]);
|
||||||
@ -156,25 +153,21 @@ public class Rollback extends FaweCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case "r":
|
case "r":
|
||||||
case "radius": {
|
case "radius":
|
||||||
if (!MathMan.isInteger(split[1])) {
|
if (!MathMan.isInteger(split[1])) {
|
||||||
player.sendMessage("&dInvalid radius: " + split[1]);
|
player.sendMessage("&dInvalid radius: " + split[1]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
radius = Integer.parseInt(split[1]);
|
radius = Integer.parseInt(split[1]);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case "t":
|
case "t":
|
||||||
case "time": {
|
case "time":
|
||||||
time = MainUtil.timeToSec(split[1]) * 1000;
|
time = MainUtil.timeToSec(split[1]) * 1000;
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
default: {
|
|
||||||
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
BBC.COMMAND_SYNTAX.send(player, "/frb <info|undo> u:<uuid> r:<radius> t:<time>");
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Location origin = player.getLocation();
|
Location origin = player.getLocation();
|
||||||
|
@ -14,7 +14,6 @@ import com.boydti.fawe.util.TaskManager;
|
|||||||
import com.boydti.fawe.util.WEManager;
|
import com.boydti.fawe.util.WEManager;
|
||||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||||
import com.boydti.fawe.wrappers.PlayerWrapper;
|
import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.EmptyClipboardException;
|
import com.sk89q.worldedit.EmptyClipboardException;
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
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.util.Location;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public abstract class FawePlayer<T> extends Metadatable {
|
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) {
|
private void setConfirmTask(@NotNull Runnable task, InjectedValueAccess context, String command) {
|
||||||
CommandEvent event = new CommandEvent(getPlayer(), command);
|
CommandEvent event = new CommandEvent(getPlayer(), command);
|
||||||
if (task != null) {
|
Runnable newTask = () -> PlatformCommandManager.getInstance().handleCommandTask(() -> {
|
||||||
Runnable newTask = () -> PlatformCommandManager.getInstance().handleCommandTask(() -> {
|
task.run();
|
||||||
task.run();
|
return null;
|
||||||
return null;
|
}, context, getPlayer(), getSession(), event);
|
||||||
}, context, getPlayer(), getSession(), event);
|
setMeta("cmdConfirm", newTask);
|
||||||
setMeta("cmdConfirm", newTask);
|
|
||||||
} else {
|
|
||||||
setMeta("cmdConfirm", event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkConfirmation(@NotNull Runnable task, String command, int times, int limit, InjectedValueAccess context) throws RegionOperationException {
|
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;
|
package com.boydti.fawe.object.brush;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
||||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
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.ExpressionException;
|
||||||
import com.sk89q.worldedit.internal.expression.runtime.Constant;
|
import com.sk89q.worldedit.internal.expression.runtime.Constant;
|
||||||
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -27,8 +28,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
public class BrushSettings {
|
public class BrushSettings {
|
||||||
public enum SettingType {
|
public enum SettingType {
|
||||||
BRUSH,
|
BRUSH,
|
||||||
@ -64,10 +63,7 @@ public class BrushSettings {
|
|||||||
if (constructor == null) {
|
if (constructor == null) {
|
||||||
return new BrushSettings();
|
return new BrushSettings();
|
||||||
}
|
}
|
||||||
String[] split = constructor.split(" ");
|
BrushSettings bs = (BrushSettings) manager.parseArgs(constructor);
|
||||||
|
|
||||||
String args = constructor.replaceAll(split[0] + "[ ]?", "");
|
|
||||||
BrushSettings bs = (BrushSettings) manager.parse(Brush.class, args, player);
|
|
||||||
bs.constructor.put(SettingType.BRUSH, constructor);
|
bs.constructor.put(SettingType.BRUSH, constructor);
|
||||||
if (settings.containsKey(SettingType.PERMISSIONS.name())) {
|
if (settings.containsKey(SettingType.PERMISSIONS.name())) {
|
||||||
bs.permissions.addAll((Collection<? extends String>) settings.get(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.io.InputStream;
|
||||||
import java.util.HashSet;
|
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 size2;
|
||||||
public int size;
|
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 x = 0; x < width; x++) {
|
||||||
for (int z = 0; z < length; z++) {
|
for (int z = 0; z < length; z++) {
|
||||||
int pixel = heightFile.getRGB(x, z);
|
int pixel = heightFile.getRGB(x, z);
|
||||||
int red = (pixel >> 16) & 0xFF;
|
int red = pixel >> 16 & 0xFF;
|
||||||
int green = (pixel >> 8) & 0xFF;
|
int green = pixel >> 8 & 0xFF;
|
||||||
int blue = (pixel >> 0) & 0xFF;
|
int blue = pixel >> 0 & 0xFF;
|
||||||
int alpha = (pixel >> 24) & 0xFF;
|
int alpha = pixel >> 24 & 0xFF;
|
||||||
int intensity = (int) (alpha * ((red + green + blue) * third) * alphaInverse);
|
int intensity = (int) (alpha * ((red + green + blue) * third) * alphaInverse);
|
||||||
array[x][z] = (byte) intensity;
|
array[x][z] = (byte) intensity;
|
||||||
}
|
}
|
||||||
|
@ -11,21 +11,21 @@ public enum Perm {
|
|||||||
public String s;
|
public String s;
|
||||||
public String cat;
|
public String cat;
|
||||||
|
|
||||||
Perm(final String perm, final String cat) {
|
Perm(String perm, String cat) {
|
||||||
this.s = perm;
|
this.s = perm;
|
||||||
this.cat = cat;
|
this.cat = cat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean has(final FawePlayer<?> player) {
|
public boolean has(FawePlayer<?> player) {
|
||||||
return this.hasPermission(player, this);
|
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);
|
return hasPermission(player, perm.s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasPermission(final FawePlayer<?> player, final String perm) {
|
public static boolean hasPermission(FawePlayer<?> player, String perm) {
|
||||||
if ((player == null) || player.hasPermission(ADMIN.s)) {
|
if (player == null || player.hasPermission(ADMIN.s)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (player.hasPermission(perm)) {
|
if (player.hasPermission(perm)) {
|
||||||
@ -33,8 +33,8 @@ public enum Perm {
|
|||||||
}
|
}
|
||||||
final String[] nodes = perm.split("\\.");
|
final String[] nodes = perm.split("\\.");
|
||||||
final StringBuilder n = new StringBuilder();
|
final StringBuilder n = new StringBuilder();
|
||||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
for (int i = 0; i < nodes.length - 1; i++) {
|
||||||
n.append(nodes[i] + ("."));
|
n.append(nodes[i]).append(".");
|
||||||
if (player.hasPermission(n + "*")) {
|
if (player.hasPermission(n + "*")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class RandomTextureUtil extends CachedTextureUtil {
|
|||||||
|
|
||||||
private int random(int i) {
|
private int random(int i) {
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
int i1 = (-i);
|
int i1 = -i;
|
||||||
return -ThreadLocalRandom.current().nextInt(i1);
|
return -ThreadLocalRandom.current().nextInt(i1);
|
||||||
} else {
|
} else {
|
||||||
return ThreadLocalRandom.current().nextInt(i);
|
return ThreadLocalRandom.current().nextInt(i);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.util;
|
package com.boydti.fawe.util;
|
||||||
|
|
||||||
import com.sk89q.util.StringUtil;
|
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -10,17 +8,17 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.IntConsumer;
|
import java.util.stream.Collectors;
|
||||||
import java.util.function.IntFunction;
|
import java.util.stream.IntStream;
|
||||||
import java.util.function.Predicate;
|
|
||||||
|
|
||||||
public class StringMan {
|
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);
|
final StringBuilder sb = new StringBuilder(string);
|
||||||
int size = string.length();
|
int size = string.length();
|
||||||
for (final Entry<String, String> entry : replacements.entrySet()) {
|
for (Entry<String, String> entry : replacements.entrySet()) {
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -122,7 +120,6 @@ public class StringMan {
|
|||||||
boolean neg = false;
|
boolean neg = false;
|
||||||
int numIndex = 1;
|
int numIndex = 1;
|
||||||
int len = string.length();
|
int len = string.length();
|
||||||
outer:
|
|
||||||
for (int i = len - 1; i >= 0; i--) {
|
for (int i = len - 1; i >= 0; i--) {
|
||||||
char c = string.charAt(i);
|
char c = string.charAt(i);
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@ -138,10 +135,10 @@ public class StringMan {
|
|||||||
return val;
|
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);
|
final StringBuilder sb = new StringBuilder(string);
|
||||||
int size = string.length();
|
int size = string.length();
|
||||||
for (final String key : replacements) {
|
for (String key : replacements) {
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -178,8 +175,9 @@ public class StringMan {
|
|||||||
boolean inQuotes = false;
|
boolean inQuotes = false;
|
||||||
for (int current = 0; current < input.length(); current++) {
|
for (int current = 0; current < input.length(); current++) {
|
||||||
char currentChar = input.charAt(current);
|
char currentChar = input.charAt(current);
|
||||||
boolean atLastChar = (current == input.length() - 1);
|
boolean atLastChar = current == input.length() - 1;
|
||||||
if (!atLastChar && (bracket > 0 || (currentChar == '{' && ++bracket > 0) || (current == '}' && --bracket <= 0)))
|
if (!atLastChar && (bracket > 0 || currentChar == '{' && ++bracket > 0
|
||||||
|
|| current == '}' && --bracket <= 0))
|
||||||
continue;
|
continue;
|
||||||
if (currentChar == '\"') inQuotes = !inQuotes; // toggle state
|
if (currentChar == '\"') inQuotes = !inQuotes; // toggle state
|
||||||
if (atLastChar) result.add(input.substring(start));
|
if (atLastChar) result.add(input.substring(start));
|
||||||
@ -195,9 +193,9 @@ public class StringMan {
|
|||||||
return result;
|
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;
|
int count = 0;
|
||||||
for (final String check : toCheck) {
|
for (String check : toCheck) {
|
||||||
if (options.contains(check)) {
|
if (options.contains(check)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -213,7 +211,7 @@ public class StringMan {
|
|||||||
return String.format("%1$" + n + "s", s);
|
return String.format("%1$" + n + "s", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getString(final Object obj) {
|
public static String getString(Object obj) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return "null";
|
return "null";
|
||||||
}
|
}
|
||||||
@ -221,18 +219,18 @@ public class StringMan {
|
|||||||
return (String) obj;
|
return (String) obj;
|
||||||
}
|
}
|
||||||
if (obj.getClass().isArray()) {
|
if (obj.getClass().isArray()) {
|
||||||
String result = "";
|
StringBuilder result = new StringBuilder();
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
|
|
||||||
for (int i = 0; i < Array.getLength(obj); i++) {
|
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 = ",";
|
prefix = ",";
|
||||||
}
|
}
|
||||||
return "{ " + result + " }";
|
return "{ " + result + " }";
|
||||||
} else if (obj instanceof Collection<?>) {
|
} else if (obj instanceof Collection<?>) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
for (final Object element : (Collection<?>) obj) {
|
for (Object element : (Collection<?>) obj) {
|
||||||
result.append(prefix).append(getString(element));
|
result.append(prefix).append(getString(element));
|
||||||
prefix = ",";
|
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) {
|
if (s == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -253,8 +251,8 @@ public class StringMan {
|
|||||||
final char[] newChars = new char[chars.length];
|
final char[] newChars = new char[chars.length];
|
||||||
int used = 0;
|
int used = 0;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (final char cc : chars) {
|
for (char cc : chars) {
|
||||||
if (!found && (c == cc)) {
|
if (!found && c == cc) {
|
||||||
found = true;
|
found = true;
|
||||||
} else {
|
} else {
|
||||||
newChars[used++] = cc;
|
newChars[used++] = cc;
|
||||||
@ -268,7 +266,7 @@ public class StringMan {
|
|||||||
return s;
|
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);
|
final StringBuilder sb = new StringBuilder(string);
|
||||||
for (int i = 0; i < pairs.length; i += 2) {
|
for (int i = 0; i < pairs.length; i += 2) {
|
||||||
final String key = pairs[i] + "";
|
final String key = pairs[i] + "";
|
||||||
@ -284,56 +282,57 @@ public class StringMan {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAlphanumeric(final String str) {
|
public static boolean isAlphanumeric(String str) {
|
||||||
for (int i = 0; i < str.length(); i++) {
|
for (int i = 0; i < str.length(); i++) {
|
||||||
final char c = str.charAt(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 false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAlphanumericUnd(final CharSequence str) {
|
public static boolean isAlphanumericUnd(CharSequence str) {
|
||||||
for (int i = 0; i < str.length(); i++) {
|
for (int i = 0; i < str.length(); i++) {
|
||||||
final char c = str.charAt(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 false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAlpha(final String str) {
|
public static boolean isAlpha(String str) {
|
||||||
for (int i = 0; i < str.length(); i++) {
|
for (int i = 0; i < str.length(); i++) {
|
||||||
final char c = str.charAt(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 false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
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);
|
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();
|
final Object[] array = collection.toArray();
|
||||||
Arrays.sort(array, Comparator.comparingInt(Object::hashCode));
|
Arrays.sort(array, Comparator.comparingInt(Object::hashCode));
|
||||||
return join(array, delimiter);
|
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 + "");
|
return join(collection.toArray(), delimiter + "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAsciiPrintable(final char c) {
|
public static boolean isAsciiPrintable(char c) {
|
||||||
return (c >= ' ') && (c < '');
|
return c >= ' ' && c < '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAsciiPrintable(final String s) {
|
public static boolean isAsciiPrintable(String s) {
|
||||||
for (final char c : s.toCharArray()) {
|
for (char c : s.toCharArray()) {
|
||||||
if (!isAsciiPrintable(c)) {
|
if (!isAsciiPrintable(c)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -427,7 +426,7 @@ public class StringMan {
|
|||||||
return p[n];
|
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();
|
final StringBuilder result = new StringBuilder();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (T obj : arr) {
|
for (T obj : arr) {
|
||||||
@ -440,7 +439,7 @@ public class StringMan {
|
|||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String join(final Object[] array, final String delimiter) {
|
public static String join(Object[] array, String delimiter) {
|
||||||
switch (array.length) {
|
switch (array.length) {
|
||||||
case 0:
|
case 0:
|
||||||
return "";
|
return "";
|
||||||
@ -489,16 +488,13 @@ public class StringMan {
|
|||||||
return negative ? -value : value;
|
return negative ? -value : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String join(final int[] array, final String delimiter) {
|
public static String join(int[] array, String delimiter) {
|
||||||
final Integer[] wrapped = new Integer[array.length];
|
final Integer[] wrapped = Arrays.stream(array).boxed().toArray(Integer[]::new);
|
||||||
for (int i = 0; i < array.length; i++) {
|
|
||||||
wrapped[i] = array[i];
|
|
||||||
}
|
|
||||||
return join(wrapped, delimiter);
|
return join(wrapped, delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEqualToAny(final String a, final String... args) {
|
public static boolean isEqualToAny(String a, String... args) {
|
||||||
for (final String arg : args) {
|
for (String arg : args) {
|
||||||
if (StringMan.isEqual(a, arg)) {
|
if (StringMan.isEqual(a, arg)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -506,8 +502,8 @@ public class StringMan {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEqualIgnoreCaseToAny(final String a, final String... args) {
|
public static boolean isEqualIgnoreCaseToAny(String a, String... args) {
|
||||||
for (final String arg : args) {
|
for (String arg : args) {
|
||||||
if (StringMan.isEqualIgnoreCase(a, arg)) {
|
if (StringMan.isEqualIgnoreCase(a, arg)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -515,15 +511,17 @@ public class StringMan {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEqual(final String a, final String 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)));
|
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)));
|
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();
|
final StringBuilder sb = new StringBuilder();
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
sb.append(s);
|
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 {
|
try {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
synchronized (running) {
|
synchronized (running) {
|
||||||
while (running.get()) {
|
while (running.get()) {
|
||||||
running.wait(timout);
|
running.wait(timeout);
|
||||||
if (running.get() && System.currentTimeMillis() - start > Settings.IMP.QUEUE.DISCARD_AFTER_MS) {
|
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();
|
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");
|
Fawe.debug("For full debug information use: /fawe threads");
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.boydti.fawe.util.image;
|
package com.boydti.fawe.util.image;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.command.FawePrimitiveBinding;
|
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.MathMan;
|
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 javax.annotation.Nullable;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
@ -161,19 +161,19 @@ public class ImageUtil {
|
|||||||
return (alpha << 24) + (red << 16) + (green << 8) + (blue << 0);
|
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();
|
return uri == null ? null : uri.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BufferedImage load(URI uri) throws ParameterException {
|
public static BufferedImage load(URI uri) throws InputParseException {
|
||||||
try {
|
try {
|
||||||
return MainUtil.readImage(getInputStream(uri));
|
return MainUtil.readImage(getInputStream(uri));
|
||||||
} catch (IOException e) {
|
} 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 {
|
try {
|
||||||
String uriStr = uri.toString();
|
String uriStr = uri.toString();
|
||||||
if (uriStr.startsWith("file:/")) {
|
if (uriStr.startsWith("file:/")) {
|
||||||
@ -182,11 +182,11 @@ public class ImageUtil {
|
|||||||
}
|
}
|
||||||
return new URL(uriStr).openStream();
|
return new URL(uriStr).openStream();
|
||||||
} catch (IOException e) {
|
} 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 {
|
try {
|
||||||
if (arg.startsWith("http")) {
|
if (arg.startsWith("http")) {
|
||||||
if (arg.contains("imgur.com") && !arg.contains("i.imgur.com")) {
|
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);
|
File file = MainUtil.getFile(MainUtil.getFile(Fawe.imp().getDirectory(), com.boydti.fawe.config.Settings.IMP.PATHS.HEIGHTMAP), arg);
|
||||||
return MainUtil.readImage(file);
|
return MainUtil.readImage(file);
|
||||||
} else {
|
} else {
|
||||||
throw new ParameterException("Invalid image " + arg);
|
throw new InputParseException("Invalid image " + arg);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} 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 {
|
try {
|
||||||
if (arg.startsWith("http")) {
|
if (arg.startsWith("http")) {
|
||||||
if (arg.contains("imgur.com") && !arg.contains("i.imgur.com")) {
|
if (arg.contains("imgur.com") && !arg.contains("i.imgur.com")) {
|
||||||
@ -221,17 +221,17 @@ public class ImageUtil {
|
|||||||
arg = arg.replaceFirst("file:/+", "");
|
arg = arg.replaceFirst("file:/+", "");
|
||||||
File file = MainUtil.getFile(MainUtil.getFile(Fawe.imp().getDirectory(), com.boydti.fawe.config.Settings.IMP.PATHS.HEIGHTMAP), arg);
|
File file = MainUtil.getFile(MainUtil.getFile(Fawe.imp().getDirectory(), com.boydti.fawe.config.Settings.IMP.PATHS.HEIGHTMAP), arg);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
throw new ParameterException("File not found " + file);
|
throw new InputParseException("File not found " + file);
|
||||||
}
|
}
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
throw new ParameterException("File is a directory " + file);
|
throw new InputParseException("File is a directory " + file);
|
||||||
}
|
}
|
||||||
return file.toURI();
|
return file.toURI();
|
||||||
} else {
|
} else {
|
||||||
throw new ParameterException("Invalid image " + arg);
|
throw new InputParseException("Invalid image " + arg);
|
||||||
}
|
}
|
||||||
} catch (IOException | URISyntaxException e) {
|
} catch (IOException | URISyntaxException e) {
|
||||||
throw new ParameterException(e);
|
throw new InputParseException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,26 @@
|
|||||||
package com.boydti.fawe.web;
|
package com.boydti.fawe.web;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.config.BBC;
|
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.exception.FaweException;
|
import com.boydti.fawe.object.exception.FaweException;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.command.UtilityCommands;
|
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.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class SchemSync implements Runnable {
|
public class SchemSync implements Runnable {
|
||||||
|
|
||||||
private final static char PORT = 62522;
|
private final static char PORT = 62522;
|
||||||
|
|
||||||
private final File tokensFile;
|
private final File tokensFile;
|
||||||
@ -38,7 +41,8 @@ public class SchemSync implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SchemSync() {
|
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();
|
this.worldEdit = WorldEdit.getInstance();
|
||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
LocalConfiguration config = worldEdit.getConfiguration();
|
||||||
this.working = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
this.working = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
||||||
@ -60,33 +64,39 @@ public class SchemSync implements Runnable {
|
|||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
try {
|
try {
|
||||||
byte[] header = new byte[32];
|
byte[] header = new byte[32];
|
||||||
try (ServerSocket serverSocket = this.serverSocket = new ServerSocket(PORT)){
|
try (ServerSocket serverSocket = this.serverSocket = new ServerSocket(PORT)) {
|
||||||
while (!Thread.interrupted()) {
|
while (!Thread.interrupted()) {
|
||||||
try {
|
try {
|
||||||
try (Socket clientSocket = this.clientSocket = serverSocket.accept()){
|
try (Socket clientSocket = this.clientSocket = serverSocket.accept()) {
|
||||||
try (InputStream in = clientSocket.getInputStream()) {
|
try (InputStream in = clientSocket.getInputStream()) {
|
||||||
int read = in.read(header);
|
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);
|
ByteBuffer buf = ByteBuffer.wrap(header);
|
||||||
UUID uuid = new UUID(buf.getLong(), buf.getLong());
|
UUID uuid = new UUID(buf.getLong(), buf.getLong());
|
||||||
UUID expectedToken = tokens.get(uuid);
|
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());
|
UUID receivedToken = new UUID(buf.getLong(), buf.getLong());
|
||||||
if (!receivedToken.equals(expectedToken)) continue;
|
if (!receivedToken.equals(expectedToken)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try (DataInputStream dis = new DataInputStream(in)) {
|
try (DataInputStream dis = new DataInputStream(in)) {
|
||||||
File dir = new File(working, uuid.toString());
|
File dir = new File(working, uuid.toString());
|
||||||
|
|
||||||
int data = dis.readByte() & 0xFF;
|
int data = dis.readByte() & 0xFF;
|
||||||
switch (data) {
|
switch (data) {
|
||||||
case 0: {// list
|
case 0: // list
|
||||||
try (DataOutputStream out = new DataOutputStream(clientSocket.getOutputStream())) {
|
try (DataOutputStream out = new DataOutputStream(
|
||||||
|
clientSocket.getOutputStream())) {
|
||||||
out.write(1);
|
out.write(1);
|
||||||
UtilityCommands.allFiles(dir.listFiles(), true, new Consumer<File>() {
|
UtilityCommands.allFiles(dir.listFiles(), true,
|
||||||
@Override
|
file -> {
|
||||||
public void accept(File file) {
|
|
||||||
try {
|
try {
|
||||||
String path = dir.toURI()
|
String path = dir.toURI()
|
||||||
.relativize(file.toURI()).getPath();
|
.relativize(file.toURI()).getPath();
|
||||||
@ -94,12 +104,10 @@ public class SchemSync implements Runnable {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
case 1: // get
|
||||||
case 1: {// get
|
|
||||||
String input = dis.readUTF();
|
String input = dis.readUTF();
|
||||||
File file = new File(dir, input);
|
File file = new File(dir, input);
|
||||||
if (!MainUtil.isInSubDirectory(dir, file)) {
|
if (!MainUtil.isInSubDirectory(dir, file)) {
|
||||||
@ -110,12 +118,12 @@ public class SchemSync implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo send file
|
// todo send file
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (FaweException ignore) {}
|
} catch (FaweException ignore) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -26,6 +26,8 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class CommandContext {
|
public class CommandContext {
|
||||||
|
|
||||||
@ -254,11 +256,8 @@ public class CommandContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getString(int start, int end) {
|
public String getString(int start, int end) {
|
||||||
StringBuilder buffer = new StringBuilder(parsedArgs.get(start));
|
return IntStream.range(start + 1, end + 1).mapToObj(i -> " " + parsedArgs.get(i))
|
||||||
for (int i = start + 1; i < end + 1; ++i) {
|
.collect(Collectors.joining("", parsedArgs.get(start), ""));
|
||||||
buffer.append(" ").append(parsedArgs.get(i));
|
|
||||||
}
|
|
||||||
return buffer.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInteger(int index) throws NumberFormatException {
|
public int getInteger(int index) throws NumberFormatException {
|
||||||
|
@ -20,9 +20,6 @@
|
|||||||
package com.sk89q.minecraft.util.commands;
|
package com.sk89q.minecraft.util.commands;
|
||||||
|
|
||||||
import com.sk89q.util.StringUtil;
|
import com.sk89q.util.StringUtil;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
@ -33,6 +30,9 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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,
|
* 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;
|
package com.sk89q.worldedit.command;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.command.FawePrimitiveBinding;
|
import com.boydti.fawe.command.FawePrimitiveBinding;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
@ -65,6 +67,7 @@ import com.sk89q.worldedit.EmptyClipboardException;
|
|||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
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.BrushTool;
|
||||||
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
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.GravityBrush;
|
||||||
import com.sk89q.worldedit.command.tool.brush.HollowCylinderBrush;
|
import com.sk89q.worldedit.command.tool.brush.HollowCylinderBrush;
|
||||||
import com.sk89q.worldedit.command.tool.brush.HollowSphereBrush;
|
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.SmoothBrush;
|
||||||
import com.sk89q.worldedit.command.tool.brush.SphereBrush;
|
import com.sk89q.worldedit.command.tool.brush.SphereBrush;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
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.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||||
|
import com.sk89q.worldedit.function.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.ExistingBlockMask;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.mask.SingleBlockTypeMask;
|
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.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.internal.annotation.Range;
|
import com.sk89q.worldedit.internal.annotation.Range;
|
||||||
import com.sk89q.worldedit.internal.expression.Expression;
|
import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
|
import com.sk89q.worldedit.regions.factory.RegionFactory;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
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.BlockID;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import org.enginehub.piston.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.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -113,9 +116,13 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import org.enginehub.piston.annotation.Command;
|
||||||
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
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.
|
* Commands to set brush shape.
|
||||||
@ -191,13 +198,15 @@ public class BrushCommands extends MethodCommands {
|
|||||||
aliases = {"recurse", "r"},
|
aliases = {"recurse", "r"},
|
||||||
desc = "Set all connected blocks",
|
desc = "Set all connected blocks",
|
||||||
descFooter = "Set all connected blocks\n" +
|
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"
|
"Note: Set a mask to recurse along specific blocks"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.recursive")
|
@CommandPermissions("worldedit.brush.recursive")
|
||||||
public BrushSettings recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
|
public BrushSettings recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill,
|
||||||
@Arg(desc = "The radius to sample for blending", def = "5")
|
@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);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
return set(session, context,
|
return set(session, context,
|
||||||
new RecurseBrush(depthFirst))
|
new RecurseBrush(depthFirst))
|
||||||
@ -210,15 +219,17 @@ public class BrushCommands extends MethodCommands {
|
|||||||
name = "line",
|
name = "line",
|
||||||
aliases = {"l"},
|
aliases = {"l"},
|
||||||
desc = "Create lines",
|
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")
|
@CommandPermissions("worldedit.brush.line")
|
||||||
public BrushSettings lineBrush(Player player, LocalSession session, Pattern fill,
|
public BrushSettings lineBrush(Player player, LocalSession session, Pattern fill,
|
||||||
@Arg(desc = "The radius to sample for blending", def = "0")
|
@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);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
return set(session, context,
|
return set(session, context,
|
||||||
new LineBrush(shell, select, flat))
|
new LineBrush(shell, select, flat))
|
||||||
@ -265,17 +276,19 @@ public class BrushCommands extends MethodCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "catenary",
|
name = "catenary",
|
||||||
aliases = {"cat", "gravityline", "saggedline"},
|
aliases = {"cat", "gravityline", "saggedline"},
|
||||||
desc = "Create a hanging line between two points",
|
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"
|
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.spline")
|
@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,
|
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")
|
@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);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
Brush brush = new CatenaryBrush(shell, select, facingDirection, lengthFactor);
|
Brush brush = new CatenaryBrush(shell, select, facingDirection, lengthFactor);
|
||||||
return set(session, context,
|
return set(session, context,
|
||||||
@ -384,18 +397,16 @@ public class BrushCommands extends MethodCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "stencil",
|
name = "stencil",
|
||||||
desc = "Use a height map to paint a surface",
|
desc = "Use a height map to paint a surface",
|
||||||
descFooter = "Use a height map to paint any surface.\n" +
|
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"
|
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.stencil")
|
@CommandPermissions("worldedit.brush.stencil")
|
||||||
public BrushSettings stencilBrush(Player player, LocalSession session, Pattern fill,
|
public BrushSettings stencilBrush(Player player, LocalSession session, Pattern fill,
|
||||||
@Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
@Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||||
@Arg(name = "image", desc = "String", def = "") String image,
|
@Arg(name = "image", desc = "String", def = "") String image,
|
||||||
@Arg(def = "0", desc = "rotation") @Step(90) @Range(min=0, max=360) final int rotation,
|
@Arg(def = "0", desc = "rotation") @Range(min=0, max=360) int rotation,
|
||||||
@Arg(name = "yscale", desc = "double", def = "1") final double yscale,
|
@Arg(name = "yscale", desc = "double", def = "1") double yscale,
|
||||||
@Switch(name='w', desc = "TODO") boolean onlyWhite,
|
@Switch(name='w', desc = "Apply at maximum saturation") boolean onlyWhite,
|
||||||
@Switch(name='r', desc = "TODO") boolean randomRotate,
|
@Switch(name='r', desc = "Apply random rotation") boolean randomRotate,
|
||||||
InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
InjectedValueAccess context) throws WorldEditException, FileNotFoundException {
|
||||||
worldEdit.checkMaxBrushRadius(radius);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
InputStream stream = getHeightmapStream(image);
|
InputStream stream = getHeightmapStream(image);
|
||||||
@ -418,16 +429,13 @@ public class BrushCommands extends MethodCommands {
|
|||||||
name = "image",
|
name = "image",
|
||||||
aliases = {"color"},
|
aliases = {"color"},
|
||||||
desc = "Use a height map to paint a surface",
|
desc = "Use a height map to paint a surface",
|
||||||
descFooter = "Use a height map to paint any surface.\n" +
|
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"
|
|
||||||
)
|
|
||||||
@CommandPermissions("worldedit.brush.stencil")
|
@CommandPermissions("worldedit.brush.stencil")
|
||||||
public BrushSettings imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
public BrushSettings imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius,
|
||||||
FawePrimitiveBinding.ImageUri imageUri,
|
FawePrimitiveBinding.ImageUri imageUri,
|
||||||
@Arg(def = "1", desc = "scale height") @Range(min=Double.MIN_NORMAL) final double yscale,
|
@Arg(def = "1", desc = "scale height") @Range(min=Double.MIN_NORMAL) double yscale,
|
||||||
@Switch(name='a', desc = "TODO") boolean alpha,
|
@Switch(name='a', desc = "Use image Alpha") boolean alpha,
|
||||||
@Switch(name='f', desc = "TODO") boolean fadeOut,
|
@Switch(name='f', desc = "Blend the image with existing terrain") boolean fadeOut,
|
||||||
InjectedValueAccess context) throws WorldEditException, IOException {
|
InjectedValueAccess context) throws WorldEditException, IOException {
|
||||||
BufferedImage image = imageUri.load();
|
BufferedImage image = imageUri.load();
|
||||||
worldEdit.checkMaxBrushRadius(radius);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
@ -454,7 +462,10 @@ public class BrushCommands extends MethodCommands {
|
|||||||
"The -r flag will apply random rotation"
|
"The -r flag will apply random rotation"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.surface")
|
@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);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
return set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
|
return set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
|
||||||
}
|
}
|
||||||
@ -504,8 +515,7 @@ public class BrushCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return set(session, context,
|
return set(session, context,
|
||||||
new PopulateSchem(mask, holders, (int) density, rotate))
|
new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius);
|
||||||
.setSize(radius);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -521,9 +531,7 @@ public class BrushCommands extends MethodCommands {
|
|||||||
@CommandPermissions("worldedit.brush.layer")
|
@CommandPermissions("worldedit.brush.layer")
|
||||||
public BrushSettings surfaceLayer(LocalSession session, Expression radius, List<BlockState> layers, InjectedValueAccess context) throws WorldEditException {
|
public BrushSettings surfaceLayer(LocalSession session, Expression radius, List<BlockState> layers, InjectedValueAccess context) throws WorldEditException {
|
||||||
worldEdit.checkMaxBrushRadius(radius);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
return set(session, context,
|
return set(session, context, new LayerBrush(layers.toArray(new BlockState[0]))).setSize(radius);
|
||||||
new LayerBrush(layers.toArray(new BlockState[0])))
|
|
||||||
.setSize(radius);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -537,10 +545,7 @@ public class BrushCommands extends MethodCommands {
|
|||||||
@CommandPermissions("worldedit.brush.splatter")
|
@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 {
|
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);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
return set(session, context,
|
return set(session, context, new SplatterBrush((int) points, (int) recursion, solid)).setSize(radius).setFill(fill);
|
||||||
new SplatterBrush((int) points, (int) recursion, solid))
|
|
||||||
.setSize(radius)
|
|
||||||
.setFill(fill);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -596,7 +601,6 @@ public class BrushCommands extends MethodCommands {
|
|||||||
aliases = { "copy" },
|
aliases = { "copy" },
|
||||||
desc = "Choose the clipboard brush (Recommended: `/br copypaste`)",
|
desc = "Choose the clipboard brush (Recommended: `/br copypaste`)",
|
||||||
descFooter = "Chooses the clipboard brush.\n" +
|
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. " +
|
"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 " +
|
"With the flag, then the paste will appear relative to where you had " +
|
||||||
"stood relative to the copied area when you copied it."
|
"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"
|
"Snow Pic: https://i.imgur.com/Hrzn0I4.png"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.height")
|
@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);
|
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"
|
" - The `-s` flag disables smoothing"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.height")
|
@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);
|
return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "flatten",
|
name = "flatten",
|
||||||
aliases = {"flatmap", "flat"},
|
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"
|
desc = "This brush raises or lowers land towards the clicked point"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.height")
|
@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);
|
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 {
|
private InputStream getHeightmapStream(String filename) throws FileNotFoundException {
|
||||||
if (filename == null) return null;
|
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);
|
File file = new File(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HEIGHTMAP + File.separator + filenamePng);
|
||||||
if (file.exists()) return new FileInputStream(file);
|
if (file.exists()) return new FileInputStream(file);
|
||||||
URI uri = ImageUtil.getImageURI(filename);
|
URI uri = ImageUtil.getImageURI(filename);
|
||||||
@ -773,13 +779,11 @@ public class BrushCommands extends MethodCommands {
|
|||||||
desc = "Copy Paste brush",
|
desc = "Copy Paste brush",
|
||||||
descFooter = "Left click the base of an object to copy.\n" +
|
descFooter = "Left click the base of an object to copy.\n" +
|
||||||
"Right click to paste\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" +
|
"Note: Works well with the clipboard scroll action\n" +
|
||||||
"Video: https://www.youtube.com/watch?v=RPZIaTbqoZw"
|
"Video: https://www.youtube.com/watch?v=RPZIaTbqoZw"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.copy")
|
@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);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
player.print(BBC.BRUSH_COPY.f(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 {
|
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();
|
BrushSettings bs = new BrushSettings();
|
||||||
BrushTool tool = session.getBrushTool(plr, false);
|
BrushTool tool = session.getBrushTool(plr, false);
|
||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
@ -873,11 +878,65 @@ public class BrushCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String[] perms = getPermissions(context);
|
return bs;
|
||||||
bs.addPermissions(perms);
|
|
||||||
String args = getArguments(context);
|
|
||||||
bs.addSetting(BrushSettings.SettingType.BRUSH, args.substring(args.indexOf(' ') + 1));
|
|
||||||
return bs.setBrush(brush);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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.object.io.PGZIPOutputStream;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
|
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
import com.sk89q.worldedit.blocks.BaseItem;
|
||||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
@ -47,22 +50,24 @@ import java.util.zip.GZIPInputStream;
|
|||||||
* Tool commands.
|
* Tool commands.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@Command(aliases = {"brush", "br", "/b"}, desc = "Tool commands")
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
public class BrushOptionsCommands extends MethodCommands {
|
public class BrushOptionsCommands {
|
||||||
|
|
||||||
public BrushOptionsCommands(WorldEdit we) {
|
private WorldEdit worldEdit;
|
||||||
super(we);
|
|
||||||
|
public BrushOptionsCommands(WorldEdit worldEdit) {
|
||||||
|
this.worldEdit = worldEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "savebrush",
|
name = "savebrush",
|
||||||
aliases = {"save"},
|
aliases = {"save"},
|
||||||
desc = "Save your current brush",
|
desc = "Save your current brush",
|
||||||
descFooter = "Save your current brush\n" +
|
descFooter = "Save your current brush use the -g flag to save globally"
|
||||||
"use the -g flag to save globally"
|
)
|
||||||
)
|
|
||||||
@CommandPermissions("worldedit.brush.save")
|
@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);
|
BrushTool tool = session.getBrushTool(player);
|
||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
root |= name.startsWith("../");
|
root |= name.startsWith("../");
|
||||||
@ -80,7 +85,8 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
parent.mkdirs();
|
parent.mkdirs();
|
||||||
}
|
}
|
||||||
file.createNewFile();
|
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());
|
out.writeUTF(tool.toString());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -92,12 +98,13 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "loadbrush",
|
name = "loadbrush",
|
||||||
aliases = {"load"},
|
aliases = {"load"},
|
||||||
desc = "load a brush"
|
desc = "Load a brush"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.load")
|
@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();
|
name = FileSystems.getDefault().getPath(name).getFileName().toString();
|
||||||
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
||||||
name = name.endsWith(".jsgz") ? name : name + ".jsgz";
|
name = name.endsWith(".jsgz") ? name : name + ".jsgz";
|
||||||
@ -106,16 +113,12 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
file = new File(folder, name);
|
file = new File(folder, name);
|
||||||
}
|
}
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
File[] files = folder.listFiles(new FileFilter() {
|
File[] files = folder.listFiles(pathname -> false);
|
||||||
@Override
|
|
||||||
public boolean accept(File pathname) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
BBC.BRUSH_NOT_FOUND.send(player, name);
|
BBC.BRUSH_NOT_FOUND.send(player, name);
|
||||||
return;
|
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();
|
String json = in.readUTF();
|
||||||
BrushTool tool = BrushTool.fromString(player, session, json);
|
BrushTool tool = BrushTool.fromString(player, session, json);
|
||||||
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||||
@ -128,14 +131,15 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "/listbrush",
|
name = "/listbrush",
|
||||||
desc = "List saved brushes",
|
desc = "List saved brushes",
|
||||||
|
descFooter = "List all brushes in the brush directory\n" +
|
||||||
descFooter = "List all brushes in the brush directory\n" +
|
" -p <page> prints the requested page\n"
|
||||||
" -p <page> prints the requested page\n"
|
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.list")
|
@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");
|
String baseCmd = Commands.getAlias(BrushCommands.class, "brush") + " " + Commands.getAlias(BrushOptionsCommands.class, "loadbrush");
|
||||||
File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
||||||
UtilityCommands.list(dir, actor, args, page, null, true, baseCmd);
|
UtilityCommands.list(dir, actor, args, page, null, true, baseCmd);
|
||||||
@ -148,25 +152,25 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "none",
|
name = "none",
|
||||||
aliases = {"/none"},
|
aliases = {"/none"},
|
||||||
desc = "Unbind a bound tool from your current item"
|
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);
|
session.setTool(player, null);
|
||||||
BBC.TOOL_NONE.send(player);
|
BBC.TOOL_NONE.send(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "/",
|
name = "/",
|
||||||
aliases = {","},
|
aliases = {","},
|
||||||
desc = "Toggle the super pickaxe function"
|
desc = "Toggle the super pickaxe function"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.superpickaxe")
|
@CommandPermissions("worldedit.superpickaxe")
|
||||||
public void togglePickaxe(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
|
public void togglePickaxe(Player player, LocalSession session,
|
||||||
String newState = args.getString(0, null);
|
@Arg(desc = "state", def = "on") String state) throws WorldEditException {
|
||||||
if (session.hasSuperPickAxe()) {
|
if (session.hasSuperPickAxe()) {
|
||||||
if ("on".equals(newState)) {
|
if ("on".equals(state)) {
|
||||||
BBC.SUPERPICKAXE_ENABLED.send(player);
|
BBC.SUPERPICKAXE_ENABLED.send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -174,7 +178,7 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
session.disableSuperPickAxe();
|
session.disableSuperPickAxe();
|
||||||
BBC.SUPERPICKAXE_DISABLED.send(player);
|
BBC.SUPERPICKAXE_DISABLED.send(player);
|
||||||
} else {
|
} else {
|
||||||
if ("off".equals(newState)) {
|
if ("off".equals(state)) {
|
||||||
|
|
||||||
BBC.SUPERPICKAXE_DISABLED.send(player);
|
BBC.SUPERPICKAXE_DISABLED.send(player);
|
||||||
return;
|
return;
|
||||||
@ -185,54 +189,57 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "primary",
|
name = "primary",
|
||||||
desc = "Set the right click brush",
|
desc = "Set the right click brush",
|
||||||
descFooter = "Set the right click brush"
|
descFooter = "Set the right click brush"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.primary")
|
@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);
|
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||||
BrushTool tool = session.getBrushTool(player, false);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
session.setTool(item, null, player);
|
session.setTool(item, null, player);
|
||||||
String cmd = "brush " + args.getJoinedStrings(0);
|
String cmd = "brush " + args.getJoinedStrings(0);
|
||||||
CommandEvent event = new CommandEvent(player, cmd);
|
CommandEvent event = new CommandEvent(player, cmd);
|
||||||
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
||||||
BrushTool newTool = session.getBrushTool(item.getType(), player, false);
|
BrushTool newTool = session.getBrushTool(item, player, false);
|
||||||
if (newTool != null && tool != null) {
|
if (newTool != null && tool != null) {
|
||||||
newTool.setSecondary(tool.getSecondary());
|
newTool.setSecondary(tool.getSecondary());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "secondary",
|
name = "secondary",
|
||||||
desc = "Set the left click brush",
|
desc = "Set the left click brush",
|
||||||
descFooter = "Set the left click brush"
|
descFooter = "Set the left click brush"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.secondary")
|
@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);
|
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||||
BrushTool tool = session.getBrushTool(player, false);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
session.setTool(item, null, player);
|
session.setTool(item, null, player);
|
||||||
String cmd = "brush " + args.getJoinedStrings(0);
|
String cmd = "brush " + args.getJoinedStrings(0);
|
||||||
CommandEvent event = new CommandEvent(player, cmd);
|
CommandEvent event = new CommandEvent(player, cmd);
|
||||||
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
|
||||||
BrushTool newTool = session.getBrushTool(item.getType(), player, false);
|
BrushTool newTool = session.getBrushTool(item, player, false);
|
||||||
if (newTool != null && tool != null) {
|
if (newTool != null && tool != null) {
|
||||||
newTool.setPrimary(tool.getPrimary());
|
newTool.setPrimary(tool.getPrimary());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "visualize",
|
name = "visualize",
|
||||||
aliases = {"visual", "vis"},
|
aliases = {"visual", "vis"},
|
||||||
desc = "Toggle between different visualization modes",
|
desc = "Toggle between different visualization modes",
|
||||||
descFooter = "Toggle between different visualization modes\n" +
|
descFooter = "Toggle between different visualization modes\n" +
|
||||||
"0 = No visualization\n" +
|
"0 = No visualization\n" +
|
||||||
"1 = Single block at target position\n" +
|
"1 = Single block at target position\n" +
|
||||||
"2 = Glass showing what blocks will be changed"
|
"2 = Glass showing what blocks will be changed"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.visualize")
|
@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);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
BBC.BRUSH_NONE.send(player);
|
||||||
@ -245,12 +252,13 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "target",
|
name = "target",
|
||||||
aliases = {"tar"},
|
aliases = {"tar"},
|
||||||
desc = "Toggle between different target modes"
|
desc = "Toggle between different target modes"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.target")
|
@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);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
BBC.BRUSH_NONE.send(player);
|
||||||
@ -263,12 +271,13 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "targetmask",
|
name = "targetmask",
|
||||||
aliases = {"tarmask", "tm"},
|
aliases = {"tarmask", "tm"},
|
||||||
desc = "Set the targeting mask"
|
desc = "Set the targeting mask"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.targetmask")
|
@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);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
BBC.BRUSH_NONE.send(player);
|
||||||
@ -285,12 +294,13 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "targetoffset",
|
name = "targetoffset",
|
||||||
aliases = {"to"},
|
aliases = {"to"},
|
||||||
desc = "Set the targeting mask"
|
desc = "Set the targeting mask"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.targetoffset")
|
@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);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
BBC.BRUSH_NONE.send(player);
|
||||||
@ -301,11 +311,15 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "scroll",
|
name = "scroll",
|
||||||
desc = "Toggle between different target modes"
|
desc = "Toggle between different target modes"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.scroll")
|
@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);
|
BrushTool bt = session.getBrushTool(player, false);
|
||||||
if (bt == null) {
|
if (bt == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
BBC.BRUSH_NONE.send(player);
|
||||||
@ -314,23 +328,25 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
|
BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
|
||||||
ScrollAction action = ScrollAction.fromArguments(bt, player, session, args.getJoinedStrings(0), true);
|
ScrollAction action = ScrollAction.fromArguments(bt, player, session, args.getJoinedStrings(0), true);
|
||||||
settings.setScrollAction(action);
|
settings.setScrollAction(action);
|
||||||
if (args.getString(0).equalsIgnoreCase("none")) {
|
if (modes.equalsIgnoreCase("none")) {
|
||||||
BBC.BRUSH_SCROLL_ACTION_UNSET.send(player);
|
BBC.BRUSH_SCROLL_ACTION_UNSET.send(player);
|
||||||
} else if (action != null) {
|
} else if (action != null) {
|
||||||
String full = args.getJoinedStrings(0);
|
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, modes);
|
||||||
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
|
BBC.BRUSH_SCROLL_ACTION_SET.send(player, modes);
|
||||||
BBC.BRUSH_SCROLL_ACTION_SET.send(player, full);
|
|
||||||
}
|
}
|
||||||
bt.update();
|
bt.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "mask",
|
name = "mask",
|
||||||
aliases = {"/mask"},
|
aliases = {"/mask"},
|
||||||
desc = "Set the brush destination mask"
|
desc = "Set the brush destination mask"
|
||||||
)
|
)
|
||||||
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
|
@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);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
player.print(BBC.BRUSH_NONE.f());
|
player.print(BBC.BRUSH_NONE.f());
|
||||||
@ -355,13 +371,16 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "smask",
|
name = "smask",
|
||||||
aliases = {"/smask", "/sourcemask", "sourcemask"},
|
aliases = {"/smask", "/sourcemask", "sourcemask"},
|
||||||
desc = "Set the brush source mask",
|
desc = "Set the brush source mask",
|
||||||
descFooter = "Set the brush source mask"
|
descFooter = "Set the brush source mask"
|
||||||
)
|
)
|
||||||
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
|
@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);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
player.print(BBC.BRUSH_NONE.f());
|
player.print(BBC.BRUSH_NONE.f());
|
||||||
@ -377,20 +396,25 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
parserContext.setWorld(player.getWorld());
|
parserContext.setWorld(player.getWorld());
|
||||||
parserContext.setSession(session);
|
parserContext.setSession(session);
|
||||||
parserContext.setExtent(editSession);
|
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();
|
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);
|
settings.setSourceMask(mask);
|
||||||
tool.update();
|
tool.update();
|
||||||
BBC.BRUSH_SOURCE_MASK.send(player);
|
BBC.BRUSH_SOURCE_MASK.send(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "transform",
|
name = "transform",
|
||||||
desc = "Set the brush transform"
|
desc = "Set the brush transform"
|
||||||
)
|
)
|
||||||
@CommandPermissions({"worldedit.brush.options.transform", "worldedit.transform.brush"})
|
@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);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
player.print(BBC.BRUSH_NONE.f());
|
player.print(BBC.BRUSH_NONE.f());
|
||||||
@ -415,12 +439,16 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "mat",
|
name = "mat",
|
||||||
aliases = {"material"},
|
aliases = {"material"},
|
||||||
desc = "Set the brush material"
|
desc = "Set the brush material"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.options.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);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
player.print(BBC.BRUSH_NONE.f());
|
player.print(BBC.BRUSH_NONE.f());
|
||||||
@ -439,12 +467,14 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "range",
|
name = "range",
|
||||||
desc = "Set the brush range"
|
desc = "Set the brush range"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.options.range")
|
@CommandPermissions("worldedit.brush.options.range")
|
||||||
public void range(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
|
public void range(Player player, LocalSession session,
|
||||||
int range = Math.max(0, Math.min(256, args.getInteger(0)));
|
@Arg(desc = "Range")
|
||||||
|
int range) throws WorldEditException {
|
||||||
|
range = Math.max(0, Math.min(256, range));
|
||||||
BrushTool tool = session.getBrushTool(player, false);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
player.print(BBC.BRUSH_NONE.f());
|
player.print(BBC.BRUSH_NONE.f());
|
||||||
@ -455,12 +485,15 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "size",
|
name = "size",
|
||||||
desc = "Set the brush size"
|
desc = "Set the brush size"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.options.size")
|
@CommandPermissions("worldedit.brush.options.size")
|
||||||
public void size(Player player, LocalSession session, InjectedValueAccess args, @Switch(name='h', desc = "TODO") boolean offHand) throws WorldEditException {
|
public void size(Player player, LocalSession session,
|
||||||
int radius = args.getInteger(0);
|
@Arg(desc = "The size of the brush", def = "5")
|
||||||
|
int radius,
|
||||||
|
@Switch(name = 'h', desc = "TODO")
|
||||||
|
boolean offHand) throws WorldEditException {
|
||||||
worldEdit.checkMaxBrushRadius(radius);
|
worldEdit.checkMaxBrushRadius(radius);
|
||||||
BrushTool tool = session.getBrushTool(player, false);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
|
@ -99,14 +99,16 @@ import java.util.zip.ZipOutputStream;
|
|||||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
public class ClipboardCommands {
|
public class ClipboardCommands {
|
||||||
|
|
||||||
|
private WorldEdit worldEdit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
*
|
*
|
||||||
* @param worldEdit reference to WorldEdit
|
* @param worldEdit reference to WorldEdit
|
||||||
*/
|
*/
|
||||||
public ClipboardCommands(WorldEdit worldEdit) {
|
public ClipboardCommands(WorldEdit worldEdit) {
|
||||||
super(worldEdit);
|
|
||||||
checkNotNull(worldEdit);
|
checkNotNull(worldEdit);
|
||||||
|
this.worldEdit = worldEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -262,7 +264,7 @@ public class ClipboardCommands {
|
|||||||
|
|
||||||
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
|
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
|
||||||
copy.setSourceFunction(new BlockReplace(editSession, leavePattern));
|
copy.setSourceFunction(new BlockReplace(editSession, leavePattern));
|
||||||
copy.setCopyingEntities(copyEntities);
|
copy.setCopyingEntities(!skipEntities);
|
||||||
copy.setRemovingEntities(true);
|
copy.setRemovingEntities(true);
|
||||||
copy.setCopyingBiomes(copyBiomes);
|
copy.setCopyingBiomes(copyBiomes);
|
||||||
Mask sourceMask = editSession.getSourceMask();
|
Mask sourceMask = editSession.getSourceMask();
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command;
|
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.google.common.collect.ImmutableSet;
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
import com.sk89q.worldedit.IncompleteRegionException;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
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.regions.RegionOperationException;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
|
import java.util.List;
|
||||||
import org.enginehub.piston.Command;
|
import org.enginehub.piston.Command;
|
||||||
import org.enginehub.piston.CommandManager;
|
import org.enginehub.piston.CommandManager;
|
||||||
import org.enginehub.piston.CommandManagerService;
|
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.inject.Key;
|
||||||
import org.enginehub.piston.part.SubCommandPart;
|
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}.
|
* Extracted from {@link SelectionCommands} to allow importing of {@link Command}.
|
||||||
*/
|
*/
|
||||||
@ -54,8 +53,8 @@ import static com.sk89q.worldedit.internal.command.CommandUtil.requireIV;
|
|||||||
public class ExpandCommands {
|
public class ExpandCommands {
|
||||||
|
|
||||||
public static void register(CommandRegistrationHandler registration,
|
public static void register(CommandRegistrationHandler registration,
|
||||||
CommandManager commandManager,
|
CommandManager commandManager,
|
||||||
CommandManagerService commandManagerService) {
|
CommandManagerService commandManagerService) {
|
||||||
// Collect the general expand command
|
// Collect the general expand command
|
||||||
CommandManager collect = commandManagerService.newCommandManager();
|
CommandManager collect = commandManagerService.newCommandManager();
|
||||||
|
|
||||||
@ -121,13 +120,13 @@ public class ExpandCommands {
|
|||||||
)
|
)
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void expand(Player player, LocalSession session,
|
public void expand(Player player, LocalSession session,
|
||||||
@Arg(desc = "Amount to expand the selection by, can be `vert` to expand to the whole vertical column")
|
@Arg(desc = "Amount to expand the selection by, can be `vert` to expand to the whole vertical column")
|
||||||
int amount,
|
int amount,
|
||||||
@Arg(desc = "Amount to expand the selection by in the other direction", def = "0")
|
@Arg(desc = "Amount to expand the selection by in the other direction", def = "0")
|
||||||
int reverseAmount,
|
int reverseAmount,
|
||||||
@Arg(desc = "Direction to expand", def = Direction.AIM)
|
@Arg(desc = "Direction to expand", def = Direction.AIM)
|
||||||
@MultiDirection
|
@MultiDirection
|
||||||
List<BlockVector3> direction) throws WorldEditException {
|
List<BlockVector3> direction) throws WorldEditException {
|
||||||
Region region = session.getSelection(player.getWorld());
|
Region region = session.getSelection(player.getWorld());
|
||||||
int oldSize = region.getArea();
|
int oldSize = region.getArea();
|
||||||
|
|
||||||
|
@ -247,14 +247,14 @@ public class GenerationCommands {
|
|||||||
@CommandPermissions("worldedit.generation.sphere")
|
@CommandPermissions("worldedit.generation.sphere")
|
||||||
@Logging(PLACEMENT)
|
@Logging(PLACEMENT)
|
||||||
public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
public void sphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession,
|
||||||
@Arg(desc = "The pattern of blocks to generate")
|
@Arg(desc = "The pattern of blocks to generate")
|
||||||
Pattern pattern,
|
Pattern pattern,
|
||||||
@Arg(desc = "The radii of the sphere. Order is N/S, U/D, E/W")
|
@Arg(desc = "The radii of the sphere. Order is N/S, U/D, E/W")
|
||||||
BlockVector3 radii,
|
BlockVector3 radii,
|
||||||
@Switch(name = 'r', desc = "Raise the bottom of the sphere to the placement position")
|
@Switch(name = 'r', desc = "Raise the bottom of the sphere to the placement position")
|
||||||
boolean raised,
|
boolean raised,
|
||||||
@Switch(name = 'h', desc = "Make a hollow sphere")
|
@Switch(name = 'h', desc = "Make a hollow sphere")
|
||||||
boolean hollow) throws WorldEditException {
|
boolean hollow, InjectedValueAccess context) throws WorldEditException {
|
||||||
BlockVector3 pos = session.getPlacementPosition(player);
|
BlockVector3 pos = session.getPlacementPosition(player);
|
||||||
BlockVector3 finalPos = raised ? pos.add(0, radii.getY(), 0) : pos;
|
BlockVector3 finalPos = raised ? pos.add(0, radii.getY(), 0) : pos;
|
||||||
fp.checkConfirmationRadius(() -> {
|
fp.checkConfirmationRadius(() -> {
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command;
|
package com.sk89q.worldedit.command;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweAPI;
|
import com.boydti.fawe.FaweAPI;
|
||||||
import com.boydti.fawe.config.BBC;
|
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.regions.FaweMaskManager;
|
||||||
import com.boydti.fawe.util.MainUtil;
|
import com.boydti.fawe.util.MainUtil;
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
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.CommandPermissions;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
import com.sk89q.worldedit.internal.annotation.Range;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
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 com.sk89q.worldedit.world.World;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
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.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
|
import org.enginehub.piston.annotation.param.Switch;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commands to undo, redo, and clear history.
|
* Commands to undo, redo, and clear history.
|
||||||
*/
|
*/
|
||||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
@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 {
|
public class HistoryCommands extends MethodCommands {
|
||||||
|
|
||||||
private final WorldEdit worldEdit;
|
private final WorldEdit worldEdit;
|
||||||
@ -83,7 +82,7 @@ public class HistoryCommands extends MethodCommands {
|
|||||||
" - Import from disk: /frb #import"
|
" - Import from disk: /frb #import"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.history.rollback")
|
@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) {
|
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||||
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
|
BBC.SETTING_DISABLE.send(player, "history.use-database (Import with /frb #import )");
|
||||||
return;
|
return;
|
||||||
@ -209,7 +208,7 @@ public class HistoryCommands extends MethodCommands {
|
|||||||
" - Import from disk: /frb #import"
|
" - Import from disk: /frb #import"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.history.rollback")
|
@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);
|
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.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweAPI;
|
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
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.command.util.Logging;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.World;
|
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
@ -41,7 +39,6 @@ import org.enginehub.piston.annotation.param.Switch;
|
|||||||
/**
|
/**
|
||||||
* Commands for moving the player around.
|
* 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)
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
public class NavigationCommands {
|
public class NavigationCommands {
|
||||||
|
|
||||||
|
@ -53,8 +53,7 @@ public class PatternCommands extends MethodCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "#existing",
|
name = "#existing",
|
||||||
aliases = {"#*", "*", ".*"},
|
aliases = {"#*", "*", ".*"},
|
||||||
desc = "Use the block that is already there",
|
desc = "Use the block that is already there"
|
||||||
descFooter = "[properties]"
|
|
||||||
)
|
)
|
||||||
public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties
|
public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties
|
||||||
if (properties == null) return new ExistingPattern(extent);
|
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.Fawe;
|
||||||
import com.boydti.fawe.FaweAPI;
|
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.filters.SetFilter;
|
||||||
import com.boydti.fawe.beta.implementation.QueueHandler;
|
import com.boydti.fawe.beta.implementation.QueueHandler;
|
||||||
import com.boydti.fawe.beta.filters.DistrFilter;
|
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.object.FaweLimit;
|
import com.boydti.fawe.object.FaweLimit;
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
import com.boydti.fawe.beta.IQueueExtent;
|
|
||||||
import com.boydti.fawe.object.exception.FaweException;
|
import com.boydti.fawe.object.exception.FaweException;
|
||||||
import com.boydti.fawe.object.visitor.Fast2DIterator;
|
import com.boydti.fawe.object.visitor.Fast2DIterator;
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
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.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.visitor.LayerVisitor;
|
import com.sk89q.worldedit.function.visitor.LayerVisitor;
|
||||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
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.annotation.Selection;
|
||||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
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.regions.Regions;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
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.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
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.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
import org.enginehub.piston.annotation.param.Switch;
|
import org.enginehub.piston.annotation.param.Switch;
|
||||||
|
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Commands that operate on regions.
|
* 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)
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
public class RegionCommands extends MethodCommands {
|
public class RegionCommands extends MethodCommands {
|
||||||
|
|
||||||
@ -114,6 +113,39 @@ public class RegionCommands extends MethodCommands {
|
|||||||
this.worldEdit = worldEdit;
|
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(
|
@Command(
|
||||||
name = "/fixlighting",
|
name = "/fixlighting",
|
||||||
desc = "Get the light at a position"
|
desc = "Get the light at a position"
|
||||||
@ -210,7 +242,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Arg(desc = "The pattern of blocks to place")
|
@Arg(desc = "The pattern of blocks to place")
|
||||||
Pattern pattern,
|
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,
|
int thickness,
|
||||||
@Switch(name = 'h', desc = "Generate only a shell")
|
@Switch(name = 'h', desc = "Generate only a shell")
|
||||||
boolean shell) throws WorldEditException {
|
boolean shell) throws WorldEditException {
|
||||||
@ -218,6 +250,8 @@ public class RegionCommands extends MethodCommands {
|
|||||||
player.printError("//line only works with cuboid selections");
|
player.printError("//line only works with cuboid selections");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||||
|
|
||||||
CuboidRegion cuboidregion = (CuboidRegion) region;
|
CuboidRegion cuboidregion = (CuboidRegion) region;
|
||||||
BlockVector3 pos1 = cuboidregion.getPos1();
|
BlockVector3 pos1 = cuboidregion.getPos1();
|
||||||
BlockVector3 pos2 = cuboidregion.getPos2();
|
BlockVector3 pos2 = cuboidregion.getPos2();
|
||||||
@ -235,26 +269,26 @@ public class RegionCommands extends MethodCommands {
|
|||||||
@CommandPermissions("worldedit.region.curve")
|
@CommandPermissions("worldedit.region.curve")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void curve(FawePlayer player, EditSession editSession,
|
public void curve(FawePlayer player, EditSession editSession,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Arg(desc = "The pattern of blocks to place")
|
@Arg(desc = "The pattern of blocks to place")
|
||||||
Pattern pattern,
|
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,
|
int thickness,
|
||||||
@Switch(name = 'h', desc = "Generate only a shell")
|
@Switch(name = 'h', desc = "Generate only a shell")
|
||||||
boolean shell,
|
boolean shell, InjectedValueAccess context) throws WorldEditException {
|
||||||
InjectedValueAccess context) throws WorldEditException {
|
|
||||||
if (!(region instanceof ConvexPolyhedralRegion)) {
|
if (!(region instanceof ConvexPolyhedralRegion)) {
|
||||||
player.printError("//curve only works with convex polyhedral selections");
|
player.printError("//curve only works with convex polyhedral selections");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||||
|
|
||||||
player.checkConfirmationRegion(() -> {
|
player.checkConfirmationRegion(() -> {
|
||||||
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
|
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
|
||||||
List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices());
|
List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices());
|
||||||
|
|
||||||
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
|
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
|
||||||
|
|
||||||
BBC.VISITOR_BLOCK.send(player, blocksChanged);
|
BBC.VISITOR_BLOCK.send(player, blocksChanged);
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,12 +299,20 @@ public class RegionCommands extends MethodCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.replace")
|
@CommandPermissions("worldedit.region.replace")
|
||||||
@Logging(REGION)
|
@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(() -> {
|
player.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.replaceBlocks(region, from == null ? new ExistingBlockMask(editSession) : from, to);
|
int affected = editSession.replaceBlocks(region, from == null ? new ExistingBlockMask(editSession) : from, to);
|
||||||
BBC.VISITOR_BLOCK.send(player, affected);
|
BBC.VISITOR_BLOCK.send(player, affected);
|
||||||
if (!player.hasPermission("fawe.tips"))
|
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);
|
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);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,8 +347,8 @@ public class RegionCommands extends MethodCommands {
|
|||||||
@CommandPermissions("worldedit.region.overlay")
|
@CommandPermissions("worldedit.region.overlay")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void overlay(FawePlayer player, EditSession editSession, @Selection Region region,
|
public void overlay(FawePlayer player, EditSession editSession, @Selection Region region,
|
||||||
@Arg(desc = "The pattern of blocks to overlay")
|
@Arg(desc = "The pattern of blocks to overlay")
|
||||||
Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||||
player.checkConfirmationRegion(() -> {
|
player.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.overlayCuboidBlocks(region, pattern);
|
int affected = editSession.overlayCuboidBlocks(region, pattern);
|
||||||
BBC.VISITOR_BLOCK.send(player, affected);
|
BBC.VISITOR_BLOCK.send(player, affected);
|
||||||
@ -339,14 +381,16 @@ public class RegionCommands extends MethodCommands {
|
|||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@org.enginehub.piston.annotation.Command(
|
@Command(
|
||||||
name = "/center",
|
name = "/center",
|
||||||
aliases = { "/middle" },
|
aliases = { "/middle" },
|
||||||
desc = "Set the center block(s)"
|
desc = "Set the center block(s)"
|
||||||
)
|
)
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
@CommandPermissions("worldedit.region.center")
|
@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);
|
int affected = editSession.center(region, pattern);
|
||||||
BBC.VISITOR_BLOCK.send(player, affected);
|
BBC.VISITOR_BLOCK.send(player, affected);
|
||||||
}
|
}
|
||||||
@ -370,7 +414,9 @@ public class RegionCommands extends MethodCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.walls")
|
@CommandPermissions("worldedit.region.walls")
|
||||||
@Logging(REGION)
|
@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(() -> {
|
player.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.makeWalls(region, pattern);
|
int affected = editSession.makeWalls(region, pattern);
|
||||||
BBC.VISITOR_BLOCK.send(player, affected);
|
BBC.VISITOR_BLOCK.send(player, affected);
|
||||||
@ -384,7 +430,9 @@ public class RegionCommands extends MethodCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.faces")
|
@CommandPermissions("worldedit.region.faces")
|
||||||
@Logging(REGION)
|
@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(() -> {
|
player.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.makeCuboidFaces(region, pattern);
|
int affected = editSession.makeCuboidFaces(region, pattern);
|
||||||
BBC.VISITOR_BLOCK.send(player, affected);
|
BBC.VISITOR_BLOCK.send(player, affected);
|
||||||
@ -398,7 +446,12 @@ public class RegionCommands extends MethodCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.smooth")
|
@CommandPermissions("worldedit.region.smooth")
|
||||||
@Logging(REGION)
|
@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 min = region.getMinimumPoint();
|
||||||
BlockVector3 max = region.getMaximumPoint();
|
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));
|
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||||
@ -464,24 +517,27 @@ public class RegionCommands extends MethodCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.move")
|
@CommandPermissions("worldedit.region.move")
|
||||||
@Logging(ORIENTATION_REGION)
|
@Logging(ORIENTATION_REGION)
|
||||||
public void move(FawePlayer player, LocalSession session, EditSession editSession,
|
public void move(FawePlayer player, EditSession editSession, LocalSession session,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Arg(desc = "# of blocks to move", def = "1")
|
@Arg(desc = "# of blocks to move", def = "1")
|
||||||
int count,
|
int count,
|
||||||
@Arg(desc = "The direction to move", def = Direction.AIM)
|
@Arg(desc = "The direction to move", def = Direction.AIM)
|
||||||
@Direction(includeDiagonals = true)
|
@Direction(includeDiagonals = true)
|
||||||
BlockVector3 direction,
|
BlockVector3 direction,
|
||||||
@Arg(desc = "The pattern of blocks to leave", def = "air")
|
@Arg(desc = "The pattern of blocks to leave", def = "air")
|
||||||
Pattern replace,
|
Pattern replace,
|
||||||
@Switch(name = 's', desc = "Shift the selection to the target location")
|
@Switch(name = 's', desc = "Shift the selection to the target location")
|
||||||
boolean moveSelection,
|
boolean moveSelection,
|
||||||
@Switch(name = 'a', desc = "Ignore air blocks")
|
@Switch(name = 'a', desc = "Ignore air blocks")
|
||||||
boolean ignoreAirBlocks,
|
boolean ignoreAirBlocks,
|
||||||
@Switch(name='b', desc = "TODO") boolean copyBiomes,
|
@Switch(name='b', desc = "TODO")
|
||||||
|
boolean copyBiomes,
|
||||||
@Switch(name='e', desc = "TODO") boolean skipEntities,
|
@Switch(name='e', desc = "TODO")
|
||||||
@Switch(name='a', desc = "TODO") boolean skipAir,
|
boolean skipEntities,
|
||||||
InjectedValueAccess context) throws WorldEditException {
|
@Switch(name='a', desc = "TODO")
|
||||||
|
boolean skipAir,
|
||||||
|
InjectedValueAccess context) throws WorldEditException {
|
||||||
|
checkCommandArgument(count >= 1, "Count must be >= 1");
|
||||||
player.checkConfirmationRegion(() -> {
|
player.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.moveRegion(region, direction, count, !skipAir, !skipEntities, copyBiomes, replace);
|
int affected = editSession.moveRegion(region, direction, count, !skipAir, !skipEntities, copyBiomes, replace);
|
||||||
|
|
||||||
@ -526,18 +582,19 @@ public class RegionCommands extends MethodCommands {
|
|||||||
@CommandPermissions("worldedit.region.stack")
|
@CommandPermissions("worldedit.region.stack")
|
||||||
@Logging(ORIENTATION_REGION)
|
@Logging(ORIENTATION_REGION)
|
||||||
public void stack(FawePlayer player, EditSession editSession, LocalSession session,
|
public void stack(FawePlayer player, EditSession editSession, LocalSession session,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Arg(desc = "# of copies to stack", def = "1")
|
@Arg(desc = "# of copies to stack", def = "1")
|
||||||
int count,
|
int count,
|
||||||
@Arg(desc = "The direction to stack", def = Direction.AIM)
|
@Arg(desc = "The direction to stack", def = Direction.AIM)
|
||||||
@Direction(includeDiagonals = true)
|
@Direction(includeDiagonals = true)
|
||||||
BlockVector3 direction,
|
BlockVector3 direction,
|
||||||
@Switch(name = 's', desc = "Shift the selection to the last stacked copy")
|
@Switch(name = 's', desc = "Shift the selection to the last stacked copy")
|
||||||
boolean moveSelection,
|
boolean moveSelection,
|
||||||
@Switch(name = 'b', desc = "//TODO") boolean copyBiomes,
|
@Switch(name = 'b', desc = "//TODO") boolean copyBiomes,
|
||||||
@Switch(name = 'e', desc = "//TODO") boolean skipEntities,
|
@Switch(name = 'e', desc = "//TODO") boolean skipEntities,
|
||||||
@Switch(name = 'a', desc = "Ignore air blocks")
|
@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(() -> {
|
player.checkConfirmationStack(() -> {
|
||||||
if (sourceMask != null) {
|
if (sourceMask != null) {
|
||||||
editSession.addSourceMask(sourceMask);
|
editSession.addSourceMask(sourceMask);
|
||||||
@ -562,24 +619,22 @@ public class RegionCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "/deform",
|
name = "/deform",
|
||||||
desc = "Deforms a selected region with an expression",
|
desc = "Deforms a selected region with an expression",
|
||||||
descFooter =
|
descFooter = "The expression is executed for each block and is expected\n" +
|
||||||
"Deforms a selected region with an expression\n" +
|
"to modify the variables x, y and z to point to a new block\n" +
|
||||||
"The expression is executed for each block and is expected\n" +
|
"to fetch. See also https://tinyurl.com/weexpr"
|
||||||
"to modify the variables x, y and z to point to a new block\n" +
|
)
|
||||||
"to fetch. See also tinyurl.com/wesyntax."
|
|
||||||
)
|
|
||||||
@CommandPermissions("worldedit.region.deform")
|
@CommandPermissions("worldedit.region.deform")
|
||||||
@Logging(ALL)
|
@Logging(ALL)
|
||||||
public void deform(FawePlayer fp, Player player, LocalSession session, EditSession editSession, InjectedValueAccess context,
|
public void deform(FawePlayer fp, Player player, LocalSession session, EditSession editSession, InjectedValueAccess context,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Arg(desc = "The expression to use", variable = true)
|
@Arg(desc = "The expression to use", variable = true)
|
||||||
List<String> expression,
|
List<String> expression,
|
||||||
@Switch(name = 'r', desc = "Use the game's coordinate origin")
|
@Switch(name = 'r', desc = "Use the game's coordinate origin")
|
||||||
boolean useRawCoords,
|
boolean useRawCoords,
|
||||||
@Switch(name = 'o', desc = "Use the selection's center as origin")
|
@Switch(name = 'o', desc = "Use the selection's center as origin")
|
||||||
boolean offset) throws WorldEditException {
|
boolean offset) throws WorldEditException {
|
||||||
final Vector3 zero;
|
final Vector3 zero;
|
||||||
Vector3 unit;
|
Vector3 unit;
|
||||||
|
|
||||||
@ -651,7 +706,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "/hollow",
|
name = "/hollow",
|
||||||
desc = "Hollows out the object contained in this selection",
|
desc = "Hollows out the object contained in this selection",
|
||||||
descFooter = "Hollows out the object contained in this selection.\n" +
|
descFooter = "Hollows out the object contained in this selection.\n" +
|
||||||
"Optionally fills the hollowed out part with the given block.\n" +
|
"Optionally fills the hollowed out part with the given block.\n" +
|
||||||
@ -661,11 +716,11 @@ public class RegionCommands extends MethodCommands {
|
|||||||
@CommandPermissions("worldedit.region.hollow")
|
@CommandPermissions("worldedit.region.hollow")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void hollow(FawePlayer player, EditSession editSession,
|
public void hollow(FawePlayer player, EditSession editSession,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Arg(desc = "Thickness of the shell to leave", def = "0")
|
@Arg(desc = "Thickness of the shell to leave", def = "0")
|
||||||
int thickness,
|
int thickness,
|
||||||
@Arg(desc = "The pattern of blocks to replace the hollowed area with", def = "air")
|
@Arg(desc = "The pattern of blocks to replace the hollowed area with", def = "air")
|
||||||
Pattern pattern,
|
Pattern pattern,
|
||||||
@Switch(name='m', desc = "Mask to hollow with") Mask mask,
|
@Switch(name='m', desc = "Mask to hollow with") Mask mask,
|
||||||
InjectedValueAccess context) throws WorldEditException {
|
InjectedValueAccess context) throws WorldEditException {
|
||||||
Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask;
|
Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask;
|
||||||
@ -682,10 +737,11 @@ public class RegionCommands extends MethodCommands {
|
|||||||
@CommandPermissions("worldedit.region.forest")
|
@CommandPermissions("worldedit.region.forest")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void forest(Player player, EditSession editSession, @Selection Region region,
|
public void forest(Player player, EditSession editSession, @Selection Region region,
|
||||||
@Arg(desc = "The type of tree to place", def = "tree")
|
@Arg(desc = "The type of tree to place", def = "tree")
|
||||||
TreeType type,
|
TreeType type,
|
||||||
@Arg(desc = "The density of the forest", def = "5")
|
@Arg(desc = "The density of the forest", def = "5")
|
||||||
double density) throws WorldEditException {
|
double density) throws WorldEditException {
|
||||||
|
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
|
||||||
int affected = editSession.makeForest(region, density / 100, type);
|
int affected = editSession.makeForest(region, density / 100, type);
|
||||||
BBC.COMMAND_TREE.send(player, affected);
|
BBC.COMMAND_TREE.send(player, affected);
|
||||||
}
|
}
|
||||||
@ -697,8 +753,9 @@ public class RegionCommands extends MethodCommands {
|
|||||||
@CommandPermissions("worldedit.region.flora")
|
@CommandPermissions("worldedit.region.flora")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void flora(FawePlayer player, EditSession editSession, @Selection Region region,
|
public void flora(FawePlayer player, EditSession editSession, @Selection Region region,
|
||||||
@Arg(desc = "The density of the forest", def = "5")
|
@Arg(desc = "The density of the forest", def = "5")
|
||||||
double density, InjectedValueAccess context) throws WorldEditException {
|
double density, InjectedValueAccess context) throws WorldEditException {
|
||||||
|
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
|
||||||
player.checkConfirmationRegion(() -> {
|
player.checkConfirmationRegion(() -> {
|
||||||
FloraGenerator generator = new FloraGenerator(editSession);
|
FloraGenerator generator = new FloraGenerator(editSession);
|
||||||
GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator);
|
GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator);
|
||||||
|
@ -92,9 +92,9 @@ public class ScriptingCommands {
|
|||||||
@Logging(ALL)
|
@Logging(ALL)
|
||||||
public void execute(Player player, LocalSession session,
|
public void execute(Player player, LocalSession session,
|
||||||
@Arg(desc = "Filename of the CraftScript to load")
|
@Arg(desc = "Filename of the CraftScript to load")
|
||||||
String filename,
|
String filename,
|
||||||
@Arg(desc = "Arguments to the CraftScript", def = "", variable = true)
|
@Arg(desc = "Arguments to the CraftScript", def = "", variable = true)
|
||||||
List<String> args) throws WorldEditException {
|
List<String> args) throws WorldEditException {
|
||||||
if (!player.hasPermission("worldedit.scripting.execute." + filename)) {
|
if (!player.hasPermission("worldedit.scripting.execute." + filename)) {
|
||||||
BBC.SCRIPTING_NO_PERM.send(player);
|
BBC.SCRIPTING_NO_PERM.send(player);
|
||||||
return;
|
return;
|
||||||
|
@ -27,7 +27,7 @@ import com.boydti.fawe.object.clipboard.URIClipboardHolder;
|
|||||||
import com.boydti.fawe.object.mask.IdMask;
|
import com.boydti.fawe.object.mask.IdMask;
|
||||||
import com.boydti.fawe.object.regions.selector.FuzzyRegionSelector;
|
import com.boydti.fawe.object.regions.selector.FuzzyRegionSelector;
|
||||||
import com.boydti.fawe.object.regions.selector.PolyhedralRegionSelector;
|
import com.boydti.fawe.object.regions.selector.PolyhedralRegionSelector;
|
||||||
|
import com.boydti.fawe.util.ExtentTraverser;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
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.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.command.util.Logging;
|
import com.sk89q.worldedit.command.util.Logging;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
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.extension.platform.permission.ActorSelectorLimits;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
@ -470,7 +469,7 @@ public class SelectionCommands {
|
|||||||
public void count(Player player, LocalSession session, EditSession editSession,
|
public void count(Player player, LocalSession session, EditSession editSession,
|
||||||
@Arg(desc = "The mask of blocks to match")
|
@Arg(desc = "The mask of blocks to match")
|
||||||
Mask mask) throws WorldEditException {
|
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);
|
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.CommandPermissions;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
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.InvalidSnapshotException;
|
||||||
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
||||||
import com.sk89q.worldedit.world.storage.MissingWorldException;
|
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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.ZonedDateTime;
|
import java.time.ZonedDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
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.
|
* Snapshot commands.
|
||||||
*/
|
*/
|
||||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
//@Command(aliases = {"snapshot", "snap"}, desc = "List, load and view information related to snapshots")
|
|
||||||
public class SnapshotCommands {
|
public class SnapshotCommands {
|
||||||
|
|
||||||
private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss z");
|
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")
|
@CommandPermissions("worldedit.snapshots.list")
|
||||||
public void list(Player player,
|
public void list(Player player,
|
||||||
@Arg(desc = "# of snapshots to list", def = "5")
|
@ArgFlag(name = 'p', desc = "Page of results to return", def = "1")
|
||||||
int num) throws WorldEditException {
|
int page) throws WorldEditException {
|
||||||
|
|
||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
@ -77,15 +82,7 @@ public class SnapshotCommands {
|
|||||||
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName());
|
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName());
|
||||||
|
|
||||||
if (!snapshots.isEmpty()) {
|
if (!snapshots.isEmpty()) {
|
||||||
|
player.print(new SnapshotListBox(player.getWorld().getName(), snapshots).create(page));
|
||||||
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);
|
|
||||||
} else {
|
} else {
|
||||||
BBC.SNAPSHOT_NOT_AVAILABLE.send(player);
|
BBC.SNAPSHOT_NOT_AVAILABLE.send(player);
|
||||||
|
|
||||||
@ -200,19 +197,19 @@ public class SnapshotCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, player.getWorld().getName());
|
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, player.getWorld().getName());
|
||||||
|
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
player.printError("Couldn't find a snapshot before "
|
player.printError("Couldn't find a snapshot before "
|
||||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
||||||
} else {
|
} else {
|
||||||
session.setSnapshot(snapshot);
|
session.setSnapshot(snapshot);
|
||||||
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
|
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
|
||||||
}
|
|
||||||
} catch (MissingWorldException ex) {
|
|
||||||
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
|
|
||||||
}
|
}
|
||||||
|
} catch (MissingWorldException ex) {
|
||||||
|
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -231,18 +228,40 @@ public class SnapshotCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, player.getWorld().getName());
|
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, player.getWorld().getName());
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
player.printError("Couldn't find a snapshot after "
|
player.printError("Couldn't find a snapshot after "
|
||||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
||||||
} else {
|
} else {
|
||||||
session.setSnapshot(snapshot);
|
session.setSnapshot(snapshot);
|
||||||
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
|
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
|
||||||
}
|
}
|
||||||
} catch (MissingWorldException ex) {
|
} catch (MissingWorldException ex) {
|
||||||
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
|
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
package com.sk89q.worldedit.command;
|
||||||
|
|
||||||
import com.boydti.fawe.config.BBC;
|
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.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
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.AreaPickaxe;
|
||||||
import com.sk89q.worldedit.command.tool.RecursivePickaxe;
|
import com.sk89q.worldedit.command.tool.RecursivePickaxe;
|
||||||
import com.sk89q.worldedit.command.tool.SinglePickaxe;
|
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 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 {
|
public class SuperPickaxeCommands {
|
||||||
private final WorldEdit we;
|
private final WorldEdit we;
|
||||||
|
|
||||||
@ -42,9 +43,9 @@ public class SuperPickaxeCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "single",
|
name = "single",
|
||||||
desc = "Enable the single block super pickaxe mode"
|
desc = "Enable the single block super pickaxe mode"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.superpickaxe")
|
@CommandPermissions("worldedit.superpickaxe")
|
||||||
public void single(Player player, LocalSession session) throws WorldEditException {
|
public void single(Player player, LocalSession session) throws WorldEditException {
|
||||||
session.setSuperPickaxe(new SinglePickaxe());
|
session.setSuperPickaxe(new SinglePickaxe());
|
||||||
@ -53,13 +54,13 @@ public class SuperPickaxeCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "area",
|
name = "area",
|
||||||
desc = "Enable the area super pickaxe pickaxe mode"
|
desc = "Enable the area super pickaxe pickaxe mode"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.superpickaxe.area")
|
@CommandPermissions("worldedit.superpickaxe.area")
|
||||||
public void area(Player player, LocalSession session,
|
public void area(Player player, LocalSession session,
|
||||||
@Arg(desc = "The range of the area pickaxe")
|
@Arg(desc = "The range of the area pickaxe")
|
||||||
int range) throws WorldEditException {
|
int range) throws WorldEditException {
|
||||||
|
|
||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
@ -74,14 +75,14 @@ public class SuperPickaxeCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "recur",
|
name = "recursive",
|
||||||
aliases = {"recursive"},
|
aliases = { "recur" },
|
||||||
desc = "Enable the recursive super pickaxe pickaxe mode"
|
desc = "Enable the recursive super pickaxe pickaxe mode"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.superpickaxe.recursive")
|
@CommandPermissions("worldedit.superpickaxe.recursive")
|
||||||
public void recursive(Player player, LocalSession session,
|
public void recursive(Player player, LocalSession session,
|
||||||
@Arg(desc = "The range of the recursive pickaxe")
|
@Arg(desc = "The range of the recursive pickaxe")
|
||||||
double range) throws WorldEditException {
|
double range) throws WorldEditException {
|
||||||
|
|
||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
|
@ -10,39 +10,30 @@ import com.boydti.fawe.object.extent.ResettableExtent;
|
|||||||
import com.boydti.fawe.object.extent.ScaleTransform;
|
import com.boydti.fawe.object.extent.ScaleTransform;
|
||||||
import com.boydti.fawe.object.extent.TransformExtent;
|
import com.boydti.fawe.object.extent.TransformExtent;
|
||||||
import com.boydti.fawe.util.ExtentTraverser;
|
import com.boydti.fawe.util.ExtentTraverser;
|
||||||
import org.enginehub.piston.annotation.Command;
|
|
||||||
import com.sk89q.worldedit.LocalSession;
|
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.entity.Player;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
|
||||||
import java.util.Set;
|
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"},
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
desc = "Help for the various transforms. [More Info](https://git.io/v9KHO)",
|
public class TransformCommands {
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "#linear",
|
name = "#linear",
|
||||||
aliases = {"#l"},
|
aliases = {"#l"},
|
||||||
desc = "Sequentially pick from a list of transform"
|
desc = "Sequentially pick from a list of transform"
|
||||||
)
|
)
|
||||||
public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
if (other instanceof RandomTransform) {
|
if (other instanceof RandomTransform) {
|
||||||
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
|
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;
|
return other;
|
||||||
}
|
}
|
||||||
@ -51,11 +42,11 @@ public class TransformCommands extends MethodCommands {
|
|||||||
name = "#linear3d",
|
name = "#linear3d",
|
||||||
aliases = {"#l3d"},
|
aliases = {"#l3d"},
|
||||||
desc = "Use the x,y,z coordinate to pick a transform from the list"
|
desc = "Use the x,y,z coordinate to pick a transform from the list"
|
||||||
)
|
)
|
||||||
public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
if (other instanceof RandomTransform) {
|
if (other instanceof RandomTransform) {
|
||||||
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
|
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;
|
return other;
|
||||||
}
|
}
|
||||||
@ -63,7 +54,7 @@ public class TransformCommands extends MethodCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "#pattern",
|
name = "#pattern",
|
||||||
desc = "Always use a specific pattern"
|
desc = "Always use a specific pattern"
|
||||||
)
|
)
|
||||||
public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
return new PatternTransform(other, pattern);
|
return new PatternTransform(other, pattern);
|
||||||
}
|
}
|
||||||
@ -71,7 +62,7 @@ public class TransformCommands extends MethodCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "#offset",
|
name = "#offset",
|
||||||
desc = "Offset transform"
|
desc = "Offset transform"
|
||||||
)
|
)
|
||||||
public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
return new OffsetExtent(other, (int) x, (int) y, (int) z);
|
return new OffsetExtent(other, (int) x, (int) y, (int) z);
|
||||||
}
|
}
|
||||||
@ -88,7 +79,7 @@ public class TransformCommands extends MethodCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "#scale",
|
name = "#scale",
|
||||||
desc = "All changes will be scaled"
|
desc = "All changes will be scaled"
|
||||||
)
|
)
|
||||||
public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) {
|
||||||
return new ScaleTransform(other, x, y, z);
|
return new ScaleTransform(other, x, y, z);
|
||||||
}
|
}
|
||||||
@ -96,10 +87,10 @@ public class TransformCommands extends MethodCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "#rotate",
|
name = "#rotate",
|
||||||
desc = "All changes will be rotate around the initial position"
|
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) {
|
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);
|
ExtentTraverser<TransformExtent> traverser = new ExtentTraverser(other).find(TransformExtent.class);
|
||||||
BlockTransformExtent affine = (TransformExtent) (traverser != null ? traverser.get() : null);
|
BlockTransformExtent affine = traverser != null ? traverser.get() : null;
|
||||||
if (affine == null) {
|
if (affine == null) {
|
||||||
other = affine = new TransformExtent(other);
|
other = affine = new TransformExtent(other);
|
||||||
}
|
}
|
||||||
@ -108,6 +99,6 @@ public class TransformCommands extends MethodCommands {
|
|||||||
transform = transform.rotateY(y);
|
transform = transform.rotateY(y);
|
||||||
transform = transform.rotateZ(z);
|
transform = transform.rotateZ(z);
|
||||||
affine.setTransform(transform);
|
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 static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
|
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.DelegateConsumer;
|
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.MathMan;
|
||||||
import com.boydti.fawe.util.chat.Message;
|
import com.boydti.fawe.util.chat.Message;
|
||||||
import com.boydti.fawe.util.image.ImageUtil;
|
import com.boydti.fawe.util.image.ImageUtil;
|
||||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.IncompleteRegionException;
|
import com.sk89q.worldedit.IncompleteRegionException;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
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.operation.Operations;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.visitor.EntityVisitor;
|
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.Expression;
|
||||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
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.component.SubtleFormat;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
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.Arg;
|
||||||
import org.enginehub.piston.annotation.param.ArgFlag;
|
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||||
import org.enginehub.piston.annotation.param.Switch;
|
import org.enginehub.piston.annotation.param.Switch;
|
||||||
|
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility commands.
|
* Utility commands.
|
||||||
*/
|
*/
|
||||||
@CommandContainer(superTypes = {CommandPermissionsConditionGenerator.Registration.class, CommandQueuedConditionGenerator.Registration.class})
|
@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 {
|
public class UtilityCommands {
|
||||||
|
|
||||||
private final WorldEdit we;
|
private final WorldEdit we;
|
||||||
@ -774,7 +769,7 @@ public class UtilityCommands {
|
|||||||
return page;
|
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;
|
Consumer<File> rootFunction = forEachFile;
|
||||||
//schem list all <path>
|
//schem list all <path>
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class DefaultTransformParser extends FaweParser<ResettableExtent> {
|
|||||||
public DefaultTransformParser(WorldEdit worldEdit) {
|
public DefaultTransformParser(WorldEdit worldEdit) {
|
||||||
super(worldEdit);
|
super(worldEdit);
|
||||||
this.dispatcher = new SimpleDispatcher();
|
this.dispatcher = new SimpleDispatcher();
|
||||||
this.register(new TransformCommands(worldEdit));
|
this.register(new TransformCommands());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.platform;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
|
import com.boydti.fawe.command.AnvilCommands;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
@ -30,22 +31,55 @@ import com.boydti.fawe.util.TaskManager;
|
|||||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.IncompleteRegionException;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
//import com.sk89q.worldedit.command.BiomeCommandsRegistration;
|
import com.sk89q.worldedit.command.ApplyBrushCommands;
|
||||||
//import com.sk89q.worldedit.command.ChunkCommandsRegistration;
|
import com.sk89q.worldedit.command.BiomeCommands;
|
||||||
//import com.sk89q.worldedit.command.ClipboardCommandsRegistration;
|
import com.sk89q.worldedit.command.BiomeCommandsRegistration;
|
||||||
//import com.sk89q.worldedit.command.GeneralCommandsRegistration;
|
import com.sk89q.worldedit.command.BrushCommands;
|
||||||
//import com.sk89q.worldedit.command.HistoryCommandsRegistration;
|
import com.sk89q.worldedit.command.BrushCommandsRegistration;
|
||||||
//import com.sk89q.worldedit.command.NavigationCommandsRegistration;
|
import com.sk89q.worldedit.command.BrushOptionsCommands;
|
||||||
//import com.sk89q.worldedit.command.SchematicCommandsRegistration;
|
import com.sk89q.worldedit.command.ChunkCommands;
|
||||||
//import com.sk89q.worldedit.command.SnapshotCommandsRegistration;
|
import com.sk89q.worldedit.command.ChunkCommandsRegistration;
|
||||||
//import com.sk89q.worldedit.command.SuperPickaxeCommandsRegistration;
|
import com.sk89q.worldedit.command.ClipboardCommands;
|
||||||
//import com.sk89q.worldedit.command.WorldEditCommandsRegistration;
|
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.Arguments;
|
||||||
import com.sk89q.worldedit.command.argument.BooleanConverter;
|
import com.sk89q.worldedit.command.argument.BooleanConverter;
|
||||||
import com.sk89q.worldedit.command.argument.CommaSeparatedValuesConverter;
|
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.ConsumeBindings;
|
||||||
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
|
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
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.CommandArgParser;
|
||||||
import com.sk89q.worldedit.internal.command.CommandLoggingHandler;
|
import com.sk89q.worldedit.internal.command.CommandLoggingHandler;
|
||||||
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
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.suggestion.Suggestion;
|
||||||
import org.enginehub.piston.util.HelpGenerator;
|
import org.enginehub.piston.util.HelpGenerator;
|
||||||
import org.enginehub.piston.util.ValueProvider;
|
import org.enginehub.piston.util.ValueProvider;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the registration and invocation of commands.
|
* Handles the registration and invocation of commands.
|
||||||
*
|
*
|
||||||
@ -152,14 +189,9 @@ public final class PlatformCommandManager {
|
|||||||
private final InjectedValueStore globalInjectedValues;
|
private final InjectedValueStore globalInjectedValues;
|
||||||
private final DynamicStreamHandler dynamicHandler = new DynamicStreamHandler();
|
private final DynamicStreamHandler dynamicHandler = new DynamicStreamHandler();
|
||||||
private final WorldEditExceptionConverter exceptionConverter;
|
private final WorldEditExceptionConverter exceptionConverter;
|
||||||
private final CommandRegistrationHandler registration;
|
public final CommandRegistrationHandler registration;
|
||||||
private static PlatformCommandManager INSTANCE;
|
private static PlatformCommandManager INSTANCE;
|
||||||
|
|
||||||
/*
|
|
||||||
Command types
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
*
|
*
|
||||||
@ -203,7 +235,7 @@ public final class PlatformCommandManager {
|
|||||||
DirectionConverter.register(worldEdit, commandManager);
|
DirectionConverter.register(worldEdit, commandManager);
|
||||||
FactoryConverter.register(worldEdit, commandManager);
|
FactoryConverter.register(worldEdit, commandManager);
|
||||||
for (int count = 2; count <= 3; count++) {
|
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(
|
CommaSeparatedValuesConverter.wrapAndLimit(ArgumentConverters.get(
|
||||||
TypeToken.of(double.class)
|
TypeToken.of(double.class)
|
||||||
), count)
|
), count)
|
||||||
@ -218,8 +250,9 @@ public final class PlatformCommandManager {
|
|||||||
RegionFactoryConverter.register(commandManager);
|
RegionFactoryConverter.register(commandManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerAlwaysInjectedValues() {
|
public void register(Object classWithMethods) {
|
||||||
globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), context -> Optional.of(context));
|
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 AnnotatedBindings(worldEdit));
|
||||||
register(new CommandBindings(worldEdit));
|
register(new CommandBindings(worldEdit));
|
||||||
register(new ConsumeBindings(worldEdit));
|
register(new ConsumeBindings(worldEdit));
|
||||||
@ -227,10 +260,6 @@ public final class PlatformCommandManager {
|
|||||||
register(new ProvideBindings(worldEdit));
|
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,
|
private <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
||||||
CommandRegistration<CI> registration, CI instance) {
|
CommandRegistration<CI> registration, CI instance) {
|
||||||
registerSubCommands(name, aliases, desc, registration, instance, m -> {});
|
registerSubCommands(name, aliases, desc, registration, instance, m -> {});
|
||||||
@ -266,121 +295,141 @@ public final class PlatformCommandManager {
|
|||||||
public void registerAllCommands() {
|
public void registerAllCommands() {
|
||||||
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
|
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
|
||||||
// TODO NOT IMPLEMENTED dunno why these have issues generating
|
// TODO NOT IMPLEMENTED dunno why these have issues generating
|
||||||
// registerSubCommands(
|
registerSubCommands(
|
||||||
// "schematic",
|
"schematic",
|
||||||
// ImmutableList.of("schem", "/schematic", "/schem"),
|
ImmutableList.of("schem", "/schematic", "/schem"),
|
||||||
// "Schematic commands for saving/loading areas",
|
"Schematic commands for saving/loading areas",
|
||||||
// SchematicCommandsRegistration.builder(),
|
SchematicCommandsRegistration.builder(),
|
||||||
// new SchematicCommands(worldEdit)
|
new SchematicCommands(worldEdit)
|
||||||
// );
|
);
|
||||||
// registerSubCommands(
|
registerSubCommands(
|
||||||
// "snapshot",
|
"snapshot",
|
||||||
// ImmutableList.of("snap"),
|
ImmutableList.of("snap"),
|
||||||
// "Snapshot commands for restoring backups",
|
"Snapshot commands for restoring backups",
|
||||||
// SnapshotCommandsRegistration.builder(),
|
SnapshotCommandsRegistration.builder(),
|
||||||
// new SnapshotCommands(worldEdit)
|
new SnapshotCommands(worldEdit)
|
||||||
// );
|
);
|
||||||
// registerSubCommands(
|
registerSubCommands(
|
||||||
// "superpickaxe",
|
"superpickaxe",
|
||||||
// ImmutableList.of("pickaxe", "sp"),
|
ImmutableList.of("pickaxe", "sp"),
|
||||||
// "Super-pickaxe commands",
|
"Super-pickaxe commands",
|
||||||
// SuperPickaxeCommandsRegistration.builder(),
|
SuperPickaxeCommandsRegistration.builder(),
|
||||||
// new SuperPickaxeCommands(worldEdit)
|
new SuperPickaxeCommands(worldEdit)
|
||||||
// );
|
);
|
||||||
// registerSubCommands(
|
registerSubCommands(
|
||||||
// "brush",
|
"brush",
|
||||||
// ImmutableList.of("br", "/brush", "/br"),
|
ImmutableList.of("br", "/brush", "/br"),
|
||||||
// "Brushing commands",
|
"Brushing commands",
|
||||||
// BrushCommandsRegistration.builder(),
|
BrushCommandsRegistration.builder(),
|
||||||
// new BrushCommands(worldEdit),
|
new BrushCommands(worldEdit),
|
||||||
// (Consumer<CommandManager>) manager -> {
|
manager -> {
|
||||||
// PaintBrushCommands.register(commandManagerService, manager, registration);
|
PaintBrushCommands.register(commandManagerService, manager, registration);
|
||||||
// ApplyBrushCommands.register(commandManagerService, manager, registration);
|
ApplyBrushCommands.register(commandManagerService, manager, registration);
|
||||||
// }
|
}
|
||||||
// );
|
);
|
||||||
// registerSubCommands(
|
registerSubCommands(
|
||||||
// "worldedit",
|
"brush",
|
||||||
// ImmutableList.of("we"),
|
ImmutableList.of("br", "/b"),
|
||||||
// "WorldEdit commands",
|
"Tool commands",
|
||||||
// WorldEditCommandsRegistration.builder(),
|
BrushOptionsCommandsRegistration.builder(),
|
||||||
// new WorldEditCommands(worldEdit)
|
new BrushOptionsCommands(worldEdit)
|
||||||
// );
|
);
|
||||||
// this.registration.register(
|
registerSubCommands(
|
||||||
// commandManager,
|
"worldedit",
|
||||||
// BiomeCommandsRegistration.builder(),
|
ImmutableList.of("we"),
|
||||||
// new BiomeCommands()
|
"WorldEdit commands",
|
||||||
// );
|
WorldEditCommandsRegistration.builder(),
|
||||||
// this.registration.register(
|
new WorldEditCommands(worldEdit)
|
||||||
// commandManager,
|
);
|
||||||
// ChunkCommandsRegistration.builder(),
|
registerSubCommands(
|
||||||
// new ChunkCommands(worldEdit)
|
"/anvil",
|
||||||
// );
|
ImmutableList.of(),
|
||||||
// this.registration.register(
|
"Manipulate billions of blocks https://github.com/boy0001/FastAsyncWorldedit/wiki/Anvil-API",
|
||||||
// commandManager,
|
AnvilCommandsRegistration.builder(),
|
||||||
// ClipboardCommandsRegistration.builder(),
|
new AnvilCommands(worldEdit)
|
||||||
// new ClipboardCommands(worldEdit)
|
);
|
||||||
// );
|
registerSubCommands(
|
||||||
// this.registration.register(
|
"transforms",
|
||||||
// commandManager,
|
ImmutableList.of(),
|
||||||
// GeneralCommandsRegistration.builder(),
|
"Transforms modify how a block is placed\n" +
|
||||||
// new GeneralCommands(worldEdit)
|
" - Use [brackets] for arguments\n" +
|
||||||
// );
|
" - Use , to OR multiple\n" +
|
||||||
// this.registration.register(
|
" - Use & to AND multiple\n" +
|
||||||
// commandManager,
|
"More Info: https://git.io/v9KHO",
|
||||||
// GenerationCommandsRegistration.builder(),
|
TransformCommandsRegistration.builder(),
|
||||||
// new GenerationCommands(worldEdit)
|
new TransformCommands()
|
||||||
// );
|
);
|
||||||
// this.registration.register(
|
this.registration.register(
|
||||||
// commandManager,
|
commandManager,
|
||||||
// HistoryCommandsRegistration.builder(),
|
BiomeCommandsRegistration.builder(),
|
||||||
// new HistoryCommands(worldEdit)
|
new BiomeCommands()
|
||||||
// );
|
);
|
||||||
// this.registration.register(
|
this.registration.register(
|
||||||
// commandManager,
|
commandManager,
|
||||||
// NavigationCommandsRegistration.builder(),
|
ChunkCommandsRegistration.builder(),
|
||||||
// new NavigationCommands(worldEdit)
|
new ChunkCommands(worldEdit)
|
||||||
// );
|
);
|
||||||
// this.registration.register(
|
this.registration.register(
|
||||||
// commandManager,
|
commandManager,
|
||||||
// RegionCommandsRegistration.builder(),
|
ClipboardCommandsRegistration.builder(),
|
||||||
// new RegionCommands(worldEdit)
|
new ClipboardCommands(worldEdit)
|
||||||
// );
|
);
|
||||||
// this.registration.register(
|
this.registration.register(
|
||||||
// commandManager,
|
commandManager,
|
||||||
// ScriptingCommandsRegistration.builder(),
|
GeneralCommandsRegistration.builder(),
|
||||||
// new ScriptingCommands(worldEdit)
|
new GeneralCommands(worldEdit)
|
||||||
// );
|
);
|
||||||
// this.registration.register(
|
this.registration.register(
|
||||||
// commandManager,
|
commandManager,
|
||||||
// SelectionCommandsRegistration.builder(),
|
GenerationCommandsRegistration.builder(),
|
||||||
// new SelectionCommands(worldEdit)
|
new GenerationCommands(worldEdit)
|
||||||
// );
|
);
|
||||||
// ExpandCommands.register(registration, commandManager, commandManagerService);
|
this.registration.register(
|
||||||
// this.registration.register(
|
commandManager,
|
||||||
// commandManager,
|
HistoryCommandsRegistration.builder(),
|
||||||
// SnapshotUtilCommandsRegistration.builder(),
|
new HistoryCommands(worldEdit)
|
||||||
// new SnapshotUtilCommands(worldEdit)
|
);
|
||||||
// );
|
this.registration.register(
|
||||||
// this.registration.register(
|
commandManager,
|
||||||
// commandManager,
|
NavigationCommandsRegistration.builder(),
|
||||||
// ToolCommandsRegistration.builder(),
|
new NavigationCommands(worldEdit)
|
||||||
// new ToolCommands(worldEdit)
|
);
|
||||||
// );
|
this.registration.register(
|
||||||
// this.registration.register(
|
commandManager,
|
||||||
// commandManager,
|
RegionCommandsRegistration.builder(),
|
||||||
// ToolUtilCommandsRegistration.builder(),
|
new RegionCommands(worldEdit)
|
||||||
// new ToolUtilCommands(worldEdit)
|
);
|
||||||
// );
|
this.registration.register(
|
||||||
// this.registration.register(
|
commandManager,
|
||||||
// commandManager,
|
ScriptingCommandsRegistration.builder(),
|
||||||
// UtilityCommandsRegistration.builder(),
|
new ScriptingCommands(worldEdit)
|
||||||
// new UtilityCommands(worldEdit)
|
);
|
||||||
// );
|
this.registration.register(
|
||||||
// this.registration.register(
|
commandManager,
|
||||||
// commandManager,
|
SelectionCommandsRegistration.builder(),
|
||||||
// AnvilCommandsRegistration.builder(),
|
new SelectionCommands(worldEdit)
|
||||||
// new AnvilCommands(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);
|
dynamicHandler.setHandler(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream<Substring> parseArgs(String input) {
|
public Stream<Substring> parseArgs(String input) {
|
||||||
return new CommandArgParser(CommandArgParser.spaceSplit(input.substring(1))).parseArgs();
|
return new CommandArgParser(CommandArgParser.spaceSplit(input.substring(1))).parseArgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,17 +636,20 @@ public final class PlatformCommandManager {
|
|||||||
Request.request().setWorld(((World) extent));
|
Request.request().setWorld(((World) extent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LocalConfiguration config = worldEdit.getConfiguration();
|
||||||
|
|
||||||
MemoizingValueAccess context = initializeInjectedValues(event::getArguments, actor);
|
MemoizingValueAccess context = initializeInjectedValues(event::getArguments, actor);
|
||||||
|
|
||||||
ThrowableSupplier<Throwable> task =
|
ThrowableSupplier<Throwable> task =
|
||||||
() -> commandManager.execute(context,Lists.newArrayList(split));
|
() -> commandManager.execute(context, ImmutableList.copyOf(split));
|
||||||
|
|
||||||
handleCommandTask(task, context, session, event);
|
handleCommandTask(task, context, session, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object handleCommandTask(ThrowableSupplier<Throwable> task, InjectedValueAccess context, @Nullable LocalSession session, CommandEvent 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();
|
Request.reset();
|
||||||
|
Actor actor = context.injectedValue(Key.of(Actor.class)).orElseThrow(() -> new IllegalStateException("No player"));
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -651,8 +703,7 @@ public final class PlatformCommandManager {
|
|||||||
} else {
|
} else {
|
||||||
System.out.println("Invalid context " + context);
|
System.out.println("Invalid context " + context);
|
||||||
}
|
}
|
||||||
Optional<EditSession> editSessionOpt =
|
Optional<EditSession> editSessionOpt = context.injectedValue(Key.of(EditSession.class));
|
||||||
context.injectedValue(Key.of(EditSession.class));
|
|
||||||
|
|
||||||
if (editSessionOpt.isPresent()) {
|
if (editSessionOpt.isPresent()) {
|
||||||
EditSession editSession = editSessionOpt.get();
|
EditSession editSession = editSessionOpt.get();
|
||||||
|
@ -70,7 +70,7 @@ public class CommandScriptLoader {
|
|||||||
BrushCommands processor = new BrushCommands(WorldEdit.getInstance());
|
BrushCommands processor = new BrushCommands(WorldEdit.getInstance());
|
||||||
for (FunctionParametricCallable cmd : cmds) {
|
for (FunctionParametricCallable cmd : cmds) {
|
||||||
ProcessedCallable processed = new ProcessedCallable(cmd, processor);
|
ProcessedCallable processed = new ProcessedCallable(cmd, processor);
|
||||||
PlatformCommandManager.getInstance().registerCommand(aliases, cmd.getCommand(), processed);
|
PlatformCommandManager.getInstance().registration.register(aliases, cmd.getCommand(), processed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -49,7 +49,6 @@ public class NashornCraftScriptEngine implements CraftScriptEngine {
|
|||||||
synchronized (NashornCraftScriptEngine.class) {
|
synchronized (NashornCraftScriptEngine.class) {
|
||||||
if (FACTORY == null) FACTORY = new NashornScriptEngineFactory();
|
if (FACTORY == null) FACTORY = new NashornScriptEngineFactory();
|
||||||
}
|
}
|
||||||
;
|
|
||||||
ScriptEngine engine = FACTORY.getScriptEngine("--language=es6");
|
ScriptEngine engine = FACTORY.getScriptEngine("--language=es6");
|
||||||
SimpleBindings bindings = new SimpleBindings();
|
SimpleBindings bindings = new SimpleBindings();
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class RhinoCraftScriptEngine implements CraftScriptEngine {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object evaluate(String script, String filename, Map<String, Object> args)
|
public Object evaluate(String script, String filename, Map<String, Object> args)
|
||||||
throws ScriptException, Throwable {
|
throws Throwable {
|
||||||
RhinoContextFactory factory = new RhinoContextFactory(timeLimit);
|
RhinoContextFactory factory = new RhinoContextFactory(timeLimit);
|
||||||
Context cx = factory.enterContext();
|
Context cx = factory.enterContext();
|
||||||
ScriptableObject scriptable = new ImporterTopLevel(cx);
|
ScriptableObject scriptable = new ImporterTopLevel(cx);
|
||||||
|
@ -90,7 +90,7 @@ configure(subprojects + project("core:ap")) {
|
|||||||
|
|
||||||
def textExtrasVersion = "3.0.2"
|
def textExtrasVersion = "3.0.2"
|
||||||
project("core") {
|
project("core") {
|
||||||
def textVersion = "3.0.1"
|
def textVersion = "3.0.2"
|
||||||
def pistonVersion = '0.4.3-SNAPSHOT'
|
def pistonVersion = '0.4.3-SNAPSHOT'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -98,6 +98,7 @@ project("core") {
|
|||||||
shade "net.kyori:text-serializer-gson:$textVersion"
|
shade "net.kyori:text-serializer-gson:$textVersion"
|
||||||
shade "net.kyori:text-serializer-legacy:$textVersion"
|
shade "net.kyori:text-serializer-legacy:$textVersion"
|
||||||
shade "net.kyori:text-serializer-plain:$textVersion"
|
shade "net.kyori:text-serializer-plain:$textVersion"
|
||||||
|
shade "net.kyori:text-feature-pagination:$textVersion"
|
||||||
shade('com.sk89q:jchronic:0.2.4a') {
|
shade('com.sk89q:jchronic:0.2.4a') {
|
||||||
exclude(group: "junit", module: "junit")
|
exclude(group: "junit", module: "junit")
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren