mirror of
https://github.com/5vl/Troll.git
synced 2025-05-24 06:36:56 +00:00
Added pig bomb item and formatting for inv click
This commit is contained in:
parent
cf08a87803
commit
13ef6488a8
@ -12,6 +12,7 @@ object TrollGui {
|
||||
fun getGui(target: Player, from: Player): Inventory {
|
||||
val gui = Bukkit.createInventory(null, 54, Utils.color("<color:#ff9e36>Troll Menu - ${target.name}</color>"))
|
||||
gui.setItem(0, getYeetItem())
|
||||
gui.setItem(1, getPigBombItem())
|
||||
inTrollGui[from] = target
|
||||
return gui
|
||||
}
|
||||
@ -24,4 +25,13 @@ object TrollGui {
|
||||
item.itemMeta = meta
|
||||
return item
|
||||
}
|
||||
|
||||
private fun getPigBombItem(): ItemStack {
|
||||
val item = ItemStack(Material.PIG_SPAWN_EGG)
|
||||
val meta = item.itemMeta
|
||||
meta.displayName(Utils.color("<color:#f563ff>Pig Bomb</color>"))
|
||||
meta.lore(Utils.loreBuilder("This will throw a pig bomb", "on the player."))
|
||||
item.itemMeta = meta
|
||||
return item
|
||||
}
|
||||
}
|
@ -15,13 +15,17 @@ class InvClickListener : Listener {
|
||||
e.isCancelled = true
|
||||
val ps = TrollGui.inTrollGui[p]!!
|
||||
if (e.rawSlot == 0) {
|
||||
val loc = ps.location
|
||||
loc.yaw = Random.nextInt(360).toFloat()
|
||||
loc.pitch = Random.nextInt(-50, -20).toFloat()
|
||||
ps.velocity = loc.direction.multiply(3)
|
||||
TrollGui.inTrollGui.remove(p)
|
||||
p.closeInventory()
|
||||
yeetPlayer(p, ps)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun yeetPlayer(p: Player, ps: Player) {
|
||||
val loc = ps.location
|
||||
loc.yaw = Random.nextInt(360).toFloat()
|
||||
loc.pitch = Random.nextInt(-50, -20).toFloat()
|
||||
ps.velocity = loc.direction.multiply(3)
|
||||
TrollGui.inTrollGui.remove(p)
|
||||
p.closeInventory()
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user