Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Tems-py committed Nov 3, 2023
1 parent 135fa27 commit c2852ca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.9.20'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}

group = 'org.tems'
Expand Down Expand Up @@ -50,3 +51,5 @@ processResources {
kotlin {
jvmToolchain(17)
}


Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.tems.ttotem.Tetotem


class EntityResurrectListener(private var plugin: Tetotem) : Listener {

@EventHandler
fun entityResurrectEvent(event: EntityResurrectEvent) {
if (!event.isCancelled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package org.tems.ttotem.Listeners
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.minimessage.MiniMessage
import org.bukkit.Material
import org.bukkit.entity.EntityType
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.entity.EntityResurrectEvent
import org.bukkit.event.inventory.InventoryClickEvent
import org.tems.ttotem.Tetotem
import java.util.*
Expand All @@ -19,10 +21,10 @@ class InventoryClickEvent(private val plugin: Tetotem) : Listener {
val player = event.whoClicked
val ticks = plugin.config.getInt("maximumAllowedTicksToChangeTotem")
if (item.type != Material.TOTEM_OF_UNDYING || event.slot != 40) return
if (plugin.lastTotem[player.uniqueId] != null) return
if (plugin.lastTotem[player.uniqueId] == null) return

val lastUse = plugin.lastTotem[player.uniqueId]
if (plugin.server.tickTimes.last().minus(lastUse!!) > ticks) return
val lastUse = plugin.lastTotem[player.uniqueId] ?: return
if (plugin.server.tickTimes.last().minus(lastUse) > ticks) return

val mm = MiniMessage.miniMessage();
if (plugin.config.getString("adminMessage") == null) {
Expand Down

0 comments on commit c2852ca

Please sign in to comment.