diff --git a/SpigotCore_Main/src/de/steamwar/acommand/TestCommand.java b/SpigotCore_Main/src/de/steamwar/acommand/TestCommand.java new file mode 100644 index 0000000..c0c8d9a --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/acommand/TestCommand.java @@ -0,0 +1,23 @@ +package de.steamwar.acommand; + +import de.steamwar.command.SWCommand; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class TestCommand extends SWCommand { + + public TestCommand() { + super("test"); + } + + @Register + public void test(Player player) { + + } + + @Register({"two"}) + public void testTwo(Player player, int i, @Mapper("Hello World") Material material) { + + } + +} diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java index e5923e0..4919a41 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java @@ -105,7 +105,7 @@ public abstract class SWCommand { String name = clazz.getTypeName(); Mapper mapper = parameter.getAnnotation(Mapper.class); if (mapper != null) { - name = mapper.mapper(); + name = mapper.value(); } if (!SWCommandUtils.MAPPER_FUNCTIONS.containsKey(name)) return false; } @@ -124,13 +124,13 @@ public abstract class SWCommand { @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) protected @interface Register { - String[] subCommand() default {}; + String[] value() default {}; } @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.PARAMETER}) protected @interface Mapper { - String mapper(); + String value(); } } diff --git a/SpigotCore_Main/src/de/steamwar/command/SubCommand.java b/SpigotCore_Main/src/de/steamwar/command/SubCommand.java index 3a62277..ab0c8ca 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SubCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SubCommand.java @@ -25,7 +25,7 @@ class SubCommand { Parameter[] parameters = method.getParameters(); commandSenderFunction = sender -> parameters[0].getType().cast(sender); SWCommand.Register register = method.getAnnotation(SWCommand.Register.class); - subCommand = register.subCommand(); + subCommand = register.value(); arguments = new TypeMapper[parameters.length - 1]; for (int i = 1; i < parameters.length; i++) { @@ -59,7 +59,7 @@ class SubCommand { String name = clazz.getTypeName(); SWCommand.Mapper mapper = parameter.getAnnotation(SWCommand.Mapper.class); if (mapper != null) { - name = mapper.mapper(); + name = mapper.value(); } arguments[i] = SWCommandUtils.MAPPER_FUNCTIONS.getOrDefault(name, SWCommandUtils.ERROR_FUNCTION);