mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-14 12:48:34 +00:00
Add SQL Generators
Add cache for table strings generated Add legacy support for Tags and login messages by converting legacy color codes to minimessage tags
This commit is contained in:
@ -5,7 +5,6 @@ import com.google.common.collect.Lists;
|
||||
import dev.plex.Plex;
|
||||
import dev.plex.PlexBase;
|
||||
import dev.plex.listener.impl.ChatListener;
|
||||
import dev.plex.player.PlexPlayer;
|
||||
import dev.plex.storage.StorageType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
@ -27,6 +26,7 @@ import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -98,11 +98,14 @@ public class PlexUtils implements PlexBase
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isFolia() {
|
||||
try {
|
||||
public static boolean isFolia()
|
||||
{
|
||||
try
|
||||
{
|
||||
Class.forName("io.papermc.paper.threadedregions.ThreadedRegionizer");
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -129,6 +132,45 @@ public class PlexUtils implements PlexBase
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Component removeHoverAndClick(Component component)
|
||||
{
|
||||
Stack<Component> components = new Stack<>();
|
||||
components.push(component);
|
||||
while (!components.isEmpty())
|
||||
{
|
||||
Component curr = components.pop();
|
||||
curr.clickEvent(null).hoverEvent(null);
|
||||
curr.children().forEach(components::push);
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
||||
public static String legacyToMiniString(String input)
|
||||
{
|
||||
return cleanString(input.replace("&a", "<green>")
|
||||
.replace("&b", "<aqua>")
|
||||
.replace("&c", "<red>")
|
||||
.replace("&d", "<light_purple>")
|
||||
.replace("&e", "<yellow>")
|
||||
.replace("&f", "<white>")
|
||||
.replace("&1", "<dark_blue>")
|
||||
.replace("&2", "<dark_green>")
|
||||
.replace("&3", "<dark_aqua>")
|
||||
.replace("&4", "<dark_red>")
|
||||
.replace("&5", "<dark_purple>")
|
||||
.replace("&6", "<gold>")
|
||||
.replace("&7", "<gray>")
|
||||
.replace("&8", "<dark_gray>")
|
||||
.replace("&9", "<blue>")
|
||||
.replace("&0", "<black>")
|
||||
.replace("&r", "<reset>")
|
||||
.replace("&l", "<bold>")
|
||||
.replace("&o", "<italic>")
|
||||
.replace("&n", "<underlined>")
|
||||
.replace("&m", "<strikethrough>")
|
||||
.replace("&k", "<obf>"));
|
||||
}
|
||||
|
||||
public static String mmStripColor(String input)
|
||||
{
|
||||
return PlainTextComponentSerializer.plainText().serialize(mmDeserialize(input));
|
||||
|
Reference in New Issue
Block a user