Block equipping items
This commit is contained in:
parent
76337a87bf
commit
151d28ccc5
5 changed files with 10 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,4 +2,5 @@
|
|||
/.gradle/
|
||||
|
||||
*.jar
|
||||
!/libs/*.jar
|
||||
!gradle-wrapper.jar
|
||||
|
|
|
@ -22,6 +22,7 @@ dependencies {
|
|||
implementation(kotlin("stdlib-jdk8"))
|
||||
implementation(kotlin("reflect"))
|
||||
implementation("commons-codec:commons-codec:1.14")
|
||||
compileOnly(files("./libs/ArmorEquipEvent-1.7.2.jar"))
|
||||
compileOnly("com.comphenix.protocol", "ProtocolLib", "4.5.0")
|
||||
compileOnly("org.spigotmc", "spigot-api", "1.15.2-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
|
BIN
libs/ArmorEquipEvent-1.7.2.jar
Normal file
BIN
libs/ArmorEquipEvent-1.7.2.jar
Normal file
Binary file not shown.
|
@ -1,5 +1,6 @@
|
|||
package de.moritzruth.spigot_ttt.game.items
|
||||
|
||||
import com.codingforcookies.armorequip.ArmorEquipEvent
|
||||
import de.moritzruth.spigot_ttt.game.GameListener
|
||||
import de.moritzruth.spigot_ttt.game.GameManager
|
||||
import de.moritzruth.spigot_ttt.game.items.impl.*
|
||||
|
@ -14,6 +15,7 @@ import de.moritzruth.spigot_ttt.utils.isLeftClick
|
|||
import de.moritzruth.spigot_ttt.utils.isRightClick
|
||||
import de.moritzruth.spigot_ttt.utils.nextTick
|
||||
import de.moritzruth.spigot_ttt.utils.sendActionBarMessage
|
||||
import org.bukkit.GameMode
|
||||
import org.bukkit.Location
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.entity.Item
|
||||
|
@ -85,6 +87,11 @@ object ItemManager {
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun onArmorEquip(event: ArmorEquipEvent) {
|
||||
if (event.player.gameMode != GameMode.CREATIVE) event.isCancelled = true
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
fun onPlayerInteract(event: PlayerInteractEvent) = handle(event) { tttPlayer ->
|
||||
if (tttPlayer.ignoreNextInteract) {
|
||||
|
|
|
@ -5,6 +5,7 @@ api-version: "1.15"
|
|||
main: de.moritzruth.spigot_ttt.TTTPlugin
|
||||
depend:
|
||||
- ProtocolLib
|
||||
- ArmorEquipEvent
|
||||
|
||||
commands:
|
||||
voting:
|
||||
|
|
Reference in a new issue