自己在开发一个插件,其中有一个功能是屏蔽 设定的玩家 输入的指令,后台会有屏蔽的记录。但我发现在登录前 指令系统似乎直接被authme接管了,后台也收不到屏蔽记录,却能收到玩家正常登录指令/login(如果被屏蔽了收不到)。
我的插件用的是PlayerCommandPreprocessEvent 这个事件,不知道怎样才能优先于authme或者与他同一级
我的插件用的是PlayerCommandPreprocessEvent 这个事件,不知道怎样才能优先于authme或者与他同一级
这是authme的监听,在你的监听代码上加上ignoreCancelled = true 应该就能监听到了
复制代码
- @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
- public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
- String cmd = event.getMessage().split(" ")[0].toLowerCase();
- if (settings.getProperty(HooksSettings.USE_ESSENTIALS_MOTD) && "/motd".equals(cmd)) {
- return;
- }
- if (settings.getProperty(RestrictionSettings.ALLOW_COMMANDS).contains(cmd)) {
- return;
- }
- final Player player = event.getPlayer();
- if (!quickCommandsProtectionManager.isAllowed(player.getName())) {
- event.setCancelled(true);
- player.kickPlayer(messages.retrieveSingle(player, MessageKey.QUICK_COMMAND_PROTECTION_KICK));
- return;
- }
- if (listenerService.shouldCancelEvent(player)) {
- event.setCancelled(true);
- messages.send(player, MessageKey.DENIED_COMMAND);
- }
- }