Implement Support for MinecraftForge / FML 1.7.10

Additional implementation help provided by @jk-5 and @bloodmc.
This commit is contained in:
Daniel Naylor
2014-09-26 10:20:19 +10:00
committed by md_5
parent 8715c5fd82
commit cfad2c65d4
24 changed files with 1111 additions and 24 deletions

View File

@@ -1,5 +1,7 @@
package net.md_5.bungee.api;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -74,6 +76,27 @@ public class ServerPing
private String description;
private Favicon favicon;
@Data
public static class ModInfo
{
private String type = "FML";
private List<ModItem> modList = new ArrayList<>();
}
@Data
@AllArgsConstructor
public static class ModItem
{
private String modid;
private String version;
}
// Right now, we don't get the mods from the user, so we just use a stock ModInfo object to
// create the server ping. Vanilla clients will ignore this.
private final ModInfo modinfo = new ModInfo();
@Deprecated
public ServerPing(Protocol version, Players players, String description, String favicon)
{

View File

@@ -1,6 +1,7 @@
package net.md_5.bungee.api.connection;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import net.md_5.bungee.api.Callback;
import net.md_5.bungee.api.CommandSender;
@@ -153,4 +154,28 @@ public interface ProxiedPlayer extends Connection, CommandSender
* @see Title
*/
void sendTitle(Title title);
/**
* Gets this player's Forge Mod List, if the player has sent this
* information during the lifetime of their connection to Bungee. There is
* no guarantee that information is available at any time, as it is only
* sent during a FML handshake. Therefore, this will only contain
* information for a user that has attempted joined a Forge server.
* <p>
* 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
* use this API to check for this - there is no way to tell this reliably.
* </p>
* <p>
* Calling this when handling a
* {@link net.md_5.bungee.api.event.ServerConnectedEvent} may be the best
* place to do so as this event occurs after a FML handshake has completed,
* if any has occurred.
* </p>
*
* @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
* not occurred for this {@link ProxiedPlayer} yet.
*/
Map<String, String> getModList();
}