Fixed TileEntitySign not found bug, added disconnect and command commands to remote control
Some checks failed
build-ci / build (push) Has been cancelled

This commit is contained in:
NK 2023-05-28 00:27:05 +01:00
parent 8ba3cf4ccc
commit 9ce120f521
7 changed files with 24 additions and 16 deletions

View file

@ -89,4 +89,7 @@
- remove useless code, config that isn't need to be stored in lilase.json (again)
- v3.0.4-beta
- Added debugs
- Emergency bug fixes
- Emergency bug fixes
- v3.0.5
- Fixed flipper cannot find TileEntitySign
- Added disconnect and command commands to remote control

View file

@ -1,6 +1,6 @@
mod_name = Lilase
mod_id = lilase
mod_version = 3.0.4-beta
mod_version = 3.0.4
essential.defaults.loom=0

View file

@ -5,7 +5,6 @@ pluginManagement {
maven("https://repo.polyfrost.cc/releases")
maven("https://maven.architectury.dev/")
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
}
plugins {
val egtVersion = "0.1.18"

View file

@ -42,7 +42,7 @@ import static me.night0721.lilase.features.flipper.Flipper.webhook;
public class Lilase {
public static final String MOD_NAME = "Lilase";
public static final String MODID = "Lilase";
public static final String VERSION = "3.0.4-beta";
public static final String VERSION = "3.0.4";
public static final Minecraft mc = Minecraft.getMinecraft();
// public static PageFlipper pageFlipper;
public static Claimer claimer;

View file

@ -198,10 +198,8 @@ public class Flipper {
}
case PRICE:
if (Lilase.mc.currentScreen instanceof GuiEditSign && buyWait.passed()) {
TileEntitySign tileSign;
try {
tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign");
} catch (Exception e) {
TileEntitySign tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign");
if (tileSign == null) {
tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "field_146848_f");
}
Utils.debugLog("Sign(normal): " + ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign"));

View file

@ -38,13 +38,11 @@ public class RemoteControl {
bot.updateCommands().addCommands(
Commands.slash("statistics", "Statistics of current session").setGuildOnly(true),
Commands.slash("screenshot", "Take a screenshot of the client"),
Commands.slash("enable", "Enable a feature of the mod")
.setGuildOnly(true)
.addOptions(new OptionData(OptionType.STRING, "type", "The type of feature to turn on")
.addChoice("Auto Claimer", "claimer")
.addChoice("COFL Macro", "macro")
.addChoice("Auto Relister", "relister"))
).queue();
Commands.slash("screenshot", "Take a screenshot of the client").setGuildOnly(true),
Commands.slash("enable", "Enable a feature of the mod").setGuildOnly(true)
.addOptions(new OptionData(OptionType.STRING, "type", "The type of feature to turn on").addChoice("Auto Claimer", "claimer").addChoice("COFL Macro", "macro").addChoice("Auto Relister", "relister")),
Commands.slash("command", "Runs a command on client side").setGuildOnly(true).addOptions(new OptionData(OptionType.STRING, "command", "The command to run", true)),
Commands.slash("disconnect", "Disconnect from server").setGuildOnly(true)
).queue();
}
}

View file

@ -2,6 +2,7 @@ package me.night0721.lilase.remotecontrol.events;
import me.night0721.lilase.Lilase;
import me.night0721.lilase.remotecontrol.BotUtils;
import me.night0721.lilase.utils.Utils;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
@ -88,5 +89,14 @@ public class CommandListener extends ListenerAdapter {
}
}
}
if (event.getName().equals("command")) {
String command = Objects.requireNonNull(event.getOption("command")).getAsString();
Utils.sendServerMessage("/" + command);
event.reply("Command sent").queue();
}
if (event.getName().equals("disconnect")) {
Lilase.mc.theWorld.sendQuittingDisconnectingPacket();
event.reply("Disconnected").queue();
}
}
}