Search in sources :

Example 1 with LuckPermsDataGetter

use of net.william278.huskchat.getter.LuckPermsDataGetter in project HuskChat by WiIIiam278.

the class HuskChatBungee method onEnable.

@Override
public void onEnable() {
    // Load config
    reloadSettings();
    // Load messages
    reloadMessages();
    // Setup player data getter
    Plugin luckPerms = ProxyServer.getInstance().getPluginManager().getPlugin("LuckPerms");
    if (luckPerms != null) {
        playerDataGetter = new LuckPermsDataGetter();
    } else {
        Plugin bungeePerms = ProxyServer.getInstance().getPluginManager().getPlugin("BungeePerms");
        if (bungeePerms != null) {
            playerDataGetter = new BungeePermsDataGetter();
        } else {
            playerDataGetter = new DefaultDataGetter();
        }
    }
    // Register events
    getProxy().getPluginManager().registerListener(this, new BungeeListener());
    // Register commands
    new BungeeCommand(new HuskChatCommand(this));
    new BungeeCommand(new ChannelCommand(this));
    if (Settings.doMessageCommand) {
        new BungeeCommand(new MsgCommand(this));
        new BungeeCommand(new ReplyCommand(this));
    }
    if (Settings.doBroadcastCommand) {
        new BungeeCommand(new BroadcastCommand(this));
    }
    if (Settings.doSocialSpyCommand) {
        new BungeeCommand(new SocialSpyCommand(this));
    }
    if (Settings.doLocalSpyCommand) {
        new BungeeCommand(new LocalSpyCommand(this));
    }
    // Register shortcut commands
    for (Channel channel : Settings.channels) {
        for (String command : channel.shortcutCommands) {
            new BungeeCommand(new ShortcutCommand(command, channel.id, this));
        }
    }
    // Initialise metrics
    new Metrics(this, METRICS_ID);
    // Plugin startup logic
    getLogger().info("Enabled HuskChat version " + getDescription().getVersion());
}
Also used : BungeePermsDataGetter(net.william278.huskchat.getter.BungeePermsDataGetter) Channel(net.william278.huskchat.channel.Channel) DefaultDataGetter(net.william278.huskchat.getter.DefaultDataGetter) LuckPermsDataGetter(net.william278.huskchat.getter.LuckPermsDataGetter) Metrics(org.bstats.bungeecord.Metrics) BungeeListener(net.william278.huskchat.bungeecord.listener.BungeeListener) Plugin(net.md_5.bungee.api.plugin.Plugin)

Example 2 with LuckPermsDataGetter

use of net.william278.huskchat.getter.LuckPermsDataGetter in project HuskChat by WiIIiam278.

the class HuskChatVelocity method onProxyInitialization.

@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
    instance = this;
    // Load config
    reloadSettings();
    // Load messages
    reloadMessages();
    // Setup player data getter
    Optional<PluginContainer> luckPerms = getProxyServer().getPluginManager().getPlugin("luckperms");
    if (luckPerms.isPresent()) {
        playerDataGetter = new LuckPermsDataGetter();
    } else {
        playerDataGetter = new DefaultDataGetter();
    }
    // Register events
    getProxyServer().getEventManager().register(this, new VelocityListener());
    // Register commands
    new VelocityCommand(new HuskChatCommand(this));
    new VelocityCommand(new ChannelCommand(this));
    if (Settings.doMessageCommand) {
        new VelocityCommand(new MsgCommand(this));
        new VelocityCommand(new ReplyCommand(this));
    }
    if (Settings.doBroadcastCommand) {
        new VelocityCommand(new BroadcastCommand(this));
    }
    if (Settings.doSocialSpyCommand) {
        new VelocityCommand(new SocialSpyCommand(this));
    }
    if (Settings.doLocalSpyCommand) {
        new VelocityCommand(new LocalSpyCommand(this));
    }
    // Register shortcut commands
    for (Channel channel : Settings.channels) {
        for (String command : channel.shortcutCommands) {
            new VelocityCommand(new ShortcutCommand(command, channel.id, this));
        }
    }
    // Initialise metrics
    metricsFactory.make(this, METRICS_ID);
    // Plugin startup logic
    getLoggingAdapter().info("Enabled HuskChat version " + getMetaVersion());
}
Also used : PluginContainer(com.velocitypowered.api.plugin.PluginContainer) Channel(net.william278.huskchat.channel.Channel) VelocityCommand(net.william278.huskchat.velocity.command.VelocityCommand) DefaultDataGetter(net.william278.huskchat.getter.DefaultDataGetter) LuckPermsDataGetter(net.william278.huskchat.getter.LuckPermsDataGetter) VelocityListener(net.william278.huskchat.velocity.listener.VelocityListener) Subscribe(com.velocitypowered.api.event.Subscribe)

Aggregations

Channel (net.william278.huskchat.channel.Channel)2 DefaultDataGetter (net.william278.huskchat.getter.DefaultDataGetter)2 LuckPermsDataGetter (net.william278.huskchat.getter.LuckPermsDataGetter)2 Subscribe (com.velocitypowered.api.event.Subscribe)1 PluginContainer (com.velocitypowered.api.plugin.PluginContainer)1 Plugin (net.md_5.bungee.api.plugin.Plugin)1 BungeeListener (net.william278.huskchat.bungeecord.listener.BungeeListener)1 BungeePermsDataGetter (net.william278.huskchat.getter.BungeePermsDataGetter)1 VelocityCommand (net.william278.huskchat.velocity.command.VelocityCommand)1 VelocityListener (net.william278.huskchat.velocity.listener.VelocityListener)1 Metrics (org.bstats.bungeecord.Metrics)1