diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index c84710fe0..526d2a3c7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -15,6 +15,7 @@ import net.minecraft.entity.SharedMonsterAttributes import net.minecraft.event.ClickEvent import net.minecraft.event.HoverEvent import net.minecraft.util.ChatComponentText +import org.lwjgl.input.Keyboard import java.text.DecimalFormat import java.text.NumberFormat import java.text.SimpleDateFormat @@ -224,4 +225,17 @@ object LorenzUtils { return this } + private var lastCommandSent = 0L + + fun sendCommandToServer(command: String) { + if (System.currentTimeMillis() > lastCommandSent + 2_000) { + lastCommandSent = System.currentTimeMillis() + val thePlayer = Minecraft.getMinecraft().thePlayer + thePlayer.sendChatMessage("/$command") + } + } + + fun isShiftKeyDown() = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) + + fun isControlKeyDown() = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL) }
\ No newline at end of file |