From 83c1b92ddb696e16613d847e7f628af414af1751 Mon Sep 17 00:00:00 2001 From: blockparole <> Date: Thu, 14 Nov 2019 12:44:01 +0100 Subject: [PATCH] add mode setting for chest alert --- .../seppuku/impl/module/misc/ChestAlertModule.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChestAlertModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChestAlertModule.java index 9fdeffe..fe1d696 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChestAlertModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChestAlertModule.java @@ -4,6 +4,7 @@ import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.api.event.EventStageable; import me.rigamortis.seppuku.api.event.network.EventReceivePacket; import me.rigamortis.seppuku.api.module.Module; +import me.rigamortis.seppuku.api.value.OptionalValue; import net.minecraft.client.Minecraft; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.play.server.SPacketChunkData; @@ -15,6 +16,8 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class ChestAlertModule extends Module { + public final OptionalValue mode = new OptionalValue("Mode", new String[]{"Mode", "M"}, 0, new String[]{"Chat", "Notification", "Both"}); + public ChestAlertModule() { super("ChestAlert", new String[] {"ChestAlerts"}, "Alerts you how many chests are in a chunk when it's loaded", "NONE", -1, ModuleType.MISC); } @@ -39,9 +42,14 @@ public final class ChestAlertModule extends Module { if(count > 0) { final String message = count + " Chests located at X: " + packet.getChunkX() * 16 + " Z: " + packet.getChunkZ() * 16; - Seppuku.INSTANCE.logChat(message); - Seppuku.INSTANCE.getNotificationManager().addNotification("", message); + if (this.mode.getInt() == 0 || this.mode.getInt() == 2) { + Seppuku.INSTANCE.logChat(message); + } + if (this.mode.getInt() == 1 || this.mode.getInt() == 2) { + Seppuku.INSTANCE.getNotificationManager().addNotification("", message); + } } + } } }