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

32
pom.xml
View file

@ -73,13 +73,13 @@
<url>https://jitpack.io</url>
</repository>
<repository>
<id>ess-repo</id>
<url>http://repo.ess3.net/content/groups/essentials</url>
</repository>
<repository>
<id>citizensnpcs</id>
<url>http://repo.citizensnpcs.co/</url>
</repository>
<id>ess-repo</id>
<url>http://repo.ess3.net/content/groups/essentials</url>
</repository>
<repository>
<id>citizensnpcs</id>
<url>http://repo.citizensnpcs.co/</url>
</repository>
</repositories>
<dependencies>
@ -100,14 +100,14 @@
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.ess3</groupId>
<artifactId>Essentials</artifactId>
<version>2.14-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.citizensnpcs</groupId>
<artifactId>citizens-v1_11_R1</artifactId>
<version>2.0.21-SNAPSHOT</version>
</dependency>
<groupId>net.ess3</groupId>
<artifactId>Essentials</artifactId>
<version>2.14-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.citizensnpcs</groupId>
<artifactId>citizens-v1_11_R1</artifactId>
<version>2.0.21-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View file

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

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