From ee2c29e1524c1ad00ff16f2011627519c7923742 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 16 Dec 2016 20:23:15 +0100 Subject: [PATCH] Fixed /alilink --- .../architecture/commands/ModCommand.java | 1 - .../architecture/commands/PlayerCommand.java | 2 - .../components/alilinks/AliLinkComponent.java | 12 +++- .../components/alilinks/commands/AliLink.java | 56 ------------------- .../components/alilinks/commands/Press.java | 13 ++++- .../components/alilinks/commands/Set.java | 14 +++-- 6 files changed, 30 insertions(+), 68 deletions(-) delete mode 100644 src/buttondevteam/alipresents/components/alilinks/commands/AliLink.java diff --git a/src/buttondevteam/alipresents/architecture/commands/ModCommand.java b/src/buttondevteam/alipresents/architecture/commands/ModCommand.java index d0e4f03..c9d5d03 100644 --- a/src/buttondevteam/alipresents/architecture/commands/ModCommand.java +++ b/src/buttondevteam/alipresents/architecture/commands/ModCommand.java @@ -12,7 +12,6 @@ public abstract class ModCommand extends PlayerCommand{ @Override public boolean GetModOnly() { - // TODO Auto-generated method stub return true; } } diff --git a/src/buttondevteam/alipresents/architecture/commands/PlayerCommand.java b/src/buttondevteam/alipresents/architecture/commands/PlayerCommand.java index 35d81bd..fa0282d 100644 --- a/src/buttondevteam/alipresents/architecture/commands/PlayerCommand.java +++ b/src/buttondevteam/alipresents/architecture/commands/PlayerCommand.java @@ -18,13 +18,11 @@ public abstract class PlayerCommand extends BaseCommand{ public abstract boolean OnCommand(Player player, String alias, String[] args); @Override public boolean GetPlayerOnly() { - // TODO Auto-generated method stub return true; } @Override public boolean GetModOnly() { - // TODO Auto-generated method stub return false; } @Override diff --git a/src/buttondevteam/alipresents/components/alilinks/AliLinkComponent.java b/src/buttondevteam/alipresents/components/alilinks/AliLinkComponent.java index 508e894..9d91954 100644 --- a/src/buttondevteam/alipresents/components/alilinks/AliLinkComponent.java +++ b/src/buttondevteam/alipresents/components/alilinks/AliLinkComponent.java @@ -3,11 +3,19 @@ package buttondevteam.alipresents.components.alilinks; import org.bukkit.plugin.java.JavaPlugin; import buttondevteam.alipresents.architecture.Component; -import buttondevteam.alipresents.components.alilinks.commands.AliLink; +import buttondevteam.alipresents.components.alilinks.commands.Press; +import buttondevteam.alipresents.components.alilinks.commands.Set; public class AliLinkComponent extends Component { + private static JavaPlugin p; + + public static JavaPlugin getPlugin() { + return p; + } + @Override public void register(JavaPlugin plugin) { - registerCommand(plugin, new AliLink(plugin)); + registerCommand(p = plugin, new Press()); + registerCommand(plugin, new Set()); } } diff --git a/src/buttondevteam/alipresents/components/alilinks/commands/AliLink.java b/src/buttondevteam/alipresents/components/alilinks/commands/AliLink.java deleted file mode 100644 index 1886985..0000000 --- a/src/buttondevteam/alipresents/components/alilinks/commands/AliLink.java +++ /dev/null @@ -1,56 +0,0 @@ -package buttondevteam.alipresents.components.alilinks.commands; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import buttondevteam.alipresents.architecture.commands.BaseCommand; -import buttondevteam.alipresents.components.alilinks.AliLinkAPI; - -public class AliLink extends BaseCommand{ - private JavaPlugin plugin; - - public AliLink(JavaPlugin plugin) { - this.plugin = plugin; - } - @Override - public boolean OnCommand(CommandSender player, String alias, String[] inputFrequencies) { - if(inputFrequencies.length < 1) - return false; - - switch (inputFrequencies[0].toLowerCase()){ - case "press": - return AliLinkAPI.sendPressEvent(player, inputFrequencies, plugin); - case "set": - return AliLinkAPI.createAliLink((Player) player, inputFrequencies); - default: - return false; - } - - } - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - // TODO Auto-generated method stub - return false; - } - @Override - public String[] GetHelpText(String alias) { - // TODO Auto-generated method stub - return null; - } - @Override - public boolean GetPlayerOnly() { - // TODO Auto-generated method stub - return false; - } - @Override - public boolean GetModOnly() { - // TODO Auto-generated method stub - return false; - } - - - - -} diff --git a/src/buttondevteam/alipresents/components/alilinks/commands/Press.java b/src/buttondevteam/alipresents/components/alilinks/commands/Press.java index 4b01942..4b531ed 100644 --- a/src/buttondevteam/alipresents/components/alilinks/commands/Press.java +++ b/src/buttondevteam/alipresents/components/alilinks/commands/Press.java @@ -3,12 +3,19 @@ package buttondevteam.alipresents.components.alilinks.commands; import org.bukkit.entity.Player; import buttondevteam.alipresents.architecture.commands.PlayerCommand; +import buttondevteam.alipresents.components.alilinks.AliLinkAPI; +import buttondevteam.alipresents.components.alilinks.AliLinkComponent; -public class Press extends PlayerCommand{ +public class Press extends PlayerCommand { + @Override + public String GetCommandPath() { + return "alilink press"; + } @Override public boolean OnCommand(Player player, String alias, String[] args) { - // TODO Auto-generated method stub - return false; + if (args.length < 1) + return false; + return AliLinkAPI.sendPressEvent(player, args, AliLinkComponent.getPlugin()); } } diff --git a/src/buttondevteam/alipresents/components/alilinks/commands/Set.java b/src/buttondevteam/alipresents/components/alilinks/commands/Set.java index 38fdc99..23385a6 100644 --- a/src/buttondevteam/alipresents/components/alilinks/commands/Set.java +++ b/src/buttondevteam/alipresents/components/alilinks/commands/Set.java @@ -3,12 +3,18 @@ package buttondevteam.alipresents.components.alilinks.commands; import org.bukkit.entity.Player; import buttondevteam.alipresents.architecture.commands.ModCommand; +import buttondevteam.alipresents.components.alilinks.AliLinkAPI; -public class Set extends ModCommand{ +public class Set extends ModCommand { @Override - public boolean OnCommand(Player player, String alias, String[] args) { - // TODO Auto-generated method stub - return false; + public String GetCommandPath() { + return "alilink set"; } + @Override + public boolean OnCommand(Player player, String alias, String[] args) { + if (args.length < 1) + return false; + return AliLinkAPI.createAliLink(player, args); + } }