add mode setting for chest alert

This commit is contained in:
blockparole 2019-11-14 12:44:01 +01:00
parent 4965ab1246
commit 83c1b92ddb
1 changed files with 10 additions and 2 deletions

View File

@ -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);
}
}
}
}
}