Skip to content

Commit

Permalink
Make bungeecord-chat API classes final - the API does not (nor should…
Browse files Browse the repository at this point in the history
…) support subclassing.
  • Loading branch information
md-5 committed Dec 26, 2017
1 parent 9fd9843 commit dda0638
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* part's formatting
* </p>
*/
public class ComponentBuilder
public final class ComponentBuilder
{

private BaseComponent current;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@Getter
@ToString
@RequiredArgsConstructor
final public class HoverEvent
public final class HoverEvent
{

private final Action action;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@Setter
@ToString
@NoArgsConstructor
public class KeybindComponent extends BaseComponent
public final class KeybindComponent extends BaseComponent
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@Getter
@Setter
@AllArgsConstructor
public class TextComponent extends BaseComponent
public final class TextComponent extends BaseComponent
{

private static final Pattern url = Pattern.compile( "^(?:(https?)://)?([-\\w_\\.]{2,}\\.[a-z]{2,4})(/\\S*)?$" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@Setter
@ToString
@NoArgsConstructor
public class TranslatableComponent extends BaseComponent
public final class TranslatableComponent extends BaseComponent
{

private final ResourceBundle locales = ResourceBundle.getBundle( "mojang-translations/en_US" );
Expand Down

7 comments on commit dda0638

@gw2princeps
Copy link

Choose a reason for hiding this comment

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

Haha this broke my workaround xD

@md-5
Copy link
Member Author

@md-5 md-5 commented on dda0638 Dec 28, 2017

Choose a reason for hiding this comment

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

Workaround for what?

@gw2princeps
Copy link

Choose a reason for hiding this comment

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

https://www.spigotmc.org/threads/componentbuilder-resets-color.288424/
My very last post. I extended ComponentBuilder to add a Method which was added in 1.12 (I must support 1.8.8 - 1.12).
Guess I will just use the normal ComponentBuilder for 1.12 versions and everything below the CustomComponentBuilder

@Janmm14
Copy link
Contributor

Choose a reason for hiding this comment

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

I've seen compeltely healthy code extending the ComponentBuilder to add more methods with ease. Providing more convenient methods, specialized methods, etc. through extending the ComponentBuilder seems compeltely legit for me.

@md-5
Copy link
Member Author

@md-5 md-5 commented on dda0638 Dec 28, 2017

Choose a reason for hiding this comment

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

Builders are most definitely not meant to be extendable.

@Mystiflow
Copy link
Contributor

Choose a reason for hiding this comment

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

@SpatiumPrinceps

If you're using an unsupported version, why would this commit affect you? If your 1.8 supporting fork would have this patch why wouldn't it have the method added in 1.12 unless you specifically excluded it?

Either way, I skimmed over your code on forum; why not just stop extending and convert into a utility class?

@gw2princeps
Copy link

Choose a reason for hiding this comment

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

@Mystiflow
This commit affects me, because my users are expecting me to support all the versions (and I took the extending approach).

Already fixed it, although havent uploaded yet.

Dont get me wrong, I appreciate the work you are putting into this, md-5 :)

Please sign in to comment.