mirror of
https://github.com/5vl/Troll.git
synced 2025-05-24 10:56: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 {
|
fun getGui(target: Player, from: Player): Inventory {
|
||||||
val gui = Bukkit.createInventory(null, 54, Utils.color("<color:#ff9e36>Troll Menu - ${target.name}</color>"))
|
val gui = Bukkit.createInventory(null, 54, Utils.color("<color:#ff9e36>Troll Menu - ${target.name}</color>"))
|
||||||
gui.setItem(0, getYeetItem())
|
gui.setItem(0, getYeetItem())
|
||||||
|
gui.setItem(1, getPigBombItem())
|
||||||
inTrollGui[from] = target
|
inTrollGui[from] = target
|
||||||
return gui
|
return gui
|
||||||
}
|
}
|
||||||
@ -24,4 +25,13 @@ object TrollGui {
|
|||||||
item.itemMeta = meta
|
item.itemMeta = meta
|
||||||
return item
|
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
|
e.isCancelled = true
|
||||||
val ps = TrollGui.inTrollGui[p]!!
|
val ps = TrollGui.inTrollGui[p]!!
|
||||||
if (e.rawSlot == 0) {
|
if (e.rawSlot == 0) {
|
||||||
val loc = ps.location
|
yeetPlayer(p, ps)
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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