Skip to content

Conversation

@drolpi
Copy link
Owner

@drolpi drolpi commented Jan 9, 2024

No description provided.

Copy link
Owner Author

@drolpi drolpi left a comment

Choose a reason for hiding this comment

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

In general, I think the implementation is very good. I have noted some small changes, some of which you couldn't know, which I sometimes don't know exactly myself haha. Thanks for the implementation :).

protected void start(Counter counter) {
super.start(counter);
if (!this.bossBarFeature.isRegistered(replaceBossBarId)) {
this.bossBarFeature.register(this.replaceBossBarId, this.color, this.overlay);
Copy link
Owner Author

Choose a reason for hiding this comment

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

I don't think we should register a boss bar during the runtime of a phase. If at all, this should happen in the constructor, because it is called during the configuration of a phase / game or directly after loading the configuration file

this.bossBar.setProgress(progress);
protected void set(Player player, long count, float progress) {
if (!this.bossBarFeature.isRegistered(replaceBossBarId)) {
this.bossBarFeature.register(this.replaceBossBarId, this.color, this.overlay);
Copy link
Owner Author

Choose a reason for hiding this comment

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

Same as above, here too we should not register during the term of a phase

//TODO: Lang
this.bossBar.setTitle("" + count);
this.bossBar.setProgress(progress);
protected void set(Player player, long count, float progress) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

The player is not used, is it?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Maybe we should change the AbstractCounterProgressFeature so that there is no player loop and move it to the LevelCounterFeature, because it is not needed for the BossBarCounterFeature and the method is called unnecessarily often.

private BarColor color = BarColor.BLUE;
@Expose
private BarStyle style = BarStyle.SEGMENTED_20;
private final List<BossBarInfo> bossBarInfos;
Copy link
Owner Author

Choose a reason for hiding this comment

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

I would rename the field to "bossBars" as it is correctly named in the Java code but not relevant in the config for the end user. My preferred alternative is to use the @SerialiedName annotation from Gson. https://www.javadoc.io/doc/com.google.code.gson/gson/2.6.2/com/google/gson/annotations/SerializedName.html


private final Map<String, BossBarContainer> bossBars;

private final Phase phase;
Copy link
Owner Author

Choose a reason for hiding this comment

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

I would declare the phase directly under the game, since our field sorting is unofficially always like this:

  • Attributes that are passed by the constructor or are related to a passing class.
  • Attributes that are exposed and thus stored in the config
  • Non-final attributes that are changed during (in this case feature runtime).

This should also be observed in other classes.


private BossBar bossBar;
@Expose
private final String replaceBossBarId = "counter";
Copy link
Owner Author

Choose a reason for hiding this comment

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

Maybe rename?, a little bit long and redundant.

private BossBar bossBar;
@Expose
private final String replaceBossBarId = "counter";
private final Component component;
Copy link
Owner Author

Choose a reason for hiding this comment

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

See field order :)

return this.getContainer(id).hidden;
}

public void setHidden(String id, boolean hidden) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

We dont use set or get prefixes.

return this.getContainer(id).bossBar.progress();
}

public void setProgress(String id, float progress) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

We dont use set or get prefixes.


public BarColor color() {
return this.color;
public void setName(String id, Component name) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

Should also contain the tag resolvers, as these are directly related to the text.

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