Refactor packages, add license header

Dieser Commit ist enthalten in:
Lixfel 2022-09-24 11:53:07 +02:00
Ursprung 4dc4331713
Commit d307fb90cf
11 geänderte Dateien mit 42 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"minVersion": "0.8", "minVersion": "0.8",
"package": "de.chaoscaot.altauth.mixin", "package": "de.chaoscaot.altauth.fabric.mixin",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_17",
"client": [ "client": [
"client.LoginRequestMixin" "client.LoginRequestMixin"

Datei anzeigen

@ -1,4 +1,6 @@
package de.chaoscaot.altauth; // SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;

Datei anzeigen

@ -1,6 +1,7 @@
package de.chaoscaot.altauth.config.client; // SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric;
import de.chaoscaot.altauth.AltAuth;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import java.io.File; import java.io.File;
@ -20,10 +21,10 @@ public class AltAuthClientConfig {
INSTANCE = new AltAuthClientConfig(); INSTANCE = new AltAuthClientConfig();
} else { } else {
try { try {
INSTANCE = AltAuth.GSON.fromJson(Files.readString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME)), AltAuthClientConfig.class); INSTANCE = AltAuthFabric.GSON.fromJson(Files.readString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME)), AltAuthClientConfig.class);
} catch (IOException e) { } catch (IOException e) {
AltAuth.LOGGER.error("AltauthClient: AltAuthClientConfig: Error while loading config", e); AltAuthFabric.LOGGER.error("AltauthClient: AltAuthClientConfig: Error while loading config", e);
AltAuth.LOGGER.info("Reset Config..."); AltAuthFabric.LOGGER.info("Reset Config...");
INSTANCE = new AltAuthClientConfig(); INSTANCE = new AltAuthClientConfig();
INSTANCE.save(); INSTANCE.save();
} }
@ -35,9 +36,9 @@ public class AltAuthClientConfig {
public void save() { public void save() {
try { try {
Files.writeString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME), AltAuth.GSON.toJson(this)); Files.writeString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME), AltAuthFabric.GSON.toJson(this));
} catch (IOException e) { } catch (IOException e) {
AltAuth.LOGGER.error("AltauthClient: AltAuthClientConfig: Error while saving config", e); AltAuthFabric.LOGGER.error("AltauthClient: AltAuthClientConfig: Error while saving config", e);
} }
} }
} }

Datei anzeigen

@ -1,4 +1,6 @@
package de.chaoscaot.altauth; // SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
@ -6,7 +8,7 @@ import net.fabricmc.api.ModInitializer;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public class AltAuth implements ModInitializer { public class AltAuthFabric implements ModInitializer {
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
public static final Logger LOGGER = LogManager.getLogger(); public static final Logger LOGGER = LogManager.getLogger();

Datei anzeigen

@ -1,4 +1,6 @@
package de.chaoscaot.altauth; // SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric;
import net.fabricmc.api.DedicatedServerModInitializer; import net.fabricmc.api.DedicatedServerModInitializer;

Datei anzeigen

@ -1,6 +1,7 @@
package de.chaoscaot.altauth.config.server; // SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric;
import de.chaoscaot.altauth.AltAuth;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import java.io.File; import java.io.File;
@ -18,14 +19,14 @@ public class AltAuthServerConfig {
INSTANCE = new AltAuthServerConfig(); INSTANCE = new AltAuthServerConfig();
} else { } else {
try { try {
INSTANCE = AltAuth.GSON.fromJson(Files.readString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME)), AltAuthServerConfig.class); INSTANCE = AltAuthFabric.GSON.fromJson(Files.readString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME)), AltAuthServerConfig.class);
if(INSTANCE.serverUrl.length() > 20) { if(INSTANCE.serverUrl.length() > 20) {
AltAuth.LOGGER.error("AltauthServer: AltAuthServerConfig: ServerUrl is too long. Max length is 20 characters"); AltAuthFabric.LOGGER.error("AltauthServer: AltAuthServerConfig: ServerUrl is too long. Max length is 20 characters");
INSTANCE.serverUrl = ""; INSTANCE.serverUrl = "";
} }
} catch (IOException e) { } catch (IOException e) {
AltAuth.LOGGER.error("AltauthServer: AltAuthServerConfig: Error while loading config", e); AltAuthFabric.LOGGER.error("AltauthServer: AltAuthServerConfig: Error while loading config", e);
AltAuth.LOGGER.info("Reset Config..."); AltAuthFabric.LOGGER.info("Reset Config...");
INSTANCE = new AltAuthServerConfig(); INSTANCE = new AltAuthServerConfig();
INSTANCE.save(); INSTANCE.save();
} }
@ -36,9 +37,9 @@ public class AltAuthServerConfig {
public void save() { public void save() {
try { try {
Files.writeString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME), AltAuth.GSON.toJson(this)); Files.writeString(FabricLoader.getInstance().getConfigDir().resolve(CONFIG_FILE_NAME), AltAuthFabric.GSON.toJson(this));
} catch (IOException e) { } catch (IOException e) {
AltAuth.LOGGER.error("AltauthServer: AltAuthServerConfig: Error while saving config", e); AltAuthFabric.LOGGER.error("AltauthServer: AltAuthServerConfig: Error while saving config", e);
} }
} }
} }

Datei anzeigen

@ -1,4 +1,6 @@
package de.chaoscaot.altauth.gui; // SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;

Datei anzeigen

@ -1,4 +1,6 @@
package de.chaoscaot.altauth.mixin.client; // SPDX-License-Identifier: MIT
package de.chaoscaot.altauth.fabric.mixin;
import com.mojang.authlib.yggdrasil.YggdrasilEnvironment; import com.mojang.authlib.yggdrasil.YggdrasilEnvironment;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;

Datei anzeigen

@ -1,6 +1,8 @@
package de.chaoscaot.altauth.mixin.server; // SPDX-License-Identifier: MIT
import de.chaoscaot.altauth.config.server.AltAuthServerConfig; package de.chaoscaot.altauth.fabric.mixin;
import de.chaoscaot.altauth.fabric.AltAuthServerConfig;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;

Datei anzeigen

@ -10,13 +10,13 @@
"environment": "*", "environment": "*",
"entrypoints": { "entrypoints": {
"main": [ "main": [
"de.chaoscaot.altauth.AltAuth" "de.chaoscaot.altauth.fabric.AltAuth"
], ],
"client": [ "client": [
"de.chaoscaot.altauth.AltAuthClient" "de.chaoscaot.altauth.fabric.AltAuthClient"
], ],
"server": [ "server": [
"de.chaoscaot.altauth.AltAuthServer" "de.chaoscaot.altauth.fabric.AltAuthServer"
] ]
}, },
"mixins": [ "mixins": [

Datei anzeigen

@ -177,7 +177,7 @@ class AltAuthRequestHandler(BaseHTTPRequestHandler):
except BaseException as e: except BaseException as e:
print(e) print(e)
self.send_response(HTTPStatus.INTERNAL_SERVER_ERROR) self.send_response(HTTPStatus.FORBIDDEN)
self.end_headers() self.end_headers()