Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 20:10:06 +01:00
Attempt to fix command execution.
Dieser Commit ist enthalten in:
Ursprung
183d733825
Commit
ccd8f2c2a9
@ -83,7 +83,7 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
}
|
}
|
||||||
if (PaperLib.isPaper() && Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING > 1) {
|
if (PaperLib.isPaper() && Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING > 1) {
|
||||||
new RenderListener(plugin);
|
new RenderListener(plugin);
|
||||||
}
|
}in
|
||||||
if (Bukkit.getPluginManager().getPlugin("PlotSquared") != null) {
|
if (Bukkit.getPluginManager().getPlugin("PlotSquared") != null) {
|
||||||
try {
|
try {
|
||||||
WEManager.IMP.managers.add(new PlotSquaredFeature());
|
WEManager.IMP.managers.add(new PlotSquaredFeature());
|
||||||
|
@ -31,7 +31,6 @@ import com.sk89q.worldedit.blocks.BaseItemStack;
|
|||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.extension.platform.AbstractPlayerActor;
|
import com.sk89q.worldedit.extension.platform.AbstractPlayerActor;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
@ -177,15 +176,8 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPosition(Vector3 pos, float pitch, float yaw) {
|
public void setPosition(Vector3 pos, float pitch, float yaw) {
|
||||||
if (pos instanceof com.sk89q.worldedit.util.Location) {
|
player.teleport(new Location(player.getWorld(), pos.getX(), pos.getY(),
|
||||||
com.sk89q.worldedit.util.Location loc = (com.sk89q.worldedit.util.Location) pos;
|
pos.getZ(), yaw, pitch));
|
||||||
Extent extent = loc.getExtent();
|
|
||||||
if (extent instanceof World) {
|
|
||||||
org.bukkit.World world = Bukkit.getWorld(((World) extent).getName());
|
|
||||||
player.teleport(new Location(world, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
player.teleport(new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ(), yaw, pitch));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -224,13 +224,6 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Register 1.13 Material ids with LegacyMapper
|
|
||||||
// LegacyMapper legacyMapper = LegacyMapper.getInstance();
|
|
||||||
// for (Material m : Material.values()) {
|
|
||||||
// if (!m.isLegacy() && m.isBlock()) {
|
|
||||||
// legacyMapper.register(m.getId(), 0, BukkitAdapter.adapt(m).getDefaultState());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// Enable metrics
|
// Enable metrics
|
||||||
new Metrics(this);
|
new Metrics(this);
|
||||||
PaperLib.suggestPaper(this);
|
PaperLib.suggestPaper(this);
|
||||||
@ -465,7 +458,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] = commandLabel;
|
split[0] = "/" + commandLabel;
|
||||||
|
|
||||||
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);
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
//package com.boydti.fawe.command;
|
|
||||||
//
|
|
||||||
//import com.sk89q.worldedit.WorldEdit;
|
|
||||||
//import com.sk89q.worldedit.util.command.parametric.BindingHelper;
|
|
||||||
//
|
|
||||||
//public class FaweBinding extends BindingHelper {
|
|
||||||
// private final WorldEdit worldEdit;
|
|
||||||
//
|
|
||||||
// public FaweBinding(WorldEdit worldEdit) {
|
|
||||||
// this.worldEdit = worldEdit;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public WorldEdit getWorldEdit() {
|
|
||||||
// return worldEdit;
|
|
||||||
// }
|
|
||||||
//}
|
|
@ -116,7 +116,7 @@ public class SelectionCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!session.getRegionSelector(world).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
if (!session.getRegionSelector(world).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
||||||
BBC.SELECTOR_ALREADY_SET.send(actor);
|
actor.print(BBC.SELECTOR_ALREADY_SET.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ public class SelectionCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!session.getRegionSelector(world).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
if (!session.getRegionSelector(world).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
||||||
BBC.SELECTOR_ALREADY_SET.send(actor);
|
actor.print(BBC.SELECTOR_ALREADY_SET.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,14 +163,14 @@ public class SelectionCommands {
|
|||||||
|
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
player.print(BBC.SELECTOR_ALREADY_SET.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld())
|
session.getRegionSelector(player.getWorld())
|
||||||
.explainPrimarySelection(player, session, pos.toBlockPoint());
|
.explainPrimarySelection(player, session, pos.toBlockPoint());
|
||||||
} else {
|
} else {
|
||||||
BBC.NO_BLOCK.send(player);
|
player.print(BBC.NO_BLOCK.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,14 +185,14 @@ public class SelectionCommands {
|
|||||||
|
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||||
BBC.SELECTOR_ALREADY_SET.send(player);
|
player.print(BBC.SELECTOR_ALREADY_SET.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld())
|
session.getRegionSelector(player.getWorld())
|
||||||
.explainSecondarySelection(player, session, pos.toBlockPoint());
|
.explainSecondarySelection(player, session, pos.toBlockPoint());
|
||||||
} else {
|
} else {
|
||||||
BBC.NO_BLOCK.send(player);
|
player.print(BBC.NO_BLOCK.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.registry.state.Property;
|
|||||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||||
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 java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -114,14 +114,17 @@ public abstract class AbstractNonPlayerActor implements Actor {
|
|||||||
* @param value
|
* @param value
|
||||||
* @return previous value
|
* @return previous value
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void setMeta(String key, Object value) {
|
public final void setMeta(String key, Object value) {
|
||||||
this.meta.put(key, value);
|
this.meta.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final <T> T getAndSetMeta(String key, T value) {
|
public final <T> T getAndSetMeta(String key, T value) {
|
||||||
return (T) this.meta.put(key, value);
|
return (T) this.meta.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final boolean hasMeta() {
|
public final boolean hasMeta() {
|
||||||
return !meta.isEmpty();
|
return !meta.isEmpty();
|
||||||
}
|
}
|
||||||
@ -133,6 +136,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
|
|||||||
* @param key
|
* @param key
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final <V> V getMeta(String key) {
|
public final <V> V getMeta(String key) {
|
||||||
return (V) this.meta.get(key);
|
return (V) this.meta.get(key);
|
||||||
}
|
}
|
||||||
@ -144,6 +148,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
|
|||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final <V> V deleteMeta(String key) {
|
public final <V> V deleteMeta(String key) {
|
||||||
return (V) this.meta.remove(key);
|
return (V) this.meta.remove(key);
|
||||||
}
|
}
|
||||||
|
@ -541,7 +541,6 @@ public final class PlatformCommandManager {
|
|||||||
Request.reset();
|
Request.reset();
|
||||||
Actor actor = event.getActor();
|
Actor actor = event.getActor();
|
||||||
String args = event.getArguments();
|
String args = event.getArguments();
|
||||||
System.out.println(1);
|
|
||||||
TaskManager.IMP.taskNow(() -> {
|
TaskManager.IMP.taskNow(() -> {
|
||||||
int space0 = args.indexOf(' ');
|
int space0 = args.indexOf(' ');
|
||||||
String arg0 = space0 == -1 ? args : args.substring(0, space0);
|
String arg0 = space0 == -1 ? args : args.substring(0, space0);
|
||||||
@ -596,8 +595,7 @@ public final class PlatformCommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handleCommandTask(ThrowableSupplier<Throwable> task, InjectedValueAccess context, @Nullable LocalSession session, CommandEvent event) {
|
public void handleCommandTask(ThrowableSupplier<Throwable> task, InjectedValueAccess context, @Nullable LocalSession session, CommandEvent event) {
|
||||||
Request.reset();
|
Actor actor = event.getActor();
|
||||||
Actor actor = context.injectedValue(Key.of(Actor.class)).orElseThrow(() -> new IllegalStateException("No player"));
|
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
@ -662,7 +660,7 @@ public final class PlatformCommandManager {
|
|||||||
|
|
||||||
long time = System.currentTimeMillis() - start;
|
long time = System.currentTimeMillis() - start;
|
||||||
if (time > 1000) {
|
if (time > 1000) {
|
||||||
BBC.ACTION_COMPLETE.send(actor, time / 1000D);
|
BBC.ACTION_COMPLETE.send(event.getActor(), time / 1000D);
|
||||||
}
|
}
|
||||||
|
|
||||||
worldEdit.flushBlockBag(actor, editSession);
|
worldEdit.flushBlockBag(actor, editSession);
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
package com.sk89q.worldedit.extension.platform.binding;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
|
||||||
import com.sk89q.worldedit.internal.annotation.Validate;
|
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
|
|
||||||
public class AnnotatedBindings extends Bindings {
|
|
||||||
|
|
||||||
private final WorldEdit worldEdit;
|
|
||||||
|
|
||||||
public AnnotatedBindings(WorldEdit worldEdit) {
|
|
||||||
this.worldEdit = worldEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Validate()
|
|
||||||
public String getText(String argument, Validate modifier) {
|
|
||||||
return validate(argument, modifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate a string value using relevant modifiers.
|
|
||||||
*
|
|
||||||
* @param string the string
|
|
||||||
* @param modifiers the list of modifiers to scan
|
|
||||||
* @throws InputParseException on a validation error
|
|
||||||
*/
|
|
||||||
private static String validate(String string, Annotation... modifiers) {
|
|
||||||
if (string != null) {
|
|
||||||
for (Annotation modifier : modifiers) {
|
|
||||||
if (modifier instanceof Validate) {
|
|
||||||
Validate validate = (Validate) modifier;
|
|
||||||
|
|
||||||
if (!validate.value().isEmpty()) {
|
|
||||||
if (!string.matches(validate.value())) {
|
|
||||||
throw new InputParseException(
|
|
||||||
String.format(
|
|
||||||
"The given text doesn't match the right format (technically speaking, the 'format' is %s)",
|
|
||||||
validate.value()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
}
|
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
|||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import org.enginehub.piston.CommandParameters;
|
import org.enginehub.piston.CommandParameters;
|
||||||
|
import org.enginehub.piston.exception.CommandException;
|
||||||
import org.enginehub.piston.gen.CommandCallListener;
|
import org.enginehub.piston.gen.CommandCallListener;
|
||||||
import org.enginehub.piston.inject.Key;
|
import org.enginehub.piston.inject.Key;
|
||||||
|
|
||||||
@ -72,15 +73,23 @@ public class CommandLoggingHandler implements CommandCallListener, AutoCloseable
|
|||||||
logMode = loggingAnnotation.value();
|
logMode = loggingAnnotation.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Actor> playerOpt = parameters.injectedValue(Key.of(Actor.class));
|
Optional<Actor> actorOpt = parameters.injectedValue(Key.of(Actor.class));
|
||||||
Optional<World> worldOpt = parameters.injectedValue(Key.of(World.class));
|
|
||||||
|
|
||||||
if (!playerOpt.isPresent() || !worldOpt.isPresent()) {
|
if (!actorOpt.isPresent()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Actor actor = actorOpt.get();
|
||||||
|
|
||||||
Actor actor = playerOpt.get();
|
World world;
|
||||||
World world = worldOpt.get();
|
try {
|
||||||
|
Optional<World> worldOpt = parameters.injectedValue(Key.of(World.class));
|
||||||
|
if (!worldOpt.isPresent()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
world = worldOpt.get();
|
||||||
|
} catch (CommandException ex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
builder.append("WorldEdit: ").append(actor.getName());
|
builder.append("WorldEdit: ").append(actor.getName());
|
||||||
builder.append(" (in \"").append(world.getName()).append("\")");
|
builder.append(" (in \"").append(world.getName()).append("\")");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren