mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 15:09:23 +00:00
Fixed Placeholders in Chat Prefix/Suffix
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
package net.momirealms.customnameplates.api.feature.bubble;
|
||||
|
||||
import net.momirealms.customnameplates.api.feature.PreParsedDynamicText;
|
||||
import net.momirealms.customnameplates.api.util.Vector3;
|
||||
|
||||
/**
|
||||
@@ -64,14 +65,14 @@ public interface BubbleConfig {
|
||||
*
|
||||
* @return the text prefix
|
||||
*/
|
||||
String textPrefix();
|
||||
PreParsedDynamicText textPrefix();
|
||||
|
||||
/**
|
||||
* Returns the text suffix to be applied after the Bubble content.
|
||||
*
|
||||
* @return the text suffix
|
||||
*/
|
||||
String textSuffix();
|
||||
PreParsedDynamicText textSuffix();
|
||||
|
||||
/**
|
||||
* Returns the display name of the Bubble.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
package net.momirealms.customnameplates.api.feature.bubble;
|
||||
|
||||
import net.momirealms.customnameplates.api.feature.PreParsedDynamicText;
|
||||
import net.momirealms.customnameplates.api.util.Vector3;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
@@ -30,8 +31,8 @@ public class BubbleConfigImpl implements BubbleConfig {
|
||||
private final int lineWidth;
|
||||
private final int maxLines;
|
||||
private final Bubble[] bubbles;
|
||||
private final String textPrefix;
|
||||
private final String textSuffix;
|
||||
private final PreParsedDynamicText textPrefix;
|
||||
private final PreParsedDynamicText textSuffix;
|
||||
private final String displayName;
|
||||
private final Vector3 scale;
|
||||
|
||||
@@ -54,8 +55,8 @@ public class BubbleConfigImpl implements BubbleConfig {
|
||||
this.maxLines = maxLines;
|
||||
this.id = id;
|
||||
this.bubbles = requireNonNull(bubbles);
|
||||
this.textPrefix = requireNonNull(textPrefix);
|
||||
this.textSuffix = requireNonNull(textSuffix);
|
||||
this.textPrefix = new PreParsedDynamicText(requireNonNull(textPrefix), true);
|
||||
this.textSuffix = new PreParsedDynamicText(requireNonNull(textSuffix), true);
|
||||
this.displayName = requireNonNull(displayName);
|
||||
this.scale = requireNonNull(scale);
|
||||
}
|
||||
@@ -86,12 +87,12 @@ public class BubbleConfigImpl implements BubbleConfig {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String textPrefix() {
|
||||
public PreParsedDynamicText textPrefix() {
|
||||
return textPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String textSuffix() {
|
||||
public PreParsedDynamicText textSuffix() {
|
||||
return textSuffix;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import net.momirealms.customnameplates.api.CNPlayer;
|
||||
import net.momirealms.customnameplates.api.ConfigManager;
|
||||
import net.momirealms.customnameplates.api.CustomNameplates;
|
||||
import net.momirealms.customnameplates.api.feature.ChatListener;
|
||||
import net.momirealms.customnameplates.api.feature.ConfiguredCharacter;
|
||||
import net.momirealms.customnameplates.api.feature.OffsetFont;
|
||||
import net.momirealms.customnameplates.api.feature.*;
|
||||
import net.momirealms.customnameplates.api.feature.bubble.Bubble;
|
||||
import net.momirealms.customnameplates.api.feature.bubble.BubbleConfig;
|
||||
import net.momirealms.customnameplates.api.feature.bubble.BubbleManager;
|
||||
@@ -304,7 +302,7 @@ public class BubbleManagerImpl implements BubbleManager, ChatListener {
|
||||
return;
|
||||
}
|
||||
|
||||
String fullText = config.textPrefix() + AdventureHelper.stripTags(message.replace("\\", "\\\\")) + config.textSuffix();
|
||||
String fullText = config.textPrefix().fastCreate(player).render(player) + AdventureHelper.stripTags(message.replace("\\", "\\\\")) + config.textSuffix().fastCreate(player).render(player);
|
||||
int lines = plugin.getAdvanceManager().getLines(fullText, config.lineWidth());
|
||||
if (lines > config.maxLines()) return;
|
||||
if (lines <= 0) return;
|
||||
|
||||
@@ -12,6 +12,7 @@ repositories {
|
||||
maven("https://repo.md-5.net/content/groups/public/") // disguise
|
||||
maven("https://repo.opencollab.dev/main/") // geyser
|
||||
maven("https://maven.enginehub.org/repo/") // worldguard worldedit
|
||||
maven("https://repo.alessiodp.com/releases/") // parties
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -33,6 +34,8 @@ dependencies {
|
||||
compileOnly("net.william278.huskchat:huskchat-bukkit:3.0.4")
|
||||
compileOnly("net.essentialsx:EssentialsX:2.20.1")
|
||||
compileOnly("net.essentialsx:EssentialsXChat:2.20.1")
|
||||
compileOnly("com.alessiodp.parties:parties-api:3.2.16")
|
||||
compileOnly("com.alessiodp.parties:parties-bukkit:3.2.16")
|
||||
// compileOnly("com.github.Brikster:Chatty:v2.19.14")
|
||||
compileOnly(files("libs/Chatty-3.0.0-SNAPSHOT.jar"))
|
||||
// Emoji
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package net.momirealms.customnameplates.bukkit.compatibility.chat;
|
||||
|
||||
import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPreChatEvent;
|
||||
import net.momirealms.customnameplates.api.CNPlayer;
|
||||
import net.momirealms.customnameplates.api.CustomNameplates;
|
||||
import net.momirealms.customnameplates.api.feature.chat.AbstractChatMessageProvider;
|
||||
import net.momirealms.customnameplates.api.feature.chat.ChatManager;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class PartiesChatProvider extends AbstractChatMessageProvider implements Listener {
|
||||
|
||||
public PartiesChatProvider(CustomNameplates plugin, ChatManager manager) {
|
||||
super(plugin, manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasJoinedChannel(CNPlayer player, String channelID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canJoinChannel(CNPlayer player, String channelID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIgnoring(CNPlayer sender, CNPlayer receiver) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChat(BukkitPartiesPlayerPreChatEvent event) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@ import net.momirealms.customnameplates.bukkit.compatibility.quest.TypeWriterList
|
||||
import net.momirealms.customnameplates.bukkit.compatibility.region.WorldGuardRegion;
|
||||
import net.momirealms.customnameplates.bukkit.requirement.BukkitRequirementManager;
|
||||
import net.momirealms.customnameplates.bukkit.scheduler.BukkitSchedulerAdapter;
|
||||
import net.momirealms.customnameplates.bukkit.util.Reflections;
|
||||
import net.momirealms.customnameplates.bukkit.util.SimpleLocation;
|
||||
import net.momirealms.customnameplates.common.dependency.Dependency;
|
||||
import net.momirealms.customnameplates.common.dependency.DependencyManagerImpl;
|
||||
@@ -128,6 +129,7 @@ public class BukkitCustomNameplates extends CustomNameplates implements Listener
|
||||
Dependency.LWJGL, Dependency.LWJGL_NATIVES, Dependency.LWJGL_FREETYPE, Dependency.LWJGL_FREETYPE_NATIVES
|
||||
)
|
||||
);
|
||||
Reflections.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,6 +30,8 @@ import static java.util.Objects.requireNonNull;
|
||||
|
||||
public class Reflections {
|
||||
|
||||
public static void load() {}
|
||||
|
||||
public static final Class<?> clazz$Component = requireNonNull(
|
||||
ReflectionUtils.getClazz(
|
||||
BukkitReflectionUtils.assembleMCClass("network.chat.Component"),
|
||||
|
||||
Reference in New Issue
Block a user