From e2f2c6635211dbdd48ae6430375628d17a37a953 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Fri, 16 Dec 2016 12:51:46 -0500 Subject: [PATCH] Started work on sub-commands --- pom.xml | 32 +++++++++---------- .../commands/subcommands/SubCommand.java | 12 ++++++- .../components/alilinks/commands/Press.java | 32 +++++++++++++++++++ .../components/alilinks/commands/Set.java | 14 ++++++++ 4 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 src/buttondevteam/alipresents/components/alilinks/commands/Press.java create mode 100644 src/buttondevteam/alipresents/components/alilinks/commands/Set.java diff --git a/pom.xml b/pom.xml index d4c8311..8a031d8 100644 --- a/pom.xml +++ b/pom.xml @@ -73,13 +73,13 @@ https://jitpack.io - ess-repo - http://repo.ess3.net/content/groups/essentials - - - citizensnpcs - http://repo.citizensnpcs.co/ - + ess-repo + http://repo.ess3.net/content/groups/essentials + + + citizensnpcs + http://repo.citizensnpcs.co/ + @@ -100,14 +100,14 @@ master-SNAPSHOT - net.ess3 - Essentials - 2.14-SNAPSHOT - - - net.citizensnpcs - citizens-v1_11_R1 - 2.0.21-SNAPSHOT - + net.ess3 + Essentials + 2.14-SNAPSHOT + + + net.citizensnpcs + citizens-v1_11_R1 + 2.0.21-SNAPSHOT + diff --git a/src/buttondevteam/alipresents/architecture/commands/subcommands/SubCommand.java b/src/buttondevteam/alipresents/architecture/commands/subcommands/SubCommand.java index 8a6a93d..9501bef 100644 --- a/src/buttondevteam/alipresents/architecture/commands/subcommands/SubCommand.java +++ b/src/buttondevteam/alipresents/architecture/commands/subcommands/SubCommand.java @@ -1,9 +1,19 @@ package buttondevteam.alipresents.architecture.commands.subcommands; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public abstract class SubCommand { - public abstract boolean run(Player player, String label, String[] args); + public boolean run(CommandSender sender, String label, String[] args){ + if (getPlayerOnly() && (sender instanceof Player)) + return false; + + if (getModOnly() && (sender.hasPermission("Moderator"))) + return false; + + return onCommand((Player) sender, label, args); + } + protected abstract boolean onCommand(Player player, String label, String[] args); public abstract boolean getPlayerOnly(); public abstract boolean getModOnly(); public abstract String[] GetHelpText(String alias); diff --git a/src/buttondevteam/alipresents/components/alilinks/commands/Press.java b/src/buttondevteam/alipresents/components/alilinks/commands/Press.java new file mode 100644 index 0000000..a1ad580 --- /dev/null +++ b/src/buttondevteam/alipresents/components/alilinks/commands/Press.java @@ -0,0 +1,32 @@ +package buttondevteam.alipresents.components.alilinks.commands; + +import org.bukkit.entity.Player; + +import buttondevteam.alipresents.architecture.commands.subcommands.SubCommand; + +public class Press extends SubCommand{ + + @Override + protected boolean onCommand(Player player, String label, String[] args) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getPlayerOnly() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getModOnly() { + // TODO Auto-generated method stub + return false; + } + + @Override + public String[] GetHelpText(String alias) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/buttondevteam/alipresents/components/alilinks/commands/Set.java b/src/buttondevteam/alipresents/components/alilinks/commands/Set.java new file mode 100644 index 0000000..38fdc99 --- /dev/null +++ b/src/buttondevteam/alipresents/components/alilinks/commands/Set.java @@ -0,0 +1,14 @@ +package buttondevteam.alipresents.components.alilinks.commands; + +import org.bukkit.entity.Player; + +import buttondevteam.alipresents.architecture.commands.ModCommand; + +public class Set extends ModCommand{ + @Override + public boolean OnCommand(Player player, String alias, String[] args) { + // TODO Auto-generated method stub + return false; + } + +}