Skip to content

Commit

Permalink
Java 8, you betrayed me!
Browse files Browse the repository at this point in the history
new beta ;-;
  • Loading branch information
Past Ennui committed Aug 12, 2020
1 parent 5a13837 commit a9c1664
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ yarn_mappings = 1.16.2+build.1
loader_version = 0.9.1+build.205

# Mod Properties
mod_version = 4.0.0-beta.1+1.16.2
mod_version = 4.0.0-beta.2+1.16.2
maven_group = io.github.joaoh1
archives_base_name = okzoomer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class OkZoomerClientMod implements ClientModInitializer {
public void onInitializeClient() {
//TODO - Actually do zoom stuff, remove when everything's done.
Random random = new Random();
String[] owo = new String[]{"owo", "OwO", "uwu", "nwn", "^w^", ">w<", "Owo", "owO", ";w;", "0w0", "QwQ", "TwT", "-w-", "$w$", "@w@", "*w*", ":w:", "°w°", "ºwº", "ówò", "òwó", "`w´", "´w`", "~w~", "umu", "nmn", "own", "nwo", "ùwú", "úwù", "ñwñ", "UwU", "NwN", "ÙwÚ", "PwP", "own", "nwo", "/w/", "\\w\\", "|w|", "#w#", "<>w<>", "'w'", "\"w\"", "öwö", "ôwô", "ÖwÖ", "ÔwÔ", ".w.", "+w+", ")w(", "]w[", "}w{", "_w_"};
String[] owo = new String[]{"_w_"};
ZoomUtils.modLogger.info("[Ok Zoomer] " + owo[random.nextInt(owo.length)] + " what's this");

//Load the events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

import io.github.fablabsmc.fablabs.api.fiber.v1.annotation.AnnotatedSettings;
import io.github.fablabsmc.fablabs.api.fiber.v1.annotation.SettingNamingConvention;
Expand Down Expand Up @@ -45,10 +46,13 @@ public static void loadModConfig() {
if (Files.exists(ALPHA_CONFIG_PATH)) {
try {
ZoomUtils.modLogger.info("[Ok Zoomer] A config file from the 4.0.0 alphas was found! It will be converted to the new format then used.");
String content = Files.readString(ALPHA_CONFIG_PATH, Charset.defaultCharset());
content.replace("\"technical\": {", "\"tweaks\": {");
content.replace("\"hijack_save_toolbar_activator_key\": ", "\"unbind_conflicting_key\": ");
Files.writeString(CONFIG_PATH, content, Charset.defaultCharset());
List<String> list = List.of();
Files.readAllLines(ALPHA_CONFIG_PATH).forEach(string -> {
string.replace("\"technical\": {", "\"tweaks\": {");
string.replace("\"hijack_save_toolbar_activator_key\": ", "\"unbind_conflicting_key\": ");
list.add(string);
});
Files.write(CONFIG_PATH, list, Charset.defaultCharset());
Files.delete(ALPHA_CONFIG_PATH);
} catch (IOException e) {
e.printStackTrace();
Expand All @@ -57,21 +61,28 @@ public static void loadModConfig() {
if (Files.exists(CONFIG_PATH)) {
try {
//If the legacy config file is detected, translate it to the new format.
if (Files.readString(CONFIG_PATH).contains("\"hideHands\":")) {
ZoomUtils.modLogger.info("[Ok Zoomer] A pre-4.0.0 config file was found! It will be converted to the new format then used.");
LEGACY_ANNOTATED_SETTINGS.applyToNode(LEGACY_TREE, LEGACY_POJO);
FiberSerialization.deserialize(TREE, Files.newInputStream(CONFIG_PATH), serializer);
OkZoomerConfigPojo.values.zoomDivisor = OkZoomerLegacyConfigPojo.zoomDivisor;
OkZoomerConfigPojo.values.minimumZoomDivisor = OkZoomerLegacyConfigPojo.minimumZoomDivisor;
OkZoomerConfigPojo.values.maximumZoomDivisor = OkZoomerLegacyConfigPojo.maximumZoomDivisor;
OkZoomerConfigPojo.features.cinematicCamera = OkZoomerLegacyConfigPojo.smoothCamera ? CinematicCameraOptions.VANILLA : CinematicCameraOptions.OFF;
OkZoomerConfigPojo.features.reduceSensitivity = OkZoomerLegacyConfigPojo.reduceSensitivity;
OkZoomerConfigPojo.features.zoomTransition = OkZoomerLegacyConfigPojo.smoothTransition ? ZoomTransitionOptions.SMOOTH : ZoomTransitionOptions.OFF;
OkZoomerConfigPojo.features.zoomMode = OkZoomerLegacyConfigPojo.zoomToggle ? ZoomModes.TOGGLE : ZoomModes.HOLD;
OkZoomerConfigPojo.features.zoomScrolling = OkZoomerLegacyConfigPojo.zoomScrolling;
OkZoomerConfigPojo.features.extraKeybinds = OkZoomerLegacyConfigPojo.zoomScrolling;
saveModConfig();
}
Files.readAllLines(CONFIG_PATH).forEach(string -> {
if (string.contains("\"hideHands\":")) {
try {
ZoomUtils.modLogger.info("[Ok Zoomer] A pre-4.0.0 config file was found! It will be converted to the new format then used.");
LEGACY_ANNOTATED_SETTINGS.applyToNode(LEGACY_TREE, LEGACY_POJO);
FiberSerialization.deserialize(TREE, Files.newInputStream(CONFIG_PATH), serializer);
OkZoomerConfigPojo.values.zoomDivisor = OkZoomerLegacyConfigPojo.zoomDivisor;
OkZoomerConfigPojo.values.minimumZoomDivisor = OkZoomerLegacyConfigPojo.minimumZoomDivisor;
OkZoomerConfigPojo.values.maximumZoomDivisor = OkZoomerLegacyConfigPojo.maximumZoomDivisor;
OkZoomerConfigPojo.features.cinematicCamera = OkZoomerLegacyConfigPojo.smoothCamera ? CinematicCameraOptions.VANILLA : CinematicCameraOptions.OFF;
OkZoomerConfigPojo.features.reduceSensitivity = OkZoomerLegacyConfigPojo.reduceSensitivity;
OkZoomerConfigPojo.features.zoomTransition = OkZoomerLegacyConfigPojo.smoothTransition ? ZoomTransitionOptions.SMOOTH : ZoomTransitionOptions.OFF;
OkZoomerConfigPojo.features.zoomMode = OkZoomerLegacyConfigPojo.zoomToggle ? ZoomModes.TOGGLE : ZoomModes.HOLD;
OkZoomerConfigPojo.features.zoomScrolling = OkZoomerLegacyConfigPojo.zoomScrolling;
OkZoomerConfigPojo.features.extraKeybinds = OkZoomerLegacyConfigPojo.zoomScrolling;
saveModConfig();
} catch (IOException | FiberException e) {
e.printStackTrace();
}
return;
}
});
ANNOTATED_SETTINGS.applyToNode(TREE, POJO);
FiberSerialization.deserialize(TREE, Files.newInputStream(CONFIG_PATH), serializer);
isConfigLoaded = true;
Expand Down

0 comments on commit a9c1664

Please sign in to comment.