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:
commit
68c124102a
@ -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 {
|
||||
|
@ -23,6 +23,9 @@ public class CommandBack extends SimpleEssentialCommand {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {return true;};
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||
plugin.tpcontrol.back((Player) sender);
|
||||
|
@ -25,6 +25,9 @@ public class CommandHome extends SimpleEssentialCommand {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {return true;};
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||
Player p = (Player) sender;
|
||||
|
@ -26,6 +26,9 @@ public class CommandSetHome extends SimpleEssentialCommand {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {return true;};
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||
Player p = (Player) sender;
|
||||
|
@ -27,6 +27,9 @@ public class CommandTop extends SimpleEssentialCommand {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {return true;};
|
||||
|
||||
@Override
|
||||
public String getPossibleArguments() {
|
||||
return "";
|
||||
|
@ -28,6 +28,9 @@ public class CommandTpa extends SimpleEssentialCommand {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {return true;};
|
||||
|
||||
@Override
|
||||
public String getPossibleArguments() {
|
||||
return "<目标玩家>";
|
||||
|
@ -25,6 +25,9 @@ public class CommandTpaccept extends SimpleEssentialCommand {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {return true;};
|
||||
|
||||
@Override
|
||||
public String getPossibleArguments() {
|
||||
return "";
|
||||
|
@ -25,6 +25,9 @@ public class CommandTpdeny extends SimpleEssentialCommand {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {return true;};
|
||||
|
||||
@Override
|
||||
public String getPossibleArguments() {
|
||||
return "";
|
||||
|
@ -39,6 +39,9 @@ public class CommandTphere extends SimpleEssentialCommand {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {return true;};
|
||||
|
||||
@Override
|
||||
public int getMinimumArguments() {
|
||||
return 1;
|
||||
|
@ -94,6 +94,11 @@ public abstract class SimpleEssentialCommand {
|
||||
*/
|
||||
public abstract void execute(CommandSender sender, String label, String[] args) throws CommandException;
|
||||
|
||||
/**
|
||||
* 是否只有玩家才能执行此命令
|
||||
*/
|
||||
public abstract boolean isOnlyPlayerExecutable();
|
||||
|
||||
/**
|
||||
* 命令匹配检测
|
||||
*
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user