当前位置: 首页>>代码示例>>Java>>正文


Java ExtendedJavaPlugin类代码示例

本文整理汇总了Java中me.lucko.helper.plugin.ExtendedJavaPlugin的典型用法代码示例。如果您正苦于以下问题:Java ExtendedJavaPlugin类的具体用法?Java ExtendedJavaPlugin怎么用?Java ExtendedJavaPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExtendedJavaPlugin类属于me.lucko.helper.plugin包,在下文中一共展示了ExtendedJavaPlugin类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BungeeMessaging

import me.lucko.helper.plugin.ExtendedJavaPlugin; //导入依赖的package包/类
private BungeeMessaging() {
    plugin = LoaderUtils.getPlugin();
    
    if (plugin instanceof ExtendedJavaPlugin) {
        ExtendedJavaPlugin ejp = (ExtendedJavaPlugin) plugin;
        ejp.bindRunnable(() -> {
            BungeeMessaging.instance = null;
            terminableRegistry.terminate();
        });
    }

    plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, CHANNEL);
    terminableRegistry.bindRunnable(() -> plugin.getServer().getMessenger().unregisterOutgoingPluginChannel(plugin, CHANNEL));

    plugin.getServer().getMessenger().registerIncomingPluginChannel(plugin, CHANNEL, this);
    terminableRegistry.bindRunnable(() -> plugin.getServer().getMessenger().unregisterIncomingPluginChannel(plugin, CHANNEL, this));

    Scheduler.builder()
            .sync()
            .afterAndEvery(3, TimeUnit.SECONDS)
            .run(() -> {
                if (queuedMessages.isEmpty()) {
                    return;
                }

                Player p = Iterables.getFirst(Players.all(), null);
                if (p != null) {
                    queuedMessages.removeIf(ma -> {
                        sendToChannel(ma, p);
                        return true;
                    });
                }
            })
            .bindWith(terminableRegistry);
}
 
开发者ID:lucko,项目名称:helper,代码行数:36,代码来源:BungeeMessaging.java

示例2: PacketScoreboard

import me.lucko.helper.plugin.ExtendedJavaPlugin; //导入依赖的package包/类
public PacketScoreboard(@Nullable ExtendedJavaPlugin plugin) {
    this.protocolManager = ProtocolLibrary.getProtocolManager();

    if (plugin != null) {
        Events.subscribe(PlayerJoinEvent.class).handler(this::handlePlayerJoin).bindWith(plugin);
        Events.subscribe(PlayerQuitEvent.class).handler(this::handlePlayerQuit).bindWith(plugin);
    } else {
        Events.subscribe(PlayerJoinEvent.class).handler(this::handlePlayerJoin);
        Events.subscribe(PlayerQuitEvent.class).handler(this::handlePlayerQuit);
    }
}
 
开发者ID:lucko,项目名称:helper,代码行数:12,代码来源:PacketScoreboard.java

示例3: register

import me.lucko.helper.plugin.ExtendedJavaPlugin; //导入依赖的package包/类
@Override
public void register(ExtendedJavaPlugin plugin, String... aliases) {
    plugin.registerCommand(this, aliases);
    timing = Timings.of("helper-commands: " + plugin.getName() + " - " + Arrays.toString(aliases));
}
 
开发者ID:lucko,项目名称:helper,代码行数:6,代码来源:AbstractCommand.java

示例4: register

import me.lucko.helper.plugin.ExtendedJavaPlugin; //导入依赖的package包/类
/**
 * Registers this command with the server, via the given plugin instance
 *
 * @param plugin the plugin instance
 * @param aliases the aliases for the command
 */
void register(@Nonnull ExtendedJavaPlugin plugin, @Nonnull String... aliases);
 
开发者ID:lucko,项目名称:helper,代码行数:8,代码来源:Command.java

示例5: registerAndBind

import me.lucko.helper.plugin.ExtendedJavaPlugin; //导入依赖的package包/类
/**
 * Registers this command with the server, via the given plugin instance, and then binds it with the composite terminable.
 *
 * @param consumer the terminable consumer to bind with
 * @param plugin the plugin instance
 * @param aliases the aliases for the command
 */
default void registerAndBind(@Nonnull TerminableConsumer consumer, @Nonnull ExtendedJavaPlugin plugin, @Nonnull String... aliases) {
    register(plugin, aliases);
    bindWith(consumer);
}
 
开发者ID:lucko,项目名称:helper,代码行数:12,代码来源:Command.java


注:本文中的me.lucko.helper.plugin.ExtendedJavaPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。