mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Removed commands.yml
I also did a few renames as well as a command registration fix.
This commit is contained in:
@ -2,7 +2,6 @@ package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.config.Commands;
|
||||
import com.boydti.fawe.object.brush.BrushSettings;
|
||||
import com.boydti.fawe.object.brush.TargetMode;
|
||||
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
||||
@ -139,7 +138,7 @@ public class BrushOptionsCommands {
|
||||
public void list(Actor actor, InjectedValueAccess args,
|
||||
@ArgFlag(name = 'p', desc = "Prints the requested page", def = "0")
|
||||
int page) throws WorldEditException {
|
||||
String baseCmd = Commands.getAlias(BrushCommands.class, "brush") + " " + Commands.getAlias(BrushOptionsCommands.class, "loadbrush");
|
||||
String baseCmd = "/brush loadbrush";
|
||||
File dir = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
|
||||
UtilityCommands.list(dir, actor, args, page, null, true, baseCmd);
|
||||
// new RunnableVal2<Message, String[]>() {
|
||||
|
@ -1,66 +1,16 @@
|
||||
package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.Commands;
|
||||
import com.sk89q.worldedit.command.argument.Arguments;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import java.util.Optional;
|
||||
import org.enginehub.piston.inject.InjectedValueAccess;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import org.enginehub.piston.inject.Key;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class MethodCommands {
|
||||
public static Command getCommand() {
|
||||
try {
|
||||
StackTraceElement[] stack = new Exception().getStackTrace();
|
||||
for (StackTraceElement elem : stack) {
|
||||
Class<?> clazz = Class.forName(elem.getClassName());
|
||||
for (Method method : clazz.getMethods()) {
|
||||
if (method.getName().equals(elem.getMethodName())) {
|
||||
Command command = method.getAnnotation(Command.class);
|
||||
if (command != null) return Commands.translate(clazz, command);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getArguments(InjectedValueAccess context) {
|
||||
if (context == null) return null;
|
||||
Optional<Arguments> arguments = context.injectedValue(Key.of(Arguments.class));
|
||||
if (arguments.isPresent()) {
|
||||
return arguments.get().get();
|
||||
}
|
||||
return null;
|
||||
return arguments.map(Arguments::get).orElse(null);
|
||||
}
|
||||
|
||||
public static String[] getPermissions(InjectedValueAccess context) {
|
||||
CommandPermissions cmdPerms = context.injectedValue(Key.of(CommandPermissions.class)).orElse(null);
|
||||
if (cmdPerms != null) {
|
||||
return cmdPerms.value();
|
||||
}
|
||||
try {
|
||||
StackTraceElement[] stack = new Exception().getStackTrace();
|
||||
for (StackTraceElement elem : stack) {
|
||||
Class<?> clazz = Class.forName(elem.getClassName());
|
||||
for (Method method : clazz.getMethods()) {
|
||||
if (method.getName().equals(elem.getMethodName())) {
|
||||
CommandPermissions perm = method.getAnnotation(CommandPermissions.class);
|
||||
if (perm != null) return perm.value();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ public class NavigationCommands {
|
||||
public void jumpTo(Player player,
|
||||
@Arg(desc = "Location to jump to", def = "")
|
||||
Location pos,
|
||||
@Switch(name='f', desc = "force teleport")
|
||||
@Switch(name = 'f', desc = "force teleport")
|
||||
boolean force) throws WorldEditException {
|
||||
|
||||
if (pos == null) {
|
||||
|
Reference in New Issue
Block a user