diff --git a/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java b/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java index 96144322d..544f4936a 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java +++ b/bungee/src/main/java/us/myles/ViaVersion/BungeePlugin.java @@ -12,7 +12,6 @@ import net.md_5.bungee.event.EventHandler; import us.myles.ViaVersion.api.Pair; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.ViaAPI; -import us.myles.ViaVersion.api.ViaVersionConfig; import us.myles.ViaVersion.api.command.ViaCommandSender; import us.myles.ViaVersion.api.configuration.ConfigurationProvider; import us.myles.ViaVersion.api.data.UserConnection; @@ -83,7 +82,7 @@ public class BungeePlugin extends Plugin implements ViaPlatform, Listener { @Override public TaskId runSync(Runnable runnable) { - return new BungeeTaskId(getProxy().getScheduler().runAsync(this, runnable).getId()); + return runAsync(runnable); } @Override @@ -112,13 +111,13 @@ public class BungeePlugin extends Plugin implements ViaPlatform, Listener { @Override public void sendMessage(UUID uuid, String message) { - getProxy().getPlayer(uuid).sendMessage(new TextComponent(message)); + getProxy().getPlayer(uuid).sendMessage(TextComponent.fromLegacyText(message)); } @Override public boolean kickPlayer(UUID uuid, String message) { if (getProxy().getPlayer(uuid) != null) { - getProxy().getPlayer(uuid).disconnect(new TextComponent(message)); + getProxy().getPlayer(uuid).disconnect(TextComponent.fromLegacyText(message)); return true; } return false; diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/listeners/UpdateListener.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/listeners/UpdateListener.java new file mode 100644 index 000000000..b27ba57e8 --- /dev/null +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/listeners/UpdateListener.java @@ -0,0 +1,18 @@ +package us.myles.ViaVersion.bungee.listeners; + +import net.md_5.bungee.api.event.PostLoginEvent; +import net.md_5.bungee.api.plugin.Listener; +import net.md_5.bungee.event.EventHandler; +import us.myles.ViaVersion.api.Via; +import us.myles.ViaVersion.update.UpdateUtil; + +public class UpdateListener implements Listener { + + @EventHandler + public void onJoin(PostLoginEvent e) { + if (e.getPlayer().hasPermission("viaversion.update") + && Via.getConfig().isCheckForUpdates()) { + UpdateUtil.sendUpdateMessage(e.getPlayer().getUniqueId()); + } + } +} diff --git a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaLoader.java b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaLoader.java index 3348535e3..9ba4e250e 100644 --- a/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaLoader.java +++ b/bungee/src/main/java/us/myles/ViaVersion/bungee/platform/BungeeViaLoader.java @@ -5,6 +5,7 @@ import net.md_5.bungee.api.ProxyServer; import us.myles.ViaVersion.BungeePlugin; import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.platform.ViaPlatformLoader; +import us.myles.ViaVersion.bungee.listeners.UpdateListener; import us.myles.ViaVersion.bungee.providers.BungeeMovementTransmitter; import us.myles.ViaVersion.bungee.providers.BungeeVersionProvider; import us.myles.ViaVersion.bungee.service.ProtocolDetectorService; @@ -21,6 +22,8 @@ public class BungeeViaLoader implements ViaPlatformLoader { public void load() { // Listeners ProxyServer.getInstance().getPluginManager().registerListener(plugin, plugin); + ProxyServer.getInstance().getPluginManager().registerListener(plugin, new UpdateListener()); + // Providers Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BungeeMovementTransmitter()); Via.getManager().getProviders().use(VersionProvider.class, new BungeeVersionProvider());