mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
Merge branch 'development' into render
This commit is contained in:
commit
687410bc31
@ -31,10 +31,10 @@ Minosoft is an open source minecraft client, written from scratch in java. It ai
|
||||
## Rendering
|
||||
Rendering is developed and maintained by Lukas Eisenhauer. It is very WIP, but it works. See !8 for more details.
|
||||
|
||||

|
||||

|
||||
The current result of rendering (taken in 739f861bf62341698abcd58386c353a4831f4818).
|
||||
|
||||

|
||||

|
||||
The Hypixel prototype lobby (taken in 91ab431004fa1ae132a1eb1115550f84c27f48f8).
|
||||
|
||||
## Launcher
|
||||
|
@ -52,9 +52,6 @@ public final class Minosoft {
|
||||
public static Configuration config;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// init log thread
|
||||
Log.initThread();
|
||||
|
||||
Log.info("Starting...");
|
||||
AsyncTaskWorker taskWorker = new AsyncTaskWorker("StartUp");
|
||||
|
||||
@ -109,9 +106,9 @@ public final class Minosoft {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
Log.info(String.format("Loaded config file (version=%s)", config.getInt(ConfigurationPaths.CONFIG_VERSION)));
|
||||
Log.info(String.format("Loaded config file (version=%s)", config.getInt(ConfigurationPaths.IntegerPaths.GENERAL_CONFIG_VERSION)));
|
||||
// set log level from config
|
||||
Log.setLevel(LogLevels.valueOf(config.getString(ConfigurationPaths.GENERAL_LOG_LEVEL)));
|
||||
Log.setLevel(LogLevels.valueOf(config.getString(ConfigurationPaths.StringPaths.GENERAL_LOG_LEVEL)));
|
||||
Log.info(String.format("Logging info with level: %s", Log.getLevel()));
|
||||
|
||||
serverList = config.getServers();
|
||||
@ -124,7 +121,7 @@ public final class Minosoft {
|
||||
|
||||
taskWorker.addTask(new Task(progress -> {
|
||||
progress.countUp();
|
||||
LocaleManager.load(config.getString(ConfigurationPaths.GENERAL_LANGUAGE));
|
||||
LocaleManager.load(config.getString(ConfigurationPaths.StringPaths.GENERAL_LANGUAGE));
|
||||
progress.countDown();
|
||||
}, "Minosoft Language", "Load minosoft language files", Priorities.HIGH, TaskImportance.REQUIRED, "Configuration"));
|
||||
|
||||
@ -141,7 +138,7 @@ public final class Minosoft {
|
||||
Log.debug("Refreshing account token...");
|
||||
checkClientToken();
|
||||
accountList = config.getMojangAccounts();
|
||||
selectAccount(accountList.get(config.getString(ConfigurationPaths.ACCOUNT_SELECTED)));
|
||||
selectAccount(accountList.get(config.getString(ConfigurationPaths.StringPaths.ACCOUNT_SELECTED)));
|
||||
}, "Token refresh", "Refresh selected account token", Priorities.LOW, TaskImportance.OPTIONAL, "Configuration"));
|
||||
|
||||
taskWorker.addTask(new Task(progress -> {
|
||||
@ -158,7 +155,7 @@ public final class Minosoft {
|
||||
|
||||
taskWorker.addTask(new Task(progress -> {
|
||||
progress.countUp();
|
||||
MinecraftLocaleManager.load(config.getString(ConfigurationPaths.GENERAL_LANGUAGE));
|
||||
MinecraftLocaleManager.load(config.getString(ConfigurationPaths.StringPaths.GENERAL_LANGUAGE));
|
||||
progress.countDown();
|
||||
}, "Mojang language", "Load minecraft language files", Priorities.HIGH, TaskImportance.REQUIRED, "Assets"));
|
||||
|
||||
@ -179,8 +176,8 @@ public final class Minosoft {
|
||||
}
|
||||
|
||||
public static void checkClientToken() {
|
||||
if (config.getString(ConfigurationPaths.CLIENT_TOKEN).isBlank()) {
|
||||
config.putString(ConfigurationPaths.CLIENT_TOKEN, UUID.randomUUID().toString());
|
||||
if (config.getString(ConfigurationPaths.StringPaths.CLIENT_TOKEN).isBlank()) {
|
||||
config.putString(ConfigurationPaths.StringPaths.CLIENT_TOKEN, UUID.randomUUID().toString());
|
||||
config.saveToFile();
|
||||
}
|
||||
}
|
||||
@ -188,7 +185,7 @@ public final class Minosoft {
|
||||
public static void selectAccount(MojangAccount account) {
|
||||
if (account == null) {
|
||||
selectedAccount = null;
|
||||
config.putString(ConfigurationPaths.ACCOUNT_SELECTED, "");
|
||||
config.putString(ConfigurationPaths.StringPaths.ACCOUNT_SELECTED, "");
|
||||
config.saveToFile();
|
||||
return;
|
||||
}
|
||||
@ -200,7 +197,7 @@ public final class Minosoft {
|
||||
selectedAccount = null;
|
||||
return;
|
||||
}
|
||||
config.putString(ConfigurationPaths.ACCOUNT_SELECTED, account.getUserId());
|
||||
config.putString(ConfigurationPaths.StringPaths.ACCOUNT_SELECTED, account.getUserId());
|
||||
selectedAccount = account;
|
||||
MainWindow.selectAccount();
|
||||
account.saveToConfig();
|
||||
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.config;
|
||||
|
||||
public class ConfigMigrationException extends Exception {
|
||||
public ConfigMigrationException() {
|
||||
}
|
||||
|
||||
public ConfigMigrationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ConfigMigrationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ConfigMigrationException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public ConfigMigrationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ public class Configuration {
|
||||
final JsonObject config;
|
||||
private final Object lock = new Object();
|
||||
|
||||
public Configuration() throws IOException {
|
||||
public Configuration() throws IOException, ConfigMigrationException {
|
||||
File file = new File(StaticConfiguration.HOME_DIR + "config/" + StaticConfiguration.CONFIG_FILENAME);
|
||||
if (!file.exists()) {
|
||||
// no configuration file
|
||||
@ -48,9 +48,9 @@ public class Configuration {
|
||||
file = new File(StaticConfiguration.HOME_DIR + "config/" + StaticConfiguration.CONFIG_FILENAME);
|
||||
}
|
||||
config = Util.readJsonFromFile(file.getAbsolutePath());
|
||||
int configVersion = getInt(ConfigurationPaths.CONFIG_VERSION);
|
||||
int configVersion = getInt(ConfigurationPaths.IntegerPaths.GENERAL_CONFIG_VERSION);
|
||||
if (configVersion > LATEST_CONFIG_VERSION) {
|
||||
throw new RuntimeException(String.format("Configuration was migrated to newer config format (version=%d, expected=%d). Downgrading the config file is unsupported!", configVersion, LATEST_CONFIG_VERSION));
|
||||
throw new ConfigMigrationException(String.format("Configuration was migrated to newer config format (version=%d, expected=%d). Downgrading the config file is unsupported!", configVersion, LATEST_CONFIG_VERSION));
|
||||
}
|
||||
if (configVersion < LATEST_CONFIG_VERSION) {
|
||||
migrateConfiguration();
|
||||
@ -96,57 +96,51 @@ public class Configuration {
|
||||
}, "IO").start();
|
||||
}
|
||||
|
||||
public boolean getBoolean(ConfigurationPaths path) {
|
||||
public boolean getBoolean(ConfigurationPaths.BooleanPaths path) {
|
||||
return switch (path) {
|
||||
case NETWORK_FAKE_CLIENT_BRAND -> config.getAsJsonObject("network").get("fake-network-brand").getAsBoolean();
|
||||
case DEBUG_VERIFY_ASSETS -> config.getAsJsonObject("debug").get("verify-assets").getAsBoolean();
|
||||
default -> throw new RuntimeException(String.format("Illegal boolean value: %s", path));
|
||||
};
|
||||
}
|
||||
|
||||
public void putBoolean(ConfigurationPaths path, boolean value) {
|
||||
public void putBoolean(ConfigurationPaths.BooleanPaths path, boolean value) {
|
||||
switch (path) {
|
||||
case NETWORK_FAKE_CLIENT_BRAND -> config.getAsJsonObject("network").addProperty("fake-network-brand", value);
|
||||
case DEBUG_VERIFY_ASSETS -> config.getAsJsonObject("debug").addProperty("verify-assets", value);
|
||||
default -> throw new RuntimeException(String.format("Illegal boolean value: %s", path));
|
||||
}
|
||||
}
|
||||
|
||||
public int getInt(ConfigurationPaths path) {
|
||||
public int getInt(ConfigurationPaths.IntegerPaths path) {
|
||||
return switch (path) {
|
||||
case CONFIG_VERSION -> config.getAsJsonObject("general").get("version").getAsInt();
|
||||
case GENERAL_CONFIG_VERSION -> config.getAsJsonObject("general").get("version").getAsInt();
|
||||
case GAME_RENDER_DISTANCE -> config.getAsJsonObject("game").get("render-distance").getAsInt();
|
||||
default -> throw new RuntimeException(String.format("Illegal int value: %s", path));
|
||||
};
|
||||
}
|
||||
|
||||
public void putInt(ConfigurationPaths path, int value) {
|
||||
public void putInt(ConfigurationPaths.IntegerPaths path, int value) {
|
||||
switch (path) {
|
||||
case CONFIG_VERSION -> config.getAsJsonObject("general").addProperty("version", value);
|
||||
case GENERAL_CONFIG_VERSION -> config.getAsJsonObject("general").addProperty("version", value);
|
||||
case GAME_RENDER_DISTANCE -> config.getAsJsonObject("game").addProperty("render-distance", value);
|
||||
default -> throw new RuntimeException(String.format("Illegal int value: %s", path));
|
||||
}
|
||||
}
|
||||
|
||||
public String getString(ConfigurationPaths path) {
|
||||
public String getString(ConfigurationPaths.StringPaths path) {
|
||||
return switch (path) {
|
||||
case ACCOUNT_SELECTED -> config.getAsJsonObject("accounts").get("selected").getAsString();
|
||||
case GENERAL_LOG_LEVEL -> config.getAsJsonObject("general").get("log-level").getAsString();
|
||||
case GENERAL_LANGUAGE -> config.getAsJsonObject("general").get("language").getAsString();
|
||||
case MAPPINGS_URL -> config.getAsJsonObject("download").getAsJsonObject("urls").get("mappings").getAsString();
|
||||
case CLIENT_TOKEN -> config.getAsJsonObject("accounts").get("client-token").getAsString();
|
||||
default -> throw new RuntimeException(String.format("Illegal String value: %s", path));
|
||||
};
|
||||
}
|
||||
|
||||
public void putString(ConfigurationPaths path, String value) {
|
||||
public void putString(ConfigurationPaths.StringPaths path, String value) {
|
||||
switch (path) {
|
||||
case ACCOUNT_SELECTED -> config.getAsJsonObject("accounts").addProperty("selected", value);
|
||||
case GENERAL_LOG_LEVEL -> config.getAsJsonObject("general").addProperty("log-level", value);
|
||||
case GENERAL_LANGUAGE -> config.getAsJsonObject("general").addProperty("language", value);
|
||||
case MAPPINGS_URL -> config.getAsJsonObject("download").getAsJsonObject("urls").addProperty("mappings", value);
|
||||
case CLIENT_TOKEN -> config.getAsJsonObject("accounts").addProperty("client-token", value);
|
||||
default -> throw new RuntimeException(String.format("Illegal String value: %s", path));
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,12 +188,12 @@ public class Configuration {
|
||||
}
|
||||
|
||||
private void migrateConfiguration() {
|
||||
int configVersion = getInt(ConfigurationPaths.CONFIG_VERSION);
|
||||
int configVersion = getInt(ConfigurationPaths.IntegerPaths.GENERAL_CONFIG_VERSION);
|
||||
Log.info(String.format("Migrating config from version %d to %d", configVersion, LATEST_CONFIG_VERSION));
|
||||
for (int nextVersion = configVersion + 1; nextVersion <= LATEST_CONFIG_VERSION; nextVersion++) {
|
||||
migrateConfiguration(nextVersion);
|
||||
}
|
||||
putInt(ConfigurationPaths.CONFIG_VERSION, LATEST_CONFIG_VERSION);
|
||||
putInt(ConfigurationPaths.IntegerPaths.GENERAL_CONFIG_VERSION, LATEST_CONFIG_VERSION);
|
||||
saveToFile();
|
||||
Log.info("Finished migrating config!");
|
||||
|
||||
|
@ -13,14 +13,21 @@
|
||||
|
||||
package de.bixilon.minosoft.config;
|
||||
|
||||
public enum ConfigurationPaths {
|
||||
CONFIG_VERSION,
|
||||
GAME_RENDER_DISTANCE,
|
||||
NETWORK_FAKE_CLIENT_BRAND,
|
||||
GENERAL_LOG_LEVEL,
|
||||
CLIENT_TOKEN,
|
||||
MAPPINGS_URL,
|
||||
ACCOUNT_SELECTED,
|
||||
GENERAL_LANGUAGE,
|
||||
DEBUG_VERIFY_ASSETS,
|
||||
public abstract class ConfigurationPaths {
|
||||
public enum StringPaths {
|
||||
GENERAL_LOG_LEVEL,
|
||||
CLIENT_TOKEN,
|
||||
MAPPINGS_URL,
|
||||
ACCOUNT_SELECTED,
|
||||
GENERAL_LANGUAGE,
|
||||
}
|
||||
|
||||
public enum BooleanPaths {
|
||||
NETWORK_FAKE_CLIENT_BRAND, DEBUG_VERIFY_ASSETS
|
||||
}
|
||||
|
||||
public enum IntegerPaths {
|
||||
GENERAL_CONFIG_VERSION,
|
||||
GAME_RENDER_DISTANCE
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public class AssetsManager {
|
||||
if (getAssetSize(hash) == -1) {
|
||||
return false;
|
||||
}
|
||||
if (!Minosoft.config.getBoolean(ConfigurationPaths.DEBUG_VERIFY_ASSETS)) {
|
||||
if (!Minosoft.config.getBoolean(ConfigurationPaths.BooleanPaths.DEBUG_VERIFY_ASSETS)) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.data.mappings;
|
||||
|
||||
public class MappingsLoadingException extends Exception {
|
||||
public MappingsLoadingException() {
|
||||
}
|
||||
|
||||
public MappingsLoadingException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public MappingsLoadingException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public MappingsLoadingException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public MappingsLoadingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -145,7 +145,7 @@ public class Versions {
|
||||
} catch (FileNotFoundException e) {
|
||||
long downloadStartTime = System.currentTimeMillis();
|
||||
Log.info(String.format("Mappings for %s are not available on disk. Downloading them...", version.getVersionName()));
|
||||
Util.downloadFile(String.format(Minosoft.getConfig().getString(ConfigurationPaths.MAPPINGS_URL), version.getVersionName()), fileName);
|
||||
Util.downloadFile(String.format(Minosoft.getConfig().getString(ConfigurationPaths.StringPaths.MAPPINGS_URL), version.getVersionName()), fileName);
|
||||
try {
|
||||
files = Util.readJsonTarGzFile(fileName);
|
||||
} catch (ZipException e2) {
|
||||
|
@ -187,10 +187,9 @@ public class ServerListCell extends ListCell<Server> implements Initializable {
|
||||
version.setStyle("-fx-text-fill: red;");
|
||||
optionsConnect.setDisable(true);
|
||||
canConnect = false;
|
||||
setErrorMotd(String.format("%s", server.getLastPing().getLastConnectionException().getLocalizedMessage()));
|
||||
setErrorMotd(String.format("%s: %s", server.getLastPing().getLastConnectionException().getClass().getCanonicalName(), server.getLastPing().getLastConnectionException().getLocalizedMessage()));
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +45,7 @@ public class SettingsWindow implements Initializable {
|
||||
return;
|
||||
}
|
||||
Log.setLevel(newLevel);
|
||||
Minosoft.getConfig().putString(ConfigurationPaths.GENERAL_LOG_LEVEL, newLevel.name());
|
||||
Minosoft.getConfig().putString(ConfigurationPaths.StringPaths.GENERAL_LOG_LEVEL, newLevel.name());
|
||||
Minosoft.getConfig().saveToFile();
|
||||
}));
|
||||
|
||||
|
@ -24,10 +24,10 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
public class Log {
|
||||
final static SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
final static LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<>();
|
||||
final static long startTime = System.currentTimeMillis();
|
||||
public final static long MINOSOFT_START_TIME = System.currentTimeMillis();
|
||||
static LogLevels level = LogLevels.PROTOCOL;
|
||||
|
||||
public static void initThread() {
|
||||
static {
|
||||
new Thread(() -> {
|
||||
while (true) {
|
||||
// something to print
|
||||
@ -69,7 +69,7 @@ public class Log {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("[");
|
||||
if (StaticConfiguration.LOG_RELATIVE_TIME) {
|
||||
builder.append(System.currentTimeMillis() - startTime);
|
||||
builder.append(System.currentTimeMillis() - MINOSOFT_START_TIME);
|
||||
} else {
|
||||
builder.append(timeFormat.format(System.currentTimeMillis()));
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import de.bixilon.minosoft.Minosoft;
|
||||
import de.bixilon.minosoft.data.Player;
|
||||
import de.bixilon.minosoft.data.VelocityHandler;
|
||||
import de.bixilon.minosoft.data.mappings.CustomMapping;
|
||||
import de.bixilon.minosoft.data.mappings.MappingsLoadingException;
|
||||
import de.bixilon.minosoft.data.mappings.recipes.Recipes;
|
||||
import de.bixilon.minosoft.data.mappings.versions.Version;
|
||||
import de.bixilon.minosoft.data.mappings.versions.Versions;
|
||||
@ -163,7 +164,7 @@ public class Connection {
|
||||
} catch (IOException e) {
|
||||
Log.printException(e, LogLevels.DEBUG);
|
||||
Log.fatal(String.format("Could not load mapping for %s. This version seems to be unsupported!", version));
|
||||
lastException = new RuntimeException(String.format("Mappings could not be loaded: %s", e.getLocalizedMessage()));
|
||||
lastException = new MappingsLoadingException("Mappings could not be loaded", e);
|
||||
setConnectionState(ConnectionStates.FAILED_NO_RETRY);
|
||||
}
|
||||
}
|
||||
|
@ -192,24 +192,20 @@ public class SocketNetwork implements Network {
|
||||
try {
|
||||
packet = connection.getPacketByCommand(connection.getConnectionState(), inPacketBuffer.getCommand());
|
||||
if (packet == null) {
|
||||
Log.fatal(String.format("Packet mapping does not contain a packet with id 0x%x. The server sends bullshit or your versions.json broken!", inPacketBuffer.getCommand()));
|
||||
disconnect();
|
||||
lastException = new RuntimeException(String.format("Invalid packet 0x%x", inPacketBuffer.getCommand()));
|
||||
lastException = new UnknownPacketException(String.format("Invalid packet 0x%x", inPacketBuffer.getCommand()));
|
||||
throw lastException;
|
||||
}
|
||||
Class<? extends ClientboundPacket> clazz = packet.getClazz();
|
||||
|
||||
if (clazz == null) {
|
||||
Log.warn(String.format("[IN] Received unknown packet (id=0x%x, name=%s, length=%d, dataLength=%d, version=%s, state=%s)", inPacketBuffer.getCommand(), packet, inPacketBuffer.getLength(), inPacketBuffer.getBytesLeft(), connection.getVersion(), connection.getConnectionState()));
|
||||
continue;
|
||||
throw new UnknownPacketException(String.format("Unknown packet (id=0x%x, name=%s, length=%d, dataLength=%d, version=%s, state=%s)", inPacketBuffer.getCommand(), packet, inPacketBuffer.getLength(), inPacketBuffer.getBytesLeft(), connection.getVersion(), connection.getConnectionState()));
|
||||
}
|
||||
try {
|
||||
ClientboundPacket packetInstance = clazz.getConstructor().newInstance();
|
||||
boolean success = packetInstance.read(inPacketBuffer);
|
||||
if (inPacketBuffer.getBytesLeft() > 0 || !success) {
|
||||
// warn not all data used
|
||||
Log.warn(String.format("[IN] Could not parse packet %s (used=%d, available=%d, total=%d, success=%s)", packet, inPacketBuffer.getPosition(), inPacketBuffer.getBytesLeft(), inPacketBuffer.getLength(), success));
|
||||
continue;
|
||||
throw new PacketParseException(String.format("Could not parse packet %s (used=%d, available=%d, total=%d, success=%s)", packet, inPacketBuffer.getPosition(), inPacketBuffer.getBytesLeft(), inPacketBuffer.getLength(), success));
|
||||
}
|
||||
|
||||
//set special settings to avoid miss timing issues
|
||||
|
@ -201,7 +201,7 @@ public class PacketHandler {
|
||||
if (pkg.getChannel().equals(DefaultPluginChannels.MC_BRAND.getChangeableIdentifier().get(connection.getVersion().getVersionId()))) {
|
||||
InByteBuffer data = pkg.getDataAsBuffer();
|
||||
String serverVersion;
|
||||
String clientVersion = (Minosoft.getConfig().getBoolean(ConfigurationPaths.NETWORK_FAKE_CLIENT_BRAND) ? "vanilla" : "Minosoft");
|
||||
String clientVersion = (Minosoft.getConfig().getBoolean(ConfigurationPaths.BooleanPaths.NETWORK_FAKE_CLIENT_BRAND) ? "vanilla" : "Minosoft");
|
||||
OutByteBuffer toSend = new OutByteBuffer(connection);
|
||||
if (connection.getVersion().getVersionId() < 29) {
|
||||
// no length prefix
|
||||
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.protocol.protocol;
|
||||
|
||||
public class PacketParseException extends Exception {
|
||||
public PacketParseException() {
|
||||
}
|
||||
|
||||
public PacketParseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public PacketParseException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public PacketParseException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public PacketParseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.protocol.protocol;
|
||||
|
||||
public class UnknownPacketException extends Exception {
|
||||
public UnknownPacketException() {
|
||||
}
|
||||
|
||||
public UnknownPacketException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public UnknownPacketException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public UnknownPacketException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public UnknownPacketException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ import java.net.http.HttpResponse;
|
||||
public final class MojangAuthentication {
|
||||
|
||||
public static MojangAccountAuthenticationAttempt login(String username, String password) {
|
||||
return login(Minosoft.getConfig().getString(ConfigurationPaths.CLIENT_TOKEN), username, password);
|
||||
return login(Minosoft.getConfig().getString(ConfigurationPaths.StringPaths.CLIENT_TOKEN), username, password);
|
||||
}
|
||||
|
||||
public static MojangAccountAuthenticationAttempt login(String clientToken, String username, String password) {
|
||||
@ -81,7 +81,7 @@ public final class MojangAuthentication {
|
||||
}
|
||||
|
||||
public static String refresh(String accessToken) {
|
||||
return refresh(Minosoft.getConfig().getString(ConfigurationPaths.CLIENT_TOKEN), accessToken);
|
||||
return refresh(Minosoft.getConfig().getString(ConfigurationPaths.StringPaths.CLIENT_TOKEN), accessToken);
|
||||
}
|
||||
|
||||
public static String refresh(String clientToken, String accessToken) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user