mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
More compile fixes and upstream mergesa
This commit is contained in:
parent
67b3fa054a
commit
da3019ae3d
@ -25,5 +25,4 @@ dependencies {
|
|||||||
implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
|
implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
|
||||||
implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
|
implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
|
||||||
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21")
|
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21")
|
||||||
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ fun Project.applyLibrariesConfiguration() {
|
|||||||
apply(plugin = "java-base")
|
apply(plugin = "java-base")
|
||||||
apply(plugin = "maven")
|
apply(plugin = "maven")
|
||||||
apply(plugin = "com.github.johnrengelman.shadow")
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
apply(plugin = "com.jfrog.artifactory")
|
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
create("shade")
|
create("shade")
|
||||||
|
@ -24,7 +24,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
|||||||
apply(plugin = "maven")
|
apply(plugin = "maven")
|
||||||
//apply(plugin = "checkstyle")
|
//apply(plugin = "checkstyle")
|
||||||
apply(plugin = "com.github.johnrengelman.shadow")
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
apply(plugin = "com.jfrog.artifactory")
|
//apply(plugin = "com.jfrog.artifactory")
|
||||||
|
|
||||||
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
|
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
|
||||||
|
|
||||||
|
@ -10,8 +10,18 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.PassthroughExtent;
|
import com.sk89q.worldedit.extent.PassthroughExtent;
|
||||||
import com.sk89q.worldedit.function.operation.Operation;
|
import com.sk89q.worldedit.function.operation.Operation;
|
||||||
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.function.Supplier;
|
||||||
import org.bukkit.BlockChangeDelegate;
|
import org.bukkit.BlockChangeDelegate;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -55,16 +65,6 @@ import org.bukkit.util.Consumer;
|
|||||||
import org.bukkit.util.RayTraceResult;
|
import org.bukkit.util.RayTraceResult;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -647,14 +647,17 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
parent.setThunderDuration(duration);
|
parent.setThunderDuration(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean createExplosion(double x, double y, double z, float power) {
|
public boolean createExplosion(double x, double y, double z, float power) {
|
||||||
return this.createExplosion(x, y, z, power, false, true);
|
return this.createExplosion(x, y, z, power, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire) {
|
public boolean createExplosion(double x, double y, double z, float power, boolean setFire) {
|
||||||
return this.createExplosion(x, y, z, power, setFire, true);
|
return this.createExplosion(x, y, z, power, setFire, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean createExplosion(final double x, final double y, final double z, final float power, final boolean setFire, final boolean breakBlocks) {
|
public boolean createExplosion(final double x, final double y, final double z, final float power, final boolean setFire, final boolean breakBlocks) {
|
||||||
return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
|
return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
@ -664,14 +667,28 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createExplosion(double x, double y, double z, float power, boolean setFire,
|
||||||
|
boolean breakBlocks, @Nullable Entity source) {
|
||||||
|
return TaskManager.IMP.sync(new RunnableVal<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void run(Boolean value) {
|
||||||
|
this.value = parent.createExplosion(x, y, z, power, setFire, breakBlocks, source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean createExplosion(Location loc, float power) {
|
public boolean createExplosion(Location loc, float power) {
|
||||||
return this.createExplosion(loc, power, false);
|
return this.createExplosion(loc, power, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean createExplosion(Location loc, float power, boolean setFire) {
|
public boolean createExplosion(Location loc, float power, boolean setFire) {
|
||||||
return this.createExplosion(loc.getX(), loc.getY(), loc.getZ(), power, setFire);
|
return this.createExplosion(loc.getX(), loc.getY(), loc.getZ(), power, setFire);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Environment getEnvironment() {
|
public Environment getEnvironment() {
|
||||||
return parent.getEnvironment();
|
return parent.getEnvironment();
|
||||||
@ -810,7 +827,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int z) {
|
public Biome getBiome(int x, int z) {
|
||||||
return adapter.adapt(getExtent().getBiomeType(x, z));
|
return adapter.adapt(getExtent().getBiome(BlockVector2.at(x, z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1301,6 +1318,18 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
return TaskManager.IMP.sync(() -> parent.createExplosion(source, loc, power, setFire, breakBlocks));
|
return TaskManager.IMP.sync(() -> parent.createExplosion(source, loc, power, setFire, breakBlocks));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createExplosion(@NotNull Location loc, float power, boolean setFire,
|
||||||
|
boolean breakBlocks) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean createExplosion(@NotNull Location loc, float power, boolean setFire,
|
||||||
|
boolean breakBlocks, @Nullable Entity source) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void spawnParticle(Particle particle, List<Player> receivers, Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) {
|
public <T> void spawnParticle(Particle particle, List<Player> receivers, Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.boydti.fawe.config;
|
package com.boydti.fawe.config;
|
||||||
|
|
||||||
import com.boydti.fawe.object.FaweLimit;
|
import com.boydti.fawe.object.FaweLimit;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -466,9 +466,9 @@ public class Settings extends Config {
|
|||||||
save(file);
|
save(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FaweLimit getLimit(Player player) {
|
public FaweLimit getLimit(Actor actor) {
|
||||||
FaweLimit limit;
|
FaweLimit limit;
|
||||||
if (player.hasPermission("fawe.limit.*") || player.hasPermission("fawe.bypass")) {
|
if (actor.hasPermission("fawe.limit.*") || actor.hasPermission("fawe.bypass")) {
|
||||||
limit = FaweLimit.MAX.copy();
|
limit = FaweLimit.MAX.copy();
|
||||||
} else {
|
} else {
|
||||||
limit = new FaweLimit();
|
limit = new FaweLimit();
|
||||||
@ -478,7 +478,7 @@ public class Settings extends Config {
|
|||||||
|
|
||||||
boolean limitFound = false;
|
boolean limitFound = false;
|
||||||
for (String key : keys) {
|
for (String key : keys) {
|
||||||
if (player.hasPermission("fawe.limit." + key) || !limitFound && key.equals("default")) {
|
if (actor.hasPermission("fawe.limit." + key) || !limitFound && key.equals("default")) {
|
||||||
limitFound = true;
|
limitFound = true;
|
||||||
LIMITS newLimit = LIMITS.get(key);
|
LIMITS newLimit = LIMITS.get(key);
|
||||||
limit.MAX_ACTIONS = Math.max(limit.MAX_ACTIONS, newLimit.MAX_ACTIONS != -1 ? newLimit.MAX_ACTIONS : Integer.MAX_VALUE);
|
limit.MAX_ACTIONS = Math.max(limit.MAX_ACTIONS, newLimit.MAX_ACTIONS != -1 ? newLimit.MAX_ACTIONS : Integer.MAX_VALUE);
|
||||||
|
@ -2388,10 +2388,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
* @return number of patches created
|
* @return number of patches created
|
||||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||||
*/
|
*/
|
||||||
public int makePumpkinPatches(BlockVector3 position, int apothem) throws MaxChangedBlocksException {
|
|
||||||
return makePumpkinPatches(position, apothem, 0.02);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int makePumpkinPatches(BlockVector3 position, int apothem, double density) throws MaxChangedBlocksException {
|
public int makePumpkinPatches(BlockVector3 position, int apothem, double density) throws MaxChangedBlocksException {
|
||||||
// We want to generate pumpkins
|
// We want to generate pumpkins
|
||||||
GardenPatchGenerator generator = new GardenPatchGenerator(this);
|
GardenPatchGenerator generator = new GardenPatchGenerator(this);
|
||||||
@ -2665,8 +2661,8 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
return deformRegion(region, zero, unit, expressionString, WorldEdit.getInstance().getConfiguration().calculationTimeout);
|
return deformRegion(region, zero, unit, expressionString, WorldEdit.getInstance().getConfiguration().calculationTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deformRegion(Region region, Vector3 zero, Vector3 unit, String expressionString,
|
public int deformRegion(final Region region, final Vector3 zero, final Vector3 unit, final String expressionString,
|
||||||
int timeout) throws ExpressionException, MaxChangedBlocksException {
|
final int timeout) throws ExpressionException, MaxChangedBlocksException {
|
||||||
final Expression expression = Expression.compile(expressionString, "x", "y", "z");
|
final Expression expression = Expression.compile(expressionString, "x", "y", "z");
|
||||||
expression.optimize();
|
expression.optimize();
|
||||||
|
|
||||||
|
@ -578,7 +578,6 @@ public class LocalSession implements TextureHolder {
|
|||||||
this.worldOverride = worldOverride;
|
this.worldOverride = worldOverride;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void unregisterTools(Player player) {
|
public void unregisterTools(Player player) {
|
||||||
for (Tool tool : tools) {
|
for (Tool tool : tools) {
|
||||||
if (tool instanceof BrushTool) {
|
if (tool instanceof BrushTool) {
|
||||||
|
@ -122,7 +122,7 @@ public class BiomeCommands {
|
|||||||
if (useLineOfSight) {
|
if (useLineOfSight) {
|
||||||
Location blockPosition = player.getBlockTrace(300);
|
Location blockPosition = player.getBlockTrace(300);
|
||||||
if (blockPosition == null) {
|
if (blockPosition == null) {
|
||||||
BBC.NO_BLOCK.send(player);
|
player.printError(BBC.NO_BLOCK.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,8 +144,8 @@ public class BiomeCommands {
|
|||||||
biomes.add(world.getBiome(pt));
|
biomes.add(world.getBiome(pt));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
RegionVisitor visitor = new RegionVisitor(region, position -> {
|
RegionVisitor visitor = new RegionVisitor(region, pt -> {
|
||||||
biomes.add(world.getBiome(position.toBlockVector2()));
|
biomes.add(world.getBiome(pt.toBlockVector2()));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
Operations.completeBlindly(visitor);
|
Operations.completeBlindly(visitor);
|
||||||
|
@ -50,6 +50,7 @@ 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.event.extent.PasteEvent;
|
import com.sk89q.worldedit.event.extent.PasteEvent;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||||
@ -74,6 +75,7 @@ import com.sk89q.worldedit.regions.Region;
|
|||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -117,31 +119,31 @@ public class ClipboardCommands {
|
|||||||
desc = "Copy the selection to the clipboard"
|
desc = "Copy the selection to the clipboard"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.clipboard.copy")
|
@CommandPermissions("worldedit.clipboard.copy")
|
||||||
public void copy(Player player, LocalSession session, EditSession editSession,
|
public void copy(Actor actor, LocalSession session, EditSession editSession,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Switch(name = 'e', desc = "Skip copy entities")
|
@Switch(name = 'e', desc = "Skip copy entities")
|
||||||
boolean skipEntities,
|
boolean skipEntities,
|
||||||
@Switch(name = 'b', desc = "Also copy biomes")
|
@Switch(name = 'b', desc = "Also copy biomes")
|
||||||
boolean copyBiomes,
|
boolean copyBiomes,
|
||||||
@ArgFlag(name = 'm', desc = "Set the exclude mask, matching blocks become air", def = "")
|
@ArgFlag(name = 'm', desc = "Set the exclude mask, matching blocks become air", def = "")
|
||||||
Mask maskOpt, InjectedValueAccess context) throws WorldEditException {
|
Mask mask, InjectedValueAccess context) throws WorldEditException {
|
||||||
BlockVector3 min = region.getMinimumPoint();
|
BlockVector3 min = region.getMinimumPoint();
|
||||||
BlockVector3 max = region.getMaximumPoint();
|
BlockVector3 max = region.getMaximumPoint();
|
||||||
|
|
||||||
long volume =
|
long volume =
|
||||||
((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1);
|
((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1);
|
||||||
FaweLimit limit = player.getLimit();
|
FaweLimit limit = actor.getLimit();
|
||||||
if (volume >= limit.MAX_CHECKS) {
|
if (volume >= limit.MAX_CHECKS) {
|
||||||
throw FaweException.MAX_CHECKS;
|
throw FaweException.MAX_CHECKS;
|
||||||
}
|
}
|
||||||
player.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
session.setClipboard(null);
|
session.setClipboard(null);
|
||||||
|
|
||||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, actor.getUniqueId());
|
||||||
|
|
||||||
session.setClipboard(new ClipboardHolder(clipboard));
|
session.setClipboard(new ClipboardHolder(clipboard));
|
||||||
|
|
||||||
clipboard.setOrigin(session.getPlacementPosition(player));
|
clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||||
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
|
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
|
||||||
copy.setCopyingEntities(!skipEntities);
|
copy.setCopyingEntities(!skipEntities);
|
||||||
copy.setCopyingBiomes(copyBiomes);
|
copy.setCopyingBiomes(copyBiomes);
|
||||||
@ -152,13 +154,13 @@ public class ClipboardCommands {
|
|||||||
copy.setSourceMask(sourceMask);
|
copy.setSourceMask(sourceMask);
|
||||||
editSession.setSourceMask(null);
|
editSession.setSourceMask(null);
|
||||||
}
|
}
|
||||||
if (maskOpt != null && maskOpt != Masks.alwaysTrue()) {
|
if (mask != null && mask != Masks.alwaysTrue()) {
|
||||||
copy.setSourceMask(maskOpt);
|
copy.setSourceMask(mask);
|
||||||
}
|
}
|
||||||
Operations.completeLegacy(copy);
|
Operations.completeLegacy(copy);
|
||||||
BBC.COMMAND_COPY.send(player, region.getArea());
|
BBC.COMMAND_COPY.send(actor, region.getArea());
|
||||||
if (!player.hasPermission("fawe.tips")) {
|
if (!actor.hasPermission("fawe.tips")) {
|
||||||
BBC.TIP_PASTE.or(BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player);
|
BBC.TIP_PASTE.or(BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(actor);
|
||||||
}
|
}
|
||||||
}, "/copy", region, context);
|
}, "/copy", region, context);
|
||||||
}
|
}
|
||||||
@ -168,7 +170,7 @@ public class ClipboardCommands {
|
|||||||
desc = "Lazily copy the selection to the clipboard"
|
desc = "Lazily copy the selection to the clipboard"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.clipboard.lazycopy")
|
@CommandPermissions("worldedit.clipboard.lazycopy")
|
||||||
public void lazyCopy(Player player, LocalSession session, EditSession editSession,
|
public void lazyCopy(Actor actor, LocalSession session, EditSession editSession,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Switch(name = 'e', desc = "Skip copy entities")
|
@Switch(name = 'e', desc = "Skip copy entities")
|
||||||
boolean skipEntities,
|
boolean skipEntities,
|
||||||
@ -179,7 +181,7 @@ public class ClipboardCommands {
|
|||||||
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));
|
||||||
FaweLimit limit = player.getLimit();
|
FaweLimit limit = actor.getLimit();
|
||||||
if (volume >= limit.MAX_CHECKS) {
|
if (volume >= limit.MAX_CHECKS) {
|
||||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||||
}
|
}
|
||||||
@ -187,11 +189,11 @@ public class ClipboardCommands {
|
|||||||
ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(editSession, region, !skipEntities, copyBiomes);
|
ReadOnlyClipboard lazyClipboard = ReadOnlyClipboard.of(editSession, region, !skipEntities, copyBiomes);
|
||||||
|
|
||||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard);
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard);
|
||||||
clipboard.setOrigin(session.getPlacementPosition(player));
|
clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||||
session.setClipboard(new ClipboardHolder(clipboard));
|
session.setClipboard(new ClipboardHolder(clipboard));
|
||||||
BBC.COMMAND_COPY.send(player, region.getArea());
|
BBC.COMMAND_COPY.send(actor, region.getArea());
|
||||||
if (!player.hasPermission("fawe.tips")) {
|
if (!actor.hasPermission("fawe.tips")) {
|
||||||
BBC.TIP_PASTE.or(BBC.TIP_LAZYCOPY, BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(player);
|
BBC.TIP_PASTE.or(BBC.TIP_LAZYCOPY, BBC.TIP_DOWNLOAD, BBC.TIP_ROTATE, BBC.TIP_COPYPASTE, BBC.TIP_REPLACE_MARKER, BBC.TIP_COPY_PATTERN).send(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +202,7 @@ public class ClipboardCommands {
|
|||||||
desc = "Lazily cut the selection to the clipboard"
|
desc = "Lazily cut the selection to the clipboard"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.clipboard.lazycut")
|
@CommandPermissions("worldedit.clipboard.lazycut")
|
||||||
public void lazyCut(Player player, LocalSession session, EditSession editSession,
|
public void lazyCut(Actor actor, LocalSession session, EditSession editSession,
|
||||||
@Selection final Region region,
|
@Selection final Region region,
|
||||||
@Switch(name = 'e', desc = "Skip copy entities")
|
@Switch(name = 'e', desc = "Skip copy entities")
|
||||||
boolean skipEntities,
|
boolean skipEntities,
|
||||||
@ -210,8 +212,8 @@ public class ClipboardCommands {
|
|||||||
boolean copyBiomes) throws WorldEditException {
|
boolean copyBiomes) 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);
|
||||||
FaweLimit limit = player.getLimit();
|
FaweLimit limit = actor.getLimit();
|
||||||
if (volume >= limit.MAX_CHECKS) {
|
if (volume >= limit.MAX_CHECKS) {
|
||||||
throw FaweException.MAX_CHECKS;
|
throw FaweException.MAX_CHECKS;
|
||||||
}
|
}
|
||||||
@ -222,9 +224,9 @@ public class ClipboardCommands {
|
|||||||
|
|
||||||
ReadOnlyClipboard lazyClipboard = new WorldCutClipboard(editSession, region, !skipEntities, copyBiomes);
|
ReadOnlyClipboard lazyClipboard = new WorldCutClipboard(editSession, region, !skipEntities, copyBiomes);
|
||||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard);
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, lazyClipboard);
|
||||||
clipboard.setOrigin(session.getPlacementPosition(player));
|
clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||||
session.setClipboard(new ClipboardHolder(clipboard));
|
session.setClipboard(new ClipboardHolder(clipboard));
|
||||||
BBC.COMMAND_CUT_LAZY.send(player, region.getArea());
|
BBC.COMMAND_CUT_LAZY.send(actor, region.getArea());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -235,7 +237,7 @@ public class ClipboardCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.clipboard.cut")
|
@CommandPermissions("worldedit.clipboard.cut")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void cut(Player player, LocalSession session, EditSession editSession,
|
public void cut(Actor actor, LocalSession session, EditSession editSession,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Arg(desc = "Pattern to leave in place of the selection", def = "air")
|
@Arg(desc = "Pattern to leave in place of the selection", def = "air")
|
||||||
Pattern leavePattern,
|
Pattern leavePattern,
|
||||||
@ -244,24 +246,24 @@ public class ClipboardCommands {
|
|||||||
@Switch(name = 'b', desc = "Also copy biomes, source biomes are unaffected")
|
@Switch(name = 'b', desc = "Also copy biomes, source biomes are unaffected")
|
||||||
boolean copyBiomes,
|
boolean copyBiomes,
|
||||||
@ArgFlag(name = 'm', desc = "Set the exclude mask, matching blocks become air", def = "")
|
@ArgFlag(name = 'm', desc = "Set the exclude mask, matching blocks become air", def = "")
|
||||||
Mask maskOpt,
|
Mask mask,
|
||||||
InjectedValueAccess context) throws WorldEditException {
|
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));
|
||||||
FaweLimit limit = player.getLimit();
|
FaweLimit limit = actor.getLimit();
|
||||||
if (volume >= limit.MAX_CHECKS) {
|
if (volume >= limit.MAX_CHECKS) {
|
||||||
throw FaweException.MAX_CHECKS;
|
throw FaweException.MAX_CHECKS;
|
||||||
}
|
}
|
||||||
if (volume >= limit.MAX_CHANGES) {
|
if (volume >= limit.MAX_CHANGES) {
|
||||||
throw FaweException.MAX_CHANGES;
|
throw FaweException.MAX_CHANGES;
|
||||||
}
|
}
|
||||||
player.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
session.setClipboard(null);
|
session.setClipboard(null);
|
||||||
|
|
||||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, player.getUniqueId());
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, actor.getUniqueId());
|
||||||
clipboard.setOrigin(session.getPlacementPosition(player));
|
clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||||
|
|
||||||
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));
|
||||||
@ -274,15 +276,15 @@ public class ClipboardCommands {
|
|||||||
copy.setSourceMask(sourceMask);
|
copy.setSourceMask(sourceMask);
|
||||||
editSession.setSourceMask(null);
|
editSession.setSourceMask(null);
|
||||||
}
|
}
|
||||||
if (maskOpt != null) {
|
if (mask != null) {
|
||||||
copy.setSourceMask(maskOpt);
|
copy.setSourceMask(mask);
|
||||||
}
|
}
|
||||||
Operations.completeLegacy(copy);
|
Operations.completeLegacy(copy);
|
||||||
session.setClipboard(new ClipboardHolder(clipboard));
|
session.setClipboard(new ClipboardHolder(clipboard));
|
||||||
|
|
||||||
BBC.COMMAND_CUT_SLOW.send(player, region.getArea());
|
BBC.COMMAND_CUT_SLOW.send(actor, region.getArea());
|
||||||
if (!player.hasPermission("fawe.tips")) {
|
if (!actor.hasPermission("fawe.tips")) {
|
||||||
BBC.TIP_LAZYCUT.send(player);
|
BBC.TIP_LAZYCUT.send(actor);
|
||||||
}
|
}
|
||||||
}, "cut", region, context);
|
}, "cut", region, context);
|
||||||
|
|
||||||
@ -437,7 +439,7 @@ public class ClipboardCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.clipboard.paste")
|
@CommandPermissions("worldedit.clipboard.paste")
|
||||||
@Logging(PLACEMENT)
|
@Logging(PLACEMENT)
|
||||||
public void paste(Player player, LocalSession session, EditSession editSession,
|
public void paste(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||||
@Switch(name = 'a', desc = "Skip air blocks")
|
@Switch(name = 'a', desc = "Skip air blocks")
|
||||||
boolean ignoreAirBlocks,
|
boolean ignoreAirBlocks,
|
||||||
@Switch(name = 'o', desc = "Paste at the original position")
|
@Switch(name = 'o', desc = "Paste at the original position")
|
||||||
@ -454,14 +456,14 @@ public class ClipboardCommands {
|
|||||||
|
|
||||||
ClipboardHolder holder = session.getClipboard();
|
ClipboardHolder holder = session.getClipboard();
|
||||||
if (holder.getTransform().isIdentity() && editSession.getSourceMask() == null) {
|
if (holder.getTransform().isIdentity() && editSession.getSourceMask() == null) {
|
||||||
place(player, session, editSession, ignoreAirBlocks, atOrigin, selectPasted);
|
place(actor, world, session, editSession, ignoreAirBlocks, atOrigin, selectPasted);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Clipboard clipboard = holder.getClipboard();
|
Clipboard clipboard = holder.getClipboard();
|
||||||
Region region = clipboard.getRegion();
|
Region region = clipboard.getRegion();
|
||||||
|
|
||||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(player);
|
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(actor);
|
||||||
checkPaste(player, editSession, to, holder, clipboard);
|
checkPaste(actor, editSession, to, holder, clipboard);
|
||||||
Operation operation = holder
|
Operation operation = holder
|
||||||
.createPaste(editSession)
|
.createPaste(editSession)
|
||||||
.to(to)
|
.to(to)
|
||||||
@ -476,18 +478,18 @@ public class ClipboardCommands {
|
|||||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
||||||
Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
||||||
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo.toBlockPoint(), max.toBlockPoint());
|
RegionSelector selector = new CuboidRegionSelector(world, realTo.toBlockPoint(), max.toBlockPoint());
|
||||||
session.setRegionSelector(player.getWorld(), selector);
|
session.setRegionSelector(world, selector);
|
||||||
selector.learnChanges();
|
selector.learnChanges();
|
||||||
selector.explainRegionAdjust(player, session);
|
selector.explainRegionAdjust(actor, session);
|
||||||
}
|
}
|
||||||
BBC.COMMAND_PASTE.send(player, to);
|
BBC.COMMAND_PASTE.send(actor, to);
|
||||||
if (!player.hasPermission("fawe.tips")) {
|
if (!actor.hasPermission("fawe.tips")) {
|
||||||
BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(player, to);
|
BBC.TIP_COPYPASTE.or(BBC.TIP_SOURCE_MASK, BBC.TIP_REPLACE_MARKER).send(actor, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPaste(Player player, EditSession editSession, BlockVector3 to, ClipboardHolder holder, Clipboard clipboard) {
|
private void checkPaste(Actor player, EditSession editSession, BlockVector3 to, ClipboardHolder holder, Clipboard clipboard) {
|
||||||
URI uri = null;
|
URI uri = null;
|
||||||
if (holder instanceof URIClipboardHolder) {
|
if (holder instanceof URIClipboardHolder) {
|
||||||
uri = ((URIClipboardHolder) holder).getURI(clipboard);
|
uri = ((URIClipboardHolder) holder).getURI(clipboard);
|
||||||
@ -506,7 +508,7 @@ public class ClipboardCommands {
|
|||||||
|
|
||||||
@CommandPermissions("worldedit.clipboard.place")
|
@CommandPermissions("worldedit.clipboard.place")
|
||||||
@Logging(PLACEMENT)
|
@Logging(PLACEMENT)
|
||||||
public void place(Player player, LocalSession session, final EditSession editSession,
|
public void place(Actor actor, World world, LocalSession session, final EditSession editSession,
|
||||||
@Switch(name = 'a', desc = "Skip air blocks")
|
@Switch(name = 'a', desc = "Skip air blocks")
|
||||||
boolean ignoreAirBlocks,
|
boolean ignoreAirBlocks,
|
||||||
@Switch(name = 'o', desc = "Paste at the original position")
|
@Switch(name = 'o', desc = "Paste at the original position")
|
||||||
@ -516,8 +518,8 @@ public class ClipboardCommands {
|
|||||||
ClipboardHolder holder = session.getClipboard();
|
ClipboardHolder holder = session.getClipboard();
|
||||||
final Clipboard clipboard = holder.getClipboard();
|
final Clipboard clipboard = holder.getClipboard();
|
||||||
final BlockVector3 origin = clipboard.getOrigin();
|
final BlockVector3 origin = clipboard.getOrigin();
|
||||||
final BlockVector3 to = atOrigin ? origin : session.getPlacementPosition(player);
|
final BlockVector3 to = atOrigin ? origin : session.getPlacementPosition(actor);
|
||||||
checkPaste(player, editSession, to, holder, clipboard);
|
checkPaste(actor, editSession, to, holder, clipboard);
|
||||||
|
|
||||||
Schematic schem = new Schematic(clipboard);
|
Schematic schem = new Schematic(clipboard);
|
||||||
schem.paste(editSession, to, !ignoreAirBlocks);
|
schem.paste(editSession, to, !ignoreAirBlocks);
|
||||||
@ -527,15 +529,15 @@ public class ClipboardCommands {
|
|||||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
BlockVector3 realTo = to.add(holder.getTransform().apply(clipboardOffset.toVector3()).toBlockPoint());
|
BlockVector3 realTo = to.add(holder.getTransform().apply(clipboardOffset.toVector3()).toBlockPoint());
|
||||||
BlockVector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()).toBlockPoint());
|
BlockVector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()).toBlockPoint());
|
||||||
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), realTo, max);
|
RegionSelector selector = new CuboidRegionSelector(world, realTo, max);
|
||||||
session.setRegionSelector(player.getWorld(), selector);
|
session.setRegionSelector(world, selector);
|
||||||
selector.learnChanges();
|
selector.learnChanges();
|
||||||
selector.explainRegionAdjust(player, session);
|
selector.explainRegionAdjust(actor, session);
|
||||||
}
|
}
|
||||||
BBC.COMMAND_PASTE.send(player, to);
|
BBC.COMMAND_PASTE.send(actor, to);
|
||||||
|
|
||||||
if (!player.hasPermission("fawe.tips")) {
|
if (!actor.hasPermission("fawe.tips")) {
|
||||||
BBC.TIP_COPYPASTE.send(player);
|
BBC.TIP_COPYPASTE.send(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,7 +549,7 @@ public class ClipboardCommands {
|
|||||||
"Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees.\n"
|
"Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees.\n"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.clipboard.rotate")
|
@CommandPermissions("worldedit.clipboard.rotate")
|
||||||
public void rotate(Player player, LocalSession session,
|
public void rotate(Actor actor, LocalSession session,
|
||||||
@Arg(desc = "Amount to rotate on the y-axis")
|
@Arg(desc = "Amount to rotate on the y-axis")
|
||||||
double yRotate,
|
double yRotate,
|
||||||
@Arg(desc = "Amount to rotate on the x-axis", def = "0")
|
@Arg(desc = "Amount to rotate on the x-axis", def = "0")
|
||||||
@ -560,9 +562,9 @@ public class ClipboardCommands {
|
|||||||
transform = transform.rotateX(-xRotate);
|
transform = transform.rotateX(-xRotate);
|
||||||
transform = transform.rotateZ(-zRotate);
|
transform = transform.rotateZ(-zRotate);
|
||||||
holder.setTransform(holder.getTransform().combine(transform));
|
holder.setTransform(holder.getTransform().combine(transform));
|
||||||
BBC.COMMAND_ROTATE.send(player);
|
actor.print(BBC.COMMAND_ROTATE.s());
|
||||||
if (!player.hasPermission("fawe.tips")) {
|
if (!actor.hasPermission("fawe.tips")) {
|
||||||
BBC.TIP_FLIP.or(BBC.TIP_DEFORM, BBC.TIP_TRANSFORM).send(player);
|
BBC.TIP_FLIP.or(BBC.TIP_DEFORM, BBC.TIP_TRANSFORM).send(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,7 +573,7 @@ public class ClipboardCommands {
|
|||||||
desc = "Flip the contents of the clipboard across the origin"
|
desc = "Flip the contents of the clipboard across the origin"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.clipboard.flip")
|
@CommandPermissions("worldedit.clipboard.flip")
|
||||||
public void flip(Player player, LocalSession session,
|
public void flip(Actor actor, LocalSession session,
|
||||||
@Arg(desc = "The direction to flip, defaults to look direction.", def = Direction.AIM)
|
@Arg(desc = "The direction to flip, defaults to look direction.", def = Direction.AIM)
|
||||||
@Direction BlockVector3 direction) throws WorldEditException {
|
@Direction BlockVector3 direction) throws WorldEditException {
|
||||||
|
|
||||||
@ -579,7 +581,7 @@ public class ClipboardCommands {
|
|||||||
AffineTransform transform = new AffineTransform();
|
AffineTransform transform = new AffineTransform();
|
||||||
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
|
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
|
||||||
holder.setTransform(holder.getTransform().combine(transform));
|
holder.setTransform(holder.getTransform().combine(transform));
|
||||||
BBC.COMMAND_FLIPPED.send(player);
|
actor.print(BBC.COMMAND_FLIPPED.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -587,8 +589,8 @@ public class ClipboardCommands {
|
|||||||
desc = "Clear your clipboard"
|
desc = "Clear your clipboard"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.clipboard.clear")
|
@CommandPermissions("worldedit.clipboard.clear")
|
||||||
public void clearClipboard(Player player, LocalSession session) throws WorldEditException {
|
public void clearClipboard(Actor actor, LocalSession session) throws WorldEditException {
|
||||||
session.setClipboard(null);
|
session.setClipboard(null);
|
||||||
BBC.CLIPBOARD_CLEARED.send(player);
|
actor.print(BBC.CLIPBOARD_CLEARED.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,20 +146,21 @@ public class ToolCommands {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "/selwand",
|
name = "selwand",
|
||||||
aliases = "selwand",
|
aliases = "/selwand",
|
||||||
desc = "Selection wand tool"
|
desc = "Selection wand tool"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.setwand")
|
@CommandPermissions("worldedit.setwand")
|
||||||
public void selwand(Player player, LocalSession session) throws WorldEditException {
|
public void selwand(Player player, LocalSession session) throws WorldEditException {
|
||||||
|
|
||||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||||
session.setTool(player, new SelectionWand());
|
session.setTool(player, new SelectionWand());
|
||||||
player.print("Selection wand bound to " + itemType.getName() + ".");
|
player.print("Selection wand bound to " + itemType.getName() + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "/navwand",
|
name = "navwand",
|
||||||
aliases = "navwand",
|
aliases = "/navwand",
|
||||||
desc = "Navigation wand tool"
|
desc = "Navigation wand tool"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.setwand")
|
@CommandPermissions("worldedit.setwand")
|
||||||
@ -288,10 +289,10 @@ public class ToolCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.tool.lrbuild")
|
@CommandPermissions("worldedit.tool.lrbuild")
|
||||||
public void longrangebuildtool(Player player, LocalSession session,
|
public void longrangebuildtool(Player player, LocalSession session,
|
||||||
@Arg(desc = "Pattern to set on left-click")
|
@Arg(desc = "Pattern to set on left-click")
|
||||||
Pattern primary,
|
Pattern primary,
|
||||||
@Arg(desc = "Pattern to set on right-click")
|
@Arg(desc = "Pattern to set on right-click")
|
||||||
Pattern secondary) throws WorldEditException {
|
Pattern secondary) throws WorldEditException {
|
||||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||||
|
|
||||||
session.setTool(player, new LongRangeBuildTool(primary, secondary));
|
session.setTool(player, new LongRangeBuildTool(primary, secondary));
|
||||||
|
@ -21,7 +21,6 @@ package com.sk89q.worldedit.entity;
|
|||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweLimit;
|
|
||||||
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||||
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
|
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
|
||||||
import com.boydti.fawe.regions.FaweMaskManager;
|
import com.boydti.fawe.regions.FaweMaskManager;
|
||||||
@ -320,10 +319,6 @@ public interface Player extends Entity, Actor {
|
|||||||
*/
|
*/
|
||||||
<B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, @Nullable B block);
|
<B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, @Nullable B block);
|
||||||
|
|
||||||
default FaweLimit getLimit() {
|
|
||||||
return Settings.IMP.getLimit(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Region[] getCurrentRegions();
|
public Region[] getCurrentRegions();
|
||||||
|
|
||||||
Region[] getCurrentRegions(FaweMaskManager.MaskType type);
|
Region[] getCurrentRegions(FaweMaskManager.MaskType type);
|
||||||
|
@ -19,37 +19,35 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.event.extent;
|
package com.sk89q.worldedit.event.extent;
|
||||||
|
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import static com.sk89q.worldedit.EditSession.Stage;
|
||||||
|
|
||||||
import com.sk89q.worldedit.event.Cancellable;
|
import com.sk89q.worldedit.event.Cancellable;
|
||||||
import com.sk89q.worldedit.event.Event;
|
import com.sk89q.worldedit.event.Event;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
|
|
||||||
import static com.sk89q.worldedit.EditSession.Stage;
|
|
||||||
|
|
||||||
public class PasteEvent extends Event implements Cancellable {
|
public class PasteEvent extends Event implements Cancellable {
|
||||||
|
|
||||||
private final Player player;
|
private final Actor actor;
|
||||||
private final Clipboard clipboard;
|
private final Clipboard clipboard;
|
||||||
private final URI uri;
|
private final URI uri;
|
||||||
private final BlockVector3 to;
|
private final BlockVector3 to;
|
||||||
private final Extent extent;
|
private final Extent extent;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public PasteEvent(Player player, Clipboard clipboard, URI uri, Extent extent, BlockVector3 to) {
|
public PasteEvent(Actor actor, Clipboard clipboard, URI uri, Extent extent, BlockVector3 to) {
|
||||||
this.player = player;
|
this.actor = actor;
|
||||||
this.clipboard = clipboard;
|
this.clipboard = clipboard;
|
||||||
this.uri = uri;
|
this.uri = uri;
|
||||||
this.extent = extent;
|
this.extent = extent;
|
||||||
this.to = to;
|
this.to = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Actor getActor() {
|
||||||
return player;
|
return actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Clipboard getClipboard() {
|
public Clipboard getClipboard() {
|
||||||
@ -85,7 +83,7 @@ public class PasteEvent extends Event implements Cancellable {
|
|||||||
* @return a new event
|
* @return a new event
|
||||||
*/
|
*/
|
||||||
public PasteEvent clone(Stage stage) {
|
public PasteEvent clone(Stage stage) {
|
||||||
PasteEvent clone = new PasteEvent(player, clipboard, uri, extent, to);
|
PasteEvent clone = new PasteEvent(actor, clipboard, uri, extent, to);
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ package com.sk89q.worldedit.extension.platform;
|
|||||||
|
|
||||||
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.object.FaweLimit;
|
||||||
import com.sk89q.worldedit.entity.Metadatable;
|
import com.sk89q.worldedit.entity.Metadatable;
|
||||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
@ -243,4 +245,8 @@ public interface Actor extends Identifiable, SessionOwner, Subject, Metadatable
|
|||||||
setMeta("faweActionTick", tick);
|
setMeta("faweActionTick", tick);
|
||||||
return tick > time;
|
return tick > time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default FaweLimit getLimit() {
|
||||||
|
return Settings.IMP.getLimit(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,6 @@ 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.ToolUtilCommandsRegistration;
|
||||||
import com.sk89q.worldedit.command.UtilityCommands;
|
import com.sk89q.worldedit.command.UtilityCommands;
|
||||||
@ -138,8 +137,6 @@ import java.util.stream.Stream;
|
|||||||
import javax.annotation.Nullable;
|
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.config.ConfigHolder;
|
|
||||||
import org.enginehub.piston.config.TextConfig;
|
|
||||||
import org.enginehub.piston.converter.ArgumentConverter;
|
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.converter.ConversionResult;
|
||||||
@ -380,12 +377,11 @@ public final class PlatformCommandManager {
|
|||||||
);
|
);
|
||||||
registerSubCommands(
|
registerSubCommands(
|
||||||
"brush",
|
"brush",
|
||||||
Lists.newArrayList("br", "/brush", "/br", "/tool", "tool"),
|
Lists.newArrayList("br", "/brush", "/br"),
|
||||||
"Brushing commands",
|
"Brushing commands",
|
||||||
commandManager,
|
commandManager,
|
||||||
c -> {
|
c -> {
|
||||||
c.accept(BrushCommandsRegistration.builder(), new BrushCommands(worldEdit));
|
c.accept(BrushCommandsRegistration.builder(), new BrushCommands(worldEdit));
|
||||||
c.accept(ToolCommandsRegistration.builder(), new ToolCommands(worldEdit));
|
|
||||||
},
|
},
|
||||||
manager -> {
|
manager -> {
|
||||||
PaintBrushCommands.register(commandManagerService, manager, registration);
|
PaintBrushCommands.register(commandManagerService, manager, registration);
|
||||||
@ -656,7 +652,8 @@ public final class PlatformCommandManager {
|
|||||||
} else {
|
} else {
|
||||||
System.out.println("Invalid context " + context);
|
System.out.println("Invalid context " + context);
|
||||||
}
|
}
|
||||||
Optional<EditSession> editSessionOpt = context.injectedValue(Key.of(EditSession.class));
|
Optional<EditSession> editSessionOpt =
|
||||||
|
context.injectedValue(Key.of(EditSession.class));
|
||||||
|
|
||||||
if (editSessionOpt.isPresent()) {
|
if (editSessionOpt.isPresent()) {
|
||||||
EditSession editSession = editSessionOpt.get();
|
EditSession editSession = editSessionOpt.get();
|
||||||
|
@ -38,6 +38,7 @@ import com.sk89q.worldedit.command.tool.TraceTool;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.event.platform.BlockInteractEvent;
|
import com.sk89q.worldedit.event.platform.BlockInteractEvent;
|
||||||
import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent;
|
import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent;
|
||||||
|
import com.sk89q.worldedit.event.platform.Interaction;
|
||||||
import com.sk89q.worldedit.event.platform.PlatformInitializeEvent;
|
import com.sk89q.worldedit.event.platform.PlatformInitializeEvent;
|
||||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||||
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
||||||
@ -69,9 +70,7 @@ public class PlatformManager {
|
|||||||
private static final Logger logger = LoggerFactory.getLogger(PlatformManager.class);
|
private static final Logger logger = LoggerFactory.getLogger(PlatformManager.class);
|
||||||
|
|
||||||
private final WorldEdit worldEdit;
|
private final WorldEdit worldEdit;
|
||||||
|
|
||||||
private final PlatformCommandManager platformCommandManager;
|
private final PlatformCommandManager platformCommandManager;
|
||||||
|
|
||||||
private final List<Platform> platforms = new ArrayList<>();
|
private final List<Platform> platforms = new ArrayList<>();
|
||||||
private final Map<Capability, Platform> preferences = new EnumMap<>(Capability.class);
|
private final Map<Capability, Platform> preferences = new EnumMap<>(Capability.class);
|
||||||
private @Nullable String firstSeenVersion;
|
private @Nullable String firstSeenVersion;
|
||||||
@ -116,7 +115,6 @@ public class PlatformManager {
|
|||||||
} else {
|
} else {
|
||||||
firstSeenVersion = platform.getVersion();
|
firstSeenVersion = platform.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -260,6 +258,7 @@ public class PlatformManager {
|
|||||||
|
|
||||||
if (base instanceof Player) {
|
if (base instanceof Player) {
|
||||||
Player player = (Player) base;
|
Player player = (Player) base;
|
||||||
|
|
||||||
Player permActor = queryCapability(Capability.PERMISSIONS).matchPlayer(player);
|
Player permActor = queryCapability(Capability.PERMISSIONS).matchPlayer(player);
|
||||||
if (permActor == null) {
|
if (permActor == null) {
|
||||||
permActor = player;
|
permActor = player;
|
||||||
@ -338,42 +337,45 @@ public class PlatformManager {
|
|||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (event.getType()) {
|
if (event.getType() == Interaction.HIT) {
|
||||||
case HIT: {
|
// superpickaxe is special because its primary interaction is a left click, not a right click
|
||||||
// superpickaxe is special because its primary interaction is a left click, not a right click
|
// in addition, it is implicitly bound to all pickaxe items, not just a single tool item
|
||||||
// in addition, it is implicitly bound to all pickaxe items, not just a single tool item
|
if (session.hasSuperPickAxe() && player.isHoldingPickAxe()) {
|
||||||
if (session.hasSuperPickAxe()) {
|
final BlockTool superPickaxe = session.getSuperPickaxe();
|
||||||
final BlockTool superPickaxe = session.getSuperPickaxe();
|
if (superPickaxe != null && superPickaxe.canUse(player)) {
|
||||||
if (superPickaxe != null && superPickaxe.canUse(player) && player.isHoldingPickAxe()) {
|
player.runAction(() -> reset(superPickaxe)
|
||||||
player.runAction(() -> reset(superPickaxe).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location), false, true);
|
.actPrimary(queryCapability(Capability.WORLD_EDITING),
|
||||||
event.setCancelled(true);
|
getConfiguration(), player, session, location), false, true);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Tool tool = session.getTool(player);
|
|
||||||
if (tool instanceof DoubleActionBlockTool && tool.canUse(player)) {
|
|
||||||
player.runAction(() -> reset(((DoubleActionBlockTool) tool)).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location), false, true);
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case OPEN: {
|
Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
||||||
Tool tool = session.getTool(player);
|
if (tool instanceof DoubleActionBlockTool && tool.canUse(player)) {
|
||||||
if (tool instanceof BlockTool && tool.canUse(player)) {
|
player.runAction(() -> reset(((DoubleActionBlockTool) tool))
|
||||||
if (player.checkAction()) {
|
.actSecondary(queryCapability(Capability.WORLD_EDITING),
|
||||||
player.runAction(() -> {
|
getConfiguration(), player, session, location), false, true);
|
||||||
if (tool instanceof BrushTool) {
|
event.setCancelled(true);
|
||||||
((BlockTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location);
|
}
|
||||||
} else {
|
|
||||||
reset((BlockTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session, location);
|
} else if (event.getType() == Interaction.OPEN) {
|
||||||
}
|
Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
||||||
}, false, true);
|
if (tool instanceof BlockTool && tool.canUse(player)) {
|
||||||
event.setCancelled(true);
|
if (player.checkAction()) {
|
||||||
}
|
player.runAction(() -> {
|
||||||
|
if (tool instanceof BrushTool) {
|
||||||
|
((BlockTool) tool)
|
||||||
|
.actPrimary(queryCapability(Capability.WORLD_EDITING),
|
||||||
|
getConfiguration(), player, session, location);
|
||||||
|
} else {
|
||||||
|
reset((BlockTool) tool)
|
||||||
|
.actPrimary(queryCapability(Capability.WORLD_EDITING),
|
||||||
|
getConfiguration(), player, session, location);
|
||||||
|
}
|
||||||
|
}, false, true);
|
||||||
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
@ -425,9 +427,10 @@ public class PlatformManager {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Tool tool = session.getTool(player);
|
Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
||||||
if (tool instanceof DoubleActionTraceTool && tool.canUse(player)) {
|
if (tool instanceof DoubleActionTraceTool && tool.canUse(player)) {
|
||||||
player.runAsyncIfFree(() -> reset((DoubleActionTraceTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session));
|
player.runAsyncIfFree(() -> reset((DoubleActionTraceTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING),
|
||||||
|
getConfiguration(), player, session));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -448,10 +451,11 @@ public class PlatformManager {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Tool tool = session.getTool(player);
|
Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
|
||||||
if (tool instanceof TraceTool && tool.canUse(player)) {
|
if (tool instanceof TraceTool && tool.canUse(player)) {
|
||||||
//todo this needs to be fixed so the event is canceled after actPrimary is used and returns true
|
//todo this needs to be fixed so the event is canceled after actPrimary is used and returns true
|
||||||
player.runAction(() -> reset((TraceTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING), getConfiguration(), player, session), false, true);
|
player.runAction(() -> reset((TraceTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING),
|
||||||
|
getConfiguration(), player, session), false, true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,14 +19,16 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.world.biome;
|
package com.sk89q.worldedit.world.biome;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.function.pattern.BiomePattern;
|
||||||
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.registry.Keyed;
|
import com.sk89q.worldedit.registry.Keyed;
|
||||||
import com.sk89q.worldedit.registry.RegistryItem;
|
|
||||||
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
import com.sk89q.worldedit.registry.NamespacedRegistry;
|
||||||
|
import com.sk89q.worldedit.registry.RegistryItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the types of biomes in the game.
|
* All the types of biomes in the game.
|
||||||
*/
|
*/
|
||||||
public class BiomeType implements RegistryItem, Keyed {
|
public class BiomeType implements RegistryItem, Keyed, BiomePattern {
|
||||||
|
|
||||||
public static final NamespacedRegistry<BiomeType> REGISTRY = new NamespacedRegistry<>("biome type");
|
public static final NamespacedRegistry<BiomeType> REGISTRY = new NamespacedRegistry<>("biome type");
|
||||||
|
|
||||||
@ -80,4 +82,9 @@ public class BiomeType implements RegistryItem, Keyed {
|
|||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return obj instanceof BiomeType && this.id.equals(((BiomeType) obj).id);
|
return obj instanceof BiomeType && this.id.equals(((BiomeType) obj).id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BiomeType apply(BlockVector2 position) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user