Skip to content

Commit 1d16ee1

Browse files
Separate equipping and un-equipping into two different events
1 parent 4d9f523 commit 1d16ee1

File tree

1 file changed

+6
-1
lines changed
  • src/main/java/dev/enderman/minecraft/plugins/scp/items

1 file changed

+6
-1
lines changed

src/main/java/dev/enderman/minecraft/plugins/scp/items/SCP268Item.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class SCP268Item(plugin: SCPPlugin) : TexturedItem(plugin, "scp_268", Material.L
1818
val player = event.player
1919

2020
val newItem = event.newItem
21-
val oldItem = event.oldItem
2221

2322
if (isItem(newItem)) {
2423
plugin.logger.info("[SCP-268] The player has put on the hat... now invisible.")
@@ -44,6 +43,12 @@ class SCP268Item(plugin: SCPPlugin) : TexturedItem(plugin, "scp_268", Material.L
4443
entity.target = null
4544
}
4645
}
46+
}
47+
48+
@EventHandler
49+
private fun onUnEquip(event: PlayerArmorChangeEvent) {
50+
val player = event.player
51+
val oldItem = event.oldItem
4752

4853
if (isItem(oldItem)) {
4954
plugin.logger.info("[SCP-268] The player has taken off the hat... now visible.")

0 commit comments

Comments
 (0)