mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2026-01-04 15:31:47 +00:00
2.1.1
This commit is contained in:
@@ -111,6 +111,9 @@ public final class CustomNameplates extends JavaPlugin {
|
||||
if (placeholderManager != null) {
|
||||
placeholderManager.unload();
|
||||
}
|
||||
if (widthManager != null) {
|
||||
widthManager.unload();
|
||||
}
|
||||
if (dataManager != null) {
|
||||
dataManager.disable();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ChatListener implements Listener {
|
||||
public void onChat(AsyncPlayerChatEvent event) {
|
||||
if (!event.isCancelled()) {
|
||||
Bukkit.getScheduler().runTask(CustomNameplates.plugin, () -> {
|
||||
chatBubblesManager.onChat(event.getPlayer(), MiniMessage.miniMessage().stripTags(ChatColor.stripColor(event.getMessage())));
|
||||
chatBubblesManager.onChat(event.getPlayer(), ChatColor.stripColor(event.getMessage()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import me.arasple.mc.trchat.api.event.TrChatEvent;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.manager.ChatBubblesManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
@@ -35,7 +36,7 @@ public record TrChatListener(ChatBubblesManager chatBubblesManager) implements L
|
||||
if (channelName.equals(channel)) return;
|
||||
}
|
||||
Bukkit.getScheduler().runTask(CustomNameplates.plugin, () -> {
|
||||
chatBubblesManager.onChat(event.getSession().getPlayer(), event.getMessage());
|
||||
chatBubblesManager.onChat(event.getSession().getPlayer(), ChatColor.stripColor(event.getMessage()));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.momirealms.customnameplates.listener;
|
||||
|
||||
import mineverse.Aust1n46.chat.api.events.VentureChatEvent;
|
||||
import net.momirealms.customnameplates.CustomNameplates;
|
||||
import net.momirealms.customnameplates.manager.ChatBubblesManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class VentureChatListener implements Listener {
|
||||
|
||||
private final ChatBubblesManager chatBubblesManager;
|
||||
|
||||
public VentureChatListener(ChatBubblesManager chatBubblesManager) {
|
||||
this.chatBubblesManager = chatBubblesManager;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVentureChat(VentureChatEvent event) {
|
||||
String channelName = event.getChannel().getName();
|
||||
for (String channel : ChatBubblesManager.channels) {
|
||||
if (channelName.equals(channel)) return;
|
||||
}
|
||||
Bukkit.getScheduler().runTask(CustomNameplates.plugin, () -> {
|
||||
chatBubblesManager.onChat(event.getMineverseChatPlayer().getPlayer(), ChatColor.stripColor(event.getChat()).substring(1));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.momirealms.customnameplates.hook.ImageParser;
|
||||
import net.momirealms.customnameplates.hook.OXImageHook;
|
||||
import net.momirealms.customnameplates.listener.ChatListener;
|
||||
import net.momirealms.customnameplates.listener.TrChatListener;
|
||||
import net.momirealms.customnameplates.listener.VentureChatListener;
|
||||
import net.momirealms.customnameplates.objects.nameplates.ArmorStandManager;
|
||||
import net.momirealms.customnameplates.objects.nameplates.BubbleConfig;
|
||||
import net.momirealms.customnameplates.objects.nameplates.FakeArmorStand;
|
||||
@@ -49,6 +50,7 @@ public class ChatBubblesManager extends EntityTag {
|
||||
private final BBPacketsHandle packetsHandle;
|
||||
private ChatListener chatListener;
|
||||
private TrChatListener trChatListener;
|
||||
private VentureChatListener ventureChatListener;
|
||||
private ImageParser imageParser;
|
||||
public static String defaultBubble;
|
||||
public static String defaultFormat;
|
||||
@@ -92,6 +94,10 @@ public class ChatBubblesManager extends EntityTag {
|
||||
this.trChatListener = new TrChatListener(this);
|
||||
Bukkit.getPluginManager().registerEvents(trChatListener, CustomNameplates.plugin);
|
||||
}
|
||||
else if (ConfigManager.ventureChat_Hook) {
|
||||
this.ventureChatListener = new VentureChatListener(this);
|
||||
Bukkit.getPluginManager().registerEvents(ventureChatListener, CustomNameplates.plugin);
|
||||
}
|
||||
else {
|
||||
this.chatListener = new ChatListener(this);
|
||||
Bukkit.getPluginManager().registerEvents(chatListener, CustomNameplates.plugin);
|
||||
@@ -124,6 +130,10 @@ public class ChatBubblesManager extends EntityTag {
|
||||
HandlerList.unregisterAll(trChatListener);
|
||||
trChatListener = null;
|
||||
}
|
||||
if (ventureChatListener != null) {
|
||||
HandlerList.unregisterAll(ventureChatListener);
|
||||
ventureChatListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
public ArmorStandManager getArmorStandManager(Player player) {
|
||||
|
||||
@@ -27,6 +27,7 @@ public class ConfigManager extends Function {
|
||||
public static boolean oraxenHook;
|
||||
public static boolean extract;
|
||||
public static boolean trChat_Hook;
|
||||
public static boolean ventureChat_Hook;
|
||||
public static List<Integer> offsets;
|
||||
public static char start;
|
||||
public static Key key;
|
||||
@@ -58,6 +59,7 @@ public class ConfigManager extends Function {
|
||||
oraxenHook = config.getBoolean("config.integrations.Oraxen",false);
|
||||
if (oraxenHook && Bukkit.getPluginManager().getPlugin("Oraxen") == null) oraxenHook = false;
|
||||
trChat_Hook = config.getBoolean("config.integrations.TrChat",false);
|
||||
ventureChat_Hook = config.getBoolean("config.integrations.VentureChat",false);
|
||||
offsets = config.getIntegerList("config.ascii-y-offset.offset");
|
||||
extract = config.getBoolean("config.extract-shader",true);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TABbcHook implements TeamNameInterface {
|
||||
String teamName = teamNames.get(player.getName());
|
||||
if (teamName == null) {
|
||||
sendRequest(player);
|
||||
return null;
|
||||
return player.getName();
|
||||
}
|
||||
else {
|
||||
return teamName;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Do not change
|
||||
config-version: '13'
|
||||
config-version: '14'
|
||||
|
||||
config:
|
||||
# Language
|
||||
@@ -20,6 +20,8 @@ config:
|
||||
TAB-BC: false
|
||||
# TrChat
|
||||
TrChat: false
|
||||
# VentureChat
|
||||
VentureChat: false
|
||||
|
||||
# Your namespace
|
||||
# If you don't know how font works, don't change this
|
||||
|
||||
Reference in New Issue
Block a user