Refactored code to make subcommands #23

Merged
alisolarflare merged 6 commits from Refactoring into master 2016-12-17 07:43:27 +00:00
4 changed files with 73 additions and 17 deletions
Showing only changes of commit e2f2c66352 - Show all commits

View file

@ -1,9 +1,19 @@
package buttondevteam.alipresents.architecture.commands.subcommands; package buttondevteam.alipresents.architecture.commands.subcommands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public abstract class SubCommand { 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 getPlayerOnly();
public abstract boolean getModOnly(); public abstract boolean getModOnly();
public abstract String[] GetHelpText(String alias); public abstract String[] GetHelpText(String alias);

View file

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

View file

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