format using eclipse
This commit is contained in:
11
build.gradle
11
build.gradle
@@ -1,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.2-SNAPSHOT'
|
id 'fabric-loom' version '1.2-SNAPSHOT'
|
||||||
|
id 'com.diffplug.spotless' version '6.19.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
@@ -38,3 +39,13 @@ tasks.withType(JavaCompile).configureEach {
|
|||||||
it.options.encoding = "UTF-8"
|
it.options.encoding = "UTF-8"
|
||||||
it.options.release = 17
|
it.options.release = 17
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spotless {
|
||||||
|
java {
|
||||||
|
importOrder()
|
||||||
|
removeUnusedImports()
|
||||||
|
cleanthat()
|
||||||
|
eclipse()
|
||||||
|
formatAnnotations()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,101 +18,40 @@ public class Configs implements IConfigHandler {
|
|||||||
private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json";
|
private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json";
|
||||||
|
|
||||||
public static class Generic {
|
public static class Generic {
|
||||||
public static final ConfigBoolean ENABLED =
|
public static final ConfigBoolean ENABLED = new ConfigBoolean("enabled", false,
|
||||||
new ConfigBoolean("enabled", false, "Do auto trading with villagers in range");
|
"Do auto trading with villagers in range");
|
||||||
public static final ConfigBoolean ENABLE_SELL =
|
public static final ConfigBoolean ENABLE_SELL = new ConfigBoolean("enableSell", false,
|
||||||
new ConfigBoolean(
|
|
||||||
"enableSell",
|
|
||||||
false,
|
|
||||||
"Enable buying (if disabled emeralds from the emerald container are taken instead)");
|
"Enable buying (if disabled emeralds from the emerald container are taken instead)");
|
||||||
public static final ConfigString BUY_ITEM =
|
public static final ConfigString BUY_ITEM = new ConfigString("buyItem", "minecraft:gold_ingot",
|
||||||
new ConfigString("buyItem", "minecraft:gold_ingot", "The item to sell for emerald.");
|
"The item to sell for emerald.");
|
||||||
public static final ConfigBoolean ENABLE_BUY =
|
public static final ConfigBoolean ENABLE_BUY = new ConfigBoolean("enableBuy", false,
|
||||||
new ConfigBoolean(
|
|
||||||
"enableBuy",
|
|
||||||
false,
|
|
||||||
"Enable selling (if disabled emeralds are placed in the emerald container)");
|
"Enable selling (if disabled emeralds are placed in the emerald container)");
|
||||||
public static final ConfigString SELL_ITEM =
|
public static final ConfigString SELL_ITEM = new ConfigString("sellItem", "minecraft:redstone",
|
||||||
new ConfigString("sellItem", "minecraft:redstone", "The item to buy using emerald.");
|
"The item to buy using emerald.");
|
||||||
public static final ConfigInteger MAX_INPUT_ITEMS =
|
public static final ConfigInteger MAX_INPUT_ITEMS = new ConfigInteger("maxInputStacks", 9, 1, 35,
|
||||||
new ConfigInteger(
|
|
||||||
"maxInputStacks",
|
|
||||||
9,
|
|
||||||
1,
|
|
||||||
35,
|
|
||||||
"stacks to take from input container (or emerald container in buy-only mode)");
|
"stacks to take from input container (or emerald container in buy-only mode)");
|
||||||
public static final ConfigInteger INPUT_CONTAINER_X =
|
public static final ConfigInteger INPUT_CONTAINER_X = new ConfigInteger("inputContainerX", 0, -30000000,
|
||||||
new ConfigInteger(
|
30000000, "Input container X (not used when sell disabled)");
|
||||||
"inputContainerX",
|
public static final ConfigInteger INPUT_CONTAINER_Y = new ConfigInteger("inputContainerY", 0, -64, 320,
|
||||||
0,
|
"Input container Y (not used when sell disabled)");
|
||||||
-30000000,
|
public static final ConfigInteger INPUT_CONTAINER_Z = new ConfigInteger("outputContainerZ", 0, -30000000,
|
||||||
30000000,
|
30000000, "Input container Z (not used when sell disabled)");
|
||||||
"Input container X (not used when sell disabled)");
|
public static final ConfigInteger OUTPUT_CONTAINER_X = new ConfigInteger("outputContainerX", 0, -30000000,
|
||||||
public static final ConfigInteger INPUT_CONTAINER_Y =
|
30000000, "Input container X (not used when buy disabled)");
|
||||||
new ConfigInteger(
|
public static final ConfigInteger OUTPUT_CONTAINER_Y = new ConfigInteger("outputContainerY", 0, -64, 320,
|
||||||
"inputContainerY", 0, -64, 320, "Input container Y (not used when sell disabled)");
|
"Output container Y (not used when buy disabled)");
|
||||||
public static final ConfigInteger INPUT_CONTAINER_Z =
|
public static final ConfigInteger OUTPUT_CONTAINER_Z = new ConfigInteger("outputContainerZ", 0, -30000000,
|
||||||
new ConfigInteger(
|
30000000, "Output container Z (not used when buy disabled)");
|
||||||
"outputContainerZ",
|
public static final ConfigInteger EMERALD_CONTAINER_X = new ConfigInteger("emeraldContainerX", 0, -30000000,
|
||||||
0,
|
30000000, "Emerald container X (not used when buy&sell enabled)");
|
||||||
-30000000,
|
public static final ConfigInteger EMERALD_CONTAINER_Y = new ConfigInteger("emeraldContainerY", 0, -64, 320,
|
||||||
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)");
|
"Emerald container Y (not used when buy&sell enabled)");
|
||||||
public static final ConfigInteger EMERALD_CONTAINER_Z =
|
public static final ConfigInteger EMERALD_CONTAINER_Z = new ConfigInteger("emeraldContainerZ", 0, -30000000,
|
||||||
new ConfigInteger(
|
30000000, "Emerald container Z (not used when buy&sell enabled)");
|
||||||
"emeraldContainerZ",
|
|
||||||
0,
|
|
||||||
-30000000,
|
|
||||||
30000000,
|
|
||||||
"Emerald container Z (not used when buy&sell enabled)");
|
|
||||||
|
|
||||||
public static final ImmutableList<IConfigValue> OPTIONS =
|
public static final ImmutableList<IConfigValue> OPTIONS = ImmutableList.of(ENABLED, ENABLE_BUY, BUY_ITEM,
|
||||||
ImmutableList.of(
|
ENABLE_SELL, SELL_ITEM, MAX_INPUT_ITEMS, INPUT_CONTAINER_X, INPUT_CONTAINER_Y, INPUT_CONTAINER_Z,
|
||||||
ENABLED,
|
OUTPUT_CONTAINER_X, OUTPUT_CONTAINER_Y, OUTPUT_CONTAINER_Z, EMERALD_CONTAINER_X, EMERALD_CONTAINER_Y,
|
||||||
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);
|
EMERALD_CONTAINER_Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,28 +5,20 @@ import fi.dy.masa.malilib.config.options.ConfigHotkey;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Hotkeys {
|
public class Hotkeys {
|
||||||
public static final ConfigHotkey TOGGLE_KEY =
|
public static final ConfigHotkey TOGGLE_KEY = new ConfigHotkey("toggleTrading", "",
|
||||||
new ConfigHotkey("toggleTrading", "", "Enables / disables auto trading");
|
"Enables / disables auto trading");
|
||||||
public static final ConfigHotkey SET_BUY_KEY =
|
public static final ConfigHotkey SET_BUY_KEY = new ConfigHotkey("setSellItem", "",
|
||||||
new ConfigHotkey("setSellItem", "", "Sets the item to sell from hotbar");
|
"Sets the item to sell from hotbar");
|
||||||
public static final ConfigHotkey SET_SELL_KEY =
|
public static final ConfigHotkey SET_SELL_KEY = new ConfigHotkey("setBuyItem", "",
|
||||||
new ConfigHotkey("setBuyItem", "", "Sets the item to buy from hotbar");
|
"Sets the item to buy from hotbar");
|
||||||
public static final ConfigHotkey SET_INPUT_KEY =
|
public static final ConfigHotkey SET_INPUT_KEY = new ConfigHotkey("setInputContainer", "",
|
||||||
new ConfigHotkey("setInputContainer", "", "Sets the input (item to sell) container");
|
"Sets the input (item to sell) container");
|
||||||
public static final ConfigHotkey SET_OUTPUT_KEY =
|
public static final ConfigHotkey SET_OUTPUT_KEY = new ConfigHotkey("setOutputContainer", "",
|
||||||
new ConfigHotkey("setOutputContainer", "", "Sets the output (item bought) container");
|
"Sets the output (item bought) container");
|
||||||
public static final ConfigHotkey SET_EMERALD_KEY =
|
public static final ConfigHotkey SET_EMERALD_KEY = new ConfigHotkey("setEmeraldContainer", "",
|
||||||
new ConfigHotkey("setEmeraldContainer", "", "Set the emerald container");
|
"Set the emerald container");
|
||||||
public static final ConfigHotkey OPEN_GUI_SETTINGS =
|
public static final ConfigHotkey OPEN_GUI_SETTINGS = new ConfigHotkey("openGuiSettings", "", "Open the Config GUI");
|
||||||
new ConfigHotkey("openGuiSettings", "", "Open the Config GUI");
|
|
||||||
|
|
||||||
public static final List<ConfigHotkey> HOTKEY_LIST =
|
public static final List<ConfigHotkey> HOTKEY_LIST = ImmutableList.of(TOGGLE_KEY, SET_BUY_KEY, SET_SELL_KEY,
|
||||||
ImmutableList.of(
|
SET_INPUT_KEY, SET_OUTPUT_KEY, SET_EMERALD_KEY, OPEN_GUI_SETTINGS);
|
||||||
TOGGLE_KEY,
|
|
||||||
SET_BUY_KEY,
|
|
||||||
SET_SELL_KEY,
|
|
||||||
SET_INPUT_KEY,
|
|
||||||
SET_OUTPUT_KEY,
|
|
||||||
SET_EMERALD_KEY,
|
|
||||||
OPEN_GUI_SETTINGS);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ public class InputHandler implements IKeybindProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addHotkeys(IKeybindManager manager) {
|
public void addHotkeys(IKeybindManager manager) {
|
||||||
manager.addHotkeysForCategory(
|
manager.addHotkeysForCategory(Reference.MOD_NAME, "autotrade.hotkeys.category.hotkeys", Hotkeys.HOTKEY_LIST);
|
||||||
Reference.MOD_NAME, "autotrade.hotkeys.category.hotkeys", Hotkeys.HOTKEY_LIST);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ public class KeybindCallbacks implements IHotkeyCallback {
|
|||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeybindCallbacks() {}
|
private KeybindCallbacks() {
|
||||||
|
}
|
||||||
|
|
||||||
public void setCallbacks() {
|
public void setCallbacks() {
|
||||||
for (ConfigHotkey hotkey : Hotkeys.HOTKEY_LIST) {
|
for (ConfigHotkey hotkey : Hotkeys.HOTKEY_LIST) {
|
||||||
@@ -48,8 +49,7 @@ public class KeybindCallbacks implements IHotkeyCallback {
|
|||||||
|
|
||||||
if (key == Hotkeys.TOGGLE_KEY.getKeybind()) {
|
if (key == Hotkeys.TOGGLE_KEY.getKeybind()) {
|
||||||
Configs.Generic.ENABLED.toggleBooleanValue();
|
Configs.Generic.ENABLED.toggleBooleanValue();
|
||||||
String msg =
|
String msg = this.functionalityEnabled()
|
||||||
this.functionalityEnabled()
|
|
||||||
? "autotrade.message.toggled_mod_on"
|
? "autotrade.message.toggled_mod_on"
|
||||||
: "autotrade.message.toggled_mod_off";
|
: "autotrade.message.toggled_mod_off";
|
||||||
InfoUtils.showGuiOrInGameMessage(Message.MessageType.INFO, msg);
|
InfoUtils.showGuiOrInGameMessage(Message.MessageType.INFO, msg);
|
||||||
@@ -59,8 +59,7 @@ public class KeybindCallbacks implements IHotkeyCallback {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.functionalityEnabled() == false
|
if (this.functionalityEnabled() == false || (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false) {
|
||||||
|| (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,8 +88,7 @@ public class GuiConfigs extends GuiConfigsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum ConfigGuiTab {
|
public enum ConfigGuiTab {
|
||||||
GENERIC("autotrade.gui.button.config_gui.generic"),
|
GENERIC("autotrade.gui.button.config_gui.generic"), HOTKEYS("autotrade.gui.button.config_gui.hotkeys");
|
||||||
HOTKEYS("autotrade.gui.button.config_gui.hotkeys");
|
|
||||||
|
|
||||||
private final String translationKey;
|
private final String translationKey;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user