From 3c922d0a10cb2cf9edbf0eeb3806dfb85b90af34 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Tue, 15 Apr 2025 19:44:18 -0700 Subject: [PATCH] Remove old player move listener --- .../listener/PlayerMoveListenerOld.kt | 92 ------------------- 1 file changed, 92 deletions(-) delete mode 100644 src/main/kotlin/xyz/lncvrt/galaxylobby/listener/PlayerMoveListenerOld.kt diff --git a/src/main/kotlin/xyz/lncvrt/galaxylobby/listener/PlayerMoveListenerOld.kt b/src/main/kotlin/xyz/lncvrt/galaxylobby/listener/PlayerMoveListenerOld.kt deleted file mode 100644 index 5fc792d..0000000 --- a/src/main/kotlin/xyz/lncvrt/galaxylobby/listener/PlayerMoveListenerOld.kt +++ /dev/null @@ -1,92 +0,0 @@ -package xyz.lncvrt.galaxylobby.listener - -import org.bukkit.GameMode -import org.bukkit.Material -import org.bukkit.Sound -import org.bukkit.World -import org.bukkit.event.EventHandler -import org.bukkit.event.Listener -import org.bukkit.event.player.PlayerMoveEvent -import org.bukkit.util.Vector -import org.sayandev.stickynote.bukkit.extension.sendComponent -import xyz.lncvrt.galaxyapi.utils.MessageFormat -import xyz.lncvrt.galaxylobby.GalaxyLobbyPlugin - - -class PlayerMoveListenerOld(val plugin: GalaxyLobbyPlugin) : Listener { - @EventHandler - fun onPlayerMove(event: PlayerMoveEvent) { - val player = event.getPlayer() - val location = player.location - - if (location.y < 0) { - plugin.resetPlayer(player, true) - player.sendComponent(MessageFormat.setPrefix("You happy with yourself?")) - } else if (location.y > 200) { - location.y = 200.0 - player.teleport(location) - player.sendComponent(MessageFormat.setPrefix(MessageFormat.setSecondaryColor("You can't go that high!"))) - } - } - - @EventHandler - fun onPlayerMoveLaunchPad(event: PlayerMoveEvent) { - val player = event.getPlayer() - val world: World? = plugin.server.getWorld("world") - if (world == null) return - val playerBlock = world.getBlockAt(player.location) - - val playerId = player.uniqueId - val currentTime = System.currentTimeMillis() - - if (plugin.jumpPadCooldowns.containsKey(playerId)) { - val lastActivation: Long = plugin.jumpPadCooldowns.get(playerId)!! - if (currentTime - lastActivation < 1000) return - } - - if (playerBlock.type === Material.CHERRY_PRESSURE_PLATE) { - plugin.jumpPadCooldowns.put(playerId, currentTime) - - if (player.gameMode == GameMode.ADVENTURE && player.inventory.heldItemSlot == 7) { - player.velocity = Vector(0, 1, 0) - player.playSound(player.location, Sound.ENTITY_FIREWORK_ROCKET_BLAST, 2.0f, 1.0f) - player.sendComponent(MessageFormat.setPrefix("Hacks!?!?!?!")) - val scheduler = plugin.server.scheduler - scheduler.runTaskLater(plugin, Runnable { - player.velocity = Vector(0, 2, 0) - player.playSound(player.location, Sound.ENTITY_FIREWORK_ROCKET_BLAST, 2.0f, 1.0f) - }, 10) - scheduler.runTaskLater(plugin, Runnable { - player.velocity = Vector(0, 2, 0) - player.playSound(player.location, Sound.ENTITY_FIREWORK_ROCKET_BLAST, 2.0f, 1.0f) - }, 20) - scheduler.runTaskLater(plugin, Runnable { - player.velocity = Vector(0, 2, 0) - player.playSound(player.location, Sound.ENTITY_FIREWORK_ROCKET_BLAST, 2.0f, 1.0f) - }, 30) - scheduler.runTaskLater(plugin, Runnable { - player.velocity = Vector(0, 5, 0) - player.playSound(player.location, Sound.ENTITY_FIREWORK_ROCKET_BLAST, 2.0f, 1.25f) - }, 40) - return - } - player.velocity = Vector(0.0, 1.0, 3.5) - player.playSound(player.location, Sound.ENTITY_BAT_TAKEOFF, 1.0f, 1.0f) - } - } - - @EventHandler - fun onPlayerMoveDoubleJump(event: PlayerMoveEvent) { - val player = event.getPlayer() - val location = player.location - val world = player.world - - if (!player.isFlying && player.gameMode == GameMode.ADVENTURE) { - if (player.inventory.heldItemSlot == 7) { - player.allowFlight = false - return - } - player.allowFlight = world.getBlockAt(location.subtract(0.0, 2.0, 0.0)).type != Material.AIR - } - } -} \ No newline at end of file