Dieser Commit ist enthalten in:
Ursprung
0033de233b
Commit
75e744435c
@ -20,10 +20,7 @@ package de.steamwar.bungeecore.listeners.mods;
|
|||||||
|
|
||||||
import net.md_5.bungee.api.ServerPing;
|
import net.md_5.bungee.api.ServerPing;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class FMLPing extends ServerPing {
|
public class FMLPing extends ServerPing {
|
||||||
|
|
||||||
@ -43,44 +40,26 @@ public class FMLPing extends ServerPing {
|
|||||||
channels.add(new ForgeChannel("minecraft:unregister"));
|
channels.add(new ForgeChannel("minecraft:unregister"));
|
||||||
channels.add(new ForgeChannel("minecraft:register"));
|
channels.add(new ForgeChannel("minecraft:register"));
|
||||||
channels.add(new ForgeChannel("fml:handshake"));
|
channels.add(new ForgeChannel("fml:handshake"));
|
||||||
mods.add(new ForgeMod("minecraft", ProtocolVersion.getVersion(versionNumber).toString()));
|
mods.add(new ForgeMod("minecraft", ProtocolVersion.getVersion(versionNumber)));
|
||||||
mods.add(new ForgeMod("forge", "ANY"));
|
mods.add(new ForgeMod("forge", "ANY"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ProtocolVersion {
|
public final static class ProtocolVersion {
|
||||||
MINECRAFT_1_18(757),
|
|
||||||
MINECRAFT_1_17_1(756),
|
|
||||||
MINECRAFT_1_16_5(754),
|
|
||||||
MINECRAFT_1_15_2(578),
|
|
||||||
MINECRAFT_1_14_4(498),
|
|
||||||
MINECRAFT_1_13(393),
|
|
||||||
UNKNOWN(0);
|
|
||||||
|
|
||||||
private int number;
|
private static final HashMap<Integer, String> versions;
|
||||||
|
|
||||||
ProtocolVersion(int versionNumber) {
|
|
||||||
this.number = versionNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Map<Integer, ProtocolVersion> numbers;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
numbers = new LinkedHashMap<>();
|
versions = new HashMap();
|
||||||
for(ProtocolVersion version : values()) {
|
versions.put(757, "1.18");
|
||||||
numbers.put(version.number, version);
|
versions.put(756, "1.17.1");
|
||||||
}
|
versions.put(754, "1.16.5");
|
||||||
|
versions.put(578, "1.15.2");
|
||||||
|
versions.put(498, "1.14.1");
|
||||||
|
versions.put(393, "1.13");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProtocolVersion getVersion(int versionNumber) {
|
public static String getVersion(int version) {
|
||||||
ProtocolVersion protocolVersion = numbers.get(versionNumber);
|
return versions.get(version);
|
||||||
if (protocolVersion != null) {
|
|
||||||
return protocolVersion;
|
|
||||||
}
|
|
||||||
return UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return name().replace("MINECRAFT_", "").replace("_", ".");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren