Skip to content

Commit

Permalink
Add Router | Up version
Browse files Browse the repository at this point in the history
  • Loading branch information
RoiEXLab committed Apr 28, 2017
1 parent d883135 commit fcb4368
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
19 changes: 9 additions & 10 deletions src/main/java/com/roiex/plugins/cmdhelper/CMDHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ public class CMDHelper extends JavaPlugin {
@Override
public void onEnable() {
CommandArgument.registerDefaults();
// PluginCommand testCommand = getCommand("testCommand");
// testCommand.setExecutor(new CommandExecutor() {
//
// @Override
// public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// sender.sendMessage("Hi");
// return true;
// }
// });
// registerCommandSyntax(testCommand, "[<x> <y> <z> <block>]|[<block> <material>]|[<block> <x> <y>] [<x>]", new PermissionMask("<block> <material> <x>", "permission-coolness"));
// PluginCommand testCommand = getCommand("testCommand");
// testCommand.setExecutor(new CommandRouter().addRoute("<x> <y> <z> <block>", (s, c, a, args) -> {
// System.out.println("Setblock");
// return true;
// }).addRoute("<block> <material>", (s, c, a, args) -> {
// System.out.println("Other Stuff");
// return true;
// }));
// registerCommandSyntax(testCommand, "[<x> <y> <z> <block>]|[<block> <material>]|[<block> <x> <y>] [<x>]", new PermissionMask("<block> <material> <x>", "permission-coolness"));
}

public void registerCommandSyntax(PluginCommand command, String structure, PermissionMask... permissionMasks) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/roiex/plugins/cmdhelper/CommandRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public class CommandRouter implements CommandExecutor {

private Map<String, CommandConsumer> routes = new HashMap<>();

public void addRoute(String pattern, CommandConsumer consumer){
public CommandRouter addRoute(String pattern, CommandConsumer consumer){
routes.put(pattern, consumer);
return this;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CMDHelper
main: com.roiex.plugins.cmdhelper.CMDHelper
version: 1.0
version: 2.1.0
#commands:
# testCommand:
# description: Some Test Command
Expand Down

0 comments on commit fcb4368

Please sign in to comment.