diff --git a/CHANGELOG.md b/CHANGELOG.md index dca5c08..ece0084 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +**1.6.6** +- Disabled entity cramming now that true-og/ChunkCap-OG and true-og/MobLimiter-OG establish a ceiling. +- Split string-based player messaging into miniplaceholder expanding and non-expanding APIs. +- Add `trueogRawMessage(Player, String)` and `trueogRawMessage(UUID, String)` for sending unexpanded or pre-expanded text with TrueOG formatting. + **1.6.5** - Remove all PlaceholderAPI references and support MiniPlaceholders only. - Always register built-in MiniPlaceholders without a config toggle. diff --git a/README.md b/README.md index 13733f1..96821f2 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,22 @@ Player targetPlayer = Bukkit.getPlayer("USERNAME"); UtilitiesOG.trueogMessage(targetPlayer, "&6This is a &*message with True&4OG formatting!"); ``` +**[void] trueogRawMessage(Player player, String message)** + +Sends a message to the specified player with TrueOG formatting on the caller's current thread without expanding MiniPlaceholders within the message. Supports both modern color codes and legacy Bukkit color codes (case-insensitive). + +Kotlin: +```kotlin +val targetPlayer = Bukkit.getPlayer("USERNAME") +UtilitiesOG.trueogRawMessage(targetPlayer, "&6Literal placeholder: ") +``` + +Java: +```java +Player targetPlayer = Bukkit.getPlayer("USERNAME"); +UtilitiesOG.trueogRawMessage(targetPlayer, "&6Literal placeholder: "); +``` + **[void] trueogMessage(Player player, Component message)** Sends a pre-built Adventure Component to the specified player on the caller's current thread. This overload does not perform placeholder expansion or color-code processing. @@ -94,8 +110,8 @@ Sends a message to a player identified by their UUID with TrueOG formatting. Use Kotlin: ```kotlin -UUID playerUUID = UUID.fromString("player_uuid"); -UtilitiesOG.trueogMessage(playerUUID, "&6Hello there!"); +val playerUUID = UUID.fromString("player_uuid") +UtilitiesOG.trueogMessage(playerUUID, "&6Hello there!") ``` Java: @@ -104,6 +120,22 @@ UUID playerUUID = UUID.fromString("player_uuid"); UtilitiesOG.trueogMessage(playerUUID, "&6Hello there!"); ``` +**[void] trueogRawMessage(UUID playerUUID, String message)** + +Sends a message to a player identified by their UUID with TrueOG formatting but without MiniPlaceholder expansion. Useful when the Bukkit Player object is not available. Supports modern color codes and legacy Bukkit color codes (case-insensitive). If the UUID resolves to an online player, the message is sent immediately on the caller's current thread. + +Kotlin: +```kotlin +val playerUUID = UUID.fromString("player_uuid") +UtilitiesOG.trueogRawMessage(playerUUID, "&6Literal placeholder: ") +``` + +Java: +```java +UUID playerUUID = UUID.fromString("player_uuid"); +UtilitiesOG.trueogRawMessage(playerUUID, "&6Literal placeholder: "); +``` + **[TextComponent] trueogExpand(String message)** Expands MiniPlaceholders within a message string without any player context. Supports color code processing via TrueOG's formatting. diff --git a/src/main/java/net/trueog/utilitiesog/UtilitiesOG.java b/src/main/java/net/trueog/utilitiesog/UtilitiesOG.java index a963d3f..14e5a75 100644 --- a/src/main/java/net/trueog/utilitiesog/UtilitiesOG.java +++ b/src/main/java/net/trueog/utilitiesog/UtilitiesOG.java @@ -283,6 +283,14 @@ public final class UtilitiesOG extends JavaPlugin { } + // Sends a message to a player with TrueOG formatting but without expanding + // MiniPlaceholders. + public static void trueogRawMessage(Player player, String message) { + + TextUtils.trueogRawMessage(player, message); + + } + // Unified method for sending a pre-built component to a player on the caller's // current thread. public static void trueogMessage(Player player, Component message) { @@ -307,6 +315,22 @@ public final class UtilitiesOG extends JavaPlugin { } + // Handle non-expanded messages to offline players (based on UUID). + public static void trueogRawMessage(UUID playerUUID, String message) { + + final Player player = Bukkit.getPlayer(playerUUID); + if (player != null) { + + TextUtils.trueogRawMessage(player, message); + + } else { + + logToConsole("[Utilities-OG]", "Player with UUID " + playerUUID + " is not online."); + + } + + } + // Formats a message without MiniPlaceholder expansion. public static TextComponent trueogColorize(String message) { diff --git a/src/main/java/net/trueog/utilitiesog/utils/TextUtils.java b/src/main/java/net/trueog/utilitiesog/utils/TextUtils.java index 86d68ae..22897e6 100644 --- a/src/main/java/net/trueog/utilitiesog/utils/TextUtils.java +++ b/src/main/java/net/trueog/utilitiesog/utils/TextUtils.java @@ -32,6 +32,13 @@ public class TextUtils { } + // Sends a formatted message to the player without expanding MiniPlaceholders. + public static void trueogRawMessage(Player player, String message) { + + player.sendMessage(MiniMessage.miniMessage().deserialize(processColorCodes(message))); + + } + // Sends a pre-built component to the player immediately on the caller's current // thread. public static void trueogMessage(Player player, Component message) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b81ff88..68b06a2 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -5,8 +5,8 @@ ChainArmor: true # Displays information to the player about the syntax for bukkit's color codes. Default: true. ColorCodes: true # Turn off entity cramming damage server-wide. Entity cramming is when mobs pile up and cause damage to each other. Default: false. -# WARNING: Make sure there is another plugin that establishes entity limits if this module is enabled. Otherwise the server will lag. -DisableEntityCramming: false +# WARNING: Make sure there are other plugins (such as true-og/ChunkCap-OG and true-og/MobLimiter-OG) that establish entity limits if this module is enabled. Otherwise the server will lag. +DisableEntityCramming: true # Prevents trap doors from being flipped in any WorldGuard regions with the "can-flippy" flag set to DENY. Default: true. NoFlippy: true # Empowers individual players to toggle phantom spawning on or off with the command /togglephantoms. Default: true.