From e554c7cb31546f7d19c573d811fa3fa891308b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor?= Date: Wed, 27 Dec 2023 19:46:38 +0100 Subject: [PATCH 1/2] Kick function not working on 1.20.2+ --- pom.xml | 2 +- .../me/victorgamer15/brandblocker/BrandBlocker.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 6df77d5..38e022e 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ org.spigotmc spigot-api - 1.14.3-R0.1-SNAPSHOT + 1.20.4-R0.1-SNAPSHOT provided diff --git a/src/main/java/me/victorgamer15/brandblocker/BrandBlocker.java b/src/main/java/me/victorgamer15/brandblocker/BrandBlocker.java index 2079d41..b037496 100644 --- a/src/main/java/me/victorgamer15/brandblocker/BrandBlocker.java +++ b/src/main/java/me/victorgamer15/brandblocker/BrandBlocker.java @@ -10,6 +10,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.messaging.PluginMessageListener; +import org.bukkit.scheduler.BukkitRunnable; import java.nio.charset.StandardCharsets; import java.util.HashMap; @@ -102,7 +103,11 @@ public void onPluginMessageReceived(String channel, Player p, byte[] msg) { if (str.equalsIgnoreCase(brand)) { if(p.hasPermission("brandblocker.bypass")) return; String kickMsg = getConfig().getString("kick-message"); - p.kickPlayer(ChatColor.translateAlternateColorCodes('&', kickMsg)); + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + public void run() { + p.kickPlayer(ChatColor.translateAlternateColorCodes('&', kickMsg)); + } + }, 5L); getLogger().info(getConfig().getString("console-log").replace("%player%", p.getName()).replace("%brand%", brand)); return; } @@ -116,7 +121,11 @@ public void onPluginMessageReceived(String channel, Player p, byte[] msg) { } if(p.hasPermission("brandblocker.bypass")) return; String kickMsg = getConfig().getString("kick-message"); - p.kickPlayer(ChatColor.translateAlternateColorCodes('&', kickMsg)); + Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { + public void run() { + p.kickPlayer(ChatColor.translateAlternateColorCodes('&', kickMsg)); + } + }, 5L); getLogger().info(getConfig().getString("console-log").replace("%player%", p.getName()).replace("%brand%", brand)); break; } From f68d869dffc091ccb91e2c6ae8e94f9c1d25dc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor?= Date: Wed, 27 Dec 2023 19:47:27 +0100 Subject: [PATCH 2/2] Kick function not working on 1.20.2+ (#3) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 38e022e..eca6e32 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.victorgamer15 BrandBlocker - 1.6 + 1.7 jar BrandBlocker