us.myles.ViaVersion.api.platform.ViaPlatform Java Examples
The following examples show how to use
us.myles.ViaVersion.api.platform.ViaPlatform.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProtocolPipeline.java From ViaVersion with MIT License | 5 votes |
@Override public void transform(Direction direction, State state, PacketWrapper packetWrapper) throws Exception { int originalID = packetWrapper.getId(); List<Protocol> protocols = new ArrayList<>(protocolList); // Other way if outgoing if (direction == Direction.OUTGOING) Collections.reverse(protocols); // Apply protocols packetWrapper.apply(direction, state, 0, protocols); super.transform(direction, state, packetWrapper); if (Via.getManager().isDebug()) { // Debug packet int serverProtocol = userConnection.getProtocolInfo().getServerProtocolVersion(); int clientProtocol = userConnection.getProtocolInfo().getProtocolVersion(); ViaPlatform platform = Via.getPlatform(); String actualUsername = packetWrapper.user().getProtocolInfo().getUsername(); String username = actualUsername != null ? actualUsername + " " : ""; platform.getLogger().log(Level.INFO, "{0}{1} {2}: {3} (0x{4}) -> {5} (0x{6}) [{7}] {8}", new Object[]{ username, direction, state, originalID, Integer.toHexString(originalID), packetWrapper.getId(), Integer.toHexString(packetWrapper.getId()), Integer.toString(clientProtocol), packetWrapper }); } }
Example #2
Source File: Via.java From ViaVersion with MIT License | 4 votes |
public static ViaPlatform getPlatform() { return platform; }
Example #3
Source File: ViaManager.java From ViaVersion with MIT License | 4 votes |
public ViaManager(ViaPlatform<?> platform, ViaInjector injector, ViaCommandHandler commandHandler, ViaPlatformLoader loader) { this.platform = platform; this.injector = injector; this.commandHandler = commandHandler; this.loader = loader; }
Example #4
Source File: ViaManager.java From ViaVersion with MIT License | 4 votes |
public ViaPlatform<?> getPlatform() { return platform; }
Example #5
Source File: BungeeResourcepacks.java From ResourcepacksPlugins with GNU General Public License v3.0 | 4 votes |
public void onEnable() { instance = this; boolean firstStart = !getDataFolder().exists(); if (!loadConfig()) { return; } if (!registerPacket(Protocol.GAME, "TO_CLIENT", ResourcePackSendPacket.class)) { getLogger().log(Level.SEVERE, "Disabling the plugin as it can't work without the ResourcePackSendPacket!"); return; } setEnabled(true); registerCommand(pluginCommand = new ResourcepacksPluginCommandExecutor(this)); registerCommand(new UsePackCommandExecutor(this)); registerCommand(new ResetPackCommandExecutor(this)); ViaPlatform viaPlugin = (ViaPlatform) getProxy().getPluginManager().getPlugin("ViaVersion"); if (viaPlugin != null) { viaApi = viaPlugin.getApi(); getLogger().log(Level.INFO, "Detected ViaVersion " + viaApi.getVersion()); } if (isEnabled() && getConfig().getBoolean("autogeneratehashes", true)) { getPackManager().generateHashes(null); } um = new UserManager(this); getProxy().getPluginManager().registerListener(this, new DisconnectListener(this)); getProxy().getPluginManager().registerListener(this, new ServerSwitchListener(this)); getProxy().getPluginManager().registerListener(this, new PluginMessageListener(this)); getProxy().registerChannel("rp:plugin"); if (!getConfig().getBoolean("disable-metrics", false)) { new BungeeStatsLite(this).start(); new MetricsLite(this); } if (firstStart || new Random().nextDouble() < 0.01) { startupMessage(); } }