Fixed /alilink

This commit is contained in:
Norbi Peti 2016-12-16 20:23:15 +01:00
parent 7af3544c61
commit ee2c29e152
6 changed files with 30 additions and 68 deletions

View file

@ -12,7 +12,6 @@ public abstract class ModCommand extends PlayerCommand{
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return true;
}
}

View file

@ -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

View file

@ -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());
}
}

View file

@ -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;
}
}

View file

@ -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());
}
}

View file

@ -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);
}
}