本文整理汇总了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);
}
示例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);
}
}
示例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));
}
示例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);
示例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);
}