1
0
mirror of https://e.coding.net/circlecloud/SimpleEssential.git synced 2024-11-16 01:08:46 +00:00

Merge remote-tracking branch 'GitHub/master'

This commit is contained in:
j502647092 2015-08-14 13:52:09 +08:00
commit 68c124102a
11 changed files with 39 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
@ -49,6 +50,8 @@ public class SimpleEssential extends JavaPlugin {
if (!command.hasPermission(sender)) {
sender.sendMessage(ChatColor.RED + "你没有此命令的权限.");
return true;
}else if(command.isOnlyPlayerExecutable() && !(sender instanceof Player)){
sender.sendMessage(ChatColor.RED + "此命令只能由玩家执行.");
}
if (args.length >= command.getMinimumArguments()) {
try {

View File

@ -22,6 +22,9 @@ public class CommandBack extends SimpleEssentialCommand {
super("back", "seback");
this.plugin = main;
}
@Override
public boolean isOnlyPlayerExecutable() {return true;};
@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {

View File

@ -24,6 +24,9 @@ public class CommandHome extends SimpleEssentialCommand {
super("home", "eshome");
this.plugin = main;
}
@Override
public boolean isOnlyPlayerExecutable() {return true;};
@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {

View File

@ -25,6 +25,9 @@ public class CommandSetHome extends SimpleEssentialCommand {
super("sethome", "essethome");
this.plugin = main;
}
@Override
public boolean isOnlyPlayerExecutable() {return true;};
@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {

View File

@ -26,6 +26,9 @@ public class CommandTop extends SimpleEssentialCommand {
super("top", "estop");
this.plugin = main;
}
@Override
public boolean isOnlyPlayerExecutable() {return true;};
@Override
public String getPossibleArguments() {

View File

@ -27,6 +27,9 @@ public class CommandTpa extends SimpleEssentialCommand {
super("tpa");
this.plugin = main;
}
@Override
public boolean isOnlyPlayerExecutable() {return true;};
@Override
public String getPossibleArguments() {

View File

@ -24,6 +24,9 @@ public class CommandTpaccept extends SimpleEssentialCommand {
super("tpaccept", "tpok");
this.plugin = main;
}
@Override
public boolean isOnlyPlayerExecutable() {return true;};
@Override
public String getPossibleArguments() {

View File

@ -24,6 +24,9 @@ public class CommandTpdeny extends SimpleEssentialCommand {
super("tpdeny", "tpno");
this.plugin = main;
}
@Override
public boolean isOnlyPlayerExecutable() {return true;};
@Override
public String getPossibleArguments() {

View File

@ -38,6 +38,9 @@ public class CommandTphere extends SimpleEssentialCommand {
Language.getMessage("Teleport.tpdeny")
});
}
@Override
public boolean isOnlyPlayerExecutable() {return true;};
@Override
public int getMinimumArguments() {

View File

@ -93,6 +93,11 @@ public abstract class SimpleEssentialCommand {
* - 命令异常
*/
public abstract void execute(CommandSender sender, String label, String[] args) throws CommandException;
/**
* 是否只有玩家才能执行此命令
*/
public abstract boolean isOnlyPlayerExecutable();
/**
* 命令匹配检测

View File

@ -57,6 +57,12 @@ commands:
usage: §b使用/sethome 设置当前位置为家!
permission: se.sethome
permission-message: §c你没有 <permission> 的权限来执行此命令!
suicide:
description: 自杀
aliases: [sesuicide,sd]
usage: §b使用/suicide结束自己的生命!
permission: se.suicide
permission-message: §c你没有 <permission> 的权限来执行此命令!
permissions:
se.*:
description: 简单基础插件所有权限!
@ -72,4 +78,5 @@ permissions:
se.tpaccept: true
se.tpdeny: true
se.back: true
se.suicide: true