geforkt von Mirrors/FastAsyncWorldEdit
Update Piston to fix bugs
Closes #1292 via Piston fixes. (cherry picked from commit dc56b602c0367fbd24f954de2b8be4e864add59f)
Dieser Commit ist enthalten in:
Ursprung
3426e0103b
Commit
864d160102
@ -3,10 +3,10 @@ import org.gradle.api.Project
|
||||
object Versions {
|
||||
const val TEXT = "3.0.3"
|
||||
const val TEXT_EXTRAS = "3.0.3"
|
||||
const val PISTON = "0.5.2"
|
||||
const val AUTO_VALUE = "1.6.5"
|
||||
const val JUNIT = "5.5.0"
|
||||
const val MOCKITO = "3.0.0"
|
||||
const val PISTON = "0.5.5"
|
||||
const val AUTO_VALUE = "1.7"
|
||||
const val JUNIT = "5.6.1"
|
||||
const val MOCKITO = "3.3.3"
|
||||
const val LOGBACK = "1.2.3"
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@ public class BrushCommands {
|
||||
boolean pasteEntities,
|
||||
@Switch(name = 'b', desc = "Paste biomes if available")
|
||||
boolean pasteBiomes,
|
||||
@ArgFlag(name = 'm', desc = "Skip blocks matching this mask in the clipboard", def = "")
|
||||
@ArgFlag(name = 'm', desc = "Skip blocks matching this mask in the clipboard")
|
||||
@ClipboardMask
|
||||
Mask sourceMask,
|
||||
InjectedValueAccess context) throws WorldEditException {
|
||||
|
@ -114,7 +114,7 @@ public class ChunkCommands {
|
||||
@CommandPermissions("worldedit.delchunks")
|
||||
@Logging(REGION)
|
||||
public void deleteChunks(Actor actor, World world, LocalSession session,
|
||||
@ArgFlag(name = 'o', desc = "Only delete chunks older than the specified time.", def = "")
|
||||
@ArgFlag(name = 'o', desc = "Only delete chunks older than the specified time.")
|
||||
ZonedDateTime beforeTime) throws WorldEditException {
|
||||
Path worldDir = world.getStoragePath();
|
||||
if (worldDir == null) {
|
||||
|
@ -102,7 +102,6 @@ import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ClipboardCommands {
|
||||
|
||||
|
||||
@Command(
|
||||
name = "/copy",
|
||||
aliases = "/cp",
|
||||
@ -115,11 +114,11 @@ public class ClipboardCommands {
|
||||
@Switch(name = 'e', desc = "Also copy entities")
|
||||
boolean copyEntities,
|
||||
@Switch(name = 'b', desc = "Also copy biomes")
|
||||
boolean copyBiomes,
|
||||
boolean copyBiomes,
|
||||
@Switch(name = 'c', desc = "Set the origin of the clipboard to the center of the copied region")
|
||||
boolean centerClipboard,
|
||||
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air", def = "")
|
||||
Mask mask) throws WorldEditException {
|
||||
Mask mask) throws WorldEditException {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
|
||||
@ -149,6 +148,7 @@ public class ClipboardCommands {
|
||||
}
|
||||
Operations.completeLegacy(copy);
|
||||
session.setClipboard(new ClipboardHolder(clipboard));
|
||||
|
||||
copy.getStatusMessages().forEach(actor::print);
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ public class ClipboardCommands {
|
||||
boolean copyEntities,
|
||||
@Switch(name = 'b', desc = "Also copy biomes, source biomes are unaffected")
|
||||
boolean copyBiomes,
|
||||
@ArgFlag(name = 'm', desc = "Set the exclude mask, non-matching blocks become air", def = "")
|
||||
@ArgFlag(name = 'm', desc = "Set the exclude mask, non-matching blocks become air")
|
||||
Mask mask) throws WorldEditException {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
@ -243,7 +243,6 @@ public class ClipboardCommands {
|
||||
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, actor.getUniqueId());
|
||||
clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
|
||||
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
|
||||
copy.setSourceFunction(new BlockReplace(editSession, leavePattern));
|
||||
copy.setCopyingEntities(copyEntities);
|
||||
@ -371,20 +370,29 @@ public class ClipboardCommands {
|
||||
}
|
||||
}
|
||||
|
||||
@Command(name = "/paste", aliases = {"/p", "/pa"}, desc = "Paste the clipboard's contents"
|
||||
|
||||
@Command(
|
||||
name = "/paste",
|
||||
aliases = {"/p", "/pa"},
|
||||
desc = "Paste the clipboard's contents"
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.paste")
|
||||
@Logging(PLACEMENT)
|
||||
public void paste(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
@Switch(name = 'a', desc = "Skip air blocks") boolean ignoreAirBlocks,
|
||||
@Switch(name = 'o', desc = "Paste at the original position") boolean atOrigin,
|
||||
@Switch(name = 's', desc = "Select the region after pasting") boolean selectPasted,
|
||||
@Switch(name = 'n', desc = "No paste, select only. (Implies -s)") boolean onlySelect,
|
||||
@Switch(name = 'e', desc = "Paste entities if available") boolean pasteEntities,
|
||||
@Switch(name = 'b', desc = "Paste biomes if available") boolean pasteBiomes,
|
||||
@ArgFlag(name = 'm', desc = "Only paste blocks matching this mask", def = "") @ClipboardMask
|
||||
Mask sourceMask) throws WorldEditException {
|
||||
@Switch(name = 'a', desc = "Skip air blocks")
|
||||
boolean ignoreAirBlocks,
|
||||
@Switch(name = 'o', desc = "Paste at the original position")
|
||||
boolean atOrigin,
|
||||
@Switch(name = 's', desc = "Select the region after pasting")
|
||||
boolean selectPasted,
|
||||
@Switch(name = 'n', desc = "No paste, select only. (Implies -s)")
|
||||
boolean onlySelect,
|
||||
@Switch(name = 'e', desc = "Paste entities if available")
|
||||
boolean pasteEntities,
|
||||
@Switch(name = 'b', desc = "Paste biomes if available")
|
||||
boolean pasteBiomes,
|
||||
@ArgFlag(name = 'm', desc = "Only paste blocks matching this mask")
|
||||
@ClipboardMask
|
||||
Mask sourceMask) throws WorldEditException {
|
||||
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
if (holder.getTransform().isIdentity() && editSession.getSourceMask() == null) {
|
||||
@ -409,23 +417,19 @@ public class ClipboardCommands {
|
||||
}
|
||||
|
||||
if (selectPasted || onlySelect) {
|
||||
BlockVector3 clipboardOffset =
|
||||
clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
Vector3 realTo =
|
||||
to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
||||
Vector3 max = realTo.add(holder.getTransform()
|
||||
.apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
||||
RegionSelector selector =
|
||||
new CuboidRegionSelector(world, realTo.toBlockPoint(), max.toBlockPoint());
|
||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
||||
Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
||||
RegionSelector selector = new CuboidRegionSelector(world, realTo.toBlockPoint(), max.toBlockPoint());
|
||||
session.setRegionSelector(world, selector);
|
||||
selector.learnChanges();
|
||||
selector.explainRegionAdjust(actor, session);
|
||||
}
|
||||
|
||||
if (onlySelect) {
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.paste.selected"));
|
||||
} else {
|
||||
actor.printInfo(TranslatableComponent
|
||||
.of("worldedit.paste.pasted", TextComponent.of(to.toString())));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.paste.pasted", TextComponent.of(to.toString())));
|
||||
}
|
||||
messages.forEach(actor::print);
|
||||
}
|
||||
@ -517,7 +521,6 @@ public class ClipboardCommands {
|
||||
public void flip(Actor actor, LocalSession session,
|
||||
@Arg(desc = "The direction to flip, defaults to look direction.", def = Direction.AIM)
|
||||
@Direction BlockVector3 direction) throws WorldEditException {
|
||||
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
AffineTransform transform = new AffineTransform();
|
||||
transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3());
|
||||
|
@ -490,7 +490,7 @@ public class RegionCommands {
|
||||
boolean copyEntities,
|
||||
@Switch(name = 'b', desc = "Also copy biomes")
|
||||
boolean copyBiomes,
|
||||
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air", def = "")
|
||||
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air")
|
||||
Mask mask) throws WorldEditException {
|
||||
checkCommandArgument(count >= 1, "Count must be >= 1");
|
||||
|
||||
@ -561,7 +561,7 @@ public class RegionCommands {
|
||||
boolean copyEntities,
|
||||
@Switch(name = 'b', desc = "Also copy biomes")
|
||||
boolean copyBiomes,
|
||||
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air", def = "")
|
||||
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air")
|
||||
Mask mask) throws WorldEditException {
|
||||
|
||||
Mask combinedMask;
|
||||
|
@ -527,7 +527,7 @@ public class SelectionCommands {
|
||||
boolean clipboardDistr,
|
||||
@Switch(name = 'd', desc = "Separate blocks by state")
|
||||
boolean separateStates,
|
||||
@ArgFlag(name = 'p', desc = "Gets page from a previous distribution.", def = "")
|
||||
@ArgFlag(name = 'p', desc = "Gets page from a previous distribution.")
|
||||
Integer page) throws WorldEditException {
|
||||
List<Countable<BlockState>> distribution;
|
||||
|
||||
|
@ -111,7 +111,7 @@ public abstract class AbstractDirectionConverter<D> implements ArgumentConverter
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSuggestions(String input) {
|
||||
public List<String> getSuggestions(String input, InjectedValueAccess context) {
|
||||
return limitByPrefix(suggestions.stream(), input);
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,10 @@ public class CommaSeparatedValuesConverter<T> implements ArgumentConverter<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSuggestions(String input) {
|
||||
public List<String> getSuggestions(String input, InjectedValueAccess context) {
|
||||
String lastInput = Iterables.getLast(COMMA.split(input), "");
|
||||
return delegate.getSuggestions(lastInput);
|
||||
assert lastInput != null;
|
||||
return delegate.getSuggestions(lastInput, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,7 +55,7 @@ public class EntityRemoverConverter implements ArgumentConverter<EntityRemover>
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSuggestions(String input) {
|
||||
public List<String> getSuggestions(String input, InjectedValueAccess context) {
|
||||
return limitByPrefix(suggestions.stream(), input);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class FactoryConverter<T> implements ArgumentConverter<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSuggestions(String input) {
|
||||
public List<String> getSuggestions(String input, InjectedValueAccess context) {
|
||||
return factoryExtractor.apply(worldEdit).getSuggestions(input);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,8 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
|
||||
: SuccessfulConversion.fromSingle(result);
|
||||
}
|
||||
|
||||
public List<String> getSuggestions(String input) {
|
||||
@Override
|
||||
public List<String> getSuggestions(String input, InjectedValueAccess context) {
|
||||
return SuggestionHelper.getRegistrySuggestions(registry, input).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class WorldConverter implements ArgumentConverter<World> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSuggestions(String input) {
|
||||
public List<String> getSuggestions(String input, InjectedValueAccess context) {
|
||||
return getWorlds()
|
||||
.map(World::getId)
|
||||
.filter(world -> world.startsWith(input))
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren