updated InfoBars to use Bukkit scheduler for data container updates; enhanced CoordinateDisplay with Unicode icons and adjusted text styling
This commit is contained in:
@@ -59,7 +59,7 @@ public class CoordinateDisplay extends Appliance {
|
|||||||
List<Component> components = new ArrayList<>();
|
List<Component> components = new ArrayList<>();
|
||||||
|
|
||||||
if (config.coordinates()) {
|
if (config.coordinates()) {
|
||||||
components.add(Component.text("XYZ: ", NamedTextColor.GOLD));
|
components.add(Component.text("\uD83C\uDF0E ", NamedTextColor.GOLD));
|
||||||
components.add(Component.text(String.format(
|
components.add(Component.text(String.format(
|
||||||
"%d %d %d",
|
"%d %d %d",
|
||||||
player.getLocation().getBlockX(),
|
player.getLocation().getBlockX(),
|
||||||
@@ -70,17 +70,17 @@ public class CoordinateDisplay extends Appliance {
|
|||||||
|
|
||||||
if (config.direction()) {
|
if (config.direction()) {
|
||||||
if (!components.isEmpty()) {
|
if (!components.isEmpty()) {
|
||||||
components.add(Component.text(" | ", NamedTextColor.DARK_GRAY));
|
components.add(Component.text(" | ", NamedTextColor.GRAY));
|
||||||
}
|
}
|
||||||
components.add(Component.text("Richtung: ", NamedTextColor.GOLD));
|
components.add(Component.text("\uD83E\uDDED ", NamedTextColor.GOLD));
|
||||||
components.add(Component.text(DataSizeConverter.getCardinalDirection(player.getLocation())));
|
components.add(Component.text(DataSizeConverter.getCardinalDirection(player.getLocation())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.time()) {
|
if (config.time()) {
|
||||||
if (!components.isEmpty()) {
|
if (!components.isEmpty()) {
|
||||||
components.add(Component.text(" | ", NamedTextColor.DARK_GRAY));
|
components.add(Component.text(" | ", NamedTextColor.GRAY));
|
||||||
}
|
}
|
||||||
components.add(Component.text("Zeit: ", NamedTextColor.GOLD));
|
components.add(Component.text("⏱ ", NamedTextColor.GOLD));
|
||||||
components.add(Component.text(WorldUtils.getGameTime(player.getWorld())));
|
components.add(Component.text(WorldUtils.getGameTime(player.getWorld())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,6 +7,7 @@ import eu.mhsl.craftattack.spawn.core.appliance.ApplianceCommand;
|
|||||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.infoBars.bars.MsptBar;
|
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.infoBars.bars.MsptBar;
|
||||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.infoBars.bars.PlayerCounterBar;
|
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.infoBars.bars.PlayerCounterBar;
|
||||||
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.infoBars.bars.TpsBar;
|
import eu.mhsl.craftattack.spawn.common.appliances.metaGameplay.infoBars.bars.TpsBar;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -57,7 +58,10 @@ public class InfoBars extends Appliance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setEnabledBars(Player player, List<String> bars) {
|
private void setEnabledBars(Player player, List<String> bars) {
|
||||||
player.getPersistentDataContainer().set(this.infoBarKey, PersistentDataType.LIST.strings(), bars);
|
Bukkit.getScheduler().runTask(
|
||||||
|
Main.instance(),
|
||||||
|
() -> player.getPersistentDataContainer().set(this.infoBarKey, PersistentDataType.LIST.strings(), bars)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Bar getBarByName(String name) {
|
private Bar getBarByName(String name) {
|
||||||
|
Reference in New Issue
Block a user