From 2d49a7a4b780642ee1f555ea2076c5db77274cca Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Wed, 21 Dec 2022 10:35:35 +0100 Subject: [PATCH] bugfix for < 1.13 Server Fixed a bug where you could not reload the plugin (/t2c-alias reload) when using a server below 1.13 --- pom.xml | 6 +++--- .../t2code/alias/Spigot/system/AliasRegister.java | 13 +++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 1e3c80d..43e2f03 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.t2code Alias - 1.1.6 + 1.1.7-DEV jar T2C-Alias @@ -82,9 +82,9 @@ 3.0 - net.t2code.minecraft.1_19.r1 + net.t2code.minecraft.1_13.r1 spigot - 1.19r1 + 1.13r1 diff --git a/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java b/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java index 9fe35d7..a560a74 100644 --- a/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java +++ b/src/main/java/net/t2code/alias/Spigot/system/AliasRegister.java @@ -4,6 +4,7 @@ import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.cmdManagement.RegisterCommands; import net.t2code.alias.Util; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; +import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; @@ -21,15 +22,19 @@ public class AliasRegister { final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap"); bukkitCommandMap.setAccessible(true); CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer()); - // onUnRegister(bukkitCommandMap); + // onUnRegister(bukkitCommandMap); for (String alias : Main.allAliases) { register(alias, commandMap); // wrap(alias, commandMap); } - Main.getPlugin().getBukkitCommandWrap().sync(); - if (Bukkit.getOnlinePlayers().size() >= 1) - for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands(); + + if (!(T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12())) { + Main.getPlugin().getBukkitCommandWrap().sync(); + if (Bukkit.getOnlinePlayers().size() >= 1) + for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands(); + } + } catch (Exception e) { e.printStackTrace(); }