Skip to content

Commit

Permalink
using config for items, could not think of another solution for now
Browse files Browse the repository at this point in the history
  • Loading branch information
NK committed Feb 21, 2023
1 parent 7e3b3c9 commit d80acf0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "org.spongepowered.mixin"

version = "1.0.0"
version = "1.0.1-beta"
group = "me.night0721.lilase"
archivesBaseName = "Lilase"
sourceCompatibility = 1.8
Expand All @@ -36,7 +36,7 @@ minecraft {

replace "@VERSION@": project.version

clientRunArgs += ["--tweakClass gg.essential.loader.stage0.EssentialSetupTweaker cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker", "--mixin mixins.night0721.json"]
clientRunArgs += ["--tweakClass cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker", "--mixin mixins.night0721.json"]
}

configurations {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/me/night0721/lilase/config/AHConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import cc.polyfrost.oneconfig.config.annotations.Text;
import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.config.data.ModType;
import me.night0721.lilase.gui.ConfigGUI;
import me.night0721.lilase.gui.CoordinateGUI;
import me.night0721.lilase.utils.ConfigUtils;

public class AHConfig extends Config {
Expand All @@ -18,7 +18,8 @@ public AHConfig() {
}

@HUD(name = "Lilase")
public ConfigGUI hud = new ConfigGUI();
public CoordinateGUI hud = new CoordinateGUI();


@Slider(name = "Time per fetch (seconds)", min = 5, max = 15, step = 1)
public static int AUCTION_HOUSE_DELAY = 5;
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/me/night0721/lilase/features/ah/AuctionHouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ public class AuctionHouse {
public static States clickState = States.NONE;

public AuctionHouse() {
// items.add(new Item("Livid Dagger", ItemType.WEAPON, 8000000, ItemTier.LEGENDARY));
// items.add(new Item("Aspect of the Void", ItemType.WEAPON, 8000000, ItemTier.EPIC));
// items.add(new Item("Bal", ItemType.MISC, 10000000, ItemTier.EPIC));
items.add(new Item(" ", ItemType.ANY, 1000, ItemTier.ANY));
// items.add(new Item("Livid Dagger", ItemType.WEAPON, 8000000, ItemTier.LEGENDARY));
// items.add(new Item("Aspect of the Void", ItemType.WEAPON, 8000000, ItemTier.EPIC));
// items.add(new Item("Bal", ItemType.MISC, 10000000, ItemTier.EPIC));
// items.add(new Item(" ", ItemType.ANY, 1000, ItemTier.ANY));
if (ConfigUtils.getString("item1", "Name") != "")
items.add(new Item(ConfigUtils.getString("item1", "Name"), ItemType.valueOf(ConfigUtils.getString("item1", "Type")), ConfigUtils.getInt("item1", "Price"), ItemTier.valueOf(ConfigUtils.getString("item1", "Tier"))));
if (ConfigUtils.getString("item2", "Name") != "")
items.add(new Item(ConfigUtils.getString("item2", "Name"), ItemType.valueOf(ConfigUtils.getString("item2", "Type")), ConfigUtils.getInt("item2", "Price"), ItemTier.valueOf(ConfigUtils.getString("item2", "Tier"))));
if (ConfigUtils.getString("item3", "Name") != "")
items.add(new Item(ConfigUtils.getString("item3", "Name"), ItemType.valueOf(ConfigUtils.getString("item3", "Type")), ConfigUtils.getInt("item3", "Price"), ItemTier.valueOf(ConfigUtils.getString("item3", "Tier"))));

webhook = new DiscordWebhook(ConfigUtils.getString("main", "Webhook"));
webhook.setUsername("Lilase - Auction House");
webhook.setAvatarUrl("https://wallpapercave.com/wp/wp2412537.jpg");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import java.util.List;

public class ConfigGUI extends TextHud {
public class CoordinateGUI extends TextHud {

public ConfigGUI() {
public CoordinateGUI() {
super(true, 0, 0);
}
@Override
Expand All @@ -17,6 +17,5 @@ protected void getLines(List<String> lines, boolean example) {
lines.add("Y: " + Math.round(PlayerUtils.mc.thePlayer.posY));
lines.add("Z: " + Math.round(PlayerUtils.mc.thePlayer.posZ));
// get the time in real life and format it to xx:xx, eg 23:54

}
}
14 changes: 14 additions & 0 deletions src/main/java/me/night0721/lilase/utils/ConfigUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,28 @@
public class ConfigUtils {
public static Configuration config;
public final static String file = "config/Lilase.cfg";

public static void register() {
init();
reloadConfig();
}

public static void reloadConfig() {
if (!hasKey("main", "APIKey")) writeStringConfig("main", "APIKey", "");
if (!hasKey("main", "Webhook")) writeStringConfig("main", "Webhook", "");
if (!hasKey("main", "AuctionHouseDelay")) writeIntConfig("main", "AuctionHouseDelay", 8);
if (!hasKey("item1", "Name")) writeStringConfig("item1", "Name", "");
if (!hasKey("item1", "Type")) writeStringConfig("item1", "Type", "");
if (!hasKey("item1", "Price")) writeIntConfig("item1", "Price", 0);
if (!hasKey("item1", "Tier")) writeStringConfig("item1", "Tier", "");
if (!hasKey("item2", "Name")) writeStringConfig("item2", "Name", "");
if (!hasKey("item2", "Type")) writeStringConfig("item2", "Type", "");
if (!hasKey("item2", "Price")) writeIntConfig("item2", "Price", 0);
if (!hasKey("item2", "Tier")) writeStringConfig("item2", "Tier", "");
if (!hasKey("item3", "Name")) writeStringConfig("item3", "Name", "");
if (!hasKey("item3", "Type")) writeStringConfig("item3", "Type", "");
if (!hasKey("item3", "Price")) writeIntConfig("item3", "Price", 0);
if (!hasKey("item3", "Tier")) writeStringConfig("item3", "Tier", "");
}

public static void init() {
Expand Down

0 comments on commit d80acf0

Please sign in to comment.