remove useless code + enhancement + remove some config

This commit is contained in:
NK 2023-05-26 22:41:56 +01:00
parent 07291c0da9
commit 3d1d37fb0f
7 changed files with 9 additions and 71 deletions

23
.github/README.md vendored
View file

@ -55,26 +55,9 @@ For how to use, see **[here](https://github.com/night0721/lilase#how-to-use)**
# Example Config: # Example Config:
```json ```json
{ {
"SendMessageToWebhook": true,
"ReconnectDelay": 20,
"BedSpamDelay": 100,
"OnlySniper": false,
"BedSpam": true,
"SniperMode": 2,
"GUI": true,
"Debug": true,
"RelistTimeout": 1500,
"AuctionLength": 2,
"AutoClaim": true,
"AutoRelist": true,
"RelistCheckTimeout": 1.0,
"Webhook": "https://discord.com/api/webhooks/21345234635679111/aufsdaiusdhfqwhtq798rgdfsgASD_GAdfguasfdigsdfgsdfgsdfg",
"CustomScoreboard": true,
"GUI_COLOR": -16764590,
"AuctionHouseDelay": 8,
"RemoteControl": true, "RemoteControl": true,
"BotToken": "faserfqwuerfiaozdcgjnfh0243819qtewasdulkq43twsfdg", "BotToken": "OTE1NDk3NDQ1OTMwODY2MjA=.QREQw3.ASDU238qw9adsfdWEfsgsdfg",
"ShortenNumbers": true, "LogChannel": "91549744593086620",
"LogChannel": "" "Webhook": "https://discord.com/api/webhooks/81963527359311890/MIIDBjCCAe4CCQDqzJZzANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJjbjELMAkGA1"
} }
``` ```

View file

@ -12,23 +12,7 @@ public class AHConfig extends Config {
public AHConfig() { public AHConfig() {
super(new Mod("Lilase", ModType.SKYBLOCK, "/assets/lilase.png", 84, 84), "lilase.json"); super(new Mod("Lilase", ModType.SKYBLOCK, "/assets/lilase.png", 84, 84), "lilase.json");
initialize(); initialize();
addListener("SEND_MESSAGE", () -> Lilase.configHandler.setBoolean("SendMessageToWebhook", SEND_MESSAGE)); addListener("WEBHOOK", () -> Lilase.configHandler.setString("Webhook", WEBHOOK));addListener("REMOTE_CONTROL", () -> Lilase.configHandler.setBoolean("RemoteControl", REMOTE_CONTROL));
addListener("WEBHOOK", () -> Lilase.configHandler.setString("Webhook", WEBHOOK));
addListener("RECONNECT_DELAY", () -> Lilase.configHandler.setInt("ReconnectDelay", RECONNECT_DELAY));
addListener("BED_SPAM", () -> Lilase.configHandler.setBoolean("BedSpam", BED_SPAM));
addListener("BED_SPAM_DELAY", () -> Lilase.configHandler.setInt("BedSpamDelay", BED_SPAM_DELAY));
addListener("ONLY_SNIPER", () -> Lilase.configHandler.setBoolean("OnlySniper", ONLY_SNIPER));
addListener("GUI", () -> Lilase.configHandler.setBoolean("GUI", GUI));
addListener("GUI_COLOR", () -> Lilase.configHandler.setInt("GUI_COLOR", GUI_COLOR.getRGB()));
addListener("RELIST_TIMEOUT", () -> Lilase.configHandler.setInt("RelistTimeout", RELIST_TIMEOUT));
addListener("DEBUG", () -> Lilase.configHandler.setBoolean("Debug", DEBUG));
addListener("AUCTION_LENGTH", () -> Lilase.configHandler.setInt("AuctionLength", AUCTION_LENGTH));
addListener("AUTO_RELIST", () -> Lilase.configHandler.setBoolean("AutoRelist", AUTO_RELIST));
addListener("AUTO_CLAIM", () -> Lilase.configHandler.setBoolean("AutoClaim", AUTO_CLAIM));
addListener("RELIST_CHECK_TIMEOUT", () -> Lilase.configHandler.setFloat("RelistCheckTimeout", RELIST_CHECK_TIMEOUT));
addListener("CUSTOM_SCOREBOARD", () -> Lilase.configHandler.setBoolean("CustomScoreboard", CUSTOM_SCOREBOARD));
addListener("SHORTEN_NUMBERS", () -> Lilase.configHandler.setBoolean("ShortenNumbers", SHORTEN_NUMBERS));
addListener("REMOTE_CONTROL", () -> Lilase.configHandler.setBoolean("RemoteControl", REMOTE_CONTROL));
addListener("BOT_TOKEN", () -> Lilase.configHandler.setString("BotToken", BOT_TOKEN)); addListener("BOT_TOKEN", () -> Lilase.configHandler.setString("BotToken", BOT_TOKEN));
addListener("LOG_CHANNEL", () -> Lilase.configHandler.setString("LogChannel", LOG_CHANNEL)); addListener("LOG_CHANNEL", () -> Lilase.configHandler.setString("LogChannel", LOG_CHANNEL));
addDependency("WEBHOOK", "SEND_MESSAGE"); addDependency("WEBHOOK", "SEND_MESSAGE");

View file

@ -17,23 +17,7 @@ public class ConfigHandler {
} }
public void reloadConfig() { public void reloadConfig() {
// TODO: Fix
if (hasNoKey("SendMessageToWebhook")) setBoolean("SendMessageToWebhook", true);
if (hasNoKey("Webhook")) setString("Webhook", ""); if (hasNoKey("Webhook")) setString("Webhook", "");
if (hasNoKey("ReconnectDelay")) setInt("ReconnectDelay", 20);
if (hasNoKey("SniperMode")) setBoolean("SniperMode", true);
if (hasNoKey("BedSpam")) setBoolean("BedSpam", true);
if (hasNoKey("BedSpamDelay")) setInt("BedSpamDelay", 100);
if (hasNoKey("OnlySniper")) setBoolean("OnlySniper", false);
if (hasNoKey("GUI")) setBoolean("GUI", true);
if (hasNoKey("GUI_COLOR")) setInt("GUI_COLOR", 0x003153);
if (hasNoKey("Debug")) setBoolean("Debug", false);
if (hasNoKey("RelistTimeout")) setInt("RelistTimeout", 1500);
if (hasNoKey("AuctionLength")) setInt("AuctionLength", 2);
if (hasNoKey("AutoRelist")) setBoolean("AutoRelist", true);
if (hasNoKey("AutoClaim")) setBoolean("AutoClaim", true);
if (hasNoKey("CustomScoreboard")) setBoolean("CustomScoreboard", true);
if (hasNoKey("ShortenNumbers")) setBoolean("ShortenNumbers", true);
if (hasNoKey("RemoteControl")) setBoolean("RemoteControl", false); if (hasNoKey("RemoteControl")) setBoolean("RemoteControl", false);
if (hasNoKey("BotToken")) setString("BotToken", ""); if (hasNoKey("BotToken")) setString("BotToken", "");
if (hasNoKey("LogChannel")) setString("LogChannel", ""); if (hasNoKey("LogChannel")) setString("LogChannel", "");

View file

@ -50,9 +50,8 @@ public class Queue {
this.clearTaskRunning = true; this.clearTaskRunning = true;
new Thread(() -> { new Thread(() -> {
try { try {
Thread.sleep(3000); Thread.sleep(1500);
} catch (InterruptedException e) { } catch (InterruptedException ignored) {
e.printStackTrace();
} }
this.queue.clear(); this.queue.clear();
this.setRunning(false); this.setRunning(false);

View file

@ -12,7 +12,8 @@ public class QueueItem {
final int price; final int price;
public @Getter public @Getter
final int target; final int target;
public @Getter String uid; public @Getter
final String uid;
public Flipper flipper; public Flipper flipper;
public QueueItem(String command, String name, int price, int target, String uid) { public QueueItem(String command, String name, int price, int target, String uid) {

View file

@ -2,30 +2,17 @@ package me.night0721.lilase.utils;
public class Clock { public class Clock {
private long endTime; private long endTime;
private boolean scheduled;
public void schedule(long milliseconds) { public void schedule(long milliseconds) {
this.endTime = System.currentTimeMillis() + milliseconds; this.endTime = System.currentTimeMillis() + milliseconds;
scheduled = true;
} }
public long getRemainingTime() { public long getRemainingTime() {
return endTime - System.currentTimeMillis(); return endTime - System.currentTimeMillis();
} }
public long getEndTime() {
return endTime;
}
public boolean passed() { public boolean passed() {
return System.currentTimeMillis() >= endTime; return System.currentTimeMillis() >= endTime;
} }
public boolean isScheduled() {
return scheduled;
}
public void reset() {
scheduled = false;
}
} }

View file

@ -60,7 +60,7 @@ public class InventoryUtils {
return null; return null;
} }
public static int getSlotForItemm(String id) { public static int getSlotForItem(String id) {
for (final Slot slot : Lilase.mc.thePlayer.inventoryContainer.inventorySlots) { for (final Slot slot : Lilase.mc.thePlayer.inventoryContainer.inventorySlots) {
if (slot.getHasStack()) { if (slot.getHasStack()) {
final ItemStack is = slot.getStack(); final ItemStack is = slot.getStack();