arkflame / CleanMOTD

Simple and light plugin to manage the motd of your server.
https://www.spigotmc.org/resources/58268/
MIT License
15 stars 14 forks source link

Version specific motds #7

Closed kaxlabs closed 3 years ago

kaxlabs commented 3 years ago

Since 1.16 color formatting codes don't work on lower versions, it would be good to have different version profiles (e.g. 1.16+, 1.15-) so that servers with ViaVersion/ViaBackwards are able to look good for all users.

linsaftw commented 3 years ago

Hi, how do you get the protocol version of a player with ViaVersion api? It seems you need the Player object which you can't get on ping event.

kaxlabs commented 3 years ago

For spigot, you can add it to your maven like so:

<repository>
    <id>viaversion-repo</id>
    <url>https://repo.viaversion.com</url>
</repository>

<dependency>
    <groupId>us.myles</groupId>
    <artifactId>viaversion</artifactId>
    <version>2.2.2</version>
    <scope>provided</scope>
</dependency>

and then use it in your code like this:

Player player = // some reference of the player
int protocolVersion = Via.getAPI().getPlayerVersion(player.getUniqueId());

For bungeecord this is not needed, you can just use event.getConnection().getVersion(); from the ProxyPingEvent.

linsaftw commented 3 years ago

I will try to implement this for BungeeCord. It will not be possible to do in Bukkit as you can't get the "Player" on ServerListPing.

linsaftw commented 3 years ago

I will try to implement this for BungeeCord. It will not be possible to do in Bukkit as you can't get the "Player" on ServerListPing.

You can do it with ProtocolLib tho... We will probably have an implementation soon :)

linsaftw commented 3 years ago

Closed with 4f13ced

linsaftw commented 3 years ago

I had to revert the changes because they broke some stuff and only work on BungeeCord if ViaVersion is installed.