some minor bug fixing

This commit is contained in:
rattatwinko
2025-05-04 18:58:35 +02:00
parent 3d3b6a001b
commit 7faf8627d7

View File

@@ -1,6 +1,6 @@
package org.GrapplingHook.grapplingHook
import org.bukkit.ChatColor
import org.bukkit.ChatColor // Don't Remove this or it will break shit
import org.bukkit.Material
import org.bukkit.NamespacedKey
import org.bukkit.Particle
@@ -21,7 +21,11 @@ import org.bukkit.event.entity.EntityDamageEvent
import org.bukkit.scheduler.BukkitRunnable
import org.bukkit.util.Vector
import java.util.*
import kotlin.math.cos
import kotlin.math.max
import kotlin.math.sin
@Suppress("DEPRECATION")
class GrapplingHook : JavaPlugin(), Listener {
private val grapplingHookKey = NamespacedKey(this, "grappling_hook")
private val cooldowns = HashMap<UUID, Long>()
@@ -93,7 +97,7 @@ class GrapplingHook : JavaPlugin(), Listener {
return true
}
val player = sender as Player
val player = sender
if (args.isEmpty()) {
giveGrapplingHook(player)
@@ -167,7 +171,12 @@ class GrapplingHook : JavaPlugin(), Listener {
@EventHandler
fun onPlayerJoin(event: PlayerJoinEvent) {
// Optional: giveGrapplingHook(event.player)
/**********************************************************************
* If this is enabled ; at start a player will receive a GrapplingHook *
**********************************************************************/
//giveGrapplingHook(event.player)
}
@EventHandler
@@ -264,7 +273,7 @@ class GrapplingHook : JavaPlugin(), Listener {
}
direction.normalize().multiply(adjustedPullStrength)
direction.y = Math.max(0.4, direction.y)
direction.y = max(0.4, direction.y) // If some error starts happening it is this
player.velocity = direction
if (preventFallDamage) {
@@ -343,8 +352,8 @@ class GrapplingHook : JavaPlugin(), Listener {
// Create a circular pattern
for (i in 0 until 8) {
val angle = i * Math.PI / 4
val x = Math.cos(angle) * 0.7
val z = Math.sin(angle) * 0.7
val x = cos(angle) * 0.7
val z = sin(angle) * 0.7
val particleLocation = player.location.clone().add(x, counter * 0.1, z)
player.world.spawnParticle(Particle.CLOUD, particleLocation, 1, 0.05, 0.05, 0.05, 0.01)