/** * Requests that the specified {@code handler} listen for events and associate it with the {@code * plugin}. * * @param plugin the plugin to associate with the handler * @param eventClass the class for the event handler to register * @param handler the handler to register * @param <E> the event type to handle */ default <E> void register(Object plugin, Class<E> eventClass, EventHandler<E> handler) { register(plugin, eventClass, PostOrder.NORMAL, handler); }
public OnlineForwardPluginMessagingForwardingSource(String channel, ServerFilter serverFilter, VotifierPlugin plugin, VoteCache cache, String fallbackServer, int dumpRate) { super(channel, serverFilter, plugin, cache, dumpRate); this.fallbackServer = fallbackServer; this.plugin = plugin; this.velocityChannelId = VelocityUtil.getId(channel); plugin.getServer().getChannelRegistrar().register(velocityChannelId); plugin.getServer().getEventManager().register(plugin, this); }
public PluginMessagingForwardingSource(String channel, ServerFilter serverFilter, VotifierPlugin plugin, VoteCache cache, int dumpRate) { super(channel, serverFilter, plugin, cache, dumpRate); this.plugin = plugin; this.velocityChannelId = VelocityUtil.getId(channel); plugin.getServer().getChannelRegistrar().register(velocityChannelId); plugin.getServer().getEventManager().register(plugin, this); }
@Override public void load() { Object plugin = VelocityPlugin.PROXY.getPluginManager() .getPlugin("viaversion").flatMap(PluginContainer::getInstance).get(); Via.getManager().getProviders().use(MovementTransmitterProvider.class, new VelocityMovementTransmitter()); Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider()); Via.getManager().getProviders().use(VersionProvider.class, new VelocityVersionProvider()); // We probably don't need a EntityIdProvider because velocity sends a Join packet on server change VelocityPlugin.PROXY.getEventManager().register(plugin, new UpdateListener()); VelocityPlugin.PROXY.getEventManager().register(plugin, new VelocityServerHandler()); VelocityPlugin.PROXY.getEventManager().register(plugin, new MainHandPatch()); VelocityPlugin.PROXY.getEventManager().register(plugin, new ElytraPatch()); int pingInterval = ((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval(); if (pingInterval > 0) { Via.getPlatform().runRepeatingSync( new ProtocolDetectorService(), pingInterval * 20L); } }