Pull Development into Master #6
9 arquivos alterados com 23 adições e 26 exclusões
Release 1.0.0
commit
db6573a4bf
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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!");
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
accessWidener v1 named
|
||||
|
||||
#Fields
|
||||
#mutable field net/minecraft/server/PlayerManager whitelist Lnet/minecraft/server/Whitelist;
|
||||
|
|
@ -22,7 +22,6 @@
|
|||
"mixins": [
|
||||
"autowhitelist.mixins.json"
|
||||
],
|
||||
"accessWidener": "autowhitelist.accesswidener",
|
||||
"depends": {
|
||||
"fabricloader": ">=0.13.2",
|
||||
"minecraft": ">1.18.1"
|
||||
|
|
|
|||
Referência em uma nova issue