@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onCommand(final PlayerCommandHook hook) {
String command = "";
for (String s : hook.getCommand()) {
command += s + " ";
}
PlayerCommandPreprocessEvent event =
new PlayerCommandPreprocessEvent(new CanaryPlayer(hook.getPlayer()), command) {
@Override
public void setMessage(String msg) {
super.setMessage(msg);
// Set command
}
};
event.setCancelled(hook.isCanceled());
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
hook.setCanceled();
}
if (server.dispatchCommand(new CanaryCommandSender(hook.getPlayer()), command)) {
hook.setCanceled(); //TODO: is this the best possible way?
}
}
CanaryPlayerListener.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:CanaryBukkit
作者:
评论列表
文章目录