From c76a154caa10799f06fe9bc751abe54c1f7c9272 Mon Sep 17 00:00:00 2001 From: TONY_All Date: Fri, 4 Feb 2022 23:59:37 +0800 Subject: [PATCH] fix bugs avoid interact entity --- .../kotlin/cc/maxmc/invite/command/InviteCodeCommands.kt | 2 +- src/main/kotlin/cc/maxmc/invite/listener/InvitedListener.kt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/cc/maxmc/invite/command/InviteCodeCommands.kt b/src/main/kotlin/cc/maxmc/invite/command/InviteCodeCommands.kt index b7572d0..134d887 100644 --- a/src/main/kotlin/cc/maxmc/invite/command/InviteCodeCommands.kt +++ b/src/main/kotlin/cc/maxmc/invite/command/InviteCodeCommands.kt @@ -132,7 +132,7 @@ object InviteCodeCommands { !InviteCode.find { InviteCodes.name eq arg }.empty() } } - suggestion { _, _ -> + suggestion(uncheck = true) { _, _ -> return@suggestion Bukkit.getOnlinePlayers().map { it.name } } dynamic { diff --git a/src/main/kotlin/cc/maxmc/invite/listener/InvitedListener.kt b/src/main/kotlin/cc/maxmc/invite/listener/InvitedListener.kt index 15e9889..e0817c2 100644 --- a/src/main/kotlin/cc/maxmc/invite/listener/InvitedListener.kt +++ b/src/main/kotlin/cc/maxmc/invite/listener/InvitedListener.kt @@ -48,6 +48,12 @@ object InvitedListener { if (!e.message.contains("use")) e.isCancelled = true } + @SubscribeEvent + fun onInteractEntity(e: PlayerInteractEntityEvent) { + if (!cache.containsKey(e.player.uniqueId)) return + e.isCancelled = true + } + @SubscribeEvent fun onJoin(e: PlayerJoinEvent) { tailrec suspend fun requireQQNumber(player: Player): String? {