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