Pull Development into Master #6

Merge aplicado
Awakened-Redstone mesclou 6 commits from development into master 2022-02-24 19:53:07 +00:00
9 arquivos alterados com 23 adições e 26 exclusões
Mostrando apenas as alterações do commit db6573a4bf - Mostrar todos os commits
Awakened-Redstone 2022-02-20 13:24:54 -03:00

Ver arquivo

@ -27,10 +27,6 @@ archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
loom {
accessWidenerPath = file("src/main/resources/autowhitelist.accesswidener")
}
sourceCompatibility = 16
targetCompatibility = 16
@ -49,6 +45,10 @@ dependencies {
include 'org.apache.commons:commons-collections4:4.1'
include 'com.neovisionaries:nv-websocket-client:2.14'
include 'com.squareup.okhttp3:okhttp:3.13.0'
include 'com.squareup.okio:okio:1.17.2'
include 'com.fasterxml.jackson.core:jackson-databind:2.10.1'
include 'com.fasterxml.jackson.core:jackson-annotations:2.10.1'
include 'com.fasterxml.jackson.core:jackson-core:2.10.1'
}
compileJava {

Ver arquivo

@ -42,7 +42,7 @@ public class AutoWhitelist implements ModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger("AutoWhitelist");
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
private static final File configFile = new File(config.getConfigDirectory(), "AutoWhitelist.json");
private static final File configFile = new File(config.getConfigDirectory(), "autowhitelist.json");
public static ConfigData getConfigData() {
return config.getConfigData();
@ -136,6 +136,15 @@ public class AutoWhitelist implements ModInitializer {
public void onInitialize() {
File dir = config.getConfigDirectory();
if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) {
if (new File(new File(".", "config"), "AutoWhitelist.json").exists()) {
new File(new File(".", "config"), "AutoWhitelist.json").renameTo(configFile);
}
if (new File(new File(".", "config/AutoWhitelist-assets"), "messages.json").exists()) {
if (new File(new File(".", "config/AutoWhitelist-assets"), "messages.json").renameTo(new File(config.getConfigDirectory(), "messages.json"))) {
new File(".", "config/AutoWhitelist-assets").delete();
}
}
if (!configFile.exists()) {
JsonHelper.writeJsonToFile(config.generateDefaultConfig(), configFile);
}
@ -150,11 +159,7 @@ public class AutoWhitelist implements ModInitializer {
InputStream inputStream = AutoWhitelistServer.class.getResource("/messages.json").openStream();
JigsawLanguage.load(inputStream, translations::put);
}
File file = new File(config.getConfigDirectory(), "AutoWhitelist-assets/messages.json");
File folder = new File(config.getConfigDirectory(), "AutoWhitelist-assets");
if (!folder.exists()) {
folder.mkdir();
}
File file = new File(config.getConfigDirectory(), "messages.json");
if (!file.exists()) {
Files.copy(AutoWhitelistServer.class.getResource("/messages.json").openStream(), file.toPath());
}

Ver arquivo

@ -16,11 +16,11 @@ import java.util.stream.Collectors;
public class Config {
private ConfigData configData;
private final File configFile = new File(getConfigDirectory(), "AutoWhitelist.json");
private final File configFile = new File(getConfigDirectory(), "autowhitelist.json");
private final byte configVersion = 3;
public File getConfigDirectory() {
return new File(".", "config");
return new File(".", "config/autowhitelist");
}
public void loadConfigs() {
@ -72,7 +72,7 @@ public class Config {
json.add("token", new JsonPrimitive("bot-token"));
json.add("clientId", new JsonPrimitive("client-id"));
json.add("discordServerId", new JsonPrimitive("discord-server-id"));
json.add("enableSlashCommands", new JsonPrimitive(false));
//json.add("enableSlashCommands", new JsonPrimitive(false)); Disabled due to high times to update global commands and not being practical for now
JsonObject whitelistJson = JsonHelper.getNestedObject(json, "whitelist", true);
if (whitelistJson == null) {
AutoWhitelist.LOGGER.error("Something went wrong when generating the default config file!");

Ver arquivo

@ -129,7 +129,7 @@ public class RegisterCommand {
if (whitelisted) {
BotHelper.sendFeedbackMessage(channel, new TranslatableText("command.register.username_already_registered.title"), new TranslatableText("command.register.username_already_registered.title"), BotHelper.MessageType.ERROR);
} else {
Message message = BotHelper.generateFeedbackMessage(new TranslatableText("command.register.last_steps.title"), new LiteralText("command.register.last_steps.message"), BotHelper.MessageType.INFO);
Message message = BotHelper.generateFeedbackMessage(new TranslatableText("command.register.last_steps.title"), new TranslatableText("command.register.last_steps.message"), BotHelper.MessageType.INFO);
MessageAction feedbackMessage = channel.sendMessage(message);
feedbackMessage.queue(message_ -> {
whitelist.add(new ExtendedWhitelistEntry(extendedProfile));

Ver arquivo

@ -33,11 +33,7 @@ public class AutoWhitelistServer implements DedicatedServerModInitializer {
InputStream inputStream = AutoWhitelistServer.class.getResource("/messages.json").openStream();
JigsawLanguage.load(inputStream, translations::put);
}
File file = new File(config.getConfigDirectory(), "AutoWhitelist-assets/messages.json");
File folder = new File(config.getConfigDirectory(), "AutoWhitelist-assets");
if (!folder.exists()) {
folder.mkdir();
}
File file = new File(config.getConfigDirectory(), "messages.json");
if (!file.exists()) {
Files.copy(AutoWhitelistServer.class.getResource("/messages.json").openStream(), file.toPath());
}

Ver arquivo

@ -42,7 +42,7 @@ public class ExtendedWhitelist extends Whitelist {
public JsonObject fromProfile(ExtendedWhitelistEntry entry) {
JsonObject json = new JsonObject();
entry.fromJson(json);
entry.write(json);
return json;
}

Ver arquivo

@ -22,7 +22,8 @@ public class ExtendedWhitelistEntry extends WhitelistEntry {
return (ExtendedGameProfile) ((ServerConfigEntryMixin<?>) this).getKey();
}
protected void fromJson(JsonObject json) {
@Override
protected void write(JsonObject json) {
((ServerConfigEntryMixin<?>) this).callGetKey();
if (((ServerConfigEntryMixin<?>) this).getKey() != null && ((ExtendedGameProfile) ((ServerConfigEntryMixin<?>) this).getKey()).getId() != null) {
json.addProperty("uuid", ((ExtendedGameProfile) ((ServerConfigEntryMixin<?>) this).getKey()).getId().toString());

Ver arquivo

@ -1,4 +0,0 @@
accessWidener v1 named
#Fields
#mutable field net/minecraft/server/PlayerManager whitelist Lnet/minecraft/server/Whitelist;

Ver arquivo

@ -22,7 +22,6 @@
"mixins": [
"autowhitelist.mixins.json"
],
"accessWidener": "autowhitelist.accesswidener",
"depends": {
"fabricloader": ">=0.13.2",
"minecraft": ">1.18.1"