2929
3030public class BossBarListener implements Listener {
3131
32+ private static final String AONEBLOCK_BOSSBAR = "aoneblock.bossbar" ;
33+
3234 public BossBarListener (AOneBlock addon ) {
3335 super ();
3436 this .addon = addon ;
@@ -54,7 +56,7 @@ public void onEnterIsland(IslandEnterEvent event) {
5456
5557 @ EventHandler (priority = EventPriority .NORMAL , ignoreCancelled = true )
5658 public void onFlagChange (FlagSettingChangeEvent e ) {
57- if (e .getEditedFlag () == addon .ONEBLOCK_BOSSBAR ) {
59+ if (e .getEditedFlag () == addon .BOSSBAR ) {
5860 // Show to players on island. If it isn't allowed then this will clean up the boss bar too
5961 e .getIsland ().getPlayersOnIsland ().stream ().map (Player ::getUniqueId )
6062 .forEach (uuid -> this .tryToShowBossBar (uuid , e .getIsland ()));
@@ -70,7 +72,7 @@ private void tryToShowBossBar(UUID uuid, Island island) {
7072 User user = User .getInstance (uuid );
7173
7274 // Only show if enabled for island
73- if (!island .isAllowed (addon .ONEBLOCK_BOSSBAR )) {
75+ if (!island .isAllowed (addon .BOSSBAR )) {
7476 BossBar removed = islandBossBars .remove (island );
7577 if (removed != null ) {
7678 // Remove all players from the boss bar
@@ -79,7 +81,7 @@ private void tryToShowBossBar(UUID uuid, Island island) {
7981 return ;
8082 }
8183 // Default to showing boss bar unless it is explicitly turned off
82- if (!user .getMetaData ("aoneblock.bossbar" ).map (MetaDataValue ::asBoolean ).orElse (true )) {
84+ if (!user .getMetaData (AONEBLOCK_BOSSBAR ).map (MetaDataValue ::asBoolean ).orElse (true )) {
8385 // Remove any boss bar from user if they are in the world
8486 removeBar (user , island );
8587 // Do not show a boss bar
@@ -170,8 +172,8 @@ public void onQuit(PlayerQuitEvent e) {
170172 * @param user user to toggle
171173 */
172174 public void toggleUser (User user ) {
173- boolean newState = !user .getMetaData ("aoneblock.bossbar" ).map (MetaDataValue ::asBoolean ).orElse (true );
174- user .putMetaData ("aoneblock.bossbar" , new MetaDataValue (newState ));
175+ boolean newState = !user .getMetaData (AONEBLOCK_BOSSBAR ).map (MetaDataValue ::asBoolean ).orElse (true );
176+ user .putMetaData (AONEBLOCK_BOSSBAR , new MetaDataValue (newState ));
175177 if (newState ) {
176178 // If the player is on an island then show the bar
177179 addon .getIslands ().getIslandAt (user .getLocation ()).filter (is -> addon .inWorld (is .getWorld ()))
0 commit comments