本文整理汇总了Java中org.bukkit.event.server.ServerCommandEvent.getSender方法的典型用法代码示例。如果您正苦于以下问题:Java ServerCommandEvent.getSender方法的具体用法?Java ServerCommandEvent.getSender怎么用?Java ServerCommandEvent.getSender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.server.ServerCommandEvent
的用法示例。
在下文中一共展示了ServerCommandEvent.getSender方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onServerCommand
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onServerCommand (ServerCommandEvent event)
{
String command = event.getCommand().toLowerCase();
if (command.equals("/p reload") || command.equals("/bp reload")
|| command.equals("/perm reload")
|| command.equals("/permissions reload"))
{
final CommandSender sender = event.getSender();
plugin.getServer().getScheduler()
.scheduleSyncDelayedTask(plugin, new Runnable()
{
public void run ()
{
plugin.refreshCache(sender);
}
}, 1L);
return;
}
}
示例2: onCommand
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
@EventHandler
public void onCommand(ServerCommandEvent event) {
String msg = "/" + event.getCommand();
CommandSender sender = event.getSender();
this.handle(msg, sender, event);
}
示例3: canPass
import org.bukkit.event.server.ServerCommandEvent; //导入方法依赖的package包/类
public boolean canPass(ServerCommandEvent e){
Player p = (Player) e.getSender();
try {
String[] split = e.getCommand().split(" ");
String command = split[0].substring(1, split[0].length());
for (String s : accept) {
if (s.equals("*"))
return true;
String arg = s.substring(2, s.length());
switch (s.substring(0, 1)) {
case "r":
return arg.equalsIgnoreCase(PermissionHandler.getGroupName(p));
case "p":
return arg.equalsIgnoreCase(p.getName());
case "c":
return arg.equalsIgnoreCase(command);
case "a":
for (int i = 1; i < split.length; i++) {
if (arg.equalsIgnoreCase(split[i]))
return true;
}
}
}
return false;
} catch (Exception ex) {
return false;
}
}