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,12 +805,14 @@ public abstract class Disguise {
|
|||||||
getEntity().setMetadata("LastDisguise",
|
getEntity().setMetadata("LastDisguise",
|
||||||
new FixedMetadataValue(LibsDisguises.getInstance(), System.currentTimeMillis()));
|
new FixedMetadataValue(LibsDisguises.getInstance(), System.currentTimeMillis()));
|
||||||
|
|
||||||
|
if (NmsVersion.v1_13.isSupported()) {
|
||||||
BossBar bar = Bukkit.getBossBar(getBossBar());
|
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,6 +967,7 @@ public class DisguiseUtilities {
|
|||||||
registerNoName(board);
|
registerNoName(board);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NmsVersion.v1_13.isSupported()) {
|
||||||
Iterator<KeyedBossBar> bars = Bukkit.getBossBars();
|
Iterator<KeyedBossBar> bars = Bukkit.getBossBars();
|
||||||
ArrayList<KeyedBossBar> barList = new ArrayList<>();
|
ArrayList<KeyedBossBar> barList = new ArrayList<>();
|
||||||
bars.forEachRemaining(barList::add);
|
bars.forEachRemaining(barList::add);
|
||||||
@ -980,6 +981,7 @@ public class DisguiseUtilities {
|
|||||||
Bukkit.removeBossBar(bar.getKey());
|
Bukkit.removeBossBar(bar.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isDisguiseInUse(Disguise disguise) {
|
public static boolean isDisguiseInUse(Disguise disguise) {
|
||||||
return disguise.getEntity() != null && getDisguises().containsKey(disguise.getEntity().getUniqueId()) &&
|
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?
|
# 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