AutoRespawn anti bug

This commit is contained in:
blockparole 2019-11-21 17:56:03 +01:00
parent 174297962d
commit 8390451ef8
1 changed files with 16 additions and 9 deletions

View File

@ -11,24 +11,31 @@ import net.minecraft.client.gui.GuiGameOver;
/**
* Created by 086 on 9/04/2018.
* Updated 16 November 2019 by hub
*/
@Module.Info(name = "AutoRespawn", description = "Automatically respawns upon death and tells you where you died", category = Module.Category.MISC)
@Module.Info(name = "AutoRespawn", description = "Respawn utility", category = Module.Category.MISC)
public class AutoRespawn extends Module {
private Setting<Boolean> deathCoords = register(Settings.b("DeathCoords", false));
private Setting<Boolean> respawn = register(Settings.b("Respawn", true));
private Setting<Boolean> deathCoords = register(Settings.b("DeathCoords", false));
private Setting<Boolean> antiBug = register(Settings.b("Anti Bug", true));
@EventHandler
public Listener<GuiScreenEvent.Displayed> listener = new Listener<>(event -> {
if (event.getScreen() instanceof GuiGameOver) {
if (deathCoords.getValue())
Command.sendChatMessage(String.format("You died at x %d y %d z %d", (int)mc.player.posX, (int)mc.player.posY, (int)mc.player.posZ));
if (respawn.getValue()) {
mc.player.respawnPlayer();
mc.displayGuiScreen(null);
}
if (!(event.getScreen() instanceof GuiGameOver)) {
return;
}
if (deathCoords.getValue() && mc.player.getHealth() <= 0) {
Command.sendChatMessage(String.format("You died at x %d y %d z %d", (int) mc.player.posX, (int) mc.player.posY, (int) mc.player.posZ));
}
if (respawn.getValue() || (antiBug.getValue() && mc.player.getHealth() > 0)) {
mc.player.respawnPlayer();
mc.displayGuiScreen(null);
}
});
}