mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-07-08 19:34:01 +00:00
Update to match release v3.7.1
This commit is contained in:
parent
d9fb354b83
commit
6207bdab2f
8
pom.xml
8
pom.xml
@ -168,7 +168,7 @@
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.6.0</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!--These are long depreciated. I would've removed them, but that is outside the scope of what I want to do here.
|
||||
I am using the latest builds of these plugins to be published to SpigotMC.-->
|
||||
@ -225,21 +225,21 @@
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.13-SNAPSHOT</version>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.13-SNAPSHOT</version>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<type>javadoc</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13-R0.1-SNAPSHOT</version>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -396,6 +396,15 @@ public class PluginMessageController {
|
||||
sendPluginMessage(stream);
|
||||
return;
|
||||
}
|
||||
if (p.getPlayer().hasPermission("venturechat.ignore.bypass")) {
|
||||
out.writeUTF("Ignore");
|
||||
out.writeUTF("Bypass");
|
||||
out.writeUTF(server);
|
||||
out.writeUTF(receiver);
|
||||
out.writeUTF(sender.toString());
|
||||
sendPluginMessage(stream);
|
||||
return;
|
||||
}
|
||||
out.writeUTF("Ignore");
|
||||
out.writeUTF("Echo");
|
||||
out.writeUTF(server);
|
||||
@ -428,6 +437,12 @@ public class PluginMessageController {
|
||||
p.getPlayer().sendMessage(LocalizedMessage.IGNORE_PLAYER_ON.toString().replace("{player}", receiverName));
|
||||
synchronize(p, true);
|
||||
}
|
||||
if (identifier.equals("Bypass")) {
|
||||
String receiver = msgin.readUTF();
|
||||
UUID sender = UUID.fromString(msgin.readUTF());
|
||||
VentureChatPlayer p = playerApiService.getOnlineMineverseChatPlayer(sender);
|
||||
p.getPlayer().sendMessage(LocalizedMessage.IGNORE_PLAYER_CANT.toString().replace("{player}", receiver));
|
||||
}
|
||||
}
|
||||
if (subchannel.equals("Mute")) {
|
||||
String identifier = msgin.readUTF();
|
||||
|
@ -212,6 +212,18 @@ public class VentureChatProxyController {
|
||||
source.sendPluginMessage(server, outstream.toByteArray());
|
||||
}
|
||||
}
|
||||
if (identifier.equals("Bypass")) {
|
||||
String server = in.readUTF();
|
||||
String player = in.readUTF();
|
||||
String sender = in.readUTF();
|
||||
out.writeUTF("Ignore");
|
||||
out.writeUTF("Bypass");
|
||||
out.writeUTF(player);
|
||||
out.writeUTF(sender);
|
||||
if(!source.getServer(server).isEmpty()) {
|
||||
source.sendPluginMessage(server, outstream.toByteArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(subchannel.equals("Mute")) {
|
||||
String identifier = in.readUTF();
|
||||
|
@ -22,7 +22,7 @@ import venture.Aust1n46.chat.controllers.VentureChatSpigotFlatFileController;
|
||||
import venture.Aust1n46.chat.guice.VentureChatPluginModule;
|
||||
import venture.Aust1n46.chat.initiators.listeners.ChatListener;
|
||||
import venture.Aust1n46.chat.initiators.listeners.LoginListener;
|
||||
import venture.Aust1n46.chat.initiators.listeners.PacketListener;
|
||||
import venture.Aust1n46.chat.initiators.listeners.PacketListenerLegacyChat;
|
||||
import venture.Aust1n46.chat.initiators.listeners.PreProcessCommandListener;
|
||||
import venture.Aust1n46.chat.initiators.listeners.SignListener;
|
||||
import venture.Aust1n46.chat.initiators.schedulers.UnmuteScheduler;
|
||||
@ -30,6 +30,7 @@ import venture.Aust1n46.chat.localization.Localization;
|
||||
import venture.Aust1n46.chat.placeholderapi.VentureChatPlaceholders;
|
||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||
import venture.Aust1n46.chat.xcut.VersionService;
|
||||
|
||||
/**
|
||||
* VentureChat Minecraft plugin for servers running Spigot or Paper software.
|
||||
@ -47,7 +48,7 @@ public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
||||
@Inject
|
||||
private PreProcessCommandListener commandListener;
|
||||
@Inject
|
||||
private PacketListener packetListener;
|
||||
private PacketListenerLegacyChat packetListener;
|
||||
@Inject
|
||||
private VentureChatPlaceholders ventureChatPlaceholders;
|
||||
@Inject
|
||||
@ -56,6 +57,8 @@ public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
||||
private VentureChatPlayerApiService playerApiService;
|
||||
@Inject
|
||||
private PluginMessageController pluginMessageController;
|
||||
@Inject
|
||||
private VersionService versionService;
|
||||
|
||||
private Permission permission = null;
|
||||
|
||||
@ -157,7 +160,9 @@ public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
||||
pluginManager.registerEvents(signListener, this);
|
||||
pluginManager.registerEvents(commandListener, this);
|
||||
pluginManager.registerEvents(loginListener, this);
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(packetListener);
|
||||
if (versionService.isUnder_1_19()) {
|
||||
ProtocolLibrary.getProtocolManager().addPacketListener(packetListener);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean setupPermissions() {
|
||||
|
@ -17,7 +17,7 @@ import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||
import venture.Aust1n46.chat.xcut.VersionService;
|
||||
|
||||
@Singleton
|
||||
public class PacketListener extends PacketAdapter {
|
||||
public class PacketListenerLegacyChat extends PacketAdapter {
|
||||
@Inject
|
||||
private VentureChatFormatService formatter;
|
||||
@Inject
|
||||
@ -26,13 +26,13 @@ public class PacketListener extends PacketAdapter {
|
||||
private VersionService versionService;
|
||||
|
||||
@Inject
|
||||
public PacketListener(final VentureChat plugin) {
|
||||
public PacketListenerLegacyChat(final VentureChat plugin) {
|
||||
super(plugin, ListenerPriority.MONITOR, new PacketType[] { PacketType.Play.Server.CHAT });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
if (event.isCancelled() || event.getPacketType() != PacketType.Play.Server.CHAT) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
16
src/main/java/venture/Aust1n46/chat/model/ClickAction.java
Normal file
16
src/main/java/venture/Aust1n46/chat/model/ClickAction.java
Normal file
@ -0,0 +1,16 @@
|
||||
package venture.Aust1n46.chat.model;
|
||||
|
||||
public enum ClickAction {
|
||||
SUGGEST_COMMAND, RUN_COMMAND, OPEN_URL, NONE;
|
||||
|
||||
private final String jsonValue;
|
||||
|
||||
ClickAction() {
|
||||
jsonValue = name().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return jsonValue;
|
||||
}
|
||||
}
|
@ -8,10 +8,10 @@ import lombok.Getter;
|
||||
public class JsonAttribute {
|
||||
private String name;
|
||||
private List<String> hoverText;
|
||||
private String clickAction;
|
||||
private ClickAction clickAction;
|
||||
private String clickText;
|
||||
|
||||
public JsonAttribute(String name, List<String> hoverText, String clickAction, String clickText) {
|
||||
public JsonAttribute(String name, List<String> hoverText, ClickAction clickAction, String clickText) {
|
||||
this.name = name;
|
||||
this.hoverText = hoverText;
|
||||
this.clickAction = clickAction;
|
||||
|
@ -14,6 +14,7 @@ import com.google.inject.Singleton;
|
||||
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||
import venture.Aust1n46.chat.model.Alias;
|
||||
import venture.Aust1n46.chat.model.ChatChannel;
|
||||
import venture.Aust1n46.chat.model.ClickAction;
|
||||
import venture.Aust1n46.chat.model.GuiSlot;
|
||||
import venture.Aust1n46.chat.model.JsonAttribute;
|
||||
import venture.Aust1n46.chat.model.JsonFormat;
|
||||
@ -81,8 +82,9 @@ public class ConfigService {
|
||||
if (jsonAttributeSection != null) {
|
||||
for (String attribute : jsonAttributeSection.getKeys(false)) {
|
||||
List<String> hoverText = jsonAttributeSection.getStringList(attribute + ".hover_text");
|
||||
String clickAction = jsonAttributeSection.getString(attribute + ".click_action", "");
|
||||
String clickText = jsonAttributeSection.getString(attribute + ".click_text", "");
|
||||
String clickActionText = jsonAttributeSection.getString(attribute + ".click_action", "none");
|
||||
ClickAction clickAction = ClickAction.valueOf(clickActionText.toUpperCase());
|
||||
jsonAttributes.add(new JsonAttribute(attribute, hoverText, clickAction, clickText));
|
||||
}
|
||||
}
|
||||
@ -215,8 +217,11 @@ public class ConfigService {
|
||||
|
||||
public boolean isProxyEnabled() {
|
||||
try {
|
||||
return plugin.getServer().spigot().getConfig().getBoolean("settings.bungeecord")
|
||||
|| plugin.getServer().spigot().getPaperConfig().getBoolean("settings.velocity-support.enabled");
|
||||
// return plugin.getServer().spigot().getConfig().getBoolean("settings.bungeecord")
|
||||
// || plugin.getServer().spigot().getPaperConfig().getBoolean("settings.velocity-support.enabled");
|
||||
return (plugin.getServer().spigot().getConfig().getBoolean("settings.bungeecord")
|
||||
|| plugin.getServer().spigot().getPaperConfig().getBoolean("settings.velocity-support.enabled")
|
||||
|| plugin.getServer().spigot().getPaperConfig().getBoolean("proxies.velocity.enabled"));
|
||||
} catch (NoSuchMethodError exception) { // Thrown if server isn't Paper.
|
||||
return false;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -28,6 +29,7 @@ import com.google.inject.Singleton;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||
import venture.Aust1n46.chat.model.ClickAction;
|
||||
import venture.Aust1n46.chat.model.JsonAttribute;
|
||||
import venture.Aust1n46.chat.model.JsonFormat;
|
||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||
@ -65,10 +67,10 @@ public class VentureChatFormatService {
|
||||
*/
|
||||
public String convertToJson(VentureChatPlayer sender, String format, String chat) {
|
||||
JsonFormat JSONformat = configService.getJsonFormat(sender.getJsonFormat());
|
||||
String f = escapeJsonChars(format);
|
||||
// String f = escapeJsonChars(format);
|
||||
String c = escapeJsonChars(chat);
|
||||
String json = "[\"\",{\"text\":\"\",\"extra\":[";
|
||||
json += convertPlaceholders(f, JSONformat, sender);
|
||||
json += convertPlaceholders(format, JSONformat, sender);
|
||||
json += "]}";
|
||||
json += "," + convertLinks(c);
|
||||
json += "]";
|
||||
@ -108,26 +110,59 @@ public class VentureChatFormatService {
|
||||
indexStart = matcher.start();
|
||||
indexEnd = matcher.end();
|
||||
placeholder = remaining.substring(indexStart, indexEnd);
|
||||
formattedPlaceholder = FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), placeholder));
|
||||
temp += convertToJsonColors(lastCode + remaining.substring(0, indexStart)) + ",";
|
||||
formattedPlaceholder = escapeJsonChars(FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), placeholder)));
|
||||
temp += convertToJsonColors(escapeJsonChars(lastCode + remaining.substring(0, indexStart))) + ",";
|
||||
lastCode = getLastCode(lastCode + remaining.substring(0, indexStart));
|
||||
String action = "";
|
||||
String text = "";
|
||||
String hover = "";
|
||||
// String action = "";
|
||||
// String text = "";
|
||||
// String hover = "";
|
||||
boolean placeholderHasJsonAttribute = false;
|
||||
for (JsonAttribute jsonAttribute : format.getJsonAttributes()) {
|
||||
if (placeholder.contains(jsonAttribute.getName().replace("{", "").replace("}", ""))) {
|
||||
action = jsonAttribute.getClickAction();
|
||||
text = FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), jsonAttribute.getClickText()));
|
||||
// action = jsonAttribute.getClickAction();
|
||||
// text = FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), jsonAttribute.getClickText()));
|
||||
final StringBuilder hover = new StringBuilder();
|
||||
for (String st : jsonAttribute.getHoverText()) {
|
||||
hover += FormatUtils.FormatStringAll(st) + "\n";
|
||||
// hover += FormatUtils.FormatStringAll(st) + "\n";
|
||||
hover.append(FormatUtils.FormatStringAll(st) + "\n");
|
||||
}
|
||||
final String hoverText;
|
||||
if(!hover.isEmpty()) {
|
||||
hoverText = escapeJsonChars(FormatUtils.FormatStringAll(
|
||||
PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), hover.substring(0, hover.length() - 1))));
|
||||
} else {
|
||||
hoverText = StringUtils.EMPTY;
|
||||
}
|
||||
final ClickAction clickAction = jsonAttribute.getClickAction();
|
||||
final String actionJson;
|
||||
if (clickAction == ClickAction.NONE) {
|
||||
actionJson = StringUtils.EMPTY;
|
||||
} else {
|
||||
final String clickText = escapeJsonChars(FormatUtils.FormatStringAll(
|
||||
PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), jsonAttribute.getClickText())));
|
||||
actionJson = ",\"clickEvent\":{\"action\":\"" + jsonAttribute.getClickAction().toString() + "\",\"value\":\"" + clickText
|
||||
+ "\"}";
|
||||
}
|
||||
final String hoverJson;
|
||||
if (hoverText.isEmpty()) {
|
||||
hoverJson = StringUtils.EMPTY;
|
||||
} else {
|
||||
hoverJson = ",\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":["
|
||||
+ convertToJsonColors(hoverText) + "]}}";
|
||||
}
|
||||
temp += convertToJsonColors(lastCode + formattedPlaceholder, actionJson + hoverJson) + ",";
|
||||
placeholderHasJsonAttribute = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hover.isEmpty()) {
|
||||
hover = FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), hover.substring(0, hover.length() - 1)));
|
||||
// if (!hover.isEmpty()) {
|
||||
// hover = FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), hover.substring(0, hover.length() - 1)));
|
||||
// }
|
||||
if (!placeholderHasJsonAttribute) {
|
||||
temp += convertToJsonColors(lastCode + formattedPlaceholder) + ",";
|
||||
}
|
||||
temp += convertToJsonColors(lastCode + formattedPlaceholder, ",\"clickEvent\":{\"action\":\"" + action + "\",\"value\":\"" + text
|
||||
+ "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + convertToJsonColors(hover) + "]}}") + ",";
|
||||
// temp += convertToJsonColors(lastCode + formattedPlaceholder, ",\"clickEvent\":{\"action\":\"" + action + "\",\"value\":\"" + text
|
||||
// + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + convertToJsonColors(hover) + "]}}") + ",";
|
||||
lastCode = getLastCode(lastCode + formattedPlaceholder);
|
||||
remaining = remaining.substring(indexEnd);
|
||||
} else {
|
||||
@ -165,7 +200,7 @@ public class VentureChatFormatService {
|
||||
if (ChatColor.stripColor(link).contains("https://"))
|
||||
https = "s";
|
||||
temp += convertToJsonColors(lastCode + link,
|
||||
",\"underlined\":\"" + underlineURLs() + "\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http" + https + "://"
|
||||
",\"underlined\":" + underlineURLs() + ",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http" + https + "://"
|
||||
+ ChatColor.stripColor(link.replace("http://", "").replace("https://", ""))
|
||||
+ "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + convertToJsonColors(lastCode + link) + "]}}")
|
||||
+ ",";
|
||||
@ -307,15 +342,35 @@ public class VentureChatFormatService {
|
||||
underlined = false;
|
||||
}
|
||||
if (bold)
|
||||
modifier += ",\"bold\":\"true\"";
|
||||
if (versionService.isAtLeast_1_20_4()) {
|
||||
modifier += ",\"bold\":true";
|
||||
} else {
|
||||
modifier += ",\"bold\":\"true\"";
|
||||
}
|
||||
if (obfuscated)
|
||||
modifier += ",\"obfuscated\":\"true\"";
|
||||
if (versionService.isAtLeast_1_20_4()) {
|
||||
modifier += ",\"obfuscated\":true";
|
||||
} else {
|
||||
modifier += ",\"obfuscated\":\"true\"";
|
||||
}
|
||||
if (italic)
|
||||
modifier += ",\"italic\":\"true\"";
|
||||
if (versionService.isAtLeast_1_20_4()) {
|
||||
modifier += ",\"italic\":true";
|
||||
} else {
|
||||
modifier += ",\"italic\":\"true\"";
|
||||
}
|
||||
if (underlined)
|
||||
modifier += ",\"underlined\":\"true\"";
|
||||
if (versionService.isAtLeast_1_20_4()) {
|
||||
modifier += ",\"underlined\":true";
|
||||
} else {
|
||||
modifier += ",\"underlined\":\"true\"";
|
||||
}
|
||||
if (strikethrough)
|
||||
modifier += ",\"strikethrough\":\"true\"";
|
||||
if (versionService.isAtLeast_1_20_4()) {
|
||||
modifier += ",\"strikethrough\":true";
|
||||
} else {
|
||||
modifier += ",\"strikethrough\":\"true\"";
|
||||
}
|
||||
remaining = remaining.substring(colorLength);
|
||||
colorLength = LEGACY_COLOR_CODE_LENGTH;
|
||||
indexNextColor = remaining.indexOf(BUKKIT_COLOR_CODE_PREFIX);
|
||||
@ -407,17 +462,47 @@ public class VentureChatFormatService {
|
||||
}
|
||||
|
||||
public PacketContainer createPacketPlayOutChat(String json) {
|
||||
WrappedChatComponent component = WrappedChatComponent.fromJson(json);
|
||||
PacketContainer container = new PacketContainer(PacketType.Play.Server.CHAT);
|
||||
container.getModifier().writeDefaults();
|
||||
container.getChatComponents().write(0, component);
|
||||
final PacketContainer container;
|
||||
if (versionService.isAtLeast_1_20_4()) { // 1.20.4+
|
||||
container = new PacketContainer(PacketType.Play.Server.SYSTEM_CHAT);
|
||||
container.getChatComponents().write(0, WrappedChatComponent.fromJson(json));
|
||||
container.getBooleans().write(0, false);
|
||||
} else if (versionService.isAbove_1_19()) { // 1.19.1 -> 1.20.3
|
||||
container = new PacketContainer(PacketType.Play.Server.SYSTEM_CHAT);
|
||||
container.getStrings().write(0, json);
|
||||
container.getBooleans().write(0, false);
|
||||
} else if (versionService.isUnder_1_19()) { // 1.7 -> 1.19
|
||||
WrappedChatComponent component = WrappedChatComponent.fromJson(json);
|
||||
container = new PacketContainer(PacketType.Play.Server.CHAT);
|
||||
container.getModifier().writeDefaults();
|
||||
container.getChatComponents().write(0, component);
|
||||
} else { // 1.19
|
||||
container = new PacketContainer(PacketType.Play.Server.SYSTEM_CHAT);
|
||||
container.getStrings().write(0, json);
|
||||
container.getIntegers().write(0, 1);
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
public PacketContainer createPacketPlayOutChat(WrappedChatComponent component) {
|
||||
PacketContainer container = new PacketContainer(PacketType.Play.Server.CHAT);
|
||||
container.getModifier().writeDefaults();
|
||||
container.getChatComponents().write(0, component);
|
||||
final PacketContainer container;
|
||||
if (versionService.isAtLeast_1_20_4()) { // 1.20.4+
|
||||
container = new PacketContainer(PacketType.Play.Server.SYSTEM_CHAT);
|
||||
container.getChatComponents().write(0, component);
|
||||
container.getBooleans().write(0, false);
|
||||
} else if (versionService.isAbove_1_19()) { // 1.19.1 -> 1.20.3
|
||||
container = new PacketContainer(PacketType.Play.Server.SYSTEM_CHAT);
|
||||
container.getStrings().write(0, component.getJson());
|
||||
container.getBooleans().write(0, false);
|
||||
} else if (versionService.isUnder_1_19()) { // 1.7 -> 1.19
|
||||
container = new PacketContainer(PacketType.Play.Server.CHAT);
|
||||
container.getModifier().writeDefaults();
|
||||
container.getChatComponents().write(0, component);
|
||||
} else { // 1.19
|
||||
container = new PacketContainer(PacketType.Play.Server.SYSTEM_CHAT);
|
||||
container.getStrings().write(0, component.getJson());
|
||||
container.getIntegers().write(0, 1);
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
@ -578,8 +663,13 @@ public class VentureChatFormatService {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public boolean underlineURLs() {
|
||||
return plugin.getConfig().getBoolean("underlineurls", true);
|
||||
public String underlineURLs() {
|
||||
final boolean configValue = plugin.getConfig().getBoolean("underlineurls", true);
|
||||
if (versionService.isAtLeast_1_20_4()) {
|
||||
return String.valueOf(configValue);
|
||||
} else {
|
||||
return "\"" + configValue + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastToServer(String message) {
|
||||
|
@ -6,6 +6,9 @@ import com.google.inject.Singleton;
|
||||
@Singleton
|
||||
public final class VersionService {
|
||||
public static final MinecraftVersion SERVER_VERSION = MinecraftVersion.getCurrentVersion();
|
||||
private static final MinecraftVersion MC1_19 = new MinecraftVersion(1, 19, 0);
|
||||
private static final MinecraftVersion MC1_19_1 = new MinecraftVersion(1, 19, 1);
|
||||
private static final MinecraftVersion MC1_20_4 = new MinecraftVersion(1, 20, 4);
|
||||
|
||||
private VersionService() {
|
||||
}
|
||||
@ -67,22 +70,14 @@ public final class VersionService {
|
||||
}
|
||||
|
||||
public boolean isUnder_1_19() {
|
||||
if (SERVER_VERSION.getMajor() < 1) {
|
||||
return true;
|
||||
}
|
||||
return SERVER_VERSION.getMajor() == 1 && SERVER_VERSION.getMinor() < 19;
|
||||
return !SERVER_VERSION.isAtLeast(MC1_19);
|
||||
}
|
||||
|
||||
public boolean isAbove_1_19() {
|
||||
if (SERVER_VERSION.getMajor() < 1) {
|
||||
return false;
|
||||
}
|
||||
if (SERVER_VERSION.getMajor() > 1) {
|
||||
return true;
|
||||
}
|
||||
if (SERVER_VERSION.getMinor() > 19) {
|
||||
return true;
|
||||
}
|
||||
return SERVER_VERSION.getMinor() == 19 && SERVER_VERSION.getBuild() > 0;
|
||||
return SERVER_VERSION.isAtLeast(MC1_19_1);
|
||||
}
|
||||
|
||||
public boolean isAtLeast_1_20_4() {
|
||||
return SERVER_VERSION.isAtLeast(MC1_20_4);
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ messageremovertext: '&c&o<message removed>'
|
||||
# The name of the group is the permissions node for the format
|
||||
# Example: venturechat.json.Owner is the node for the group Owner
|
||||
# A lower priority overrides a higher priority if a player has more than 1 group
|
||||
# Possible options for click_name and click_prefix are suggest_command, run_command, and open_url
|
||||
# Possible options for click_action are suggest_command, run_command, open_url, and none
|
||||
jsonformatting:
|
||||
Default: # This default format is required! Do not delete or rename it!
|
||||
priority: 2147483647 # Integer.MAX_VALUE
|
||||
|
Loading…
x
Reference in New Issue
Block a user