Skip to content

Commit

Permalink
Added createBossBar function
Browse files Browse the repository at this point in the history
  • Loading branch information
Abwasserrohr committed May 29, 2019
2 parents 9a6f9e0 + 303c3e7 commit 3a944c8
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions STEEM.CRAFT/_lib/bossbar.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# ==============
# bossbar.sk
# ==============
# bossbar.sk is part of the STEEM.CRAFT library.
# ==============

import:
org.bukkit.boss.BarStyle
org.bukkit.boss.BarColor
org.bukkit.Bukkit

#
# > Function - createBossBar
# > Creates a bossbar which can be used.
# > Parameters:
# > <text> title which should be displayed
# > [<text>] bossbar color - Options: "blue","green","pink","purple","red","white","yellow"
# > [<text>] bossbar segments - Options: "solid","6","10","12","20"
function createBossBar(title:text,barcolor:text="white",barstyle:text="solid") :: object:
#
# > Creates a bar color to the boxx bar. This is done to allow
# > the server operator easily calling the function with text.
if {_barcolor} is "blue":
set {_bc} to BarColor.BLUE!
else if {_barcolor} is "green":
set {_bc} to BarColor.GREEN!
else if {_barcolor} is "pink":
set {_bc} to BarColor.PINK!
else if {_barcolor} is "purple":
set {_bc} to BarColor.PURPLE!
else if {_barcolor} is "red":
set {_bc} to BarColor.RED!
else if {_barcolor} is "white":
set {_bc} to BarColor.WHITE!
else if {_barcolor} is "yellow":
set {_bc} to BarColor.YELLOW!

#
# > Creates a bar style to the boss bar. This is done to allow
# > the server operator easily calling the function with text.
if {_barstyle} is "solid":
set {_bs} to BarStyle.SOLID!
if {_barstyle} is "SEGMENTED_10" or "10":
set {_bs} to BarStyle.SEGMENTED_10!
if {_barstyle} is "SEGMENTED_12" or "12":
set {_bs} to BarStyle.SEGMENTED_12!
if {_barstyle} is "SEGMENTED_20" or "20":
set {_bs} to BarStyle.SEGMENTED_20!
if {_barstyle} is "SEGMENTED_6" or "6":
set {_bs} to BarStyle.SEGMENTED_6!

#
# > Return the created boss bar.
return Bukkit.createBossBar({_title}, {_bc}, {_bs}, null)

0 comments on commit 3a944c8

Please sign in to comment.