mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-19 02:39:18 +00:00
Remove Hytale chat formatter and update deps
This commit is contained in:
16 files changed
+19
-161
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ dependencies {
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.0'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
|
||||
testImplementation 'org.testcontainers:junit-jupiter:1.21.1'
|
||||
testImplementation 'org.testcontainers:testcontainers-junit-jupiter:2.0.2'
|
||||
testImplementation 'org.mockito:mockito-core:5.18.0'
|
||||
testImplementation 'org.mockito:mockito-junit-jupiter:5.18.0'
|
||||
|
||||
|
||||
@@ -756,14 +756,9 @@ public final class ConfigKeys {
|
||||
public static final ConfigKey<String> RABBITMQ_PASSWORD = notReloadable(stringKey("rabbitmq.password", "guest"));
|
||||
|
||||
/**
|
||||
* If the chat formatter is enabled
|
||||
* If the chat formatter is enabled - deprecated
|
||||
*/
|
||||
public static final ConfigKey<Boolean> CHAT_FORMATTER_ENABLED = booleanKey("chat-formatter.enabled", true);
|
||||
|
||||
/**
|
||||
* The chat formatter format string
|
||||
*/
|
||||
public static final ConfigKey<String> CHAT_FORMATTER_MESSAGE_FORMAT = stringKey("chat-formatter.message-format", "<prefix><username><suffix>: <message>");
|
||||
public static final ConfigKey<Boolean> CHAT_FORMATTER_ENABLED = booleanKey("chat-formatter.enabled", false);
|
||||
|
||||
/**
|
||||
* If the editor key should be generated lazily (only when needed)
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package me.lucko.luckperms.common.cacheddata;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
import me.lucko.luckperms.common.cacheddata.metastack.SimpleMetaStackDefinition;
|
||||
import me.lucko.luckperms.common.cacheddata.metastack.StandardStackElements;
|
||||
@@ -44,8 +46,6 @@ import net.luckperms.api.node.types.PrefixNode;
|
||||
import net.luckperms.api.node.types.SuffixNode;
|
||||
import net.luckperms.api.node.types.WeightNode;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.testcontainers.shaded.com.google.common.collect.ImmutableList;
|
||||
import org.testcontainers.shaded.com.google.common.collect.ImmutableSet;
|
||||
|
||||
import java.util.SortedMap;
|
||||
|
||||
|
||||
+1
-1
@@ -25,6 +25,7 @@
|
||||
|
||||
package me.lucko.luckperms.common.cacheddata;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import me.lucko.luckperms.common.cacheddata.metastack.SimpleMetaStackDefinition;
|
||||
import me.lucko.luckperms.common.cacheddata.metastack.StandardStackElements;
|
||||
import me.lucko.luckperms.common.cacheddata.result.StringResult;
|
||||
@@ -34,7 +35,6 @@ import net.luckperms.api.metastacking.DuplicateRemovalFunction;
|
||||
import net.luckperms.api.node.ChatMetaType;
|
||||
import net.luckperms.api.node.types.PrefixNode;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.testcontainers.shaded.com.google.common.collect.ImmutableList;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
package me.lucko.luckperms.common.cacheddata;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import me.lucko.luckperms.common.cacheddata.metastack.StandardStackElements;
|
||||
import me.lucko.luckperms.common.model.HolderType;
|
||||
import me.lucko.luckperms.common.model.InheritanceOrigin;
|
||||
@@ -39,7 +40,6 @@ import net.luckperms.api.model.data.DataType;
|
||||
import net.luckperms.api.node.ChatMetaType;
|
||||
import net.luckperms.api.node.metadata.types.InheritanceOriginMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.testcontainers.shaded.com.google.common.collect.ImmutableList;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
+1
-1
@@ -25,9 +25,9 @@
|
||||
|
||||
package me.lucko.luckperms.common.command.access;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.EnumSource;
|
||||
import org.testcontainers.shaded.com.google.common.collect.ImmutableSet;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
|
||||
package me.lucko.luckperms.common.treeview;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.testcontainers.shaded.com.google.common.collect.ImmutableSet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ dependencies {
|
||||
implementation 'com.google.guava:guava:19.0'
|
||||
implementation 'com.google.code.gson:gson:2.7'
|
||||
|
||||
compileOnly 'com.hypixel.hytale:Server:2026.01.24-6e2d4fc36'
|
||||
compileOnly 'com.hypixel.hytale:Server:2026.02.17-255364b8e'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -10,7 +10,7 @@ dependencies {
|
||||
implementation project(':api')
|
||||
implementation project(':common:loader-utils')
|
||||
|
||||
compileOnly 'com.hypixel.hytale:Server:2026.01.24-6e2d4fc36'
|
||||
compileOnly 'com.hypixel.hytale:Server:2026.02.17-255364b8e'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"Description": "A permissions plugin",
|
||||
"Authors": [{"Name": "Luck"}],
|
||||
"Website": "https://luckperms.net",
|
||||
"ServerVersion": "*",
|
||||
"ServerVersion": "2026.02.17-255364b8e",
|
||||
"Dependencies": {},
|
||||
"OptionalDependencies": {},
|
||||
"DisabledByDefault": false,
|
||||
|
||||
@@ -6,7 +6,7 @@ dependencies {
|
||||
implementation project(':api')
|
||||
implementation project(':common:loader-utils')
|
||||
|
||||
compileOnly 'com.hypixel.hytale:Server:2026.01.24-6e2d4fc36'
|
||||
compileOnly 'com.hypixel.hytale:Server:2026.02.17-255364b8e'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"Description": "A permissions plugin",
|
||||
"Authors": [{"Name": "Luck"}],
|
||||
"Website": "https://luckperms.net",
|
||||
"ServerVersion": "*",
|
||||
"ServerVersion": "2026.02.17-255364b8e",
|
||||
"Dependencies": {},
|
||||
"OptionalDependencies": {},
|
||||
"DisabledByDefault": false,
|
||||
|
||||
@@ -50,7 +50,6 @@ import me.lucko.luckperms.common.plugin.util.AbstractConnectionListener;
|
||||
import me.lucko.luckperms.common.sender.Sender;
|
||||
import me.lucko.luckperms.hytale.calculator.HytaleCalculatorFactory;
|
||||
import me.lucko.luckperms.hytale.calculator.virtualgroups.VirtualGroupsMap;
|
||||
import me.lucko.luckperms.hytale.chat.LuckPermsChatFormatter;
|
||||
import me.lucko.luckperms.hytale.context.HytaleContextManager;
|
||||
import me.lucko.luckperms.hytale.context.HytalePlayerCalculator;
|
||||
import me.lucko.luckperms.hytale.listeners.HytaleConnectionListener;
|
||||
@@ -203,10 +202,11 @@ public class LPHytalePlugin extends AbstractLuckPermsPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
// chat
|
||||
if (getConfiguration().get(ConfigKeys.CHAT_FORMATTER_ENABLED)) {
|
||||
LuckPermsChatFormatter chatFormatter = new LuckPermsChatFormatter(this);
|
||||
chatFormatter.register(this.bootstrap.getLoader().getEventRegistry());
|
||||
getLogger().warn("The built-in LuckPerms chat formatter has been removed. Please delete the 'CHAT SETTINGS' section " +
|
||||
"from your LuckPerms config.yml. We recommend that users migrate to " +
|
||||
"mini-chat-formatter (https://github.com/lucko/mini-chat-formatter) or a suitable alternative." +
|
||||
"Please see the LuckPerms wiki for more information: https://luckperms.net/wiki/Hytale#chat-formatting");
|
||||
}
|
||||
|
||||
// general
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.hytale.chat;
|
||||
|
||||
import com.hypixel.hytale.event.EventRegistry;
|
||||
import com.hypixel.hytale.server.core.Message;
|
||||
import com.hypixel.hytale.server.core.event.events.player.PlayerChatEvent;
|
||||
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||
import me.lucko.luckperms.common.model.User;
|
||||
import me.lucko.luckperms.hytale.HytaleSenderFactory;
|
||||
import me.lucko.luckperms.hytale.LPHytalePlugin;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.TagPattern;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
public class LuckPermsChatFormatter implements PlayerChatEvent.Formatter {
|
||||
private final LPHytalePlugin plugin;
|
||||
private final String format;
|
||||
|
||||
public LuckPermsChatFormatter(LPHytalePlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.format = plugin.getConfiguration().get(ConfigKeys.CHAT_FORMATTER_MESSAGE_FORMAT);
|
||||
}
|
||||
|
||||
public void register(EventRegistry registry) {
|
||||
registry.registerGlobal(PlayerChatEvent.class, this::onPlayerChat);
|
||||
}
|
||||
|
||||
private void onPlayerChat(PlayerChatEvent e) {
|
||||
e.setFormatter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Message format(@NonNull PlayerRef playerRef, @NonNull String message) {
|
||||
String username = playerRef.getUsername();
|
||||
String prefix = "";
|
||||
String suffix = "";
|
||||
|
||||
User user = this.plugin.getUserManager().getIfLoaded(playerRef.getUuid());
|
||||
if (user != null) {
|
||||
prefix = user.getCachedData().getMetaData().getPrefix();
|
||||
if (prefix == null) {
|
||||
prefix = "";
|
||||
}
|
||||
suffix = user.getCachedData().getMetaData().getSuffix();
|
||||
if (suffix == null) {
|
||||
suffix = "";
|
||||
}
|
||||
}
|
||||
|
||||
Component component = MiniMessage.miniMessage().deserialize(
|
||||
this.format,
|
||||
parse("prefix", prefix),
|
||||
parse("suffix", suffix),
|
||||
Placeholder.unparsed("username", username),
|
||||
Placeholder.unparsed("message", message)
|
||||
);
|
||||
return HytaleSenderFactory.toHytaleMessage(component);
|
||||
}
|
||||
|
||||
private static TagResolver parse(@TagPattern String key, String value) {
|
||||
boolean containsLegacyFormattingCharacter = value.indexOf(LegacyComponentSerializer.AMPERSAND_CHAR) != -1
|
||||
|| value.indexOf(LegacyComponentSerializer.SECTION_CHAR) != -1;
|
||||
|
||||
if (containsLegacyFormattingCharacter) {
|
||||
TextComponent component = LegacyComponentSerializer.legacyAmpersand().deserialize(value);
|
||||
return Placeholder.component(key, component);
|
||||
} else {
|
||||
return Placeholder.parsed(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,41 +46,6 @@ use-server-uuid-cache: false
|
||||
|
||||
|
||||
|
||||
# +----------------------------------------------------------------------------------------------+ #
|
||||
# | | #
|
||||
# | CHAT SETTINGS | #
|
||||
# | | #
|
||||
# | Controls how LuckPerms should format messages from players in the chat. | #
|
||||
# | | #
|
||||
# +----------------------------------------------------------------------------------------------+ #
|
||||
|
||||
# Configuration for the built-in LuckPerms chat formatter.
|
||||
#
|
||||
# Note: This functionality is only intended for simple chat formatting needs. For more advanced
|
||||
# chat formatting, we recommend using a dedicated chat plugin that integrates with LuckPerms.
|
||||
#
|
||||
# When enabled, LuckPerms formats the chat using the format defined below.
|
||||
# The following placeholders are supported:
|
||||
#
|
||||
# - <prefix>: The players prefix meta value
|
||||
# - <username>: The players username
|
||||
# - <suffix>: The players suffix meta value
|
||||
# - <message>: The actual chat message sent by the player
|
||||
#
|
||||
# The format string, as well as the prefix and suffix values support formatting using MiniMessage:
|
||||
# https://docs.papermc.io/adventure/minimessage/
|
||||
#
|
||||
chat-formatter:
|
||||
|
||||
# If LuckPerms should handle chat formatting.
|
||||
enabled: true
|
||||
|
||||
# The format to use.
|
||||
message-format: "<prefix><username><suffix>: <message>"
|
||||
|
||||
|
||||
|
||||
|
||||
# +----------------------------------------------------------------------------------------------+ #
|
||||
# | | #
|
||||
# | STORAGE SETTINGS | #
|
||||
|
||||
@@ -28,7 +28,7 @@ dependencies {
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.0'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
|
||||
testImplementation 'org.testcontainers:junit-jupiter:1.21.1'
|
||||
testImplementation 'org.testcontainers:testcontainers-junit-jupiter:2.0.2'
|
||||
testImplementation 'org.mockito:mockito-core:5.18.0'
|
||||
testImplementation 'org.mockito:mockito-junit-jupiter:5.18.0'
|
||||
testImplementation 'org.awaitility:awaitility:4.3.0'
|
||||
|
||||
Reference in new issue
Block a user