Add API for getting whether the user is a Forge user.
For Minecraft+Forge 1.8 we can detect whether the user is a Forge user before we get the mod list, due to the changes to the initial (not FML|HS) handshake that are now made (which is for vanilla client support). Bungee can exploit this to detect FML clients from the off, but it still does not tell us what the mod list is. Thus, creating this API method for users who simply need to know whether the user is connected via FML is no longer a duplication of the getModList api method.
This commit is contained in:
parent
4809f1f80a
commit
28496e0471
@ -172,6 +172,20 @@ public interface ProxiedPlayer extends Connection, CommandSender
|
|||||||
*/
|
*/
|
||||||
void sendTitle(Title title);
|
void sendTitle(Title title);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether this player is using a FML client.
|
||||||
|
* <p>
|
||||||
|
* This method is only reliable if BungeeCord links Minecraft 1.8 servers
|
||||||
|
* together, as Bungee can pick up whether a user is a Forge user with the
|
||||||
|
* initial handshake. If this is used for a 1.7 network, this might return
|
||||||
|
* <code>false</code> even if the user is a FML user, as Bungee can only
|
||||||
|
* determine this information if a handshake successfully completes.
|
||||||
|
* </p>
|
||||||
|
* @return <code>true</code> if it is known that the user is using a FML
|
||||||
|
* client, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
boolean isForgeUser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets this player's Forge Mod List, if the player has sent this
|
* Gets this player's Forge Mod List, if the player has sent this
|
||||||
* information during the lifetime of their connection to Bungee. There is
|
* information during the lifetime of their connection to Bungee. There is
|
||||||
@ -181,7 +195,8 @@ public interface ProxiedPlayer extends Connection, CommandSender
|
|||||||
* <p>
|
* <p>
|
||||||
* Consumers of this API should be aware that an empty mod list does
|
* Consumers of this API should be aware that an empty mod list does
|
||||||
* <em>not</em> indicate that a user is not a Forge user, and so should not
|
* <em>not</em> indicate that a user is not a Forge user, and so should not
|
||||||
* use this API to check for this - there is no way to tell this reliably.
|
* use this API to check for this. See the {@link #isForgeUser()
|
||||||
|
* isForgeUser} method instead.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* Calling this when handling a
|
* Calling this when handling a
|
||||||
@ -189,7 +204,7 @@ public interface ProxiedPlayer extends Connection, CommandSender
|
|||||||
* place to do so as this event occurs after a FML handshake has completed,
|
* place to do so as this event occurs after a FML handshake has completed,
|
||||||
* if any has occurred.
|
* if any has occurred.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return A {@link Map} of mods, where the key is the name of the mod, and
|
* @return A {@link Map} of mods, where the key is the name of the mod, and
|
||||||
* the value is the version. Returns an empty list if the FML handshake has
|
* the value is the version. Returns an empty list if the FML handshake has
|
||||||
* not occurred for this {@link ProxiedPlayer} yet.
|
* not occurred for this {@link ProxiedPlayer} yet.
|
||||||
|
@ -519,6 +519,12 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
return ( locale == null && settings != null ) ? locale = Locale.forLanguageTag( settings.getLocale().replaceAll( "_", "-" ) ) : locale;
|
return ( locale == null && settings != null ) ? locale = Locale.forLanguageTag( settings.getLocale().replaceAll( "_", "-" ) ) : locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isForgeUser()
|
||||||
|
{
|
||||||
|
return forgeClientHandler.isForgeUser();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getModList()
|
public Map<String, String> getModList()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user