format using eclipse

This commit is contained in:
sebseb7
2023-06-29 14:26:56 +02:00
parent 96f265ee42
commit f8d8bd2657
10 changed files with 390 additions and 451 deletions

View File

@@ -1,5 +1,6 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'com.diffplug.spotless' version '6.19.0'
}
sourceCompatibility = JavaVersion.VERSION_17
@@ -38,3 +39,13 @@ tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
}
spotless {
java {
importOrder()
removeUnusedImports()
cleanthat()
eclipse()
formatAnnotations()
}
}

View File

@@ -18,101 +18,40 @@ public class Configs implements IConfigHandler {
private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json";
public static class Generic {
public static final ConfigBoolean ENABLED =
new ConfigBoolean("enabled", false, "Do auto trading with villagers in range");
public static final ConfigBoolean ENABLE_SELL =
new ConfigBoolean(
"enableSell",
false,
public static final ConfigBoolean ENABLED = new ConfigBoolean("enabled", false,
"Do auto trading with villagers in range");
public static final ConfigBoolean ENABLE_SELL = new ConfigBoolean("enableSell", false,
"Enable buying (if disabled emeralds from the emerald container are taken instead)");
public static final ConfigString BUY_ITEM =
new ConfigString("buyItem", "minecraft:gold_ingot", "The item to sell for emerald.");
public static final ConfigBoolean ENABLE_BUY =
new ConfigBoolean(
"enableBuy",
false,
public static final ConfigString BUY_ITEM = new ConfigString("buyItem", "minecraft:gold_ingot",
"The item to sell for emerald.");
public static final ConfigBoolean ENABLE_BUY = new ConfigBoolean("enableBuy", false,
"Enable selling (if disabled emeralds are placed in the emerald container)");
public static final ConfigString SELL_ITEM =
new ConfigString("sellItem", "minecraft:redstone", "The item to buy using emerald.");
public static final ConfigInteger MAX_INPUT_ITEMS =
new ConfigInteger(
"maxInputStacks",
9,
1,
35,
public static final ConfigString SELL_ITEM = new ConfigString("sellItem", "minecraft:redstone",
"The item to buy using emerald.");
public static final ConfigInteger MAX_INPUT_ITEMS = new ConfigInteger("maxInputStacks", 9, 1, 35,
"stacks to take from input container (or emerald container in buy-only mode)");
public static final ConfigInteger INPUT_CONTAINER_X =
new ConfigInteger(
"inputContainerX",
0,
-30000000,
30000000,
"Input container X (not used when sell disabled)");
public static final ConfigInteger INPUT_CONTAINER_Y =
new ConfigInteger(
"inputContainerY", 0, -64, 320, "Input container Y (not used when sell disabled)");
public static final ConfigInteger INPUT_CONTAINER_Z =
new ConfigInteger(
"outputContainerZ",
0,
-30000000,
30000000,
"Input container Z (not used when sell disabled)");
public static final ConfigInteger OUTPUT_CONTAINER_X =
new ConfigInteger(
"outputContainerX",
0,
-30000000,
30000000,
"Input container X (not used when buy disabled)");
public static final ConfigInteger OUTPUT_CONTAINER_Y =
new ConfigInteger(
"outputContainerY", 0, -64, 320, "Output container Y (not used when buy disabled)");
public static final ConfigInteger OUTPUT_CONTAINER_Z =
new ConfigInteger(
"outputContainerZ",
0,
-30000000,
30000000,
"Output container Z (not used when buy disabled)");
public static final ConfigInteger EMERALD_CONTAINER_X =
new ConfigInteger(
"emeraldContainerX",
0,
-30000000,
30000000,
"Emerald container X (not used when buy&sell enabled)");
public static final ConfigInteger EMERALD_CONTAINER_Y =
new ConfigInteger(
"emeraldContainerY",
0,
-64,
320,
public static final ConfigInteger INPUT_CONTAINER_X = new ConfigInteger("inputContainerX", 0, -30000000,
30000000, "Input container X (not used when sell disabled)");
public static final ConfigInteger INPUT_CONTAINER_Y = new ConfigInteger("inputContainerY", 0, -64, 320,
"Input container Y (not used when sell disabled)");
public static final ConfigInteger INPUT_CONTAINER_Z = new ConfigInteger("outputContainerZ", 0, -30000000,
30000000, "Input container Z (not used when sell disabled)");
public static final ConfigInteger OUTPUT_CONTAINER_X = new ConfigInteger("outputContainerX", 0, -30000000,
30000000, "Input container X (not used when buy disabled)");
public static final ConfigInteger OUTPUT_CONTAINER_Y = new ConfigInteger("outputContainerY", 0, -64, 320,
"Output container Y (not used when buy disabled)");
public static final ConfigInteger OUTPUT_CONTAINER_Z = new ConfigInteger("outputContainerZ", 0, -30000000,
30000000, "Output container Z (not used when buy disabled)");
public static final ConfigInteger EMERALD_CONTAINER_X = new ConfigInteger("emeraldContainerX", 0, -30000000,
30000000, "Emerald container X (not used when buy&sell enabled)");
public static final ConfigInteger EMERALD_CONTAINER_Y = new ConfigInteger("emeraldContainerY", 0, -64, 320,
"Emerald container Y (not used when buy&sell enabled)");
public static final ConfigInteger EMERALD_CONTAINER_Z =
new ConfigInteger(
"emeraldContainerZ",
0,
-30000000,
30000000,
"Emerald container Z (not used when buy&sell enabled)");
public static final ConfigInteger EMERALD_CONTAINER_Z = new ConfigInteger("emeraldContainerZ", 0, -30000000,
30000000, "Emerald container Z (not used when buy&sell enabled)");
public static final ImmutableList<IConfigValue> OPTIONS =
ImmutableList.of(
ENABLED,
ENABLE_BUY,
BUY_ITEM,
ENABLE_SELL,
SELL_ITEM,
MAX_INPUT_ITEMS,
INPUT_CONTAINER_X,
INPUT_CONTAINER_Y,
INPUT_CONTAINER_Z,
OUTPUT_CONTAINER_X,
OUTPUT_CONTAINER_Y,
OUTPUT_CONTAINER_Z,
EMERALD_CONTAINER_X,
EMERALD_CONTAINER_Y,
public static final ImmutableList<IConfigValue> OPTIONS = ImmutableList.of(ENABLED, ENABLE_BUY, BUY_ITEM,
ENABLE_SELL, SELL_ITEM, MAX_INPUT_ITEMS, INPUT_CONTAINER_X, INPUT_CONTAINER_Y, INPUT_CONTAINER_Z,
OUTPUT_CONTAINER_X, OUTPUT_CONTAINER_Y, OUTPUT_CONTAINER_Z, EMERALD_CONTAINER_X, EMERALD_CONTAINER_Y,
EMERALD_CONTAINER_Z);
}

View File

@@ -5,28 +5,20 @@ import fi.dy.masa.malilib.config.options.ConfigHotkey;
import java.util.List;
public class Hotkeys {
public static final ConfigHotkey TOGGLE_KEY =
new ConfigHotkey("toggleTrading", "", "Enables / disables auto trading");
public static final ConfigHotkey SET_BUY_KEY =
new ConfigHotkey("setSellItem", "", "Sets the item to sell from hotbar");
public static final ConfigHotkey SET_SELL_KEY =
new ConfigHotkey("setBuyItem", "", "Sets the item to buy from hotbar");
public static final ConfigHotkey SET_INPUT_KEY =
new ConfigHotkey("setInputContainer", "", "Sets the input (item to sell) container");
public static final ConfigHotkey SET_OUTPUT_KEY =
new ConfigHotkey("setOutputContainer", "", "Sets the output (item bought) container");
public static final ConfigHotkey SET_EMERALD_KEY =
new ConfigHotkey("setEmeraldContainer", "", "Set the emerald container");
public static final ConfigHotkey OPEN_GUI_SETTINGS =
new ConfigHotkey("openGuiSettings", "", "Open the Config GUI");
public static final ConfigHotkey TOGGLE_KEY = new ConfigHotkey("toggleTrading", "",
"Enables / disables auto trading");
public static final ConfigHotkey SET_BUY_KEY = new ConfigHotkey("setSellItem", "",
"Sets the item to sell from hotbar");
public static final ConfigHotkey SET_SELL_KEY = new ConfigHotkey("setBuyItem", "",
"Sets the item to buy from hotbar");
public static final ConfigHotkey SET_INPUT_KEY = new ConfigHotkey("setInputContainer", "",
"Sets the input (item to sell) container");
public static final ConfigHotkey SET_OUTPUT_KEY = new ConfigHotkey("setOutputContainer", "",
"Sets the output (item bought) container");
public static final ConfigHotkey SET_EMERALD_KEY = new ConfigHotkey("setEmeraldContainer", "",
"Set the emerald container");
public static final ConfigHotkey OPEN_GUI_SETTINGS = new ConfigHotkey("openGuiSettings", "", "Open the Config GUI");
public static final List<ConfigHotkey> HOTKEY_LIST =
ImmutableList.of(
TOGGLE_KEY,
SET_BUY_KEY,
SET_SELL_KEY,
SET_INPUT_KEY,
SET_OUTPUT_KEY,
SET_EMERALD_KEY,
OPEN_GUI_SETTINGS);
public static final List<ConfigHotkey> HOTKEY_LIST = ImmutableList.of(TOGGLE_KEY, SET_BUY_KEY, SET_SELL_KEY,
SET_INPUT_KEY, SET_OUTPUT_KEY, SET_EMERALD_KEY, OPEN_GUI_SETTINGS);
}

View File

@@ -22,7 +22,6 @@ public class InputHandler implements IKeybindProvider {
@Override
public void addHotkeys(IKeybindManager manager) {
manager.addHotkeysForCategory(
Reference.MOD_NAME, "autotrade.hotkeys.category.hotkeys", Hotkeys.HOTKEY_LIST);
manager.addHotkeysForCategory(Reference.MOD_NAME, "autotrade.hotkeys.category.hotkeys", Hotkeys.HOTKEY_LIST);
}
}

View File

@@ -21,7 +21,8 @@ public class KeybindCallbacks implements IHotkeyCallback {
return INSTANCE;
}
private KeybindCallbacks() {}
private KeybindCallbacks() {
}
public void setCallbacks() {
for (ConfigHotkey hotkey : Hotkeys.HOTKEY_LIST) {
@@ -48,8 +49,7 @@ public class KeybindCallbacks implements IHotkeyCallback {
if (key == Hotkeys.TOGGLE_KEY.getKeybind()) {
Configs.Generic.ENABLED.toggleBooleanValue();
String msg =
this.functionalityEnabled()
String msg = this.functionalityEnabled()
? "autotrade.message.toggled_mod_on"
: "autotrade.message.toggled_mod_off";
InfoUtils.showGuiOrInGameMessage(Message.MessageType.INFO, msg);
@@ -59,8 +59,7 @@ public class KeybindCallbacks implements IHotkeyCallback {
return true;
}
if (this.functionalityEnabled() == false
|| (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false) {
if (this.functionalityEnabled() == false || (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false) {
return false;
}

View File

@@ -88,8 +88,7 @@ public class GuiConfigs extends GuiConfigsBase {
}
public enum ConfigGuiTab {
GENERIC("autotrade.gui.button.config_gui.generic"),
HOTKEYS("autotrade.gui.button.config_gui.hotkeys");
GENERIC("autotrade.gui.button.config_gui.generic"), HOTKEYS("autotrade.gui.button.config_gui.hotkeys");
private final String translationKey;