Refactored code to make subcommands #23
4 changed files with 73 additions and 17 deletions
32
pom.xml
32
pom.xml
|
@ -73,13 +73,13 @@
|
||||||
<url>https://jitpack.io</url>
|
<url>https://jitpack.io</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>ess-repo</id>
|
<id>ess-repo</id>
|
||||||
<url>http://repo.ess3.net/content/groups/essentials</url>
|
<url>http://repo.ess3.net/content/groups/essentials</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>citizensnpcs</id>
|
<id>citizensnpcs</id>
|
||||||
<url>http://repo.citizensnpcs.co/</url>
|
<url>http://repo.citizensnpcs.co/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -100,14 +100,14 @@
|
||||||
<version>master-SNAPSHOT</version>
|
<version>master-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ess3</groupId>
|
<groupId>net.ess3</groupId>
|
||||||
<artifactId>Essentials</artifactId>
|
<artifactId>Essentials</artifactId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>2.14-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizens-v1_11_R1</artifactId>
|
<artifactId>citizens-v1_11_R1</artifactId>
|
||||||
<version>2.0.21-SNAPSHOT</version>
|
<version>2.0.21-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue