mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
More work on getting commands to compile
This commit is contained in:
parent
f5c202af6d
commit
9c3122a227
@ -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);
|
||||||
|
@ -1,78 +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.bukkit.util;
|
|
||||||
|
|
||||||
import org.enginehub.piston.annotation.Command;
|
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
|
||||||
import com.sk89q.minecraft.util.commands.CommandsManager;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public class CommandsManagerRegistration extends CommandRegistration {
|
|
||||||
|
|
||||||
protected CommandsManager<?> commands;
|
|
||||||
|
|
||||||
public CommandsManagerRegistration(Plugin plugin, CommandsManager<?> commands) {
|
|
||||||
super(plugin);
|
|
||||||
this.commands = commands;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandsManagerRegistration(Plugin plugin, CommandExecutor executor, CommandsManager<?> commands) {
|
|
||||||
super(plugin, executor);
|
|
||||||
this.commands = commands;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean register(Class<?> clazz) {
|
|
||||||
return registerAll(commands.registerAndReturn(clazz));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean registerAll(List<Command> registered) {
|
|
||||||
List<CommandInfo> toRegister = new ArrayList<>();
|
|
||||||
for (Command command : registered) {
|
|
||||||
List<String> permissions = null;
|
|
||||||
Method cmdMethod = commands.getMethods().get(null).get(command.aliases()[0]);
|
|
||||||
Map<String, Method> childMethods = commands.getMethods().get(cmdMethod);
|
|
||||||
|
|
||||||
if (cmdMethod != null && cmdMethod.isAnnotationPresent(CommandPermissions.class)) {
|
|
||||||
permissions = Arrays.asList(cmdMethod.getAnnotation(CommandPermissions.class).value());
|
|
||||||
} else if (cmdMethod != null && childMethods != null && !childMethods.isEmpty()) {
|
|
||||||
permissions = new ArrayList<>();
|
|
||||||
for (Method m : childMethods.values()) {
|
|
||||||
if (m.isAnnotationPresent(CommandPermissions.class)) {
|
|
||||||
permissions.addAll(Arrays.asList(m.getAnnotation(CommandPermissions.class).value()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
toRegister.add(new CommandInfo(command.usage(), command.desc(), command.aliases(), commands, permissions == null ? null : permissions.toArray(new String[permissions.size()])));
|
|
||||||
}
|
|
||||||
|
|
||||||
return register(toRegister);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,14 +318,13 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
World ref = worldRef.get();
|
if (worldRef.get() == null) {
|
||||||
if (ref == null) {
|
|
||||||
return false;
|
return false;
|
||||||
} else if (other == null) {
|
} else if (other == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if ((other instanceof BukkitWorld)) {
|
} else if ((other instanceof BukkitWorld)) {
|
||||||
World otherWorld = ((BukkitWorld) other).worldRef.get();
|
World otherWorld = ((BukkitWorld) other).worldRef.get();
|
||||||
return ref.equals(otherWorld);
|
return otherWorld != null && otherWorld.equals(getWorld());
|
||||||
} else if (other instanceof com.sk89q.worldedit.world.World) {
|
} else if (other instanceof com.sk89q.worldedit.world.World) {
|
||||||
return ((com.sk89q.worldedit.world.World) other).getName().equals(getName());
|
return ((com.sk89q.worldedit.world.World) other).getName().equals(getName());
|
||||||
} else {
|
} else {
|
||||||
@ -420,8 +419,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;
|
||||||
@ -37,15 +36,12 @@ import org.bukkit.event.player.PlayerCommandSendEvent;
|
|||||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.enginehub.piston.Command;
|
|
||||||
import org.enginehub.piston.CommandManager;
|
import org.enginehub.piston.CommandManager;
|
||||||
import org.enginehub.piston.inject.InjectedValueStore;
|
import org.enginehub.piston.inject.InjectedValueStore;
|
||||||
import org.enginehub.piston.inject.Key;
|
import org.enginehub.piston.inject.Key;
|
||||||
import org.enginehub.piston.inject.MapBackedValueStore;
|
import org.enginehub.piston.inject.MapBackedValueStore;
|
||||||
|
|
||||||
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,22 +71,16 @@ 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;
|
InjectedValueStore store = MapBackedValueStore.create();
|
||||||
|
store.injectValue(Key.of(Actor.class), context ->
|
||||||
|
Optional.of(plugin.wrapCommandSender(event.getPlayer())));
|
||||||
CommandManager commandManager = plugin.getWorldEdit().getPlatformManager().getPlatformCommandManager().getCommandManager();
|
CommandManager commandManager = plugin.getWorldEdit().getPlatformManager().getPlatformCommandManager().getCommandManager();
|
||||||
Iterator<String> iter = event.getCommands().iterator();
|
event.getCommands().removeIf(name ->
|
||||||
while (iter.hasNext()) {
|
// remove if in the manager and not satisfied
|
||||||
String name = iter.next();
|
commandManager.getCommand(name)
|
||||||
Optional<Command> optional = commandManager.getCommand(name);
|
.filter(command -> !command.getCondition().satisfied(store))
|
||||||
if (optional.isPresent()) {
|
.isPresent()
|
||||||
if (store == null) {
|
);
|
||||||
store = MapBackedValueStore.create();
|
|
||||||
store.injectValue(Key.of(Actor.class), context -> Optional.of(plugin.wrapCommandSender(event.getPlayer())));
|
|
||||||
}
|
|
||||||
if (!optional.get().getCondition().satisfied(store)) {
|
|
||||||
iter.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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")
|
||||||
|
@ -82,10 +82,6 @@ public class CFICommand extends MethodCommands {
|
|||||||
dispatcher.call(cmd, context.getLocals(), new String[0]);
|
dispatcher.call(cmd, context.getLocals(), new String[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 2:
|
|
||||||
String cmd = Commands.getAlias(CFICommands.class, "empty") + " " + context.getJoinedStrings(0);
|
|
||||||
dispatcher.call(cmd, context.getLocals(), new String[0]);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dispatcher.call(remaining, context.getLocals(), new String[0]);
|
dispatcher.call(remaining, context.getLocals(), new String[0]);
|
||||||
|
@ -1,13 +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.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;
|
||||||
@ -18,17 +21,14 @@ import com.boydti.fawe.util.TaskManager;
|
|||||||
import com.boydti.fawe.util.TextureUtil;
|
import com.boydti.fawe.util.TextureUtil;
|
||||||
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 com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
import org.enginehub.piston.annotation.Command;
|
|
||||||
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;
|
||||||
@ -44,14 +44,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;
|
||||||
@ -67,15 +64,18 @@ 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 {
|
||||||
|
|
||||||
private final Dispatcher dispathcer;
|
private final Dispatcher dispatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
@ -84,7 +84,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
*/
|
*/
|
||||||
public CFICommands(WorldEdit worldEdit, Dispatcher dispatcher) {
|
public CFICommands(WorldEdit worldEdit, Dispatcher dispatcher) {
|
||||||
super(worldEdit);
|
super(worldEdit);
|
||||||
this.dispathcer = dispatcher;
|
this.dispatcher = dispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getFolder(String worldName) {
|
public static File getFolder(String worldName) {
|
||||||
@ -99,7 +99,7 @@ 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) throws ParameterException {
|
public void heightmap(FawePlayer fp, FawePrimitiveBinding.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)))
|
||||||
@ -121,7 +121,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);
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Info about using brushes with CFI"
|
desc = "Info about using brushes with CFI"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void brush(FawePlayer fp) throws ParameterException {
|
public void brush(FawePlayer fp) {
|
||||||
CFISettings settings = assertSettings(fp);
|
CFISettings settings = assertSettings(fp);
|
||||||
settings.popMessages(fp);
|
settings.popMessages(fp);
|
||||||
Message msg;
|
Message msg;
|
||||||
@ -232,7 +232,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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException{
|
public void column(FawePlayer fp, Pattern pattern, FawePrimitiveBinding.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);
|
||||||
@ -251,14 +251,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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException{
|
public void floorCmd(FawePlayer fp, Pattern pattern, FawePrimitiveBinding.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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException {
|
private void floor(FawePlayer fp, Pattern pattern, FawePrimitiveBinding.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);
|
||||||
@ -274,14 +274,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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException{
|
public void mainCmd(FawePlayer fp, Pattern pattern, FawePrimitiveBinding.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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException{
|
public void main(FawePlayer fp, Pattern pattern, FawePrimitiveBinding.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);
|
||||||
@ -300,7 +300,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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException{
|
public void overlay(FawePlayer fp, Pattern pattern, FawePrimitiveBinding.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);
|
||||||
@ -322,13 +322,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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException{
|
public void smoothCmd(FawePlayer fp, int radius, int iterations, FawePrimitiveBinding.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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException{
|
private void smooth(FawePlayer fp, int radius, int iterations, FawePrimitiveBinding.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);
|
||||||
@ -342,7 +342,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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException{
|
public void snow(FawePlayer fp, FawePrimitiveBinding.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);
|
||||||
@ -361,7 +361,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
"Below 50 will prefer to color with blocks"
|
"Below 50 will prefer to color with blocks"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void biomepriority(FawePlayer fp, int value) throws ParameterException {
|
public void biomepriority(FawePlayer fp, int value) {
|
||||||
assertSettings(fp).getGenerator().setBiomePriority(value);
|
assertSettings(fp).getGenerator().setBiomePriority(value);
|
||||||
coloring(fp);
|
coloring(fp);
|
||||||
}
|
}
|
||||||
@ -374,7 +374,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
"`#clipboard` will only use the blocks present in your clipboard."
|
"`#clipboard` will only use the blocks present in your clipboard."
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void paletteblocks(FawePlayer fp, Player player, LocalSession session, @Arg(name = "arg", desc = "String", def = "") String arg) throws ParameterException, 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")
|
||||||
@ -452,7 +452,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
"Randomization will allow mixing biomes when coloring with biomes"
|
"Randomization will allow mixing biomes when coloring with biomes"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void randomization(FawePlayer fp, boolean enabled) throws ParameterException {
|
public void randomization(FawePlayer fp, boolean enabled) {
|
||||||
assertSettings(fp).getGenerator().setTextureRandomVariation(enabled);
|
assertSettings(fp).getGenerator().setTextureRandomVariation(enabled);
|
||||||
coloring(fp);
|
coloring(fp);
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
"Using 0 73 for the min/max would use the simplest 73% of blocks for coloring, and is a reasonable value."
|
"Using 0 73 for the min/max would use the simplest 73% of blocks for coloring, and is a reasonable value."
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void complexity(FawePlayer fp, int min, int max) throws ParameterException, FileNotFoundException {
|
public void complexity(FawePlayer fp, int min, int max) throws FileNotFoundException {
|
||||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
if (min == 0 && max == 100) {
|
if (min == 0 && max == 100) {
|
||||||
gen.setTextureUtil(Fawe.get().getTextureUtil());
|
gen.setTextureUtil(Fawe.get().getTextureUtil());
|
||||||
@ -485,7 +485,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, @Optional FawePrimitiveBinding.ImageUri imageMask, Mask mask, String schematic, int rarity, int distance, boolean rotate) throws ParameterException, IOException, WorldEditException {
|
public void schem(FawePlayer fp, FawePrimitiveBinding.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();
|
||||||
@ -511,7 +511,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, @Optional FawePrimitiveBinding.ImageUri image, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException{
|
public void biome(FawePlayer fp, BiomeType biome, FawePrimitiveBinding.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);
|
||||||
@ -530,7 +530,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Generate vanilla caves"
|
desc = "Generate vanilla caves"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void caves(FawePlayer fp) throws ParameterException, WorldEditException {
|
public void caves(FawePlayer fp) throws WorldEditException {
|
||||||
assertSettings(fp).getGenerator().addCaves();
|
assertSettings(fp).getGenerator().addCaves();
|
||||||
msg("Added caves!").send(fp);
|
msg("Added caves!").send(fp);
|
||||||
populate(fp);
|
populate(fp);
|
||||||
@ -542,7 +542,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
descFooter = "Use a specific pattern and settings to generate ore"
|
descFooter = "Use a specific pattern and settings to generate ore"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void ore(FawePlayer fp, Mask mask, Pattern pattern, int size, int frequency, int rariry, int minY, int maxY) throws ParameterException, WorldEditException {
|
public void ore(FawePlayer fp, Mask mask, Pattern pattern, int size, int frequency, int rariry, int minY, int maxY) throws WorldEditException {
|
||||||
assertSettings(fp).getGenerator().addOre(mask, pattern, size, frequency, rariry, minY, maxY);
|
assertSettings(fp).getGenerator().addOre(mask, pattern, size, frequency, rariry, minY, maxY);
|
||||||
msg("Added ore!").send(fp);
|
msg("Added ore!").send(fp);
|
||||||
populate(fp);
|
populate(fp);
|
||||||
@ -553,7 +553,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Generate the vanilla ores"
|
desc = "Generate the vanilla ores"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void ores(FawePlayer fp, Mask mask) throws ParameterException, WorldEditException {
|
public void ores(FawePlayer fp, Mask mask) throws WorldEditException {
|
||||||
assertSettings(fp).getGenerator().addDefaultOres(mask);
|
assertSettings(fp).getGenerator().addDefaultOres(mask);
|
||||||
msg("Added ores!").send(fp);
|
msg("Added ores!").send(fp);
|
||||||
populate(fp);
|
populate(fp);
|
||||||
@ -565,7 +565,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
descFooter = "Set the terrain height either based on an image heightmap, or a numeric value."
|
descFooter = "Set the terrain height either based on an image heightmap, or a numeric value."
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void height(FawePlayer fp, String arg) throws ParameterException, WorldEditException {
|
public void height(FawePlayer fp, String arg) throws WorldEditException {
|
||||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
if (!MathMan.isInteger(arg)) {
|
if (!MathMan.isInteger(arg)) {
|
||||||
gen.setHeight(ImageUtil.getImage(arg));
|
gen.setHeight(ImageUtil.getImage(arg));
|
||||||
@ -581,7 +581,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Change the block used for water\ne.g. Lava"
|
desc = "Change the block used for water\ne.g. Lava"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void waterId(FawePlayer fp, BlockStateHolder block) throws ParameterException, WorldEditException {
|
public void waterId(FawePlayer fp, BlockStateHolder block) throws WorldEditException {
|
||||||
CFISettings settings = assertSettings(fp);
|
CFISettings settings = assertSettings(fp);
|
||||||
settings.getGenerator().setWaterId(block.getBlockType().getInternalId());
|
settings.getGenerator().setWaterId(block.getBlockType().getInternalId());
|
||||||
msg("Set water id!").send(fp);
|
msg("Set water id!").send(fp);
|
||||||
@ -595,7 +595,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Change the block used for the base\ne.g. Bedrock"
|
desc = "Change the block used for the base\ne.g. Bedrock"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void baseId(FawePlayer fp, BlockStateHolder block) throws ParameterException, WorldEditException {
|
public void baseId(FawePlayer fp, BlockStateHolder block) throws WorldEditException {
|
||||||
CFISettings settings = assertSettings(fp);
|
CFISettings settings = assertSettings(fp);
|
||||||
settings.getGenerator().setBedrockId(block.getBlockType().getInternalId());
|
settings.getGenerator().setBedrockId(block.getBlockType().getInternalId());
|
||||||
msg("Set base id!").send(fp);
|
msg("Set base id!").send(fp);
|
||||||
@ -610,7 +610,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
" - A value of 0 is the default and will not modify the height"
|
" - A value of 0 is the default and will not modify the height"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void worldthickness(FawePlayer fp, int height) throws ParameterException, WorldEditException {
|
public void worldthickness(FawePlayer fp, int height) throws WorldEditException {
|
||||||
assertSettings(fp).getGenerator().setWorldThickness(height);
|
assertSettings(fp).getGenerator().setWorldThickness(height);
|
||||||
msg("Set world thickness!").send(fp);
|
msg("Set world thickness!").send(fp);
|
||||||
component(fp);
|
component(fp);
|
||||||
@ -623,7 +623,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
" - A value of 0 is the default and will only set the top block"
|
" - A value of 0 is the default and will only set the top block"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void floorthickness(FawePlayer fp, int height) throws ParameterException, WorldEditException {
|
public void floorthickness(FawePlayer fp, int height) throws WorldEditException {
|
||||||
assertSettings(fp).getGenerator().setFloorThickness(height);
|
assertSettings(fp).getGenerator().setFloorThickness(height);
|
||||||
msg("Set floor thickness!").send(fp);
|
msg("Set floor thickness!").send(fp);
|
||||||
component(fp);
|
component(fp);
|
||||||
@ -635,7 +635,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Resend the CFI chunks"
|
desc = "Resend the CFI chunks"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void update(FawePlayer fp) throws ParameterException, WorldEditException {
|
public void update(FawePlayer fp) throws WorldEditException {
|
||||||
assertSettings(fp).getGenerator().update();
|
assertSettings(fp).getGenerator().update();
|
||||||
msg("Chunks refreshed!").send(fp);
|
msg("Chunks refreshed!").send(fp);
|
||||||
mainMenu(fp);
|
mainMenu(fp);
|
||||||
@ -647,7 +647,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Teleport to the CFI virtual world"
|
desc = "Teleport to the CFI virtual world"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void tp(FawePlayer fp) throws ParameterException, WorldEditException {
|
public void tp(FawePlayer fp) throws WorldEditException {
|
||||||
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
HeightMapMCAGenerator gen = assertSettings(fp).getGenerator();
|
||||||
msg("Teleporting...").send(fp);
|
msg("Teleporting...").send(fp);
|
||||||
Vector3 origin = gen.getOrigin();
|
Vector3 origin = gen.getOrigin();
|
||||||
@ -665,7 +665,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
" - By default water is disabled (with a value of 0)"
|
" - By default water is disabled (with a value of 0)"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void waterheight(FawePlayer fp, int height) throws ParameterException, WorldEditException {
|
public void waterheight(FawePlayer fp, int height) throws WorldEditException {
|
||||||
assertSettings(fp).getGenerator().setWaterHeight(height);
|
assertSettings(fp).getGenerator().setWaterHeight(height);
|
||||||
msg("Set water height!").send(fp);
|
msg("Set water height!").send(fp);
|
||||||
component(fp);
|
component(fp);
|
||||||
@ -678,7 +678,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, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException, WorldEditException {
|
public void glass(FawePlayer fp, FawePrimitiveBinding.ImageUri image, FawePrimitiveBinding.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);
|
||||||
@ -695,7 +695,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, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException, WorldEditException {
|
public void color(FawePlayer fp, FawePrimitiveBinding.ImageUri image, FawePrimitiveBinding.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) {
|
||||||
@ -719,7 +719,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, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException, WorldEditException {
|
public void blockbiome(FawePlayer fp, FawePrimitiveBinding.ImageUri image, FawePrimitiveBinding.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);
|
||||||
@ -735,7 +735,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, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly) throws ParameterException, WorldEditException {
|
public void biomecolor(FawePlayer fp, FawePrimitiveBinding.ImageUri image, FawePrimitiveBinding.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);
|
||||||
@ -750,7 +750,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Color the world using an image"
|
desc = "Color the world using an image"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void coloring(FawePlayer fp) throws ParameterException {
|
public void coloring(FawePlayer fp) {
|
||||||
CFISettings settings = assertSettings(fp);
|
CFISettings settings = assertSettings(fp);
|
||||||
settings.popMessages(fp);
|
settings.popMessages(fp);
|
||||||
settings.setCategory("coloring");
|
settings.setCategory("coloring");
|
||||||
@ -834,7 +834,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, @Optional FawePrimitiveBinding.ImageUri imageMask, @Arg(name = "mask", desc = "Mask", def = "") Mask mask, @Switch(name='w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context) throws ParameterException{
|
public void mask(FawePlayer fp, FawePrimitiveBinding.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;
|
||||||
@ -859,7 +859,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Select a pattern"
|
desc = "Select a pattern"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void pattern(FawePlayer fp, @Arg(name = "pattern", desc = "Pattern", def = "") Pattern pattern, InjectedValueAccess context) throws ParameterException, CommandException {
|
public void pattern(FawePlayer fp, @Arg(name = "pattern", desc = "Pattern", def = "") Pattern pattern, 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;
|
||||||
@ -869,7 +869,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
StringBuilder cmd = new StringBuilder(alias() + " pattern ");
|
StringBuilder cmd = new StringBuilder(alias() + " pattern ");
|
||||||
|
|
||||||
if (pattern != null) {
|
if (pattern != null) {
|
||||||
dispathcer.call(settings.getCategory(), context.getLocals(), new String[0]);
|
dispatcher.call(settings.getCategory(), context.getLocals(), new String[0]);
|
||||||
} else {
|
} else {
|
||||||
msg(">> Current Settings <<").newline()
|
msg(">> Current Settings <<").newline()
|
||||||
.text("Pattern ").text("[Click Here]").suggestTip(cmd + " stone")
|
.text("Pattern ").text("[Click Here]").suggestTip(cmd + " stone")
|
||||||
@ -883,7 +883,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Download the current image"
|
desc = "Download the current image"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void download(FawePlayer fp) throws ParameterException, IOException {
|
public void download(FawePlayer fp) throws IOException {
|
||||||
CFISettings settings = assertSettings(fp);
|
CFISettings settings = assertSettings(fp);
|
||||||
BufferedImage image = settings.getGenerator().draw();
|
BufferedImage image = settings.getGenerator().draw();
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
@ -899,7 +899,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, @Optional FawePrimitiveBinding.ImageUri image, InjectedValueAccess context) throws ParameterException, CommandException {
|
public void image(FawePlayer fp, @Optional FawePrimitiveBinding.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;
|
||||||
@ -921,7 +921,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
String next = Commands.getAlias(CFICommands.class, "heightmap " + settings.imageArg);
|
String next = Commands.getAlias(CFICommands.class, "heightmap " + settings.imageArg);
|
||||||
dispathcer.call(next, context.getLocals(), new String[0]);
|
dispatcher.call(next, context.getLocals(), new String[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -932,7 +932,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = ""
|
desc = ""
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void populate(FawePlayer fp) throws ParameterException {
|
public void populate(FawePlayer fp) {
|
||||||
CFISettings settings = assertSettings(fp);
|
CFISettings settings = assertSettings(fp);
|
||||||
settings.popMessages(fp);
|
settings.popMessages(fp);
|
||||||
settings.setCategory("populate");
|
settings.setCategory("populate");
|
||||||
@ -949,7 +949,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
desc = "Components menu"
|
desc = "Components menu"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.cfi")
|
@CommandPermissions("worldedit.anvil.cfi")
|
||||||
public void component(FawePlayer fp) throws ParameterException {
|
public void component(FawePlayer fp) {
|
||||||
CFISettings settings = assertSettings(fp);
|
CFISettings settings = assertSettings(fp);
|
||||||
settings.popMessages(fp);
|
settings.popMessages(fp);
|
||||||
settings.setCategory("component");
|
settings.setCategory("component");
|
||||||
@ -1027,7 +1027,7 @@ public class CFICommands extends MethodCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private CFISettings assertSettings(FawePlayer fp) throws ParameterException {
|
private CFISettings assertSettings(FawePlayer fp) {
|
||||||
CFISettings settings = getSettings(fp);
|
CFISettings settings = getSettings(fp);
|
||||||
if (!settings.hasGenerator()) {
|
if (!settings.hasGenerator()) {
|
||||||
throw new ParameterException("Please use /" + alias());
|
throw new ParameterException("Please use /" + alias());
|
||||||
|
@ -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;
|
||||||
@ -125,11 +123,10 @@ 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,27 +153,23 @@ 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();
|
||||||
List<DiskStorageHistory> edits = FaweAPI.getBDFiles(origin, user, radius, time, shallow);
|
List<DiskStorageHistory> edits = FaweAPI.getBDFiles(origin, user, radius, time, shallow);
|
||||||
if (edits == null) {
|
if (edits == null) {
|
||||||
|
@ -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,19 +511,18 @@ 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 Objects.equals(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();
|
return IntStream.range(0, n).mapToObj(i -> s).collect(Collectors.joining());
|
||||||
for (int i = 0; i < n; i++) {
|
|
||||||
sb.append(s);
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,12 +271,12 @@ public abstract class TaskManager {
|
|||||||
return sync(function, Integer.MAX_VALUE);
|
return sync(function, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
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,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)) {
|
||||||
@ -114,8 +122,8 @@ public class SchemSync implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} 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;
|
||||||
@ -30,7 +33,6 @@ import com.sk89q.worldedit.function.mask.Mask;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.internal.annotation.Range;
|
import com.sk89q.worldedit.internal.annotation.Range;
|
||||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
|
||||||
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;
|
||||||
|
|
||||||
@ -48,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("../");
|
||||||
@ -81,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();
|
||||||
@ -95,10 +100,11 @@ 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";
|
||||||
@ -107,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);
|
||||||
@ -131,12 +133,13 @@ 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);
|
||||||
@ -152,8 +155,8 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
@ -164,10 +167,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@ -175,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;
|
||||||
@ -189,16 +192,17 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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());
|
||||||
}
|
}
|
||||||
@ -208,16 +212,17 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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());
|
||||||
}
|
}
|
||||||
@ -231,9 +236,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
"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);
|
||||||
@ -249,9 +255,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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);
|
||||||
@ -269,7 +276,8 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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);
|
||||||
@ -291,7 +299,8 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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);
|
||||||
@ -306,7 +315,11 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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);
|
||||||
@ -315,12 +328,11 @@ 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();
|
||||||
}
|
}
|
||||||
@ -331,7 +343,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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());
|
||||||
@ -362,7 +377,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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());
|
||||||
@ -378,9 +396,11 @@ 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);
|
||||||
@ -391,7 +411,10 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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());
|
||||||
@ -419,9 +442,13 @@ public class BrushOptionsCommands extends MethodCommands {
|
|||||||
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());
|
||||||
@ -442,10 +469,12 @@ 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());
|
||||||
@ -458,10 +487,13 @@ 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}.
|
||||||
*/
|
*/
|
||||||
|
@ -254,7 +254,7 @@ public class GenerationCommands {
|
|||||||
@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 {
|
||||||
|
|
||||||
|
@ -51,8 +51,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"
|
||||||
usage = "[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();
|
||||||
@ -238,15 +272,15 @@ 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 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;
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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,7 +517,7 @@ 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,
|
||||||
@ -477,11 +530,14 @@ public class RegionCommands extends MethodCommands {
|
|||||||
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,
|
||||||
|
@Switch(name='a', desc = "TODO")
|
||||||
|
boolean skipAir,
|
||||||
InjectedValueAccess context) throws WorldEditException {
|
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);
|
||||||
|
|
||||||
@ -537,7 +593,8 @@ public class RegionCommands extends MethodCommands {
|
|||||||
@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);
|
||||||
@ -564,12 +621,10 @@ 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" +
|
|
||||||
"The expression is executed for each block and is expected\n" +
|
|
||||||
"to modify the variables x, y and z to point to a new block\n" +
|
"to modify the variables x, y and z to point to a new block\n" +
|
||||||
"to fetch. See also tinyurl.com/wesyntax."
|
"to fetch. See also https://tinyurl.com/weexpr"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.deform")
|
@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,
|
||||||
@ -686,6 +741,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
@ -699,6 +755,7 @@ public class RegionCommands extends MethodCommands {
|
|||||||
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);
|
||||||
|
@ -114,10 +114,11 @@ public class ScriptingCommands {
|
|||||||
file = new FileInputStream(f);
|
file = new FileInputStream(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataInputStream in = new DataInputStream(file);
|
byte[] data;
|
||||||
byte[] data = new byte[in.available()];
|
try (DataInputStream in = new DataInputStream(file)) {
|
||||||
|
data = new byte[in.available()];
|
||||||
in.readFully(data);
|
in.readFully(data);
|
||||||
in.close();
|
}
|
||||||
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
actor.printError("Script read error: " + e.getMessage());
|
actor.printError("Script read error: " + e.getMessage());
|
||||||
@ -131,11 +132,10 @@ public class ScriptingCommands {
|
|||||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||||
LocalSession session = worldEdit.getSessionManager().get(actor);
|
LocalSession session = worldEdit.getSessionManager().get(actor);
|
||||||
|
|
||||||
CraftScriptEngine engine = null;
|
CraftScriptEngine engine;
|
||||||
|
|
||||||
Object result = null;
|
Object result = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
engine = new RhinoCraftScriptEngine();
|
engine = new RhinoCraftScriptEngine();
|
||||||
} catch (NoClassDefFoundError e) {
|
} catch (NoClassDefFoundError e) {
|
||||||
actor.printError("Failed to find an installed script engine.");
|
actor.printError("Failed to find an installed script engine.");
|
||||||
@ -182,10 +182,11 @@ public class ScriptingCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.scripting.execute")
|
@CommandPermissions("worldedit.scripting.execute")
|
||||||
@Logging(ALL)
|
@Logging(ALL)
|
||||||
public void execute(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
|
public void execute(Player player, LocalSession session,
|
||||||
final String[] scriptArgs = args.getSlice(1);
|
@Arg(desc = "Filename of the CraftScript to load")
|
||||||
final String filename = args.getString(0);
|
String filename,
|
||||||
|
@Arg(desc = "Arguments to the CraftScript", def = "", variable = true)
|
||||||
|
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;
|
||||||
@ -204,7 +205,8 @@ public class ScriptingCommands {
|
|||||||
player.printError("More info: https://github.com/boy0001/CraftScripts/");
|
player.printError("More info: https://github.com/boy0001/CraftScripts/");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
runScript(LocationMaskedPlayerWrapper.unwrap(player), f, scriptArgs);
|
worldEdit.runScript(LocationMaskedPlayerWrapper.unwrap(player), f, Stream.concat(Stream.of(filename), args.stream())
|
||||||
|
.toArray(String[]::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
|
@ -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);
|
||||||
|
|
||||||
@ -205,7 +202,7 @@ public class SnapshotCommands {
|
|||||||
|
|
||||||
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().toZoneId()).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());
|
||||||
@ -235,7 +232,7 @@ public class SnapshotCommands {
|
|||||||
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().toZoneId()).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());
|
||||||
@ -245,4 +242,26 @@ public class SnapshotCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class SnapshotListBox extends PaginationBox {
|
||||||
|
private final List<Snapshot> snapshots;
|
||||||
|
|
||||||
|
SnapshotListBox(String world, List<Snapshot> snapshots) {
|
||||||
|
super("Snapshots for: " + world, "/snap list -p %page%");
|
||||||
|
this.snapshots = snapshots;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(int number) {
|
||||||
|
final Snapshot snapshot = snapshots.get(number);
|
||||||
|
return TextComponent.of(number + 1 + ". ", TextColor.GOLD)
|
||||||
|
.append(TextComponent.of(snapshot.getName(), TextColor.LIGHT_PURPLE)
|
||||||
|
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to use")))
|
||||||
|
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/snap use " + snapshot.getName())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getComponentsSize() {
|
||||||
|
return snapshots.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,9 +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.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;
|
||||||
@ -30,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;
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ 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());
|
||||||
@ -54,12 +56,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, InjectedValueAccess args) throws WorldEditException {
|
public void area(Player player, LocalSession session,
|
||||||
|
@Arg(desc = "The range of the area pickaxe")
|
||||||
|
int range) throws WorldEditException {
|
||||||
|
|
||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
int range = args.getInteger(0);
|
|
||||||
|
|
||||||
if (range > config.maxSuperPickaxeSize) {
|
if (range > config.maxSuperPickaxeSize) {
|
||||||
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
||||||
@ -72,15 +75,16 @@ 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, InjectedValueAccess args) throws WorldEditException {
|
public void recursive(Player player, LocalSession session,
|
||||||
|
@Arg(desc = "The range of the recursive pickaxe")
|
||||||
|
double range) throws WorldEditException {
|
||||||
|
|
||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
double range = args.getDouble(0);
|
|
||||||
|
|
||||||
if (range > config.maxSuperPickaxeSize) {
|
if (range > config.maxSuperPickaxeSize) {
|
||||||
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
||||||
|
@ -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
|
||||||
|
@ -29,12 +29,9 @@ import com.boydti.fawe.object.FawePlayer;
|
|||||||
import com.boydti.fawe.object.task.ThrowableSupplier;
|
import com.boydti.fawe.object.task.ThrowableSupplier;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
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.minecraft.util.commands.CommandLocals;
|
|
||||||
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;
|
||||||
@ -42,36 +39,46 @@ import com.sk89q.worldedit.LocalSession;
|
|||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.command.ApplyBrushCommands;
|
import com.sk89q.worldedit.command.ApplyBrushCommands;
|
||||||
import com.sk89q.worldedit.command.BiomeCommands;
|
import com.sk89q.worldedit.command.BiomeCommands;
|
||||||
//import com.sk89q.worldedit.command.BiomeCommandsRegistration;
|
import com.sk89q.worldedit.command.BiomeCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.BrushCommands;
|
import com.sk89q.worldedit.command.BrushCommands;
|
||||||
|
import com.sk89q.worldedit.command.BrushCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.ChunkCommands;
|
import com.sk89q.worldedit.command.ChunkCommands;
|
||||||
//import com.sk89q.worldedit.command.ChunkCommandsRegistration;
|
import com.sk89q.worldedit.command.ChunkCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.ClipboardCommands;
|
import com.sk89q.worldedit.command.ClipboardCommands;
|
||||||
//import com.sk89q.worldedit.command.ClipboardCommandsRegistration;
|
import com.sk89q.worldedit.command.ClipboardCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.ExpandCommands;
|
import com.sk89q.worldedit.command.ExpandCommands;
|
||||||
import com.sk89q.worldedit.command.GeneralCommands;
|
import com.sk89q.worldedit.command.GeneralCommands;
|
||||||
//import com.sk89q.worldedit.command.GeneralCommandsRegistration;
|
import com.sk89q.worldedit.command.GeneralCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.GenerationCommands;
|
import com.sk89q.worldedit.command.GenerationCommands;
|
||||||
|
import com.sk89q.worldedit.command.GenerationCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.HistoryCommands;
|
import com.sk89q.worldedit.command.HistoryCommands;
|
||||||
//import com.sk89q.worldedit.command.HistoryCommandsRegistration;
|
import com.sk89q.worldedit.command.HistoryCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.NavigationCommands;
|
import com.sk89q.worldedit.command.NavigationCommands;
|
||||||
//import com.sk89q.worldedit.command.NavigationCommandsRegistration;
|
import com.sk89q.worldedit.command.NavigationCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.PaintBrushCommands;
|
import com.sk89q.worldedit.command.PaintBrushCommands;
|
||||||
import com.sk89q.worldedit.command.RegionCommands;
|
import com.sk89q.worldedit.command.RegionCommands;
|
||||||
|
import com.sk89q.worldedit.command.RegionCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.SchematicCommands;
|
import com.sk89q.worldedit.command.SchematicCommands;
|
||||||
//import com.sk89q.worldedit.command.SchematicCommandsRegistration;
|
import com.sk89q.worldedit.command.SchematicCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.ScriptingCommands;
|
import com.sk89q.worldedit.command.ScriptingCommands;
|
||||||
|
import com.sk89q.worldedit.command.ScriptingCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.SelectionCommands;
|
import com.sk89q.worldedit.command.SelectionCommands;
|
||||||
|
import com.sk89q.worldedit.command.SelectionCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.SnapshotCommands;
|
import com.sk89q.worldedit.command.SnapshotCommands;
|
||||||
//import com.sk89q.worldedit.command.SnapshotCommandsRegistration;
|
import com.sk89q.worldedit.command.SnapshotCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.SnapshotUtilCommands;
|
import com.sk89q.worldedit.command.SnapshotUtilCommands;
|
||||||
|
import com.sk89q.worldedit.command.SnapshotUtilCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.SuperPickaxeCommands;
|
import com.sk89q.worldedit.command.SuperPickaxeCommands;
|
||||||
//import com.sk89q.worldedit.command.SuperPickaxeCommandsRegistration;
|
import com.sk89q.worldedit.command.SuperPickaxeCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.ToolCommands;
|
import com.sk89q.worldedit.command.ToolCommands;
|
||||||
|
import com.sk89q.worldedit.command.ToolCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.ToolUtilCommands;
|
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.UtilityCommands;
|
||||||
|
import com.sk89q.worldedit.command.UtilityCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.WorldEditCommands;
|
import com.sk89q.worldedit.command.WorldEditCommands;
|
||||||
//import com.sk89q.worldedit.command.WorldEditCommandsRegistration;
|
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;
|
||||||
@ -84,9 +91,7 @@ import com.sk89q.worldedit.command.argument.RegionFactoryConverter;
|
|||||||
import com.sk89q.worldedit.command.argument.RegistryConverter;
|
import com.sk89q.worldedit.command.argument.RegistryConverter;
|
||||||
import com.sk89q.worldedit.command.argument.VectorConverter;
|
import com.sk89q.worldedit.command.argument.VectorConverter;
|
||||||
import com.sk89q.worldedit.command.argument.ZonedDateTimeConverter;
|
import com.sk89q.worldedit.command.argument.ZonedDateTimeConverter;
|
||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||||
import com.sk89q.worldedit.command.util.CommandQueued;
|
|
||||||
import com.sk89q.worldedit.command.util.CommandQueuedCondition;
|
import com.sk89q.worldedit.command.util.CommandQueuedCondition;
|
||||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||||
import com.sk89q.worldedit.command.util.SubCommandPermissionCondition;
|
import com.sk89q.worldedit.command.util.SubCommandPermissionCondition;
|
||||||
@ -117,8 +122,6 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -133,9 +136,7 @@ import javax.annotation.Nullable;
|
|||||||
import org.enginehub.piston.Command;
|
import org.enginehub.piston.Command;
|
||||||
import org.enginehub.piston.CommandManager;
|
import org.enginehub.piston.CommandManager;
|
||||||
import org.enginehub.piston.TextConfig;
|
import org.enginehub.piston.TextConfig;
|
||||||
import org.enginehub.piston.converter.ArgumentConverter;
|
|
||||||
import org.enginehub.piston.converter.ArgumentConverters;
|
import org.enginehub.piston.converter.ArgumentConverters;
|
||||||
import org.enginehub.piston.converter.ConversionResult;
|
|
||||||
import org.enginehub.piston.exception.CommandException;
|
import org.enginehub.piston.exception.CommandException;
|
||||||
import org.enginehub.piston.exception.CommandExecutionException;
|
import org.enginehub.piston.exception.CommandExecutionException;
|
||||||
import org.enginehub.piston.exception.ConditionFailedException;
|
import org.enginehub.piston.exception.ConditionFailedException;
|
||||||
@ -156,6 +157,7 @@ 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.
|
||||||
*
|
*
|
||||||
@ -179,14 +181,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.
|
||||||
*
|
*
|
||||||
@ -230,7 +227,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)
|
||||||
@ -271,7 +268,7 @@ public final class PlatformCommandManager {
|
|||||||
return editSession;
|
return editSession;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), context -> Optional.of(context));
|
globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), Optional::of);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
private <CI> void registerSubCommands(String name, List<String> aliases, String desc,
|
||||||
@ -309,121 +306,141 @@ public final class PlatformCommandManager {
|
|||||||
private void registerAllCommands() {
|
private 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)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,22 +548,10 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> Collection<T> parse(Class<T> clazz, String arguments, @Nullable Actor actor) {
|
|
||||||
List<T> def = Collections.emptyList();
|
|
||||||
Optional<ArgumentConverter<T>> converterOptional = commandManager.getConverter(Key.of(clazz));
|
|
||||||
if (converterOptional.isPresent()) {
|
|
||||||
ArgumentConverter<T> converter = converterOptional.get();
|
|
||||||
MemoizingValueAccess injectedValues = initializeInjectedValues(() -> arguments, actor);
|
|
||||||
ConversionResult<T> result = converter.convert(arguments, injectedValues);
|
|
||||||
return result.orElse(def);
|
|
||||||
}
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Actor wrapActor(Actor actor, InjectedValueStore context) {
|
private Actor wrapActor(Actor actor, InjectedValueStore context) {
|
||||||
if (actor instanceof Player) {
|
if (actor instanceof Player) {
|
||||||
final Set<String> failedPermissions = new LinkedHashSet<>();
|
final Set<String> failedPermissions = new LinkedHashSet<>();
|
||||||
@ -630,17 +635,19 @@ 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, actor, session, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object handleCommandTask(ThrowableSupplier<Throwable> task, InjectedValueAccess context, @Nullable LocalSession session, CommandEvent event) {
|
public Object handleCommandTask(ThrowableSupplier<Throwable> task, InjectedValueAccess context, @NotNull Actor actor, @Nullable LocalSession session, CommandEvent event) {
|
||||||
Actor actor = context.injectedValue(Key.of(Actor.class)).orElseThrow(() -> new IllegalStateException("No player"));
|
|
||||||
Request.reset();
|
Request.reset();
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -694,8 +701,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")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user