Skip to content

Conversation

@Fameless9
Copy link
Contributor

Hello, this PR adds a bossbar option.

Options

the bossbar feature supports the following options:

Setting What it does
title message shown on the bossbar (supports '&' color codes)
progress the progress of the bossbar (between 0.0 and 1.0)
color color of the bossbar (supported colors)
style style of the bossbar (supported styles)
show-after time until the bossbar should be shown (in seconds)
hide-after time until the bossbar should be hidden (in seconds)

The runnable controlling when to hide and show the bossbar will also automatically cancel itself when either the point has finished or hide-after has been reached to save resources.

Default values

title: empty, bossbar will not be shown
progress: 1.0
color: WHITE
style: SOLID
show-after: 0.0
hide-after: duration of the point

Example

bossbar:
  title: '&4Text'
  color: BLUE
  style: SEGMENTED_12
  progress: 0.6
  show-after: 2.5
  hide-after: 3.5
ServerTutorialPlus.bossbar.mp4

@MartenM
Copy link
Owner

MartenM commented Apr 22, 2024

Seems to be quite an okay PR.
Will be testing this later this week probably.

Copy link
Owner

@MartenM MartenM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, but seems to be missing an editor that allows to change this in-game.
Please attach one. See other settings for how this is done.

try {
String bossBarStyleString = tutorialSaves.getString("tutorials." + ID + ".points." + i + ".bossbar.style", "SOLID");
bossBarStyle = BarStyle.valueOf(bossBarStyleString.toUpperCase());
} catch (IllegalArgumentException e) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason for the 'try-catch' blocks here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, the exception IllegalArgumentException is caught when the valueOf method is called on the BarStyle enum with a string that doesn't match any of the enum constants.

@Fameless9
Copy link
Contributor Author

latest commit added the editor command /st editpoint

bossbar <title/progress/color/style/show-after/hide-after>

@Fameless9 Fameless9 requested a review from MartenM May 6, 2024 13:28
@mawoka-myblock
Copy link

Any progress as I'm personally interested in this feature, but already thanks for your work guys!

@MartenM
Copy link
Owner

MartenM commented May 16, 2024

I'm quite busy with my personal life right now.
It's still on my radar to review & merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants