Merge pull request #7 from blockparole/chestalert-patch-setting

ChestAlert notification mode setting
This commit is contained in:
noil 2019-11-17 08:48:53 -05:00 committed by GitHub
commit 57eb04377e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}
}
}
}
}