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 -->
|
||||
<groupId>LibsDisguises</groupId>
|
||||
<artifactId>LibsDisguises</artifactId>
|
||||
<version>10.0.1</version>
|
||||
<version>10.0.1-SNAPSHOT</version>
|
||||
|
||||
<build>
|
||||
<defaultGoal>exec:java clean install</defaultGoal>
|
||||
|
@ -444,6 +444,14 @@ public class DisguiseConfig {
|
||||
|
||||
try {
|
||||
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) {
|
||||
DisguiseUtilities.getLogger()
|
||||
|
@ -20,6 +20,7 @@ import me.libraryaddict.disguise.events.DisguiseEvent;
|
||||
import me.libraryaddict.disguise.events.UndisguiseEvent;
|
||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||
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.translations.LibsMsg;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
@ -186,7 +187,8 @@ public abstract class Disguise {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -803,12 +805,14 @@ public abstract class Disguise {
|
||||
getEntity().setMetadata("LastDisguise",
|
||||
new FixedMetadataValue(LibsDisguises.getInstance(), System.currentTimeMillis()));
|
||||
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
BossBar bar = Bukkit.getBossBar(getBossBar());
|
||||
|
||||
if (bar != null) {
|
||||
bar.removeAll();
|
||||
Bukkit.removeBossBar(getBossBar());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -967,6 +967,7 @@ public class DisguiseUtilities {
|
||||
registerNoName(board);
|
||||
}
|
||||
|
||||
if (NmsVersion.v1_13.isSupported()) {
|
||||
Iterator<KeyedBossBar> bars = Bukkit.getBossBars();
|
||||
ArrayList<KeyedBossBar> barList = new ArrayList<>();
|
||||
bars.forEachRemaining(barList::add);
|
||||
@ -980,6 +981,7 @@ public class DisguiseUtilities {
|
||||
Bukkit.removeBossBar(bar.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDisguiseInUse(Disguise disguise) {
|
||||
return disguise.getEntity() != null && getDisguises().containsKey(disguise.getEntity().getUniqueId()) &&
|
||||
|
@ -127,6 +127,7 @@ HearSelfDisguise: true
|
||||
|
||||
# When disguised, should a message be displayed to the player? If so, where?
|
||||
# The message can be customized in translations
|
||||
# BOSS_BAR is not supported in 1.12!
|
||||
# NONE, BOSS_BAR, ACTION_BAR
|
||||
NotifyBar: ACTION_BAR
|
||||
# If using boss bar, these two options come into play
|
||||
|
Loading…
Reference in New Issue
Block a user