mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
properly unregister module cmds
This commit is contained in:
parent
8fc2f74275
commit
048518dc49
@ -17,6 +17,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.bukkit.command.SimpleCommandMap;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -119,6 +120,14 @@ public class ModuleManager
|
|||||||
{
|
{
|
||||||
module.unregisterCommand(plexCommand);
|
module.unregisterCommand(plexCommand);
|
||||||
Plex.get().getServer().getCommandMap().getKnownCommands().remove(plexCommand.getName());
|
Plex.get().getServer().getCommandMap().getKnownCommands().remove(plexCommand.getName());
|
||||||
|
plexCommand.unregister(Plex.get().getServer().getCommandMap());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Plex.get().getServer().getCommandMap().getCommand(plexCommand.getName()).unregister(Plex.get().getServer().getCommandMap());
|
||||||
|
} catch (Exception ignored)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
plexCommand.getAliases().forEach(alias -> Plex.get().getServer().getCommandMap().getKnownCommands().remove(alias));
|
plexCommand.getAliases().forEach(alias -> Plex.get().getServer().getCommandMap().getKnownCommands().remove(alias));
|
||||||
});
|
});
|
||||||
module.getListeners().stream().toList().forEach(module::unregisterListener);
|
module.getListeners().stream().toList().forEach(module::unregisterListener);
|
||||||
|
Loading…
Reference in New Issue
Block a user