BossBars are no longer supported in 1.12 due to api restrictions
This commit is contained in:
parent
dc2a1a23a0
commit
a2262860d5
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<!-- A good example on why temporary names for project identification shouldn't be used -->
|
<!-- A good example on why temporary names for project identification shouldn't be used -->
|
||||||
<groupId>LibsDisguises</groupId>
|
<groupId>LibsDisguises</groupId>
|
||||||
<artifactId>LibsDisguises</artifactId>
|
<artifactId>LibsDisguises</artifactId>
|
||||||
<version>10.0.1</version>
|
<version>10.0.1-SNAPSHOT</version>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>exec:java clean install</defaultGoal>
|
<defaultGoal>exec:java clean install</defaultGoal>
|
||||||
|
@ -444,6 +444,14 @@ public class DisguiseConfig {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
setNotifyBar(NotifyBar.valueOf(config.getString("NotifyBar").toUpperCase()));
|
setNotifyBar(NotifyBar.valueOf(config.getString("NotifyBar").toUpperCase()));
|
||||||
|
|
||||||
|
if (getNotifyBar() == NotifyBar.BOSS_BAR) {
|
||||||
|
DisguiseUtilities.getLogger().warning(
|
||||||
|
"BossBars hasn't been implemented properly in 1.12 due to api restrictions, falling back to " +
|
||||||
|
"ACTION_BAR");
|
||||||
|
|
||||||
|
setNotifyBar(NotifyBar.ACTION_BAR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
DisguiseUtilities.getLogger()
|
DisguiseUtilities.getLogger()
|
||||||
|
@ -20,6 +20,7 @@ import me.libraryaddict.disguise.events.DisguiseEvent;
|
|||||||
import me.libraryaddict.disguise.events.UndisguiseEvent;
|
import me.libraryaddict.disguise.events.UndisguiseEvent;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||||
|
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
@ -186,7 +187,8 @@ public abstract class Disguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void makeBossBar() {
|
private void makeBossBar() {
|
||||||
if (getNotifyBar() != DisguiseConfig.NotifyBar.BOSS_BAR || !(getEntity() instanceof Player)) {
|
if (getNotifyBar() != DisguiseConfig.NotifyBar.BOSS_BAR || !NmsVersion.v1_13.isSupported() ||
|
||||||
|
!(getEntity() instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -803,11 +805,13 @@ public abstract class Disguise {
|
|||||||
getEntity().setMetadata("LastDisguise",
|
getEntity().setMetadata("LastDisguise",
|
||||||
new FixedMetadataValue(LibsDisguises.getInstance(), System.currentTimeMillis()));
|
new FixedMetadataValue(LibsDisguises.getInstance(), System.currentTimeMillis()));
|
||||||
|
|
||||||
BossBar bar = Bukkit.getBossBar(getBossBar());
|
if (NmsVersion.v1_13.isSupported()) {
|
||||||
|
BossBar bar = Bukkit.getBossBar(getBossBar());
|
||||||
|
|
||||||
if (bar != null) {
|
if (bar != null) {
|
||||||
bar.removeAll();
|
bar.removeAll();
|
||||||
Bukkit.removeBossBar(getBossBar());
|
Bukkit.removeBossBar(getBossBar());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -967,17 +967,19 @@ public class DisguiseUtilities {
|
|||||||
registerNoName(board);
|
registerNoName(board);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<KeyedBossBar> bars = Bukkit.getBossBars();
|
if (NmsVersion.v1_13.isSupported()) {
|
||||||
ArrayList<KeyedBossBar> barList = new ArrayList<>();
|
Iterator<KeyedBossBar> bars = Bukkit.getBossBars();
|
||||||
bars.forEachRemaining(barList::add);
|
ArrayList<KeyedBossBar> barList = new ArrayList<>();
|
||||||
|
bars.forEachRemaining(barList::add);
|
||||||
|
|
||||||
for (KeyedBossBar bar : barList) {
|
for (KeyedBossBar bar : barList) {
|
||||||
if (!bar.getKey().getNamespace().equalsIgnoreCase("libsdisguises")) {
|
if (!bar.getKey().getNamespace().equalsIgnoreCase("libsdisguises")) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bar.removeAll();
|
||||||
|
Bukkit.removeBossBar(bar.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
bar.removeAll();
|
|
||||||
Bukkit.removeBossBar(bar.getKey());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@ HearSelfDisguise: true
|
|||||||
|
|
||||||
# When disguised, should a message be displayed to the player? If so, where?
|
# When disguised, should a message be displayed to the player? If so, where?
|
||||||
# The message can be customized in translations
|
# The message can be customized in translations
|
||||||
|
# BOSS_BAR is not supported in 1.12!
|
||||||
# NONE, BOSS_BAR, ACTION_BAR
|
# NONE, BOSS_BAR, ACTION_BAR
|
||||||
NotifyBar: ACTION_BAR
|
NotifyBar: ACTION_BAR
|
||||||
# If using boss bar, these two options come into play
|
# If using boss bar, these two options come into play
|
||||||
|
Loading…
Reference in New Issue
Block a user