Use spaces for "empty" titles.
Due to a breaking change in Spigot 1.17, sending a title with an empty string no longer works, even if a non-empty subtitle is provided. The TitleAnnouncer and TitleHealthBar components only use the subtitle portion of the title API to avoid obtrusive behavior. With this commit, the two components send a single space character as the title. Effectively, there is no difference between showing the empty string or a single space on the client-side. It's a dirty hack to fix something that should be fixed in Spigot instead, but odds are that it won't be. Fixes #683
This commit is contained in:
committed by
Andreas Troelsen
parent
c143cc81c9
commit
c9766dee97
@@ -27,6 +27,7 @@ These changes will (most likely) be included in the next version.
|
|||||||
- Pillagers and vindicators no longer spawn without their much-needed weapons.
|
- Pillagers and vindicators no longer spawn without their much-needed weapons.
|
||||||
- Piglins, piglin brutes, and hoglins no longer zombify. This fixes a bug where the mobs would despawn due to the zombification process.
|
- Piglins, piglin brutes, and hoglins no longer zombify. This fixes a bug where the mobs would despawn due to the zombification process.
|
||||||
- Reward groups with `nothing` in them no longer cause errors when earned/granted.
|
- Reward groups with `nothing` in them no longer cause errors when earned/granted.
|
||||||
|
- The title-based announcer and the title-based boss health bar have been fixed to work with the breaking change to the Title API in Spigot 1.17.
|
||||||
|
|
||||||
## [0.106] - 2021-05-09
|
## [0.106] - 2021-05-09
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class TitleAnnouncer implements Announcer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void announce(Player player, String message) {
|
public void announce(Player player, String message) {
|
||||||
player.sendTitle("", message, fadeIn, stay, fadeOut);
|
player.sendTitle(" ", message, fadeIn, stay, fadeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class TitleHealthBar implements HealthBar {
|
|||||||
String message = title.isEmpty() ? health : title + " " + health;
|
String message = title.isEmpty() ? health : title + " " + health;
|
||||||
|
|
||||||
players.forEach(player -> player.sendTitle(
|
players.forEach(player -> player.sendTitle(
|
||||||
"",
|
" ",
|
||||||
message,
|
message,
|
||||||
FADE_IN_TICKS,
|
FADE_IN_TICKS,
|
||||||
STAY_TICKS,
|
STAY_TICKS,
|
||||||
|
|||||||
Reference in New Issue
Block a user