mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 15:09:23 +00:00
2.2.1.0
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'net.momirealms'
|
||||
version = '2.2.0.8'
|
||||
version = '2.2.1.0'
|
||||
|
||||
repositories {
|
||||
maven {name = "aliyun-repo"; url = "https://maven.aliyun.com/repository/public/"}
|
||||
@@ -62,7 +62,7 @@ processResources {
|
||||
shadowJar {
|
||||
relocate ('net.kyori', 'net.momirealms.customnameplates.libs.net.kyori')
|
||||
relocate ('org.bstats', 'net.momirealms.customnameplates.libs.org.bstats')
|
||||
relocate ('net.momirealms', 'net.momirealms.customnameplates.libs.net.momirealms')
|
||||
relocate ('net.momirealms.biomeapi', 'net.momirealms.customnameplates.libs.net.momirealms.biomeapi')
|
||||
}
|
||||
|
||||
tasks.register("delete", Delete).get().delete("build/libs/"+project.name+"-"+project.version+".jar")
|
||||
|
||||
Binary file not shown.
BIN
libs/MagicCosmetics-2.3.7-API.jar
Normal file
BIN
libs/MagicCosmetics-2.3.7-API.jar
Normal file
Binary file not shown.
@@ -27,7 +27,7 @@ import net.momirealms.customnameplates.command.AbstractSubCommand;
|
||||
import net.momirealms.customnameplates.manager.MessageManager;
|
||||
import net.momirealms.customnameplates.manager.NameplateManager;
|
||||
import net.momirealms.customnameplates.object.nameplate.NameplateConfig;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import net.momirealms.customnameplates.utils.AdventureUtils;
|
||||
import net.momirealms.customnameplates.utils.ArmorStandUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -70,7 +70,7 @@ public class ForcePreviewCommand extends AbstractSubCommand {
|
||||
.append(Component.text(player.getName()).color(TextColor.color(AdventureUtils.colorToDecimal(nameplateConfig.color()))).font(Key.key("minecraft:default"))
|
||||
.append(MiniMessage.miniMessage().deserialize(suffixImage)));
|
||||
ArmorStandUtils.preview(holoComponent, player, (int) nameplateManager.getPreview_time());
|
||||
} else if (nameplateManager.getMode() == DisplayMode.ARMOR_STAND) {
|
||||
} else if (nameplateManager.getMode() == DisplayMode.ARMOR_STAND || nameplateManager.getMode() == DisplayMode.TEXT_DISPLAY) {
|
||||
nameplateManager.showPlayerArmorStandTags(player, nameplate);
|
||||
} else {
|
||||
AdventureUtils.sendMessage(sender, MessageManager.prefix + "<white>Nameplate is disabled.");
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.momirealms.customnameplates.command.AbstractSubCommand;
|
||||
import net.momirealms.customnameplates.manager.MessageManager;
|
||||
import net.momirealms.customnameplates.manager.NameplateManager;
|
||||
import net.momirealms.customnameplates.object.nameplate.NameplatesTeam;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import net.momirealms.customnameplates.utils.AdventureUtils;
|
||||
import net.momirealms.customnameplates.utils.ArmorStandUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -57,7 +57,7 @@ public class PreviewCommand extends AbstractSubCommand {
|
||||
.append(team.getNameplateSuffixComponent()));
|
||||
ArmorStandUtils.preview(full, player, (int) nameplateManager.getPreview_time());
|
||||
}
|
||||
} else if (nameplateManager.getMode() == DisplayMode.ARMOR_STAND) {
|
||||
} else if (nameplateManager.getMode() == DisplayMode.ARMOR_STAND || nameplateManager.getMode() == DisplayMode.TEXT_DISPLAY) {
|
||||
nameplateManager.showPlayerArmorStandTags(player);
|
||||
} else {
|
||||
AdventureUtils.playerMessage(player, MessageManager.prefix + "<white>Nameplate is disabled.");
|
||||
|
||||
@@ -61,8 +61,7 @@ public class FileStorageImpl implements DataStorageInterface {
|
||||
data.set("nameplate", playerData.getNameplate());
|
||||
try {
|
||||
data.save(new File(plugin.getDataFolder(), "player_data" + File.separator + playerData.getUuid() + ".yml"));
|
||||
}
|
||||
catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@ public class SqlConnection {
|
||||
hikariConfig.addDataSourceProperty(property, config.getString(storageMode + ".properties." + property));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
hikariDataSource = new HikariDataSource(hikariConfig);
|
||||
} catch (HikariPool.PoolInitializationException e) {
|
||||
|
||||
@@ -33,6 +33,7 @@ public class VersionHelper {
|
||||
|
||||
private boolean isNewerThan1_19_R2;
|
||||
private boolean isNewerThan1_19;
|
||||
private boolean isNewerThan1_20;
|
||||
private String serverVersion;
|
||||
private final CustomNameplates plugin;
|
||||
private final String pluginVersion;
|
||||
@@ -55,6 +56,7 @@ public class VersionHelper {
|
||||
else if (main_ver == 19) isNewerThan1_19_R2 = Integer.parseInt(split[2].substring(1)) >= 2;
|
||||
else isNewerThan1_19_R2 = false;
|
||||
isNewerThan1_19 = main_ver >= 19;
|
||||
isNewerThan1_20 = main_ver >= 20;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +68,10 @@ public class VersionHelper {
|
||||
return isNewerThan1_19;
|
||||
}
|
||||
|
||||
public boolean isVersionNewerThan1_20() {
|
||||
return isNewerThan1_20;
|
||||
}
|
||||
|
||||
public void checkUpdate() {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try {
|
||||
@@ -102,6 +108,9 @@ public class VersionHelper {
|
||||
|
||||
private int getPack_format(String version) {
|
||||
switch (version) {
|
||||
case "v1_20_R1" -> {
|
||||
return 15;
|
||||
}
|
||||
case "v1_19_R3" -> {
|
||||
return 13;
|
||||
}
|
||||
|
||||
@@ -17,21 +17,21 @@
|
||||
|
||||
package net.momirealms.customnameplates.listener;
|
||||
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.EntityTag;
|
||||
import net.momirealms.customnameplates.object.carrier.NamedEntityCarrier;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
|
||||
public record EntityTagListener(EntityTag entityTag) implements Listener {
|
||||
public record EntityTagListener(NamedEntityCarrier namedEntityCarrier) implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onSneak(PlayerToggleSneakEvent event) {
|
||||
entityTag.onSneak(event.getPlayer(), event.isSneaking());
|
||||
namedEntityCarrier.onSneak(event.getPlayer(), event.isSneaking());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRespawn(PlayerRespawnEvent event) {
|
||||
entityTag.onRespawn(event.getPlayer());
|
||||
namedEntityCarrier.onRespawn(event.getPlayer());
|
||||
}
|
||||
}
|
||||
@@ -2,23 +2,23 @@ package net.momirealms.customnameplates.listener.compatibility;
|
||||
|
||||
import com.francobm.magicosmetics.api.Cosmetic;
|
||||
import com.francobm.magicosmetics.api.CosmeticType;
|
||||
import com.francobm.magicosmetics.api.MagicAPI;
|
||||
import com.francobm.magicosmetics.cache.cosmetics.Hat;
|
||||
import com.francobm.magicosmetics.events.CosmeticChangeEquipEvent;
|
||||
import com.francobm.magicosmetics.events.CosmeticEquipEvent;
|
||||
import com.francobm.magicosmetics.events.CosmeticUnEquipEvent;
|
||||
import net.momirealms.customnameplates.object.armorstand.ArmorStandManager;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.EntityTag;
|
||||
import com.francobm.magicosmetics.events.PlayerDataLoadEvent;
|
||||
import net.momirealms.customnameplates.object.carrier.NamedEntityManager;
|
||||
import net.momirealms.customnameplates.object.carrier.NamedEntityCarrier;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class MagicCosmeticsListener implements Listener {
|
||||
|
||||
private final EntityTag entityTag;
|
||||
private final NamedEntityCarrier namedEntityCarrier;
|
||||
|
||||
public MagicCosmeticsListener(EntityTag entityTag) {
|
||||
this.entityTag = entityTag;
|
||||
public MagicCosmeticsListener(NamedEntityCarrier namedEntityCarrier) {
|
||||
this.namedEntityCarrier = namedEntityCarrier;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -26,7 +26,7 @@ public class MagicCosmeticsListener implements Listener {
|
||||
final Cosmetic cosmetic = event.getNewCosmetic();
|
||||
final Player player = event.getPlayer();
|
||||
if (cosmetic instanceof Hat hat) {
|
||||
ArmorStandManager asm = entityTag.getArmorStandManager(player);
|
||||
NamedEntityManager asm = namedEntityCarrier.getNamedEntityManager(player);
|
||||
if (asm != null) {
|
||||
asm.setHatOffset(hat.getOffSetY());
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class MagicCosmeticsListener implements Listener {
|
||||
final Cosmetic cosmetic = event.getCosmetic();
|
||||
final Player player = event.getPlayer();
|
||||
if (cosmetic instanceof Hat hat) {
|
||||
ArmorStandManager asm = entityTag.getArmorStandManager(player);
|
||||
NamedEntityManager asm = namedEntityCarrier.getNamedEntityManager(player);
|
||||
if (asm != null) {
|
||||
asm.setHatOffset(hat.getOffSetY());
|
||||
}
|
||||
@@ -49,15 +49,22 @@ public class MagicCosmeticsListener implements Listener {
|
||||
public void onUnEquip(CosmeticUnEquipEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (event.getCosmeticType() == CosmeticType.HAT) {
|
||||
ArmorStandManager asm = entityTag.getArmorStandManager(player);
|
||||
NamedEntityManager asm = namedEntityCarrier.getNamedEntityManager(player);
|
||||
if (asm != null) {
|
||||
asm.setHatOffset(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Lack an event
|
||||
public void onJoin(Player player) {
|
||||
|
||||
@EventHandler
|
||||
public void onDataLoaded(PlayerDataLoadEvent event) {
|
||||
for (Cosmetic cosmetic : event.getEquippedCosmetics()) {
|
||||
if (cosmetic instanceof Hat hat) {
|
||||
NamedEntityManager asm = namedEntityCarrier.getNamedEntityManager(event.getPlayerData().getOfflinePlayer().getPlayer());
|
||||
if (asm != null) {
|
||||
asm.setHatOffset(hat.getOffSetY());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.PacketsHandler;
|
||||
import net.momirealms.customnameplates.object.carrier.AbstractPacketsHandler;
|
||||
|
||||
public class EntityDestroyListener extends PacketAdapter {
|
||||
|
||||
private final PacketsHandler handler;
|
||||
private final AbstractPacketsHandler handler;
|
||||
|
||||
public EntityDestroyListener(PacketsHandler handler) {
|
||||
public EntityDestroyListener(AbstractPacketsHandler handler) {
|
||||
super(CustomNameplates.getInstance(), ListenerPriority.HIGHEST, PacketType.Play.Server.ENTITY_DESTROY);
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.PacketsHandler;
|
||||
import net.momirealms.customnameplates.object.carrier.AbstractPacketsHandler;
|
||||
|
||||
public class EntityLookListener extends PacketAdapter {
|
||||
|
||||
private final PacketsHandler handler;
|
||||
private final AbstractPacketsHandler handler;
|
||||
|
||||
public EntityLookListener(PacketsHandler handler) {
|
||||
public EntityLookListener(AbstractPacketsHandler handler) {
|
||||
super(CustomNameplates.getInstance(), ListenerPriority.HIGHEST, PacketType.Play.Server.REL_ENTITY_MOVE_LOOK);
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.PacketsHandler;
|
||||
import net.momirealms.customnameplates.object.carrier.AbstractPacketsHandler;
|
||||
|
||||
public class EntityMoveListener extends PacketAdapter {
|
||||
|
||||
private final PacketsHandler handler;
|
||||
private final AbstractPacketsHandler handler;
|
||||
|
||||
public EntityMoveListener(PacketsHandler handler) {
|
||||
public EntityMoveListener(AbstractPacketsHandler handler) {
|
||||
super(CustomNameplates.getInstance(), ListenerPriority.NORMAL, PacketType.Play.Server.REL_ENTITY_MOVE);
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.PacketsHandler;
|
||||
import net.momirealms.customnameplates.object.carrier.AbstractPacketsHandler;
|
||||
|
||||
public class EntitySpawnListener extends PacketAdapter {
|
||||
|
||||
private final PacketsHandler handler;
|
||||
private final AbstractPacketsHandler handler;
|
||||
|
||||
public EntitySpawnListener(PacketsHandler handler) {
|
||||
public EntitySpawnListener(AbstractPacketsHandler handler) {
|
||||
super(CustomNameplates.getInstance(), ListenerPriority.HIGHEST, PacketType.Play.Server.NAMED_ENTITY_SPAWN);
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.PacketsHandler;
|
||||
import net.momirealms.customnameplates.object.carrier.AbstractPacketsHandler;
|
||||
|
||||
public class EntityTeleportListener extends PacketAdapter {
|
||||
|
||||
private final PacketsHandler handler;
|
||||
private final AbstractPacketsHandler handler;
|
||||
|
||||
public EntityTeleportListener(PacketsHandler handler) {
|
||||
public EntityTeleportListener(AbstractPacketsHandler handler) {
|
||||
super(CustomNameplates.getInstance(), ListenerPriority.HIGHEST, PacketType.Play.Server.ENTITY_TELEPORT);
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -89,8 +90,8 @@ public class BossBarManager extends Function {
|
||||
if (bossBarSection == null) continue;
|
||||
bossBars.put(key, new BossBarConfig(
|
||||
bossBarSection.getString("text") == null ? bossBarSection.getStringList("dynamic-text").toArray(new String[0]) : new String[]{bossBarSection.getString("text")},
|
||||
Overlay.valueOf(bossBarSection.getString("overlay","progress").toUpperCase()),
|
||||
BarColor.valueOf(bossBarSection.getString("color","white").toUpperCase()),
|
||||
Overlay.valueOf(bossBarSection.getString("overlay","progress").toUpperCase(Locale.ENGLISH)),
|
||||
BarColor.valueOf(bossBarSection.getString("color","white").toUpperCase(Locale.ENGLISH)),
|
||||
bossBarSection.getInt("switch-interval", 5) * 20,
|
||||
ConfigUtils.getRequirements(bossBarSection.getConfigurationSection("conditions"))
|
||||
));
|
||||
|
||||
@@ -22,20 +22,19 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.api.events.BubblesEvent;
|
||||
import net.momirealms.customnameplates.listener.AbstractChatListener;
|
||||
import net.momirealms.customnameplates.listener.AsyncChatListener;
|
||||
import net.momirealms.customnameplates.listener.TrChatListener;
|
||||
import net.momirealms.customnameplates.listener.VentureChatListener;
|
||||
import net.momirealms.customnameplates.listener.*;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.Function;
|
||||
import net.momirealms.customnameplates.object.SimpleChar;
|
||||
import net.momirealms.customnameplates.object.armorstand.ArmorStandManager;
|
||||
import net.momirealms.customnameplates.object.armorstand.FakeArmorStand;
|
||||
import net.momirealms.customnameplates.object.bubble.BBPacketsHandle;
|
||||
import net.momirealms.customnameplates.object.carrier.NamedEntityManager;
|
||||
import net.momirealms.customnameplates.object.carrier.NamedEntityImpl;
|
||||
import net.momirealms.customnameplates.object.bubble.BubbleConfig;
|
||||
import net.momirealms.customnameplates.object.emoji.ImageParser;
|
||||
import net.momirealms.customnameplates.object.emoji.ItemsAdderImpl;
|
||||
import net.momirealms.customnameplates.object.emoji.OraxenImpl;
|
||||
import net.momirealms.customnameplates.object.carrier.TextDisplayMeta;
|
||||
import net.momirealms.customnameplates.object.img.ImageParser;
|
||||
import net.momirealms.customnameplates.object.img.ItemsAdderImageImpl;
|
||||
import net.momirealms.customnameplates.object.img.OraxenImageImpl;
|
||||
import net.momirealms.customnameplates.object.font.OffsetFont;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.EntityTag;
|
||||
import net.momirealms.customnameplates.object.carrier.NamedEntityCarrier;
|
||||
import net.momirealms.customnameplates.utils.AdventureUtils;
|
||||
import net.momirealms.customnameplates.utils.ConfigUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -51,13 +50,19 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ChatBubblesManager extends EntityTag {
|
||||
public class ChatBubblesManager extends Function {
|
||||
|
||||
private AbstractChatListener chatListener;
|
||||
private ImageParser imageParser;
|
||||
private final ConcurrentHashMap<Player, Long> coolDownMap;
|
||||
private final HashMap<String, BubbleConfig> bubbleConfigMap;
|
||||
private final CustomNameplates plugin;
|
||||
private NamedEntityCarrier namedEntityCarrier;
|
||||
private final JoinQuitListener joinQuitListener;
|
||||
private String defaultBubble;
|
||||
private String defaultStartFormat;
|
||||
private String defaultEndFormat;
|
||||
@@ -70,25 +75,13 @@ public class ChatBubblesManager extends EntityTag {
|
||||
private int maxCharLength;
|
||||
private int lengthPerLine;
|
||||
private String[] channels;
|
||||
private final ConcurrentHashMap<Player, Long> coolDownMap;
|
||||
private final HashMap<String, BubbleConfig> bubbleConfigMap;
|
||||
private final CustomNameplates plugin;
|
||||
private TextDisplayMeta textDisplayMeta;
|
||||
|
||||
public ChatBubblesManager(CustomNameplates plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.bubbleConfigMap = new HashMap<>();
|
||||
this.coolDownMap = new ConcurrentHashMap<>();
|
||||
super.handler = new BBPacketsHandle(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadToAllPlayers() {
|
||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||
createArmorStandManager(all);
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
spawnArmorStands(player, all);
|
||||
}
|
||||
this.joinQuitListener = new JoinQuitListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,6 +92,7 @@ public class ChatBubblesManager extends EntityTag {
|
||||
this.loadBubbles();
|
||||
this.registerListener();
|
||||
this.registerImageParser();
|
||||
this.namedEntityCarrier.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,31 +102,35 @@ public class ChatBubblesManager extends EntityTag {
|
||||
this.bubbleConfigMap.clear();
|
||||
this.coolDownMap.clear();
|
||||
if (chatListener != null) HandlerList.unregisterAll(chatListener);
|
||||
if (joinQuitListener != null) HandlerList.unregisterAll(joinQuitListener);
|
||||
if (namedEntityCarrier != null) namedEntityCarrier.unload();
|
||||
}
|
||||
|
||||
private void loadConfig() {
|
||||
YamlConfiguration config = ConfigUtils.getConfig("configs" + File.separator + "bubble.yml");
|
||||
defaultBubble = config.getString("default-bubbles", "none");
|
||||
DisplayMode displayMode = DisplayMode.valueOf(config.getString("mode", "ARMOR_STAND").toUpperCase(Locale.ENGLISH));
|
||||
defaultBubble = config.getString("default-bubbles", "chat");
|
||||
prefix = config.getString("text-prefix", "");
|
||||
suffix = config.getString("text-suffix", "");
|
||||
lineSpace = config.getDouble("line-spacing");
|
||||
defaultStartFormat = config.getString("default-format.start", "<gradient:#F5F5F5:#E1FFFF:#F5F5F5><u>");
|
||||
defaultEndFormat = config.getString("default-format.end", "<!u></gradient>");
|
||||
yOffset = config.getDouble("bottom-line-Y-offset");
|
||||
yOffset = config.getDouble("bottom-line-Y-offset") + (displayMode == DisplayMode.TEXT_DISPLAY ? 1.2 : 0);
|
||||
stayTime = config.getInt("stay-time", 5);
|
||||
coolDown = (int) (config.getDouble("cool-down", 1) * 1000);
|
||||
maxCharLength = config.getInt("max-character-length", 100);
|
||||
channels = config.getStringList("blacklist-channels").toArray(new String[0]);
|
||||
lengthPerLine = config.getInt("characters-per-line", 30);
|
||||
textDisplayMeta = ConfigUtils.getTextDisplayMeta(config.getConfigurationSection("text-display-options"));
|
||||
namedEntityCarrier = new NamedEntityCarrier(plugin, displayMode, new HashMap<>());
|
||||
}
|
||||
|
||||
private void registerImageParser() {
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
if (pluginManager.isPluginEnabled("Oraxen")) {
|
||||
this.imageParser = new OraxenImpl();
|
||||
}
|
||||
else if (pluginManager.isPluginEnabled("ItemsAdder")) {
|
||||
this.imageParser = new ItemsAdderImpl();
|
||||
this.imageParser = new OraxenImageImpl();
|
||||
} else if (pluginManager.isPluginEnabled("ItemsAdder")) {
|
||||
this.imageParser = new ItemsAdderImageImpl();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +144,7 @@ public class ChatBubblesManager extends EntityTag {
|
||||
this.chatListener = new AsyncChatListener(this);
|
||||
}
|
||||
pluginManager.registerEvents(chatListener, plugin);
|
||||
pluginManager.registerEvents(joinQuitListener, plugin);
|
||||
}
|
||||
|
||||
private void loadBubbles() {
|
||||
@@ -202,21 +201,11 @@ public class ChatBubblesManager extends EntityTag {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoin(Player player) {
|
||||
super.onJoin(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuit(Player player) {
|
||||
super.onQuit(player);
|
||||
coolDownMap.remove(player);
|
||||
}
|
||||
|
||||
public void init(Player player) {
|
||||
createArmorStandManager(player);
|
||||
}
|
||||
|
||||
private boolean isCoolDown(Player player, int lines) {
|
||||
long time = System.currentTimeMillis();
|
||||
if (time - (coolDownMap.getOrDefault(player, time - (long) coolDown * lines)) < (long) coolDown * lines) return true;
|
||||
@@ -232,14 +221,12 @@ public class ChatBubblesManager extends EntityTag {
|
||||
int mid_amount;
|
||||
if (totalWidth - 1 <= bubble.tail().getWidth() ) {
|
||||
mid_amount = -1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
mid_amount = (totalWidth - 1 - bubble.tail().getWidth()) / (bubble.middle().getWidth());
|
||||
}
|
||||
if (mid_amount == -1) {
|
||||
stringBuilder.append(bubble.tail().getChars()).append(OffsetFont.NEG_1.getCharacter());
|
||||
}
|
||||
else if (mid_amount == 0) {
|
||||
} else if (mid_amount == 0) {
|
||||
stringBuilder.append(bubble.tail().getChars()).append(OffsetFont.NEG_1.getCharacter());
|
||||
stringBuilder.append(
|
||||
plugin.getFontManager().getShortestNegChars(
|
||||
@@ -247,8 +234,7 @@ public class ChatBubblesManager extends EntityTag {
|
||||
)
|
||||
);
|
||||
stringBuilder.append(bubble.middle().getChars()).append(OffsetFont.NEG_1.getCharacter());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
stringBuilder.append(bubble.middle().getChars()).append(OffsetFont.NEG_1.getCharacter());
|
||||
for (int i = 0; i < mid_amount; i++) {
|
||||
if (i == mid_amount / 2) stringBuilder.append(bubble.tail().getChars()).append(OffsetFont.NEG_1.getCharacter());
|
||||
@@ -295,8 +281,7 @@ public class ChatBubblesManager extends EntityTag {
|
||||
if (bubbleConfig == null || key.equals("none")) {
|
||||
text = defaultStartFormat + PlaceholderAPI.setPlaceholders(player, prefix) + text + PlaceholderAPI.setPlaceholders(player, suffix) + defaultEndFormat;
|
||||
json = GsonComponentSerializer.gson().serialize(MiniMessage.miniMessage().deserialize(imageParser != null ? imageParser.parse(player, text) : text));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
String parsedPrefix = PlaceholderAPI.setPlaceholders(player, prefix);
|
||||
String parsedSuffix = PlaceholderAPI.setPlaceholders(player, suffix);
|
||||
String strippedPrefix = AdventureUtils.stripAllTags(parsedPrefix);
|
||||
@@ -307,10 +292,22 @@ public class ChatBubblesManager extends EntityTag {
|
||||
String finalStr = ConfigManager.surroundWithFont(bubbleImage) + bubbleConfig.startFormat() + parsedPrefix + text + parsedSuffix + bubbleConfig.endFormat() + ConfigManager.surroundWithFont(suffixImage);
|
||||
json = GsonComponentSerializer.gson().serialize(MiniMessage.miniMessage().deserialize(finalStr));
|
||||
}
|
||||
NamedEntityManager asm = namedEntityCarrier.getNamedEntityManager(player);
|
||||
|
||||
ArmorStandManager asm = getArmorStandManager(player);
|
||||
if (asm != null) {
|
||||
asm.addBubble(UUID.randomUUID(), new FakeArmorStand(asm, player, json, yOffset), stayTime, lineSpace);
|
||||
double offset = yOffset;
|
||||
DisplayMode nameplateMode = plugin.getNameplateManager().getMode();
|
||||
if (nameplateMode == DisplayMode.ARMOR_STAND || nameplateMode == DisplayMode.TEXT_DISPLAY) {
|
||||
NamedEntityCarrier carrier = (NamedEntityCarrier) plugin.getNameplateManager().getTextCarrier();
|
||||
NamedEntityManager nem = carrier.getNamedEntityManager(player);
|
||||
if (nem != null) {
|
||||
offset += nem.getHighestTextHeight();
|
||||
}
|
||||
}
|
||||
UUID uuid = UUID.randomUUID();
|
||||
asm.ascent(lineSpace);
|
||||
asm.addNamedEntity(uuid, new NamedEntityImpl(asm, player, json, offset, textDisplayMeta));
|
||||
Bukkit.getScheduler().runTaskLater(CustomNameplates.getInstance(), () -> asm.removeArmorStand(uuid), stayTime * 20L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,11 +325,6 @@ public class ChatBubblesManager extends EntityTag {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void arrangeRefreshTask() {
|
||||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BubbleConfig getBubble(String bubble) {
|
||||
return bubbleConfigMap.get(bubble);
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.data.*;
|
||||
import net.momirealms.customnameplates.listener.JoinQuitListener;
|
||||
import net.momirealms.customnameplates.object.Function;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import net.momirealms.customnameplates.utils.ConfigUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
@@ -94,11 +94,8 @@ public class FontManager extends Function {
|
||||
saveResource("unicodes" + File.separator + "unicode_page_" + String.format("%02x", i) + ".png");
|
||||
}
|
||||
}
|
||||
File template_file = new File(plugin.getDataFolder(), "templates");
|
||||
if (!template_file.exists()) {
|
||||
plugin.saveResource("templates" + File.separator + "default.json", false);
|
||||
plugin.saveResource("templates" + File.separator + "unicode.json", false);
|
||||
}
|
||||
plugin.saveResource("templates" + File.separator + "default.json", true);
|
||||
plugin.saveResource("templates" + File.separator + "unicode.json", true);
|
||||
}
|
||||
|
||||
public String getSuffixStringWithFont(String text) {
|
||||
|
||||
@@ -22,15 +22,10 @@ import net.momirealms.customnameplates.api.CustomNameplatesAPI;
|
||||
import net.momirealms.customnameplates.object.ConditionalText;
|
||||
import net.momirealms.customnameplates.object.Function;
|
||||
import net.momirealms.customnameplates.object.SimpleChar;
|
||||
import net.momirealms.customnameplates.object.armorstand.ArmorStandManager;
|
||||
import net.momirealms.customnameplates.object.carrier.*;
|
||||
import net.momirealms.customnameplates.object.font.OffsetFont;
|
||||
import net.momirealms.customnameplates.object.nameplate.NameplateConfig;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.AbstractNameplateTag;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.DisableNameplate;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.EntityTag;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.armorstand.ArmorStandTag;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.team.TeamTag;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.requirements.Requirement;
|
||||
import net.momirealms.customnameplates.utils.AdventureUtils;
|
||||
import net.momirealms.customnameplates.utils.ConfigUtils;
|
||||
@@ -54,16 +49,14 @@ public class NameplateManager extends Function {
|
||||
private long preview_time;
|
||||
private DisplayMode mode;
|
||||
private boolean fakeTeam;
|
||||
private final HashMap<ConditionalText, Double> contentMap;
|
||||
private final HashMap<String, NameplateConfig> nameplateConfigMap;
|
||||
private final CustomNameplates plugin;
|
||||
private AbstractNameplateTag nameplateTag;
|
||||
private AbstractTextCarrier textCarrier;
|
||||
protected HashMap<UUID, Long> previewCoolDown = new HashMap<>();
|
||||
|
||||
public NameplateManager(CustomNameplates plugin) {
|
||||
this.plugin = plugin;
|
||||
this.nameplateConfigMap = new HashMap<>();
|
||||
this.contentMap = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,11 +70,10 @@ public class NameplateManager extends Function {
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
if (this.nameplateTag != null) {
|
||||
this.nameplateTag.unload();
|
||||
this.nameplateTag = null;
|
||||
if (this.textCarrier != null) {
|
||||
this.textCarrier.unload();
|
||||
this.textCarrier = null;
|
||||
}
|
||||
this.contentMap.clear();
|
||||
this.nameplateConfigMap.clear();
|
||||
}
|
||||
|
||||
@@ -130,7 +122,7 @@ public class NameplateManager extends Function {
|
||||
SimpleChar leftChar = new SimpleChar(config.getInt("left.height"), config.getInt("left.ascent"), config.getInt("left.width"), left, config.getString("left.image") + ".png");
|
||||
SimpleChar middleChar = new SimpleChar(config.getInt("middle.height"), config.getInt("middle.ascent"), config.getInt("middle.width"), middle, config.getString("middle.image") + ".png");
|
||||
SimpleChar rightChar = new SimpleChar(config.getInt("right.height"), config.getInt("right.ascent"), config.getInt("right.width"), right, config.getString("right.image") + ".png");
|
||||
ChatColor color = ChatColor.valueOf(Objects.requireNonNull(config.getString("color", "WHITE")).toUpperCase());
|
||||
ChatColor color = ChatColor.valueOf(Objects.requireNonNull(config.getString("color", "WHITE")).toUpperCase(Locale.ENGLISH));
|
||||
nameplateConfigMap.put(key, new NameplateConfig(color, config.getString("display-name"), leftChar, middleChar, rightChar));
|
||||
}
|
||||
AdventureUtils.consoleMessage("[CustomNameplates] Loaded <green>" + nameplateConfigMap.size() + " <gray>nameplates");
|
||||
@@ -147,36 +139,43 @@ public class NameplateManager extends Function {
|
||||
}
|
||||
|
||||
private void loadMode(ConfigurationSection config) {
|
||||
this.mode = DisplayMode.valueOf(config.getString("mode","Team").toUpperCase());
|
||||
this.mode = DisplayMode.valueOf(config.getString("mode","Team").toUpperCase(Locale.ENGLISH));
|
||||
if (mode == DisplayMode.TEAM) {
|
||||
this.nameplateTag = new TeamTag(plugin);
|
||||
}
|
||||
else if (mode == DisplayMode.ARMOR_STAND) {
|
||||
this.nameplateTag = new ArmorStandTag(plugin);
|
||||
this.textCarrier = new TeamInfoCarrier(plugin);
|
||||
} else if (mode == DisplayMode.ARMOR_STAND) {
|
||||
HashMap<ConditionalText, Double> contentMap = new HashMap<>();
|
||||
ConfigurationSection armorStandSection = config.getConfigurationSection("armor_stand");
|
||||
if (armorStandSection != null) {
|
||||
for (String key :armorStandSection.getKeys(false)) {
|
||||
for (String key : armorStandSection.getKeys(false)) {
|
||||
String text = armorStandSection.getString(key + ".text");
|
||||
double offset = armorStandSection.getDouble(key + ".vertical-offset");
|
||||
Requirement[] requirements = ConfigUtils.getRequirements(armorStandSection.getConfigurationSection(key + ".conditions"));
|
||||
contentMap.put(new ConditionalText(requirements, text), offset);
|
||||
contentMap.put(new ConditionalText(requirements, text, null), offset);
|
||||
}
|
||||
}
|
||||
this.textCarrier = new NamedEntityCarrier(plugin, mode, contentMap);
|
||||
} else if (mode == DisplayMode.TEXT_DISPLAY) {
|
||||
|
||||
HashMap<ConditionalText, Double> contentMap = new HashMap<>();
|
||||
ConfigurationSection textDisplaySection = config.getConfigurationSection("text_display");
|
||||
if (textDisplaySection != null) {
|
||||
for (String key :textDisplaySection.getKeys(false)) {
|
||||
String text = textDisplaySection.getString(key + ".text");
|
||||
double offset = textDisplaySection.getDouble(key + ".vertical-offset") + 1.2;
|
||||
Requirement[] requirements = ConfigUtils.getRequirements(textDisplaySection.getConfigurationSection(key + ".conditions"));
|
||||
TextDisplayMeta textDisplayMeta = ConfigUtils.getTextDisplayMeta(textDisplaySection.getConfigurationSection("options"));
|
||||
contentMap.put(new ConditionalText(requirements, text, textDisplayMeta), offset);
|
||||
}
|
||||
}
|
||||
this.textCarrier = new NamedEntityCarrier(plugin, mode, contentMap);
|
||||
} else if (mode == DisplayMode.DISABLE) {
|
||||
this.nameplateTag = new DisableNameplate(plugin);
|
||||
this.textCarrier = new DisableNameplate(plugin);
|
||||
}
|
||||
plugin.getTeamManager().setTeamPacketInterface();
|
||||
if (this.nameplateTag != null) {
|
||||
this.nameplateTag.load();
|
||||
if (this.textCarrier != null) {
|
||||
this.textCarrier.load();
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<ConditionalText, Double> getContentMap() {
|
||||
return contentMap;
|
||||
}
|
||||
|
||||
public String getNameplatePrefixWithFont(String text, NameplateConfig nameplate) {
|
||||
return ConfigManager.surroundWithFont(getNameplatePrefix(text, nameplate));
|
||||
}
|
||||
@@ -230,8 +229,8 @@ public class NameplateManager extends Function {
|
||||
}
|
||||
|
||||
public void showPlayerArmorStandTags(Player player) {
|
||||
EntityTag entityTag = (EntityTag) this.getNameplateTag();
|
||||
ArmorStandManager asm = entityTag.getArmorStandManager(player);
|
||||
NamedEntityCarrier namedEntityCarrier = (NamedEntityCarrier) this.getTextCarrier();
|
||||
NamedEntityManager asm = namedEntityCarrier.getNamedEntityManager(player);
|
||||
asm.spawn(player);
|
||||
for (int i = 0; i < this.getPreview_time() * 20; i++) {
|
||||
Bukkit.getScheduler().runTaskLater(CustomNameplates.getInstance(), ()-> {
|
||||
@@ -260,8 +259,8 @@ public class NameplateManager extends Function {
|
||||
return nameplateConfigMap.containsKey(nameplate);
|
||||
}
|
||||
|
||||
public AbstractNameplateTag getNameplateTag() {
|
||||
return nameplateTag;
|
||||
public AbstractTextCarrier getTextCarrier() {
|
||||
return textCarrier;
|
||||
}
|
||||
|
||||
public HashMap<String, NameplateConfig> getNameplateConfigMap() {
|
||||
@@ -296,7 +295,7 @@ public class NameplateManager extends Function {
|
||||
return nameplateConfigMap.get(nameplate);
|
||||
}
|
||||
|
||||
public String getPlayer_name_papi() {
|
||||
public String getPlayerNamePapi() {
|
||||
return player_name_papi;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.ConditionalText;
|
||||
import net.momirealms.customnameplates.object.Function;
|
||||
import net.momirealms.customnameplates.object.StaticText;
|
||||
import net.momirealms.customnameplates.object.placeholders.StaticText;
|
||||
import net.momirealms.customnameplates.object.font.OffsetFont;
|
||||
import net.momirealms.customnameplates.object.placeholders.*;
|
||||
import net.momirealms.customnameplates.utils.ConfigUtils;
|
||||
@@ -29,10 +29,7 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -49,8 +46,10 @@ public class PlaceholderManager extends Function {
|
||||
private final HashMap<String, DescentText> descentUnicodeMap;
|
||||
private final HashMap<String, ConditionalTexts> conditionalTextsMap;
|
||||
private final HashMap<String, VanillaHud> vanillaHudMap;
|
||||
private CustomNameplates plugin;
|
||||
|
||||
public PlaceholderManager(CustomNameplates plugin) {
|
||||
this.plugin = plugin;
|
||||
this.nameplatePlaceholders = new NameplatePlaceholders(plugin, this);
|
||||
this.descent_fonts = new HashSet<>();
|
||||
this.descent_unicode_fonts = new HashSet<>();
|
||||
@@ -106,11 +105,6 @@ public class PlaceholderManager extends Function {
|
||||
loadDescentText(descentSection);
|
||||
}
|
||||
|
||||
ConfigurationSection descentUnicodeSection = config.getConfigurationSection("descent-unicode");
|
||||
if (descentUnicodeSection != null) {
|
||||
loadDescentUnicode(descentUnicodeSection);
|
||||
}
|
||||
|
||||
ConfigurationSection conditionalSection = config.getConfigurationSection("conditional-text");
|
||||
if (conditionalSection != null) {
|
||||
loadConditionalText(conditionalSection);
|
||||
@@ -120,6 +114,15 @@ public class PlaceholderManager extends Function {
|
||||
if (vanillaHudSection != null) {
|
||||
loadVanillaHud(vanillaHudSection);
|
||||
}
|
||||
|
||||
if (plugin.getVersionHelper().isVersionNewerThan1_20()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigurationSection descentUnicodeSection = config.getConfigurationSection("descent-unicode");
|
||||
if (descentUnicodeSection != null) {
|
||||
loadDescentUnicode(descentUnicodeSection);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadVanillaHud(ConfigurationSection section) {
|
||||
@@ -129,7 +132,8 @@ public class PlaceholderManager extends Function {
|
||||
PlaceholderAPI.setPlaceholders(null, section.getString(key + ".images.half", "")) + ConfigManager.surroundWithFont(String.valueOf(OffsetFont.NEG_2.getCharacter())),
|
||||
PlaceholderAPI.setPlaceholders(null, section.getString(key + ".images.full", "")) + ConfigManager.surroundWithFont(String.valueOf(OffsetFont.NEG_2.getCharacter())),
|
||||
section.getString(key + ".placeholder.value"),
|
||||
section.getString(key + ".placeholder.max-value")
|
||||
section.getString(key + ".placeholder.max-value"),
|
||||
section.getBoolean(key + ".reverse", true)
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -142,7 +146,8 @@ public class PlaceholderManager extends Function {
|
||||
for (String priority : innerSection.getKeys(false)) {
|
||||
ConditionalText conditionalText = new ConditionalText(
|
||||
ConfigUtils.getRequirements(innerSection.getConfigurationSection(priority + ".conditions")),
|
||||
innerSection.getString(priority + ".text")
|
||||
innerSection.getString(priority + ".text"),
|
||||
null
|
||||
);
|
||||
conditionalTexts.add(conditionalText);
|
||||
}
|
||||
@@ -167,7 +172,7 @@ public class PlaceholderManager extends Function {
|
||||
|
||||
private void loadStaticText(ConfigurationSection section) {
|
||||
for (String key : section.getKeys(false)) {
|
||||
stringStaticTextMap.put(key, new StaticText(section.getString(key + ".text"), section.getInt(key + ".value"), StaticText.StaticState.valueOf(section.getString(key + ".position", "left").toUpperCase())));
|
||||
stringStaticTextMap.put(key, new StaticText(section.getString(key + ".text"), section.getInt(key + ".value"), StaticText.StaticState.valueOf(section.getString(key + ".position", "left").toUpperCase(Locale.ENGLISH))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
|
||||
package net.momirealms.customnameplates.manager;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.*;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.SimpleChar;
|
||||
import net.momirealms.customnameplates.object.background.BackGroundConfig;
|
||||
@@ -147,8 +146,7 @@ public class ResourceManager {
|
||||
addCharToArray(jsonArray, simpleChar, jo_bg);
|
||||
try {
|
||||
FileUtils.copyFile(new File(plugin.getDataFolder(), "contents" + File.separator + "backgrounds" + File.separator + simpleChar.getFile()), new File(textures_file.getPath() + File.separatorChar + ConfigManager.backgrounds_folder_path.replace("\\", File.separator) + simpleChar.getFile()));
|
||||
}
|
||||
catch (IOException e){
|
||||
} catch (IOException e){
|
||||
AdventureUtils.consoleMessage("<red>[CustomNameplates] Error! Failed to copy backgrounds to resource pack.</red>");
|
||||
}
|
||||
}
|
||||
@@ -210,17 +208,40 @@ public class ResourceManager {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try (BufferedWriter writer = new BufferedWriter(
|
||||
new OutputStreamWriter(new FileOutputStream(new File(plugin.getDataFolder(),
|
||||
File outPut = new File(plugin.getDataFolder(),
|
||||
"ResourcePack" +
|
||||
File.separator + "assets" +
|
||||
File.separator + ConfigManager.namespace +
|
||||
File.separator + "font" +
|
||||
File.separator + "ascent_" + ascent + ".json")), StandardCharsets.UTF_8))) {
|
||||
File.separator + "ascent_" + ascent + ".json");
|
||||
try (BufferedWriter writer = new BufferedWriter(
|
||||
new OutputStreamWriter(new FileOutputStream(outPut), StandardCharsets.UTF_8))) {
|
||||
writer.write(sb.toString().replace("\\\\", "\\").replace("%ascent%", String.valueOf(ascent)));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!plugin.getVersionHelper().isVersionNewerThan1_20()) {
|
||||
try {
|
||||
JsonElement jsonElement = JsonParser.parseReader(new JsonReader(new FileReader(outPut)));
|
||||
if (jsonElement.isJsonObject()) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.add("type", new JsonPrimitive("legacy_unicode"));
|
||||
jsonObject.add("sizes", new JsonPrimitive("minecraft:font/glyph_sizes.bin"));
|
||||
jsonObject.add("template", new JsonPrimitive("minecraft:font/unicode_page_%s.png"));
|
||||
jsonElement.getAsJsonObject().getAsJsonArray("providers").add(jsonObject);
|
||||
}
|
||||
try (FileWriter fileWriter = new FileWriter(outPut))
|
||||
{
|
||||
fileWriter.write(jsonElement.toString().replace("\\\\", "\\"));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plugin.getVersionHelper().isVersionNewerThan1_20()) {
|
||||
AdventureUtils.consoleMessage("<white>[CustomNameplates] For the moment decent unicode is not available on 1.20");
|
||||
return;
|
||||
}
|
||||
for (int ascent : plugin.getPlaceholderManager().getDescent_unicode_fonts()) {
|
||||
String line;
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.listener.JoinQuitListener;
|
||||
import net.momirealms.customnameplates.object.Function;
|
||||
import net.momirealms.customnameplates.object.nameplate.NameplatesTeam;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.team.TeamNameInterface;
|
||||
import net.momirealms.customnameplates.object.team.TeamPacketInterface;
|
||||
import net.momirealms.customnameplates.object.team.name.PlayerNameTeamImpl;
|
||||
@@ -85,7 +85,7 @@ public class TeamManager extends Function {
|
||||
public void setTeamPacketInterface() {
|
||||
if (plugin.getNameplateManager().getMode() == DisplayMode.TEAM) {
|
||||
teamPacketInterface = new TeamInfoImpl(this);
|
||||
} else if (plugin.getNameplateManager().getMode() == DisplayMode.ARMOR_STAND) {
|
||||
} else if (plugin.getNameplateManager().getMode() == DisplayMode.ARMOR_STAND || plugin.getNameplateManager().getMode() == DisplayMode.TEXT_DISPLAY) {
|
||||
teamPacketInterface = new TeamVisibilityImpl(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
|
||||
package net.momirealms.customnameplates.object;
|
||||
|
||||
import net.momirealms.customnameplates.object.carrier.TextDisplayMeta;
|
||||
import net.momirealms.customnameplates.object.requirements.Requirement;
|
||||
|
||||
public record ConditionalText(Requirement[] requirements, String text) {
|
||||
public record ConditionalText(Requirement[] requirements, String text, TextDisplayMeta textDisplayMeta) {
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.nameplate.mode;
|
||||
package net.momirealms.customnameplates.object;
|
||||
|
||||
public enum DisplayMode {
|
||||
TEAM,
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.nameplate.mode;
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import net.momirealms.customnameplates.object.Function;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -24,7 +24,7 @@ import org.bukkit.entity.Player;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public abstract class PacketsHandler extends Function {
|
||||
public abstract class AbstractPacketsHandler extends Function {
|
||||
|
||||
protected ConcurrentHashMap<Integer, Player> entityIdMap = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -15,24 +15,27 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.nameplate.mode;
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.listener.JoinQuitListener;
|
||||
import net.momirealms.customnameplates.manager.TeamManager;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.Function;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public abstract class AbstractNameplateTag extends Function {
|
||||
public abstract class AbstractTextCarrier extends Function {
|
||||
|
||||
protected BukkitTask refreshTask;
|
||||
protected CustomNameplates plugin;
|
||||
protected JoinQuitListener joinQuitListener;
|
||||
protected DisplayMode displayMode;
|
||||
|
||||
public AbstractNameplateTag(CustomNameplates plugin) {
|
||||
public AbstractTextCarrier(CustomNameplates plugin, DisplayMode displayMode) {
|
||||
this.displayMode = displayMode;
|
||||
this.plugin = plugin;
|
||||
this.joinQuitListener = new JoinQuitListener(this);
|
||||
}
|
||||
@@ -50,16 +53,6 @@ public abstract class AbstractNameplateTag extends Function {
|
||||
HandlerList.unregisterAll(joinQuitListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoin(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuit(Player player) {
|
||||
|
||||
}
|
||||
|
||||
public void arrangeRefreshTask() {
|
||||
//child
|
||||
}
|
||||
@@ -71,4 +64,8 @@ public abstract class AbstractNameplateTag extends Function {
|
||||
teamManager.sendUpdateToOne(player);
|
||||
}
|
||||
}
|
||||
|
||||
public DisplayMode getDisplayMode() {
|
||||
return displayMode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
|
||||
public class DisableNameplate extends AbstractTextCarrier {
|
||||
|
||||
public DisableNameplate(CustomNameplates plugin) {
|
||||
super(plugin, DisplayMode.DISABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadToAllPlayers() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import net.momirealms.customnameplates.object.DynamicText;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface NamedEntity {
|
||||
|
||||
void refresh();
|
||||
|
||||
boolean canShow();
|
||||
|
||||
boolean isShown();
|
||||
|
||||
void destroy();
|
||||
|
||||
void destroy(Player viewer);
|
||||
|
||||
void spawn();
|
||||
|
||||
void spawn(Player viewer);
|
||||
|
||||
void teleport();
|
||||
|
||||
void teleport(Player viewer);
|
||||
|
||||
void setSneak(boolean sneaking, boolean respawn);
|
||||
|
||||
void respawn(Player viewer);
|
||||
|
||||
double getOffset();
|
||||
|
||||
void setOffset(double v);
|
||||
|
||||
DynamicText getDynamicText();
|
||||
|
||||
int getEntityId();
|
||||
}
|
||||
@@ -15,31 +15,38 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.nameplate.mode;
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.listener.EntityTagListener;
|
||||
import net.momirealms.customnameplates.listener.compatibility.MagicCosmeticsListener;
|
||||
import net.momirealms.customnameplates.object.armorstand.ArmorStandManager;
|
||||
import net.momirealms.customnameplates.object.ConditionalText;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public abstract class EntityTag extends AbstractNameplateTag {
|
||||
|
||||
protected final ConcurrentHashMap<Player, ArmorStandManager> armorStandManagerMap = new ConcurrentHashMap<>();
|
||||
public class NamedEntityCarrier extends AbstractTextCarrier {
|
||||
|
||||
protected final ConcurrentHashMap<Player, NamedEntityManager> namedEntityManagerMap = new ConcurrentHashMap<>();
|
||||
protected EntityTagListener entityTagListener;
|
||||
protected PacketsHandler handler;
|
||||
protected AbstractPacketsHandler handler;
|
||||
protected MagicCosmeticsListener magicCosmeticsListener;
|
||||
private final VehicleChecker vehicleChecker;
|
||||
private final HashMap<ConditionalText, Double> persistentText;
|
||||
|
||||
protected EntityTag(CustomNameplates plugin) {
|
||||
super(plugin);
|
||||
public NamedEntityCarrier(CustomNameplates plugin, DisplayMode displayMode, @NotNull HashMap<ConditionalText, Double> persistentText) {
|
||||
super(plugin, displayMode);
|
||||
this.vehicleChecker = new VehicleChecker(this);
|
||||
this.entityTagListener = new EntityTagListener(this);
|
||||
this.persistentText = persistentText;
|
||||
this.handler = new NamedEntityPacketsHandler(this);
|
||||
if (Bukkit.getPluginManager().getPlugin("MagicCosmetics") != null) {
|
||||
this.magicCosmeticsListener = new MagicCosmeticsListener(this);
|
||||
}
|
||||
@@ -49,6 +56,7 @@ public abstract class EntityTag extends AbstractNameplateTag {
|
||||
public void load(){
|
||||
super.load();
|
||||
handler.load();
|
||||
this.vehicleChecker.load();
|
||||
Bukkit.getPluginManager().registerEvents(entityTagListener, CustomNameplates.getInstance());
|
||||
if (magicCosmeticsListener != null) Bukkit.getPluginManager().registerEvents(magicCosmeticsListener, CustomNameplates.getInstance());
|
||||
}
|
||||
@@ -57,60 +65,75 @@ public abstract class EntityTag extends AbstractNameplateTag {
|
||||
public void unload(){
|
||||
super.unload();
|
||||
handler.unload();
|
||||
for (ArmorStandManager asm : armorStandManagerMap.values()) {
|
||||
for (NamedEntityManager asm : namedEntityManagerMap.values()) {
|
||||
asm.destroy();
|
||||
}
|
||||
armorStandManagerMap.clear();
|
||||
namedEntityManagerMap.clear();
|
||||
HandlerList.unregisterAll(entityTagListener);
|
||||
this.vehicleChecker.unload();
|
||||
if (magicCosmeticsListener != null) HandlerList.unregisterAll(magicCosmeticsListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoin(Player player) {
|
||||
handler.onJoin(player);
|
||||
init(player);
|
||||
createNamedEntityManager(player);
|
||||
for (Player viewer : Bukkit.getOnlinePlayers()) {
|
||||
spawnNamedEntity(viewer, player);
|
||||
spawnNamedEntity(player, viewer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuit(Player player) {
|
||||
handler.onQuit(player);
|
||||
ArmorStandManager asm = armorStandManagerMap.remove(player);
|
||||
NamedEntityManager asm = namedEntityManagerMap.remove(player);
|
||||
if (asm != null) {
|
||||
asm.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void init(Player player) {
|
||||
|
||||
@Override
|
||||
public void loadToAllPlayers() {
|
||||
super.loadToAllPlayers();
|
||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||
createNamedEntityManager(all);
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
spawnNamedEntity(player, all);
|
||||
}
|
||||
}
|
||||
|
||||
public ArmorStandManager createArmorStandManager(Player player) {
|
||||
ArmorStandManager asm = new ArmorStandManager(player);
|
||||
armorStandManagerMap.put(player, asm);
|
||||
public NamedEntityManager createNamedEntityManager(Player player) {
|
||||
NamedEntityManager asm = new NamedEntityManager(this, player);
|
||||
namedEntityManagerMap.put(player, asm);
|
||||
return asm;
|
||||
}
|
||||
|
||||
public void onSneak(Player player, boolean isSneaking) {
|
||||
//child
|
||||
getNamedEntityManager(player).setSneak(isSneaking, true);
|
||||
}
|
||||
|
||||
public void onRespawn(Player player) {
|
||||
//child
|
||||
getNamedEntityManager(player).teleport();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void arrangeRefreshTask() {
|
||||
|
||||
refreshTask = Bukkit.getScheduler().runTaskTimerAsynchronously(CustomNameplates.getInstance(), () -> {
|
||||
for (NamedEntityManager asm : namedEntityManagerMap.values()) {
|
||||
asm.refresh(false);
|
||||
}
|
||||
}, 1, 1);
|
||||
}
|
||||
|
||||
public ArmorStandManager getArmorStandManager(Player player) {
|
||||
return armorStandManagerMap.get(player);
|
||||
public NamedEntityManager getNamedEntityManager(Player player) {
|
||||
return namedEntityManagerMap.get(player);
|
||||
}
|
||||
|
||||
protected void spawnArmorStands(Player viewer, Player target) {
|
||||
protected void spawnNamedEntity(Player viewer, Player target) {
|
||||
if (target == viewer || target.getGameMode() == GameMode.SPECTATOR || viewer.getWorld() != target.getWorld()) return;
|
||||
if (getDistance(target, viewer) < 48 && viewer.canSee(target)) {
|
||||
ArmorStandManager asm = getArmorStandManager(target);
|
||||
NamedEntityManager asm = getNamedEntityManager(target);
|
||||
asm.spawn(viewer);
|
||||
}
|
||||
}
|
||||
@@ -120,4 +143,8 @@ public abstract class EntityTag extends AbstractNameplateTag {
|
||||
Location loc2 = player2.getLocation();
|
||||
return Math.sqrt(Math.pow(loc1.getX()-loc2.getX(), 2) + Math.pow(loc1.getZ()-loc2.getZ(), 2));
|
||||
}
|
||||
|
||||
public HashMap<ConditionalText, Double> getPersistentText() {
|
||||
return persistentText;
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.armorstand;
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
@@ -23,7 +23,10 @@ import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataValue;
|
||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.DynamicText;
|
||||
import net.momirealms.customnameplates.object.requirements.Requirement;
|
||||
import org.bukkit.Location;
|
||||
@@ -31,12 +34,14 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Pose;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class FakeArmorStand {
|
||||
public class NamedEntityImpl implements NamedEntity {
|
||||
|
||||
private final ArmorStandManager asm;
|
||||
private final NamedEntityManager asm;
|
||||
private final Player owner;
|
||||
private double yOffset;
|
||||
private final int entityId;
|
||||
@@ -46,9 +51,10 @@ public class FakeArmorStand {
|
||||
private String textJson;
|
||||
private final Requirement[] requirements;
|
||||
private boolean isShown;
|
||||
private final TextDisplayMeta textDisplayMeta;
|
||||
|
||||
// nameplate
|
||||
public FakeArmorStand(ArmorStandManager asm, Player owner, DynamicText text, double yOffset, Requirement[] requirements) {
|
||||
//dynamic value
|
||||
public NamedEntityImpl(NamedEntityManager asm, Player owner, DynamicText text, double yOffset, @NotNull Requirement[] requirements, @Nullable TextDisplayMeta textDisplayMeta) {
|
||||
this.asm = asm;
|
||||
this.entityId = new Random().nextInt(Integer.MAX_VALUE);
|
||||
this.owner = owner;
|
||||
@@ -58,10 +64,11 @@ public class FakeArmorStand {
|
||||
this.requirements = requirements;
|
||||
this.isShown = false;
|
||||
this.textJson = dynamicText.getLatestJson();
|
||||
this.textDisplayMeta = textDisplayMeta;
|
||||
}
|
||||
|
||||
// bubble
|
||||
public FakeArmorStand(ArmorStandManager asm, Player owner, String textJson, double yOffset) {
|
||||
//constant value
|
||||
public NamedEntityImpl(NamedEntityManager asm, Player owner, String textJson, double yOffset, @Nullable TextDisplayMeta textDisplayMeta) {
|
||||
this.asm = asm;
|
||||
this.entityId = new Random().nextInt(Integer.MAX_VALUE);
|
||||
this.owner = owner;
|
||||
@@ -70,8 +77,10 @@ public class FakeArmorStand {
|
||||
this.sneaking = owner.isSneaking();
|
||||
this.requirements = null;
|
||||
this.isShown = true;
|
||||
this.textDisplayMeta = textDisplayMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canShow() {
|
||||
if (requirements == null) return true;
|
||||
for (Requirement requirement : requirements) {
|
||||
@@ -82,16 +91,19 @@ public class FakeArmorStand {
|
||||
return true;
|
||||
}
|
||||
|
||||
// dynamicText would not be null because bubbles would not be updated
|
||||
@Override
|
||||
public void refresh() {
|
||||
if (dynamicText == null) return;
|
||||
textJson = dynamicText.getLatestJson();
|
||||
updateMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getOffset() {
|
||||
return yOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOffset(double offset) {
|
||||
if (yOffset == offset) return;
|
||||
yOffset = offset;
|
||||
@@ -100,12 +112,14 @@ public class FakeArmorStand {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawn(Player viewer) {
|
||||
for (PacketContainer packet : getSpawnPackets()) {
|
||||
CustomNameplates.getProtocolManager().sendServerPacket(viewer, packet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawn() {
|
||||
for (Player all : asm.getNearbyPlayers()) {
|
||||
spawn(all);
|
||||
@@ -113,6 +127,7 @@ public class FakeArmorStand {
|
||||
isShown = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
PacketContainer destroyPacket = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
|
||||
destroyPacket.getIntLists().write(0, List.of(entityId));
|
||||
@@ -122,12 +137,14 @@ public class FakeArmorStand {
|
||||
isShown = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy(Player viewer) {
|
||||
PacketContainer destroyPacket = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
|
||||
destroyPacket.getIntLists().write(0, List.of(entityId));
|
||||
CustomNameplates.getProtocolManager().sendServerPacket(viewer, destroyPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleport() {
|
||||
PacketContainer packet = getTeleportPacket();
|
||||
for (Player all : asm.getNearbyPlayers()) {
|
||||
@@ -135,6 +152,7 @@ public class FakeArmorStand {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleport(Player viewer) {
|
||||
if (!asm.isNearby(viewer) && viewer != owner) {
|
||||
asm.spawn(viewer);
|
||||
@@ -143,6 +161,7 @@ public class FakeArmorStand {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSneak(boolean isSneaking, boolean respawn) {
|
||||
this.sneaking = isSneaking;
|
||||
if (respawn) {
|
||||
@@ -155,10 +174,22 @@ public class FakeArmorStand {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShown() {
|
||||
return isShown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicText getDynamicText() {
|
||||
return dynamicText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void respawn(Player viewer) {
|
||||
destroy(viewer);
|
||||
spawn(viewer);
|
||||
@@ -167,7 +198,7 @@ public class FakeArmorStand {
|
||||
public PacketContainer getTeleportPacket() {
|
||||
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
|
||||
packet.getIntegers().write(0, entityId);
|
||||
Location location = getArmorStandLocation();
|
||||
Location location = getEntityLocation();
|
||||
packet.getDoubles().write(0, location.getX());
|
||||
packet.getDoubles().write(1, location.getY());
|
||||
packet.getDoubles().write(2, location.getZ());
|
||||
@@ -185,17 +216,19 @@ public class FakeArmorStand {
|
||||
PacketContainer metaPacket = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
|
||||
metaPacket.getIntegers().write(0, entityId);
|
||||
if (CustomNameplates.getInstance().getVersionHelper().isVersionNewerThan1_19_R2()) {
|
||||
WrappedDataWatcher wrappedDataWatcher = createDataWatcher(textJson);
|
||||
WrappedDataWatcher wrappedDataWatcher =
|
||||
asm.getDisplayMode() == DisplayMode.ARMOR_STAND ?
|
||||
createArmorStandDataWatcher(textJson) : createTextDisplayDataWatcher(textJson, textDisplayMeta);
|
||||
List<WrappedDataValue> wrappedDataValueList = Lists.newArrayList();
|
||||
wrappedDataWatcher.getWatchableObjects().stream().filter(Objects::nonNull).forEach(entry -> wrappedDataValueList.add(new WrappedDataValue(entry.getWatcherObject().getIndex(), entry.getWatcherObject().getSerializer(), entry.getRawValue())));
|
||||
metaPacket.getDataValueCollectionModifier().write(0, wrappedDataValueList);
|
||||
} else {
|
||||
metaPacket.getWatchableCollectionModifier().write(0, createDataWatcher(textJson).getWatchableObjects());
|
||||
metaPacket.getWatchableCollectionModifier().write(0, createArmorStandDataWatcher(textJson).getWatchableObjects());
|
||||
}
|
||||
return metaPacket;
|
||||
}
|
||||
|
||||
public Location getArmorStandLocation() {
|
||||
private Location getEntityLocation() {
|
||||
double x = owner.getLocation().getX();
|
||||
double y = getY() + yOffset;
|
||||
double z = owner.getLocation().getZ();
|
||||
@@ -208,7 +241,7 @@ public class FakeArmorStand {
|
||||
return new Location(null, x, y, z);
|
||||
}
|
||||
|
||||
protected double getY() {
|
||||
private double getY() {
|
||||
Entity vehicle = owner.getVehicle();
|
||||
if (vehicle != null) {
|
||||
if (vehicle.getType() == EntityType.HORSE) {
|
||||
@@ -230,7 +263,7 @@ public class FakeArmorStand {
|
||||
return owner.getLocation().getY();
|
||||
}
|
||||
|
||||
public WrappedDataWatcher createDataWatcher(String json) {
|
||||
private WrappedDataWatcher createArmorStandDataWatcher(String json) {
|
||||
WrappedDataWatcher wrappedDataWatcher = new WrappedDataWatcher();
|
||||
WrappedDataWatcher.Serializer serializer1 = WrappedDataWatcher.Registry.get(Boolean.class);
|
||||
WrappedDataWatcher.Serializer serializer2 = WrappedDataWatcher.Registry.get(Byte.class);
|
||||
@@ -246,24 +279,30 @@ public class FakeArmorStand {
|
||||
return wrappedDataWatcher;
|
||||
}
|
||||
|
||||
public PacketContainer[] getSpawnPackets() {
|
||||
private WrappedDataWatcher createTextDisplayDataWatcher(String textJson, TextDisplayMeta textDisplayMeta) {
|
||||
WrappedDataWatcher wrappedDataWatcher = new WrappedDataWatcher();
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(22, WrappedDataWatcher.Registry.getChatComponentSerializer(false)), WrappedChatComponent.fromJson(textJson));
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(24, WrappedDataWatcher.Registry.get(Integer.class)), textDisplayMeta.backgroundColor());
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(14, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 3);
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(25, WrappedDataWatcher.Registry.get(Byte.class)), textDisplayMeta.opacity());
|
||||
int mask = 0;
|
||||
if (textDisplayMeta.hasShadow()) mask += 1;
|
||||
if (textDisplayMeta.isSeeThrough()) mask += 2;
|
||||
if (textDisplayMeta.useDefaultBackground()) mask += 4;
|
||||
wrappedDataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(26, WrappedDataWatcher.Registry.get(Byte.class)), (byte) mask);
|
||||
return wrappedDataWatcher;
|
||||
}
|
||||
|
||||
private PacketContainer[] getSpawnPackets() {
|
||||
PacketContainer entityPacket = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY);
|
||||
entityPacket.getModifier().write(0, entityId);
|
||||
entityPacket.getModifier().write(1, uuid);
|
||||
entityPacket.getEntityTypeModifier().write(0, EntityType.ARMOR_STAND);
|
||||
Location location = getArmorStandLocation();
|
||||
entityPacket.getEntityTypeModifier().write(0, asm.getDisplayMode() == DisplayMode.ARMOR_STAND ? EntityType.ARMOR_STAND : EntityType.TEXT_DISPLAY);
|
||||
Location location = getEntityLocation();
|
||||
entityPacket.getDoubles().write(0, location.getX());
|
||||
entityPacket.getDoubles().write(1, location.getY());
|
||||
entityPacket.getDoubles().write(2, location.getZ());
|
||||
PacketContainer metaPacket = getMetaPacket();
|
||||
return new PacketContainer[] {entityPacket, metaPacket};
|
||||
}
|
||||
|
||||
public boolean isShown() {
|
||||
return isShown;
|
||||
}
|
||||
|
||||
public DynamicText getDynamicText() {
|
||||
return dynamicText;
|
||||
}
|
||||
}
|
||||
@@ -15,53 +15,54 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.armorstand;
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.ConditionalText;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import net.momirealms.customnameplates.object.DynamicText;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.Vector;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ArmorStandManager {
|
||||
public class NamedEntityManager {
|
||||
|
||||
private final ConcurrentHashMap<UUID, FakeArmorStand> armorStands = new ConcurrentHashMap<>();
|
||||
private FakeArmorStand[] armorStandArray;
|
||||
private final ConcurrentHashMap<UUID, NamedEntity> namedEntities = new ConcurrentHashMap<>();
|
||||
private NamedEntity[] namedEntityArray;
|
||||
private final Vector<Player> nearbyPlayers;
|
||||
private Player[] nearbyPlayerArray ;
|
||||
private final Player owner;
|
||||
private double hatOffset;
|
||||
private final NamedEntityCarrier namedEntityCarrier;
|
||||
private double highestTextHeight;
|
||||
|
||||
public ArmorStandManager(Player owner) {
|
||||
public NamedEntityManager(NamedEntityCarrier namedEntityCarrier, Player owner) {
|
||||
this.owner = owner;
|
||||
this.nearbyPlayers = new Vector<>();
|
||||
this.armorStandArray = new FakeArmorStand[0];
|
||||
this.namedEntityArray = new NamedEntityImpl[0];
|
||||
this.nearbyPlayerArray = new Player[0];
|
||||
this.namedEntityCarrier = namedEntityCarrier;
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void initNameplateArmorStands() {
|
||||
Set<Map.Entry<ConditionalText, Double>> entries = CustomNameplates.getInstance().getNameplateManager().getContentMap().entrySet();
|
||||
public void init() {
|
||||
Set<Map.Entry<ConditionalText, Double>> entries = namedEntityCarrier.getPersistentText().entrySet();
|
||||
for (Map.Entry<ConditionalText, Double> entry : entries) {
|
||||
addArmorStand(UUID.randomUUID(), new FakeArmorStand(
|
||||
addNamedEntity(UUID.randomUUID(), new NamedEntityImpl(
|
||||
this,
|
||||
owner,
|
||||
new DynamicText(owner, entry.getKey().text()),
|
||||
entry.getValue(),
|
||||
entry.getKey().requirements()
|
||||
entry.getKey().requirements(),
|
||||
entry.getKey().textDisplayMeta()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public void addArmorStand(UUID uuid, FakeArmorStand fakeArmorStand) {
|
||||
this.armorStands.put(uuid, fakeArmorStand);
|
||||
this.armorStandArray = armorStands.values().toArray(new FakeArmorStand[0]);
|
||||
for (Player p : nearbyPlayerArray) fakeArmorStand.spawn(p);
|
||||
public void addNamedEntity(UUID uuid, NamedEntity namedEntity) {
|
||||
this.namedEntities.put(uuid, namedEntity);
|
||||
this.namedEntityArray = namedEntities.values().toArray(new NamedEntity[0]);
|
||||
for (Player p : nearbyPlayerArray) namedEntity.spawn(p);
|
||||
}
|
||||
|
||||
public Player[] getNearbyPlayers(){
|
||||
@@ -75,72 +76,71 @@ public class ArmorStandManager {
|
||||
public void spawn(Player viewer) {
|
||||
nearbyPlayers.add(viewer);
|
||||
nearbyPlayerArray = nearbyPlayers.toArray(new Player[0]);
|
||||
for (FakeArmorStand fakeArmorStand : armorStandArray)
|
||||
for (NamedEntity fakeArmorStand : namedEntityArray)
|
||||
if (fakeArmorStand.canShow())
|
||||
fakeArmorStand.spawn(viewer);
|
||||
}
|
||||
|
||||
public void refresh(boolean force) {
|
||||
for (FakeArmorStand fakeArmorStand : armorStandArray) {
|
||||
fakeArmorStand.refresh();
|
||||
highestTextHeight = -2;
|
||||
for (NamedEntity fakeArmorStand : namedEntityArray) {
|
||||
boolean canShow = fakeArmorStand.canShow();
|
||||
if (!canShow) {
|
||||
if (fakeArmorStand.isShown()) {
|
||||
fakeArmorStand.destroy();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (fakeArmorStand.isShown()) {
|
||||
if (fakeArmorStand.getDynamicText().update() || force)
|
||||
if (fakeArmorStand.getDynamicText() != null && (fakeArmorStand.getDynamicText().update() || force))
|
||||
fakeArmorStand.refresh();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fakeArmorStand.spawn();
|
||||
}
|
||||
highestTextHeight = Math.max(fakeArmorStand.getOffset(), highestTextHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
for (FakeArmorStand fakeArmorStand : armorStandArray) {
|
||||
fakeArmorStand.destroy();
|
||||
for (NamedEntity entity : namedEntityArray) {
|
||||
entity.destroy();
|
||||
}
|
||||
nearbyPlayers.clear();
|
||||
nearbyPlayerArray = new Player[0];
|
||||
}
|
||||
|
||||
public void teleport(Player viewer) {
|
||||
for (FakeArmorStand fakeArmorStand : armorStandArray) {
|
||||
if (fakeArmorStand.isShown())
|
||||
fakeArmorStand.teleport(viewer);
|
||||
for (NamedEntity entity : namedEntityArray) {
|
||||
if (entity.isShown())
|
||||
entity.teleport(viewer);
|
||||
}
|
||||
}
|
||||
|
||||
public void teleport() {
|
||||
for (FakeArmorStand fakeArmorStand : armorStandArray) {
|
||||
if (fakeArmorStand.isShown())
|
||||
fakeArmorStand.teleport();
|
||||
for (NamedEntity entity : namedEntityArray) {
|
||||
if (entity.isShown())
|
||||
entity.teleport();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSneak(boolean sneaking, boolean respawn) {
|
||||
for (FakeArmorStand fakeArmorStand : armorStandArray) {
|
||||
if (fakeArmorStand.isShown())
|
||||
fakeArmorStand.setSneak(sneaking, respawn);
|
||||
for (NamedEntity entity : namedEntityArray) {
|
||||
if (entity.isShown())
|
||||
entity.setSneak(sneaking, respawn);
|
||||
}
|
||||
}
|
||||
|
||||
public void respawn() {
|
||||
for (FakeArmorStand fakeArmorStand : armorStandArray) {
|
||||
if (fakeArmorStand.isShown())
|
||||
for (NamedEntity entity : namedEntityArray) {
|
||||
if (entity.isShown())
|
||||
for (Player viewer : nearbyPlayerArray)
|
||||
fakeArmorStand.respawn(viewer);
|
||||
entity.respawn(viewer);
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy(Player viewer) {
|
||||
for (FakeArmorStand fakeArmorStand : armorStandArray) {
|
||||
fakeArmorStand.destroy(viewer);
|
||||
for (NamedEntity entity : namedEntityArray) {
|
||||
entity.destroy(viewer);
|
||||
}
|
||||
unregisterPlayer(viewer);
|
||||
}
|
||||
@@ -152,23 +152,17 @@ public class ArmorStandManager {
|
||||
}
|
||||
|
||||
public void removeArmorStand(UUID uuid) {
|
||||
FakeArmorStand fakeArmorStand = armorStands.remove(uuid);
|
||||
if (fakeArmorStand != null) {
|
||||
fakeArmorStand.destroy();
|
||||
armorStandArray = armorStands.values().toArray(new FakeArmorStand[0]);
|
||||
NamedEntity entity = namedEntities.remove(uuid);
|
||||
if (entity != null) {
|
||||
entity.destroy();
|
||||
namedEntityArray = namedEntities.values().toArray(new NamedEntity[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public void addBubble(UUID uuid, FakeArmorStand fakeArmorStand, int stayTime, double lineSpace) {
|
||||
ascent(lineSpace);
|
||||
addArmorStand(uuid, fakeArmorStand);
|
||||
Bukkit.getScheduler().runTaskLater(CustomNameplates.getInstance(), () -> removeArmorStand(uuid), stayTime * 20L);
|
||||
}
|
||||
|
||||
public void ascent(double lineSpace) {
|
||||
for (FakeArmorStand fakeArmorStand : armorStandArray) {
|
||||
fakeArmorStand.setOffset(fakeArmorStand.getOffset() + lineSpace);
|
||||
fakeArmorStand.teleport();
|
||||
for (NamedEntity entity : namedEntityArray) {
|
||||
entity.setOffset(entity.getOffset() + lineSpace);
|
||||
entity.teleport();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,4 +174,12 @@ public class ArmorStandManager {
|
||||
this.hatOffset = hatOffset;
|
||||
teleport();
|
||||
}
|
||||
|
||||
public DisplayMode getDisplayMode() {
|
||||
return namedEntityCarrier.getDisplayMode();
|
||||
}
|
||||
|
||||
public double getHighestTextHeight() {
|
||||
return highestTextHeight;
|
||||
}
|
||||
}
|
||||
@@ -15,28 +15,28 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.bubble;
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.listener.packet.*;
|
||||
import net.momirealms.customnameplates.manager.ChatBubblesManager;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.PacketsHandler;
|
||||
import net.momirealms.customnameplates.object.carrier.NamedEntityCarrier;
|
||||
import net.momirealms.customnameplates.object.carrier.AbstractPacketsHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BBPacketsHandle extends PacketsHandler {
|
||||
public class NamedEntityPacketsHandler extends AbstractPacketsHandler {
|
||||
|
||||
private final ChatBubblesManager chatBubblesManager;
|
||||
private final NamedEntityCarrier namedEntityCarrier;
|
||||
private final EntityDestroyListener entityDestroyListener;
|
||||
private final EntityMoveListener entityMoveListener;
|
||||
private final EntitySpawnListener entitySpawnListener;
|
||||
private final EntityTeleportListener entityTeleportListener;
|
||||
private final EntityLookListener entityLookListener;
|
||||
|
||||
public BBPacketsHandle(ChatBubblesManager chatBubblesManager) {
|
||||
public NamedEntityPacketsHandler(NamedEntityCarrier namedEntityCarrier) {
|
||||
super();
|
||||
this.chatBubblesManager = chatBubblesManager;
|
||||
this.namedEntityCarrier = namedEntityCarrier;
|
||||
this.entityDestroyListener = new EntityDestroyListener(this);
|
||||
this.entityMoveListener = new EntityMoveListener(this);
|
||||
this.entitySpawnListener = new EntitySpawnListener(this);
|
||||
@@ -66,17 +66,17 @@ public class BBPacketsHandle extends PacketsHandler {
|
||||
|
||||
@Override
|
||||
public void onEntityMove(Player receiver, int entityId) {
|
||||
Player mover = getPlayerFromMap(entityId);
|
||||
Player mover = super.getPlayerFromMap(entityId);
|
||||
if (mover != null) {
|
||||
chatBubblesManager.getArmorStandManager(mover).teleport(receiver);
|
||||
namedEntityCarrier.getNamedEntityManager(mover).teleport(receiver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntitySpawn(Player receiver, int entityId) {
|
||||
Player spawnedPlayer = getPlayerFromMap(entityId);
|
||||
Player spawnedPlayer = super.getPlayerFromMap(entityId);
|
||||
if (spawnedPlayer != null) {
|
||||
chatBubblesManager.getArmorStandManager(spawnedPlayer).spawn(receiver);
|
||||
namedEntityCarrier.getNamedEntityManager(spawnedPlayer).spawn(receiver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,9 +89,9 @@ public class BBPacketsHandle extends PacketsHandler {
|
||||
|
||||
@Override
|
||||
public void onEntityDestroy(Player receiver, int entity) {
|
||||
Player deSpawnedPlayer = getPlayerFromMap(entity);
|
||||
Player deSpawnedPlayer = super.getPlayerFromMap(entity);
|
||||
if (deSpawnedPlayer != null) {
|
||||
chatBubblesManager.getArmorStandManager(deSpawnedPlayer).destroy(receiver);
|
||||
namedEntityCarrier.getNamedEntityManager(deSpawnedPlayer).destroy(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,20 +15,20 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.nameplate.mode.team;
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.manager.TeamManager;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.AbstractNameplateTag;
|
||||
import net.momirealms.customnameplates.object.DisplayMode;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TeamTag extends AbstractNameplateTag {
|
||||
public class TeamInfoCarrier extends AbstractTextCarrier {
|
||||
|
||||
private final TeamManager teamManager;
|
||||
|
||||
public TeamTag(CustomNameplates plugin) {
|
||||
super(plugin);
|
||||
public TeamInfoCarrier(CustomNameplates plugin) {
|
||||
super(plugin, DisplayMode.TEAM);
|
||||
this.teamManager = plugin.getTeamManager();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
public record TextDisplayMeta(boolean hasShadow, boolean isSeeThrough, boolean useDefaultBackground,
|
||||
int backgroundColor, byte opacity) {
|
||||
|
||||
public static TextDisplayMeta defaultValue = new TextDisplayMeta(false, false, true, 0, (byte) -1);
|
||||
}
|
||||
@@ -15,10 +15,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.nameplate.mode.armorstand;
|
||||
package net.momirealms.customnameplates.object.carrier;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.Function;
|
||||
import net.momirealms.customnameplates.object.carrier.NamedEntityCarrier;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -30,12 +31,13 @@ public class VehicleChecker extends Function {
|
||||
|
||||
private final ConcurrentHashMap<Player, Entity> playersOnVehicle;
|
||||
|
||||
private final ArmorStandTag armorStandTag;
|
||||
private final NamedEntityCarrier namedEntityCarrier;
|
||||
|
||||
private BukkitTask task;
|
||||
private BukkitTask updatePosTask;
|
||||
private BukkitTask vehicleCheckTask;
|
||||
|
||||
public VehicleChecker(ArmorStandTag armorStandTag) {
|
||||
this.armorStandTag = armorStandTag;
|
||||
public VehicleChecker(NamedEntityCarrier namedEntityCarrier) {
|
||||
this.namedEntityCarrier = namedEntityCarrier;
|
||||
this.playersOnVehicle = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
@@ -47,17 +49,23 @@ public class VehicleChecker extends Function {
|
||||
playersOnVehicle.put(all, vehicle);
|
||||
}
|
||||
}
|
||||
this.task = Bukkit.getScheduler().runTaskTimerAsynchronously(CustomNameplates.getInstance(), () -> {
|
||||
this.updatePosTask = Bukkit.getScheduler().runTaskTimerAsynchronously(CustomNameplates.getInstance(), () -> {
|
||||
for (Player inVehicle : playersOnVehicle.keySet()) {
|
||||
if (!inVehicle.isOnline() || armorStandTag.getArmorStandManager(inVehicle) == null) continue;
|
||||
armorStandTag.getArmorStandManager(inVehicle).teleport();
|
||||
if (!inVehicle.isOnline() || namedEntityCarrier.getNamedEntityManager(inVehicle) == null) continue;
|
||||
namedEntityCarrier.getNamedEntityManager(inVehicle).teleport();
|
||||
}
|
||||
}, 1, 1);
|
||||
this.vehicleCheckTask = Bukkit.getScheduler().runTaskTimerAsynchronously(CustomNameplates.getInstance(), () -> {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
this.refresh(player);
|
||||
}
|
||||
},20,20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
this.task.cancel();
|
||||
this.updatePosTask.cancel();
|
||||
this.vehicleCheckTask.cancel();
|
||||
playersOnVehicle.clear();
|
||||
}
|
||||
|
||||
@@ -73,11 +81,11 @@ public class VehicleChecker extends Function {
|
||||
public void refresh(Player player) {
|
||||
Entity vehicle = player.getVehicle();
|
||||
if (playersOnVehicle.containsKey(player) && vehicle == null) {
|
||||
armorStandTag.getArmorStandManager(player).teleport();
|
||||
namedEntityCarrier.getNamedEntityManager(player).teleport();
|
||||
playersOnVehicle.remove(player);
|
||||
}
|
||||
if (!playersOnVehicle.containsKey(player) && vehicle != null) {
|
||||
armorStandTag.getArmorStandManager(player).respawn();
|
||||
namedEntityCarrier.getNamedEntityManager(player).respawn();
|
||||
playersOnVehicle.put(player, vehicle);
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.emoji;
|
||||
package net.momirealms.customnameplates.object.img;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.emoji;
|
||||
package net.momirealms.customnameplates.object.img;
|
||||
|
||||
import dev.lone.itemsadder.api.FontImages.FontImageWrapper;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ItemsAdderImpl implements ImageParser{
|
||||
public class ItemsAdderImageImpl implements ImageParser{
|
||||
|
||||
@Override
|
||||
public String parse(Player player, String text) {
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.emoji;
|
||||
package net.momirealms.customnameplates.object.img;
|
||||
|
||||
import io.th0rgal.oraxen.OraxenPlugin;
|
||||
import io.th0rgal.oraxen.font.FontManager;
|
||||
@@ -24,11 +24,11 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class OraxenImpl implements ImageParser{
|
||||
public class OraxenImageImpl implements ImageParser{
|
||||
|
||||
private final FontManager fontManager;
|
||||
|
||||
public OraxenImpl() {
|
||||
public OraxenImageImpl() {
|
||||
this.fontManager = OraxenPlugin.get().getFontManager();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package net.momirealms.customnameplates.object.nameplate;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.manager.NameplateManager;
|
||||
import net.momirealms.customnameplates.object.DynamicText;
|
||||
@@ -60,10 +59,9 @@ public class NameplatesTeam {
|
||||
nameplate_prefix = prefix.getLatestValue();
|
||||
nameplate_suffix = suffix.getLatestValue();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.color = nameplateConfig.color();
|
||||
String name = PlaceholderAPI.setPlaceholders(player, nameplateManager.getPlayer_name_papi());
|
||||
String name = PlaceholderAPI.setPlaceholders(player, nameplateManager.getPlayerNamePapi());
|
||||
if (updated) {
|
||||
nameplate = newNameplate;
|
||||
String text = AdventureUtils.stripAllTags(prefix.getLatestValue())
|
||||
@@ -93,10 +91,10 @@ public class NameplatesTeam {
|
||||
}
|
||||
|
||||
public Component getNameplatePrefixComponent() {
|
||||
return MiniMessage.miniMessage().deserialize(nameplate_prefix);
|
||||
return AdventureUtils.getComponentFromMiniMessage(nameplate_prefix);
|
||||
}
|
||||
|
||||
public Component getNameplateSuffixComponent() {
|
||||
return MiniMessage.miniMessage().deserialize(nameplate_suffix);
|
||||
return AdventureUtils.getComponentFromMiniMessage(nameplate_suffix);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package net.momirealms.customnameplates.object.nameplate.mode;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DisableNameplate extends AbstractNameplateTag {
|
||||
|
||||
public DisableNameplate(CustomNameplates plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoin(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuit(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void arrangeRefreshTask() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadToAllPlayers() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.nameplate.mode.armorstand;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.listener.packet.*;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.PacketsHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ArmorStandPacketsHandler extends PacketsHandler {
|
||||
|
||||
private final ArmorStandTag armorStandTag;
|
||||
|
||||
private EntityDestroyListener entityDestroyListener;
|
||||
private EntityMoveListener entityMoveListener;
|
||||
private EntitySpawnListener entitySpawnListener;
|
||||
private EntityTeleportListener entityTeleportListener;
|
||||
private EntityLookListener entityLookListener;
|
||||
|
||||
protected ArmorStandPacketsHandler(ArmorStandTag armorStandTag) {
|
||||
super();
|
||||
this.armorStandTag = armorStandTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
super.load();
|
||||
this.entityDestroyListener = new EntityDestroyListener(this);
|
||||
this.entityMoveListener = new EntityMoveListener(this);
|
||||
this.entitySpawnListener = new EntitySpawnListener(this);
|
||||
this.entityTeleportListener = new EntityTeleportListener(this);
|
||||
this.entityLookListener = new EntityLookListener(this);
|
||||
CustomNameplates.getProtocolManager().addPacketListener(entityDestroyListener);
|
||||
CustomNameplates.getProtocolManager().addPacketListener(entityMoveListener);
|
||||
CustomNameplates.getProtocolManager().addPacketListener(entitySpawnListener);
|
||||
CustomNameplates.getProtocolManager().addPacketListener(entityTeleportListener);
|
||||
CustomNameplates.getProtocolManager().addPacketListener(entityLookListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
super.unload();
|
||||
CustomNameplates.getProtocolManager().removePacketListener(entityDestroyListener);
|
||||
CustomNameplates.getProtocolManager().removePacketListener(entityMoveListener);
|
||||
CustomNameplates.getProtocolManager().removePacketListener(entitySpawnListener);
|
||||
CustomNameplates.getProtocolManager().removePacketListener(entityTeleportListener);
|
||||
CustomNameplates.getProtocolManager().removePacketListener(entityLookListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityMove(Player receiver, int entityId) {
|
||||
Player mover = super.getPlayerFromMap(entityId);
|
||||
if (mover != null) {
|
||||
armorStandTag.getArmorStandManager(mover).teleport(receiver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntitySpawn(Player receiver, int entityId) {
|
||||
Player spawnedPlayer = super.getPlayerFromMap(entityId);
|
||||
if (spawnedPlayer != null) {
|
||||
armorStandTag.getArmorStandManager(spawnedPlayer).spawn(receiver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDestroy(Player receiver, List<Integer> entities) {
|
||||
for (int entity : entities) {
|
||||
onEntityDestroy(receiver, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDestroy(Player receiver, int entity) {
|
||||
Player deSpawnedPlayer = super.getPlayerFromMap(entity);
|
||||
if (deSpawnedPlayer != null) {
|
||||
armorStandTag.getArmorStandManager(deSpawnedPlayer).destroy(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object.nameplate.mode.armorstand;
|
||||
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.object.armorstand.ArmorStandManager;
|
||||
import net.momirealms.customnameplates.object.nameplate.mode.EntityTag;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class ArmorStandTag extends EntityTag {
|
||||
|
||||
private final VehicleChecker vehicleChecker;
|
||||
private BukkitTask vehicleCheckTask;
|
||||
|
||||
public ArmorStandTag(CustomNameplates plugin) {
|
||||
super(plugin);
|
||||
super.handler = new ArmorStandPacketsHandler(this);
|
||||
this.vehicleChecker = new VehicleChecker(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
super.load();
|
||||
this.vehicleChecker.load();
|
||||
this.vehicleCheckTask = Bukkit.getScheduler().runTaskTimerAsynchronously(CustomNameplates.getInstance(), () -> {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
this.vehicleChecker.refresh(player);
|
||||
}
|
||||
},20,20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
super.unload();
|
||||
this.vehicleChecker.unload();
|
||||
this.vehicleCheckTask.cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoin(Player player) {
|
||||
super.onJoin(player);
|
||||
for (Player viewer : Bukkit.getOnlinePlayers()) {
|
||||
spawnArmorStands(viewer, player);
|
||||
spawnArmorStands(player, viewer);
|
||||
}
|
||||
}
|
||||
|
||||
public void init(Player player) {
|
||||
ArmorStandManager asm = createArmorStandManager(player);
|
||||
asm.initNameplateArmorStands();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadToAllPlayers() {
|
||||
super.loadToAllPlayers();
|
||||
for (Player all : Bukkit.getOnlinePlayers()) {
|
||||
ArmorStandManager asm = createArmorStandManager(all);
|
||||
asm.initNameplateArmorStands();
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
spawnArmorStands(player, all);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void arrangeRefreshTask() {
|
||||
refreshTask = Bukkit.getScheduler().runTaskTimerAsynchronously(CustomNameplates.getInstance(), () -> {
|
||||
for (ArmorStandManager asm : armorStandManagerMap.values()) {
|
||||
asm.refresh(false);
|
||||
}
|
||||
}, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSneak(Player player, boolean isSneaking) {
|
||||
getArmorStandManager(player).setSneak(isSneaking, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRespawn(Player player) {
|
||||
getArmorStandManager(player).teleport();
|
||||
}
|
||||
}
|
||||
@@ -18,4 +18,5 @@
|
||||
package net.momirealms.customnameplates.object.placeholders;
|
||||
|
||||
public record BackGroundText(String text, String background, boolean remove_shadow) {
|
||||
|
||||
}
|
||||
|
||||
@@ -18,4 +18,5 @@
|
||||
package net.momirealms.customnameplates.object.placeholders;
|
||||
|
||||
public record DescentText(String text, int ascent) {
|
||||
|
||||
}
|
||||
|
||||
@@ -25,11 +25,9 @@ import net.momirealms.customnameplates.manager.FontManager;
|
||||
import net.momirealms.customnameplates.manager.NameplateManager;
|
||||
import net.momirealms.customnameplates.manager.PlaceholderManager;
|
||||
import net.momirealms.customnameplates.object.SimpleChar;
|
||||
import net.momirealms.customnameplates.object.StaticText;
|
||||
import net.momirealms.customnameplates.object.nameplate.NameplateConfig;
|
||||
import net.momirealms.customnameplates.object.nameplate.NameplatesTeam;
|
||||
import net.momirealms.customnameplates.utils.AdventureUtils;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -138,24 +136,18 @@ public class NameplatePlaceholders extends PlaceholderExpansion {
|
||||
private String getEquipped(String param, Player player) {
|
||||
if (param.equals("nameplate")) {
|
||||
return plugin.getDataManager().getEquippedNameplate(player);
|
||||
}
|
||||
else if (param.equals("bubble")) {
|
||||
} else if (param.equals("bubble")) {
|
||||
return plugin.getDataManager().getEquippedBubble(player);
|
||||
}
|
||||
return "null";
|
||||
}
|
||||
|
||||
private String getTime(Player player) {
|
||||
World world = player.getWorld();
|
||||
long time = world.getTime();
|
||||
String ap;
|
||||
if (time >= 6000 && time < 18000) ap = " PM";
|
||||
else ap = " AM";
|
||||
int hours = (int) (time / 1000);
|
||||
long time = player.getWorld().getTime();
|
||||
String ap = time >= 6000 && time < 18000 ? " PM" : " AM";
|
||||
int hours = (int) (time / 1000) + 6;
|
||||
int minutes = (int) ((time - hours * 1000 ) * 0.06);
|
||||
hours += 6;
|
||||
if (hours >= 24) hours -= 24;
|
||||
if (hours >= 12) hours -= 12;
|
||||
while (hours >= 12) hours -= 12;
|
||||
if (minutes < 10) return hours + ":0" + minutes + ap;
|
||||
else return hours + ":" + minutes + ap;
|
||||
}
|
||||
@@ -186,16 +178,15 @@ public class NameplatePlaceholders extends PlaceholderExpansion {
|
||||
int parsedWidth = fontManager.getTotalWidth(AdventureUtils.stripAllTags(parsed));
|
||||
if (staticText.staticState() == StaticText.StaticState.LEFT) {
|
||||
return parsed + ConfigManager.surroundWithFont(fontManager.getOffset(staticText.value() - parsedWidth));
|
||||
}
|
||||
else if (staticText.staticState() == StaticText.StaticState.RIGHT) {
|
||||
} else if (staticText.staticState() == StaticText.StaticState.RIGHT) {
|
||||
return ConfigManager.surroundWithFont(fontManager.getOffset(staticText.value() - parsedWidth)) + parsed;
|
||||
}
|
||||
else {
|
||||
} else if (staticText.staticState() == StaticText.StaticState.MIDDLE) {
|
||||
int half = (staticText.value() - parsedWidth) / 2;
|
||||
String left = ConfigManager.surroundWithFont(fontManager.getOffset(half));
|
||||
String right = ConfigManager.surroundWithFont(fontManager.getOffset(staticText.value() - parsedWidth - half));
|
||||
return left + parsed + right;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getBackground(String param, Player player) {
|
||||
@@ -222,6 +213,9 @@ public class NameplatePlaceholders extends PlaceholderExpansion {
|
||||
}
|
||||
|
||||
private String getUnicodeDescent(String param, Player player) {
|
||||
if (plugin.getVersionHelper().isVersionNewerThan1_20()) {
|
||||
return "Not Available on 1.20";
|
||||
}
|
||||
DescentText descentText = placeholderManager.getDescentUnicode(param);
|
||||
if (descentText == null) return param + " NOT FOUND";
|
||||
String parsed = PlaceholderAPI.setPlaceholders(player, descentText.text());
|
||||
@@ -237,6 +231,10 @@ public class NameplatePlaceholders extends PlaceholderExpansion {
|
||||
int full_amount = point / 2;
|
||||
int half_amount = point % 2;
|
||||
int empty_amount = 10 - full_amount - half_amount;
|
||||
if (vanillaHud.reverse()) {
|
||||
return "<#FFFEFD>" + vanillaHud.empty().repeat(empty_amount) + vanillaHud.half().repeat(half_amount) + vanillaHud.full().repeat(full_amount) + "</#FFFEFD>";
|
||||
} else {
|
||||
return "<#FFFEFD>" + vanillaHud.full().repeat(full_amount) + vanillaHud.half().repeat(half_amount) + vanillaHud.empty().repeat(empty_amount) + "</#FFFEFD>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.object;
|
||||
package net.momirealms.customnameplates.object.placeholders;
|
||||
|
||||
public record StaticText(String text, int value, StaticState staticState) {
|
||||
|
||||
@@ -17,5 +17,6 @@
|
||||
|
||||
package net.momirealms.customnameplates.object.placeholders;
|
||||
|
||||
public record VanillaHud(String empty, String half, String full, String papi, String max) {
|
||||
public record VanillaHud(String empty, String half, String full, String papi, String max, boolean reverse) {
|
||||
|
||||
}
|
||||
|
||||
@@ -115,8 +115,7 @@ public class AdventureUtils {
|
||||
} else {
|
||||
stringBuilder.append(chars[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
stringBuilder.append(chars[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import dev.dejvokep.boostedyaml.settings.loader.LoaderSettings;
|
||||
import dev.dejvokep.boostedyaml.settings.updater.UpdaterSettings;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.helper.Log;
|
||||
import net.momirealms.customnameplates.object.carrier.TextDisplayMeta;
|
||||
import net.momirealms.customnameplates.object.requirements.*;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -92,4 +93,24 @@ public class ConfigUtils {
|
||||
}
|
||||
return requirements.toArray(new Requirement[0]);
|
||||
}
|
||||
|
||||
public static TextDisplayMeta getTextDisplayMeta(ConfigurationSection section) {
|
||||
if (section == null) return TextDisplayMeta.defaultValue;
|
||||
return new TextDisplayMeta(
|
||||
section.getBoolean("has-shadow", false),
|
||||
section.getBoolean("is-see-through", false),
|
||||
section.getBoolean("use-default-background-color", false),
|
||||
ConfigUtils.rgbToDecimal(section.getString("background-color", "0,0,0,128")),
|
||||
(byte) section.getInt("text-opacity")
|
||||
);
|
||||
}
|
||||
|
||||
public static int rgbToDecimal(String rgba) {
|
||||
String[] split = rgba.split(",");
|
||||
int r = Integer.parseInt(split[0]);
|
||||
int g = Integer.parseInt(split[1]);
|
||||
int b = Integer.parseInt(split[2]);
|
||||
int a = Integer.parseInt(split[3]);
|
||||
return (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
# Armor_Stand / Text_Display (1.19.4+)
|
||||
mode: Text_Display
|
||||
|
||||
# Text display options
|
||||
text-display-options:
|
||||
# RGBA
|
||||
background-color: 0,0,0,0
|
||||
has-shadow: false
|
||||
is-see-through: false
|
||||
use-default-background-color: false
|
||||
text-opacity: -1
|
||||
|
||||
# blacklist channels
|
||||
# 黑名单聊天频道
|
||||
blacklist-channels:
|
||||
@@ -6,7 +18,7 @@ blacklist-channels:
|
||||
|
||||
# Player's default chatting bubbles
|
||||
# 玩家默认聊天气泡
|
||||
default-bubbles: 'none'
|
||||
default-bubbles: 'chat'
|
||||
|
||||
# Text startFormat when no bubbles equipped
|
||||
# 无气泡时的默认聊天格式
|
||||
@@ -21,11 +33,11 @@ text-suffix: ''
|
||||
|
||||
# Space between two bubbles
|
||||
# 两行气泡之间的间距
|
||||
line-spacing: 0.5
|
||||
line-spacing: 0.4
|
||||
|
||||
# This decides where the bottom line is
|
||||
# 第一行气泡的起始位置
|
||||
bottom-line-Y-offset: -0.35
|
||||
bottom-line-Y-offset: 0.4
|
||||
|
||||
# Seconds
|
||||
# This decides how long will the chat hologram remains
|
||||
|
||||
@@ -149,6 +149,7 @@ descent-unicode:
|
||||
# %nameplates_vanilla_{0}%
|
||||
vanilla-hud:
|
||||
stamina_hud:
|
||||
reverse: true
|
||||
images:
|
||||
empty: "%nameplates_image_stamina_0%"
|
||||
half: "%nameplates_image_stamina_1%"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# mode: Team / Armor_Stand / Disable
|
||||
# 模式 队伍/盔甲架/禁用
|
||||
# mode: Team / Armor_Stand / Text_Display(1.19.4+) / Disable
|
||||
# 模式 队伍/盔甲架/文字/禁用
|
||||
mode: Team
|
||||
|
||||
# Disable this if you meet "Team xxx already exists" when you are running a BungeeCord server
|
||||
@@ -32,7 +32,25 @@ suffix: ''
|
||||
armor_stand:
|
||||
text_1:
|
||||
text: '%nameplates_prefix%%player_name%%nameplates_suffix%'
|
||||
vertical-offset: -0.99
|
||||
vertical-offset: -1
|
||||
text_2:
|
||||
text: '%vault_prefix%'
|
||||
vertical-offset: -0.7
|
||||
conditions:
|
||||
papi-condition:
|
||||
condition_1:
|
||||
type: '!='
|
||||
papi: '%vault_prefix%'
|
||||
value: ''
|
||||
|
||||
# Not recommended to use text display because it's not moving as smoothly as armor stand do
|
||||
# This is caused by the way how client handles the packet which cannot be solved from server side
|
||||
text_display:
|
||||
text_1:
|
||||
text: '%nameplates_prefix%%player_name%%nameplates_suffix%'
|
||||
vertical-offset: -1
|
||||
options:
|
||||
is-see-through: false
|
||||
text_2:
|
||||
text: '%vault_prefix%'
|
||||
vertical-offset: -0.7
|
||||
|
||||
@@ -103,11 +103,6 @@
|
||||
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u2205\u2208\u0000",
|
||||
"\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u0000\u221a\u207f\u00b2\u25a0\u0000"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "legacy_unicode",
|
||||
"sizes": "minecraft:font/glyph_sizes.bin",
|
||||
"template": "minecraft:font/unicode_page_%s.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user