mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 10:25:06 -04:00
remove some java warning, improve code
This commit is contained in:
parent
d5707abc30
commit
14d25bcbb7
@ -132,7 +132,7 @@ public class AssetsManager {
|
|||||||
|
|
||||||
private static void downloadAsset(AssetsSource source, String hash) throws Exception {
|
private static void downloadAsset(AssetsSource source, String hash) throws Exception {
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case MOJANG -> downloadAsset(String.format("https://resources.download.minecraft.net/%s/%s", hash.substring(0, 2), hash), hash);
|
case MOJANG -> downloadAsset(String.format(ProtocolDefinition.MOJANG_URL_RESOURCES, hash.substring(0, 2), hash), hash);
|
||||||
case MINOSOFT_GIT -> downloadAsset(String.format(Minosoft.getConfig().getString(ConfigurationPaths.StringPaths.RESOURCES_URL), hash.substring(0, 2), hash), hash, false);
|
case MINOSOFT_GIT -> downloadAsset(String.format(Minosoft.getConfig().getString(ConfigurationPaths.StringPaths.RESOURCES_URL), hash.substring(0, 2), hash), hash, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ public class AssetsManager {
|
|||||||
Log.verbose("client.jar assets probably already generated, skipping");
|
Log.verbose("client.jar assets probably already generated, skipping");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JsonObject manifest = HTTP.getJson("https://launchermeta.mojang.com/mc/game/version_manifest.json").getAsJsonObject();
|
JsonObject manifest = HTTP.getJson(ProtocolDefinition.MOJANG_URL_VERSION_MANIFEST).getAsJsonObject();
|
||||||
String assetsVersionJsonUrl = null;
|
String assetsVersionJsonUrl = null;
|
||||||
for (JsonElement versionElement : manifest.getAsJsonArray("versions")) {
|
for (JsonElement versionElement : manifest.getAsJsonArray("versions")) {
|
||||||
JsonObject version = versionElement.getAsJsonObject();
|
JsonObject version = versionElement.getAsJsonObject();
|
||||||
@ -205,7 +205,7 @@ public class AssetsManager {
|
|||||||
if (assetsVersionJsonUrl == null) {
|
if (assetsVersionJsonUrl == null) {
|
||||||
throw new RuntimeException(String.format("Invalid version manifest or invalid ASSETS_CLIENT_JAR_VERSION (%s)", ASSETS_CLIENT_JAR_VERSION));
|
throw new RuntimeException(String.format("Invalid version manifest or invalid ASSETS_CLIENT_JAR_VERSION (%s)", ASSETS_CLIENT_JAR_VERSION));
|
||||||
}
|
}
|
||||||
String versionJsonHash = assetsVersionJsonUrl.replace("https://launchermeta.mojang.com/v1/packages/", "").replace(String.format("/%s.json", ASSETS_CLIENT_JAR_VERSION), "");
|
String versionJsonHash = assetsVersionJsonUrl.replace(ProtocolDefinition.MOJANG_URL_PACKAGES, "").replace(String.format("/%s.json", ASSETS_CLIENT_JAR_VERSION), "");
|
||||||
downloadAsset(assetsVersionJsonUrl, versionJsonHash);
|
downloadAsset(assetsVersionJsonUrl, versionJsonHash);
|
||||||
// download jar
|
// download jar
|
||||||
JsonObject clientJarJson = readJsonAssetByHash(versionJsonHash).getAsJsonObject().getAsJsonObject("downloads").getAsJsonObject("client");
|
JsonObject clientJarJson = readJsonAssetByHash(versionJsonHash).getAsJsonObject().getAsJsonObject("downloads").getAsJsonObject("client");
|
||||||
|
@ -167,7 +167,7 @@ public class Slot {
|
|||||||
return this.item;
|
return this.item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@IntRange(from = 0, to = 64)
|
@IntRange(from = 0, to = ProtocolDefinition.ITEM_STACK_MAX_SIZE)
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return this.itemCount;
|
return this.itemCount;
|
||||||
}
|
}
|
||||||
|
@ -13,15 +13,16 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.modding.event.events;
|
package de.bixilon.minosoft.modding.event.events;
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.data.mappings.ModIdentifier;
|
||||||
import de.bixilon.minosoft.protocol.network.Connection;
|
import de.bixilon.minosoft.protocol.network.Connection;
|
||||||
import de.bixilon.minosoft.protocol.packets.clientbound.play.PacketPluginMessageReceiving;
|
import de.bixilon.minosoft.protocol.packets.clientbound.play.PacketPluginMessageReceiving;
|
||||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||||
|
|
||||||
public class PluginMessageReceiveEvent extends CancelableEvent {
|
public class PluginMessageReceiveEvent extends CancelableEvent {
|
||||||
private final String channel;
|
private final ModIdentifier channel;
|
||||||
private final InByteBuffer data;
|
private final InByteBuffer data;
|
||||||
|
|
||||||
public PluginMessageReceiveEvent(Connection connection, String channel, InByteBuffer data) {
|
public PluginMessageReceiveEvent(Connection connection, ModIdentifier channel, InByteBuffer data) {
|
||||||
super(connection);
|
super(connection);
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
@ -33,7 +34,7 @@ public class PluginMessageReceiveEvent extends CancelableEvent {
|
|||||||
this.data = pkg.getDataAsBuffer();
|
this.data = pkg.getDataAsBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getChannel() {
|
public ModIdentifier getChannel() {
|
||||||
return this.channel;
|
return this.channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ public class ModLoader {
|
|||||||
ZipFile zipFile = new ZipFile(file);
|
ZipFile zipFile = new ZipFile(file);
|
||||||
ModInfo modInfo = new ModInfo(Util.readJsonFromZip("mod.json", zipFile));
|
ModInfo modInfo = new ModInfo(Util.readJsonFromZip("mod.json", zipFile));
|
||||||
if (isModLoaded(modInfo)) {
|
if (isModLoaded(modInfo)) {
|
||||||
Log.warn(String.format("Mod %s:%d (uuid=%s) is loaded multiple times! Skipping", modInfo.getName(), modInfo.getVersionId(), modInfo.getUUID()));
|
Log.warn(String.format("Mod %s:%d (uuid=%s) is loaded multiple times! Skipping", modInfo.getName(), modInfo.getModIdentifier().getVersionId(), modInfo.getModIdentifier().getUUID()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
JarClassLoader jcl = new JarClassLoader();
|
JarClassLoader jcl = new JarClassLoader();
|
||||||
|
@ -318,10 +318,8 @@ public class Connection {
|
|||||||
// after sending it, switch to next state
|
// after sending it, switch to next state
|
||||||
setConnectionState(next);
|
setConnectionState(next);
|
||||||
}
|
}
|
||||||
case STATUS -> {
|
case STATUS -> // send status request
|
||||||
// send status request
|
|
||||||
this.network.sendPacket(new PacketStatusRequest());
|
this.network.sendPacket(new PacketStatusRequest());
|
||||||
}
|
|
||||||
case LOGIN -> this.network.sendPacket(new PacketLoginStart(this.player));
|
case LOGIN -> this.network.sendPacket(new PacketLoginStart(this.player));
|
||||||
case DISCONNECTED -> {
|
case DISCONNECTED -> {
|
||||||
if (this.reason == ConnectionReasons.GET_VERSION) {
|
if (this.reason == ConnectionReasons.GET_VERSION) {
|
||||||
|
@ -26,8 +26,6 @@ import de.bixilon.minosoft.protocol.protocol.*;
|
|||||||
import de.bixilon.minosoft.util.ServerAddress;
|
import de.bixilon.minosoft.util.ServerAddress;
|
||||||
import de.bixilon.minosoft.util.Util;
|
import de.bixilon.minosoft.util.Util;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public abstract class Network {
|
public abstract class Network {
|
||||||
protected final Connection connection;
|
protected final Connection connection;
|
||||||
protected int compressionThreshold = -1;
|
protected int compressionThreshold = -1;
|
||||||
@ -52,7 +50,7 @@ public abstract class Network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected ClientboundPacket receiveClientboundPacket(byte[] bytes) throws IOException, PacketParseException {
|
protected ClientboundPacket receiveClientboundPacket(byte[] bytes) throws PacketParseException {
|
||||||
if (this.compressionThreshold >= 0) {
|
if (this.compressionThreshold >= 0) {
|
||||||
// compression is enabled
|
// compression is enabled
|
||||||
InByteBuffer rawData = new InByteBuffer(bytes, this.connection);
|
InByteBuffer rawData = new InByteBuffer(bytes, this.connection);
|
||||||
|
@ -15,6 +15,7 @@ package de.bixilon.minosoft.protocol.packets.clientbound.play;
|
|||||||
|
|
||||||
import de.bixilon.minosoft.Minosoft;
|
import de.bixilon.minosoft.Minosoft;
|
||||||
import de.bixilon.minosoft.config.ConfigurationPaths;
|
import de.bixilon.minosoft.config.ConfigurationPaths;
|
||||||
|
import de.bixilon.minosoft.data.mappings.ModIdentifier;
|
||||||
import de.bixilon.minosoft.logging.Log;
|
import de.bixilon.minosoft.logging.Log;
|
||||||
import de.bixilon.minosoft.modding.channels.DefaultPluginChannels;
|
import de.bixilon.minosoft.modding.channels.DefaultPluginChannels;
|
||||||
import de.bixilon.minosoft.modding.event.events.PluginMessageReceiveEvent;
|
import de.bixilon.minosoft.modding.event.events.PluginMessageReceiveEvent;
|
||||||
@ -27,14 +28,14 @@ import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_14W29A;
|
|||||||
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_14W31A;
|
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_14W31A;
|
||||||
|
|
||||||
public class PacketPluginMessageReceiving extends ClientboundPacket {
|
public class PacketPluginMessageReceiving extends ClientboundPacket {
|
||||||
String channel;
|
ModIdentifier channel;
|
||||||
byte[] data;
|
byte[] data;
|
||||||
Connection connection;
|
Connection connection;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean read(InByteBuffer buffer) {
|
public boolean read(InByteBuffer buffer) {
|
||||||
this.connection = buffer.getConnection();
|
this.connection = buffer.getConnection();
|
||||||
this.channel = buffer.readString();
|
this.channel = buffer.readIdentifier();
|
||||||
// "read" length prefix
|
// "read" length prefix
|
||||||
if (buffer.getVersionId() < V_14W29A) {
|
if (buffer.getVersionId() < V_14W29A) {
|
||||||
buffer.readShort();
|
buffer.readShort();
|
||||||
@ -84,7 +85,7 @@ public class PacketPluginMessageReceiving extends ClientboundPacket {
|
|||||||
Log.protocol(String.format("[IN] Plugin message received in channel \"%s\" with %s bytes of data", this.channel, this.data.length));
|
Log.protocol(String.format("[IN] Plugin message received in channel \"%s\" with %s bytes of data", this.channel, this.data.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getChannel() {
|
public ModIdentifier getChannel() {
|
||||||
return this.channel;
|
return this.channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,13 +19,14 @@ import de.bixilon.minosoft.logging.Log;
|
|||||||
import de.bixilon.minosoft.protocol.network.Connection;
|
import de.bixilon.minosoft.protocol.network.Connection;
|
||||||
import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
|
import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
|
||||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition;
|
||||||
import de.bixilon.minosoft.util.nbt.tag.CompoundTag;
|
import de.bixilon.minosoft.util.nbt.tag.CompoundTag;
|
||||||
import de.bixilon.minosoft.util.nbt.tag.StringTag;
|
import de.bixilon.minosoft.util.nbt.tag.StringTag;
|
||||||
|
|
||||||
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_14W04A;
|
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_14W04A;
|
||||||
|
|
||||||
public class PacketUpdateSignReceiving extends ClientboundPacket {
|
public class PacketUpdateSignReceiving extends ClientboundPacket {
|
||||||
final ChatComponent[] lines = new ChatComponent[4];
|
final ChatComponent[] lines = new ChatComponent[ProtocolDefinition.SIGN_LINES];
|
||||||
BlockPosition position;
|
BlockPosition position;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -35,7 +36,7 @@ public class PacketUpdateSignReceiving extends ClientboundPacket {
|
|||||||
} else {
|
} else {
|
||||||
this.position = buffer.readPosition();
|
this.position = buffer.readPosition();
|
||||||
}
|
}
|
||||||
for (byte i = 0; i < 4; i++) {
|
for (byte i = 0; i < ProtocolDefinition.SIGN_LINES; i++) {
|
||||||
this.lines[i] = buffer.readChatComponent();
|
this.lines[i] = buffer.readChatComponent();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -46,7 +47,7 @@ public class PacketUpdateSignReceiving extends ClientboundPacket {
|
|||||||
CompoundTag nbt = new CompoundTag();
|
CompoundTag nbt = new CompoundTag();
|
||||||
nbt.writeBlockPosition(getPosition());
|
nbt.writeBlockPosition(getPosition());
|
||||||
nbt.writeTag("id", new StringTag("minecraft:sign"));
|
nbt.writeTag("id", new StringTag("minecraft:sign"));
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < ProtocolDefinition.SIGN_LINES; i++) {
|
||||||
nbt.writeTag(String.format("Text%d", (i + 1)), new StringTag(getLines()[i].getLegacyText()));
|
nbt.writeTag(String.format("Text%d", (i + 1)), new StringTag(getLines()[i].getLegacyText()));
|
||||||
}
|
}
|
||||||
// ToDo: handle sign updates
|
// ToDo: handle sign updates
|
||||||
|
@ -24,8 +24,8 @@ import de.bixilon.minosoft.protocol.protocol.Packets;
|
|||||||
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_14W06B;
|
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.V_14W06B;
|
||||||
|
|
||||||
public class PacketPlayerPositionAndRotationSending implements ServerboundPacket {
|
public class PacketPlayerPositionAndRotationSending implements ServerboundPacket {
|
||||||
Location location;
|
final Location location;
|
||||||
EntityRotation rotation;
|
final EntityRotation rotation;
|
||||||
final boolean onGround;
|
final boolean onGround;
|
||||||
|
|
||||||
public PacketPlayerPositionAndRotationSending(Location location, EntityRotation rotation, boolean onGround) {
|
public PacketPlayerPositionAndRotationSending(Location location, EntityRotation rotation, boolean onGround) {
|
||||||
|
@ -20,6 +20,7 @@ import de.bixilon.minosoft.protocol.network.Connection;
|
|||||||
import de.bixilon.minosoft.protocol.packets.ServerboundPacket;
|
import de.bixilon.minosoft.protocol.packets.ServerboundPacket;
|
||||||
import de.bixilon.minosoft.protocol.protocol.OutPacketBuffer;
|
import de.bixilon.minosoft.protocol.protocol.OutPacketBuffer;
|
||||||
import de.bixilon.minosoft.protocol.protocol.Packets;
|
import de.bixilon.minosoft.protocol.protocol.Packets;
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition;
|
||||||
|
|
||||||
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.*;
|
import static de.bixilon.minosoft.protocol.protocol.ProtocolVersions.*;
|
||||||
|
|
||||||
@ -41,11 +42,11 @@ public class PacketUpdateSignSending implements ServerboundPacket {
|
|||||||
buffer.writePosition(this.position);
|
buffer.writePosition(this.position);
|
||||||
}
|
}
|
||||||
if (buffer.getVersionId() < V_14W25A || buffer.getVersionId() >= V_15W35A) {
|
if (buffer.getVersionId() < V_14W25A || buffer.getVersionId() >= V_15W35A) {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < ProtocolDefinition.SIGN_LINES; i++) {
|
||||||
buffer.writeString(this.lines[i].getMessage());
|
buffer.writeString(this.lines[i].getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < ProtocolDefinition.SIGN_LINES; i++) {
|
||||||
buffer.writeChatComponent(this.lines[i]);
|
buffer.writeChatComponent(this.lines[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,18 @@ public final class ProtocolDefinition {
|
|||||||
public static final int SECTIONS_PER_CHUNK = 16;
|
public static final int SECTIONS_PER_CHUNK = 16;
|
||||||
public static final int BLOCKS_PER_SECTION = SECTION_WIDTH_X * SECTION_HEIGHT_Y * SECTION_WIDTH_X;
|
public static final int BLOCKS_PER_SECTION = SECTION_WIDTH_X * SECTION_HEIGHT_Y * SECTION_WIDTH_X;
|
||||||
|
|
||||||
|
public static final int SIGN_LINES = 4;
|
||||||
|
public static final int ITEM_STACK_MAX_SIZE = 64;
|
||||||
|
|
||||||
|
|
||||||
|
public static final String MOJANG_URL_VERSION_MANIFEST = "https://launchermeta.mojang.com/mc/game/version_manifest.json";
|
||||||
|
public static final String MOJANG_URL_RESOURCES = "https://resources.download.minecraft.net/%s/%s";
|
||||||
|
public static final String MOJANG_URL_PACKAGES = "https://launchermeta.mojang.com/v1/packages/";
|
||||||
|
|
||||||
|
public static final String MOJANG_URL_BLOCKED_SERVERS = "https://sessionserver.mojang.com/blockedservers";
|
||||||
|
public static final String MOJANG_URL_LOGIN = "https://authserver.mojang.com/authenticate";
|
||||||
|
public static final String MOJANG_URL_JOIN = "https://sessionserver.mojang.com/session/minecraft/join";
|
||||||
|
public static final String MOJANG_URL_REFRESH = "https://authserver.mojang.com/refresh";
|
||||||
|
|
||||||
public static final char[] OBFUSCATED_CHARS = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~".toCharArray();
|
public static final char[] OBFUSCATED_CHARS = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~".toCharArray();
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import de.bixilon.minosoft.Minosoft;
|
|||||||
import de.bixilon.minosoft.config.ConfigurationPaths;
|
import de.bixilon.minosoft.config.ConfigurationPaths;
|
||||||
import de.bixilon.minosoft.config.StaticConfiguration;
|
import de.bixilon.minosoft.config.StaticConfiguration;
|
||||||
import de.bixilon.minosoft.logging.Log;
|
import de.bixilon.minosoft.logging.Log;
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition;
|
||||||
import de.bixilon.minosoft.util.HTTP;
|
import de.bixilon.minosoft.util.HTTP;
|
||||||
|
|
||||||
import java.net.http.HttpResponse;
|
import java.net.http.HttpResponse;
|
||||||
@ -41,7 +42,7 @@ public final class MojangAuthentication {
|
|||||||
payload.addProperty("clientToken", clientToken);
|
payload.addProperty("clientToken", clientToken);
|
||||||
payload.addProperty("requestUser", true);
|
payload.addProperty("requestUser", true);
|
||||||
|
|
||||||
HttpResponse<String> response = HTTP.postJson(MojangURLs.LOGIN.getUrl(), payload);
|
HttpResponse<String> response = HTTP.postJson(ProtocolDefinition.MOJANG_URL_LOGIN, payload);
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
Log.mojang(String.format("Failed to login with username %s", username));
|
Log.mojang(String.format("Failed to login with username %s", username));
|
||||||
return new MojangAccountAuthenticationAttempt("Unknown error, check your Internet connection");
|
return new MojangAccountAuthenticationAttempt("Unknown error, check your Internet connection");
|
||||||
@ -65,7 +66,7 @@ public final class MojangAuthentication {
|
|||||||
payload.addProperty("selectedProfile", account.getUUID().toString().replace("-", ""));
|
payload.addProperty("selectedProfile", account.getUUID().toString().replace("-", ""));
|
||||||
payload.addProperty("serverId", serverId);
|
payload.addProperty("serverId", serverId);
|
||||||
|
|
||||||
HttpResponse<String> response = HTTP.postJson(MojangURLs.JOIN.toString(), payload);
|
HttpResponse<String> response = HTTP.postJson(ProtocolDefinition.MOJANG_URL_JOIN, payload);
|
||||||
|
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
Log.mojang(String.format("Failed to join server: %s", serverId));
|
Log.mojang(String.format("Failed to join server: %s", serverId));
|
||||||
@ -94,7 +95,7 @@ public final class MojangAuthentication {
|
|||||||
|
|
||||||
HttpResponse<String> response;
|
HttpResponse<String> response;
|
||||||
try {
|
try {
|
||||||
response = HTTP.postJson(MojangURLs.REFRESH.getUrl(), payload);
|
response = HTTP.postJson(ProtocolDefinition.MOJANG_URL_REFRESH, payload);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.mojang(String.format("Could not connect to mojang server: %s", e.getCause().toString()));
|
Log.mojang(String.format("Could not connect to mojang server: %s", e.getCause().toString()));
|
||||||
return null;
|
return null;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
package de.bixilon.minosoft.util.mojang.api;
|
package de.bixilon.minosoft.util.mojang.api;
|
||||||
|
|
||||||
import de.bixilon.minosoft.logging.Log;
|
import de.bixilon.minosoft.logging.Log;
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition;
|
||||||
import de.bixilon.minosoft.util.HTTP;
|
import de.bixilon.minosoft.util.HTTP;
|
||||||
import de.bixilon.minosoft.util.Util;
|
import de.bixilon.minosoft.util.Util;
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ import java.util.List;
|
|||||||
public final class MojangBlockedServers {
|
public final class MojangBlockedServers {
|
||||||
|
|
||||||
public static ArrayList<String> getBlockedServers() {
|
public static ArrayList<String> getBlockedServers() {
|
||||||
HttpResponse<String> response = HTTP.get(MojangURLs.BLOCKED_SERVERS.getUrl());
|
HttpResponse<String> response = HTTP.get(ProtocolDefinition.MOJANG_URL_BLOCKED_SERVERS);
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
Log.mojang("Failed to fetch blocked servers");
|
Log.mojang("Failed to fetch blocked servers");
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Minosoft
|
|
||||||
* Copyright (C) 2020 Moritz Zwerger
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with this program.If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.bixilon.minosoft.util.mojang.api;
|
|
||||||
|
|
||||||
public enum MojangURLs {
|
|
||||||
BLOCKED_SERVERS("https://sessionserver.mojang.com/blockedservers"),
|
|
||||||
LOGIN("https://authserver.mojang.com/authenticate"),
|
|
||||||
JOIN("https://sessionserver.mojang.com/session/minecraft/join"),
|
|
||||||
REFRESH("https://authserver.mojang.com/refresh");
|
|
||||||
|
|
||||||
final String url;
|
|
||||||
|
|
||||||
MojangURLs(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return this.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.url;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user