This commit is contained in:
parent
20c3631bf7
commit
8dcd831443
29 changed files with 85 additions and 430 deletions
|
@ -19,6 +19,7 @@ repositories {
|
|||
|
||||
maven { url 'https://maven.nucleoid.xyz' }
|
||||
maven { url 'https://maven.reconnected.cc/releases' }
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
loom {
|
||||
|
@ -41,6 +42,8 @@ dependencies {
|
|||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modImplementation "cc.reconnected:rcc-lib:${project.rcclib_version}"
|
||||
|
||||
compileOnly "net.luckperms:api:${project.luckpermsapi_version}"
|
||||
include modImplementation("me.lucko:fabric-permissions-api:${project.permissions_api_version}")
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@ archives_base_name=rcc-server
|
|||
# Dependencies
|
||||
fabric_version=0.92.2+1.20.1
|
||||
|
||||
rcclib_version=1.0.0
|
||||
|
||||
luckpermsapi_version=5.4
|
||||
permissions_api_version=0.2-SNAPSHOT
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server;
|
||||
|
||||
import cc.reconnected.library.config.ConfigManager;
|
||||
import cc.reconnected.server.api.events.RccEvents;
|
||||
import cc.reconnected.server.commands.admin.*;
|
||||
import cc.reconnected.server.commands.home.DeleteHomeCommand;
|
||||
|
@ -19,8 +20,6 @@ import cc.reconnected.server.commands.tell.TellCommand;
|
|||
import cc.reconnected.server.commands.warp.DeleteWarpCommand;
|
||||
import cc.reconnected.server.commands.warp.SetWarpCommand;
|
||||
import cc.reconnected.server.commands.warp.WarpCommand;
|
||||
import cc.reconnected.server.config.Config;
|
||||
import cc.reconnected.server.config.ConfigManager;
|
||||
import cc.reconnected.server.core.*;
|
||||
import cc.reconnected.server.core.customChat.CustomChatMessage;
|
||||
import cc.reconnected.server.data.StateManager;
|
||||
|
@ -45,7 +44,6 @@ import net.minecraft.util.WorldSavePath;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
@ -53,7 +51,7 @@ public class RccServer implements ModInitializer {
|
|||
public static final String MOD_ID = "rcc-server";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
|
||||
public static Config CONFIG;
|
||||
public static RccServerConfig CONFIG;
|
||||
|
||||
public static final StateManager state = new StateManager();
|
||||
|
||||
|
@ -93,7 +91,7 @@ public class RccServer implements ModInitializer {
|
|||
LOGGER.info("Starting rcc-server");
|
||||
|
||||
try {
|
||||
CONFIG = ConfigManager.load();
|
||||
CONFIG = ConfigManager.load(RccServerConfig.class);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Failed to load config. Refusing to continue.", e);
|
||||
return;
|
||||
|
@ -144,7 +142,6 @@ public class RccServer implements ModInitializer {
|
|||
TeleportTracker.register();
|
||||
BackTracker.register();
|
||||
TabList.register();
|
||||
HttpApiServer.register();
|
||||
BossBarManager.register();
|
||||
AutoRestart.register();
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package cc.reconnected.server.config;
|
||||
package cc.reconnected.server;
|
||||
|
||||
import cc.reconnected.library.config.Config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Config {
|
||||
Config() {
|
||||
}
|
||||
|
||||
public HttpApi httpApi = new HttpApi();
|
||||
@Config(RccServer.MOD_ID)
|
||||
public class RccServerConfig {
|
||||
public Afk afk = new Afk();
|
||||
public TeleportRequests teleportRequests = new TeleportRequests();
|
||||
public Homes homes = new Homes();
|
||||
|
@ -19,11 +18,6 @@ public class Config {
|
|||
public Chat chat = new Chat();
|
||||
public TextFormats textFormats = new TextFormats();
|
||||
|
||||
public static class HttpApi {
|
||||
public boolean enableHttpApi = true;
|
||||
public int httpPort = 25581;
|
||||
}
|
||||
|
||||
public static class Afk {
|
||||
public int afkTimeTrigger = 300;
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
package cc.reconnected.server.commands.admin;
|
||||
|
||||
import cc.reconnected.library.config.ConfigManager;
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.RccServerConfig;
|
||||
import cc.reconnected.server.api.events.RccEvents;
|
||||
import cc.reconnected.server.config.ConfigManager;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
|
@ -31,7 +33,7 @@ public class RccCommand {
|
|||
"version", Text.of(metadata.getVersion().getFriendlyString())
|
||||
);
|
||||
|
||||
var text = Components.parse(
|
||||
var text = Placeholder.parse(
|
||||
"<gold>${name} v${version}</gold>",
|
||||
placeholders);
|
||||
context.getSource().sendFeedback(() -> text, false);
|
||||
|
@ -44,7 +46,7 @@ public class RccCommand {
|
|||
context.getSource().sendFeedback(() -> Text.of("Reloading RCC config..."), true);
|
||||
|
||||
try {
|
||||
RccServer.CONFIG = ConfigManager.load();
|
||||
RccServer.CONFIG = ConfigManager.load(RccServerConfig.class);
|
||||
} catch (Exception e) {
|
||||
RccServer.LOGGER.error("Failed to load RCC config", e);
|
||||
context.getSource().sendFeedback(() -> Text.of("Failed to load RCC config. Check console for more info."), true);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.home;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
@ -46,7 +47,7 @@ public class DeleteHomeCommand {
|
|||
);
|
||||
|
||||
if (!homes.containsKey(name)) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.home.homeNotFound,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
@ -57,7 +58,7 @@ public class DeleteHomeCommand {
|
|||
homes.remove(name);
|
||||
RccServer.state.savePlayerState(player.getUuid(), playerState);
|
||||
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.home.homeDeleted,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.home;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
@ -47,7 +48,7 @@ public class HomeCommand {
|
|||
|
||||
if (!homes.containsKey(name)) {
|
||||
context.getSource().sendFeedback(() ->
|
||||
Components.parse(
|
||||
Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.home.homeNotFound,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
@ -57,7 +58,7 @@ public class HomeCommand {
|
|||
}
|
||||
|
||||
context.getSource().sendFeedback(() ->
|
||||
Components.parse(
|
||||
Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.home.teleporting,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.home;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.struct.ServerPosition;
|
||||
import cc.reconnected.server.util.Components;
|
||||
|
@ -54,7 +55,7 @@ public class SetHomeCommand {
|
|||
|
||||
var exists = homes.containsKey(name);
|
||||
if (exists && !forced) {
|
||||
var text = Components.parse(
|
||||
var text = Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.home.homeExists,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
@ -67,7 +68,7 @@ public class SetHomeCommand {
|
|||
|
||||
var maxHomes = RccServer.CONFIG.homes.maxHomes;
|
||||
if(maxHomes >= 0 && homes.size() >= maxHomes && !exists) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.home.maxHomesReached,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
@ -80,7 +81,7 @@ public class SetHomeCommand {
|
|||
|
||||
RccServer.state.savePlayerState(player.getUuid(), playerState);
|
||||
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.home.homeSetSuccess,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.misc;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
@ -43,7 +44,7 @@ public class NearCommand {
|
|||
});
|
||||
|
||||
if (list.isEmpty()) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.near.noOne,
|
||||
playerContext
|
||||
), false);
|
||||
|
@ -53,7 +54,7 @@ public class NearCommand {
|
|||
list.sort(Comparator.comparingDouble(ClosePlayers::distance));
|
||||
|
||||
var listText = Text.empty();
|
||||
var comma = Components.parse(RccServer.CONFIG.textFormats.commands.near.comma);
|
||||
var comma = Placeholder.parse(RccServer.CONFIG.textFormats.commands.near.comma);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
var player = list.get(i);
|
||||
if (i > 0) {
|
||||
|
@ -66,7 +67,7 @@ public class NearCommand {
|
|||
|
||||
var targetContext = PlaceholderContext.of(sourcePlayer);
|
||||
|
||||
listText = listText.append(Components.parse(
|
||||
listText = listText.append(Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.near.format,
|
||||
targetContext,
|
||||
placeholders
|
||||
|
@ -76,7 +77,7 @@ public class NearCommand {
|
|||
var placeholders = Map.of(
|
||||
"playerList", (Text) listText
|
||||
);
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.near.nearestPlayers,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.spawn;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.struct.ServerPosition;
|
||||
import cc.reconnected.server.util.Components;
|
||||
|
@ -26,7 +27,7 @@ public class SpawnCommand {
|
|||
spawnPosition = new ServerPosition(spawnPos.getX(), spawnPos.getY(), spawnPos.getZ(), 0, 0, server.getOverworld());
|
||||
}
|
||||
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.spawn.teleporting,
|
||||
playerContext
|
||||
), false);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.teleport;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.core.BackTracker;
|
||||
import cc.reconnected.server.util.Components;
|
||||
|
@ -21,14 +22,14 @@ public class BackCommand {
|
|||
|
||||
var lastPosition = BackTracker.lastPlayerPositions.get(player.getUuid());
|
||||
if (lastPosition == null) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.back.noPosition,
|
||||
playerContext
|
||||
), false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.back.teleporting,
|
||||
playerContext
|
||||
), false);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.teleport;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.core.TeleportTracker;
|
||||
import cc.reconnected.server.struct.ServerPosition;
|
||||
|
@ -28,7 +29,7 @@ public class TeleportAcceptCommand {
|
|||
var request = playerRequests.pollLast();
|
||||
|
||||
if (request == null) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.noPending,
|
||||
playerContext
|
||||
), false);
|
||||
|
@ -54,7 +55,7 @@ public class TeleportAcceptCommand {
|
|||
|
||||
var request = playerRequests.stream().filter(req -> req.requestId.equals(uuid)).findFirst().orElse(null);
|
||||
if (request == null) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.unavailable,
|
||||
playerContext
|
||||
), false);
|
||||
|
@ -83,7 +84,7 @@ public class TeleportAcceptCommand {
|
|||
var playerContext = PlaceholderContext.of(player);
|
||||
|
||||
if (sourcePlayer == null || targetPlayer == null) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.playerUnavailable,
|
||||
playerContext
|
||||
), false);
|
||||
|
@ -93,23 +94,23 @@ public class TeleportAcceptCommand {
|
|||
if (player.getUuid().equals(request.target)) {
|
||||
var sourceContext = PlaceholderContext.of(sourcePlayer);
|
||||
// accepted a tpa from other to self
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.requestAcceptedResult,
|
||||
playerContext
|
||||
), false);
|
||||
sourcePlayer.sendMessage(Components.parse(
|
||||
sourcePlayer.sendMessage(Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.teleporting,
|
||||
sourceContext
|
||||
), false);
|
||||
} else {
|
||||
var targetContext = PlaceholderContext.of(targetPlayer);
|
||||
// accepted a tpa from self to other
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.teleporting,
|
||||
playerContext
|
||||
), false);
|
||||
|
||||
targetPlayer.sendMessage(Components.parse(
|
||||
targetPlayer.sendMessage(Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.requestAccepted,
|
||||
targetContext,
|
||||
Map.of("player", sourcePlayer.getDisplayName())
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.teleport;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.core.TeleportTracker;
|
||||
import cc.reconnected.server.util.Components;
|
||||
|
@ -48,7 +49,7 @@ public class TeleportAskCommand {
|
|||
var placeholders = Map.of(
|
||||
"targetPlayer", Text.of(targetName)
|
||||
);
|
||||
source.sendFeedback(() -> Components.parse(
|
||||
source.sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.playerNotFound,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
@ -72,13 +73,13 @@ public class TeleportAskCommand {
|
|||
"/tpdeny " + request.requestId)
|
||||
);
|
||||
|
||||
target.sendMessage(Components.parse(
|
||||
target.sendMessage(Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.pendingTeleport,
|
||||
targetContext,
|
||||
placeholders
|
||||
));
|
||||
|
||||
source.sendFeedback(() -> Components.parse(
|
||||
source.sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.requestSent,
|
||||
playerContext
|
||||
), false);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.teleport;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.core.TeleportTracker;
|
||||
import cc.reconnected.server.util.Components;
|
||||
|
@ -47,7 +48,7 @@ public class TeleportAskHereCommand {
|
|||
var placeholders = Map.of(
|
||||
"targetPlayer", Text.of(targetName)
|
||||
);
|
||||
source.sendFeedback(() -> Components.parse(
|
||||
source.sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.playerNotFound,
|
||||
playerContext,
|
||||
placeholders
|
||||
|
@ -72,13 +73,13 @@ public class TeleportAskHereCommand {
|
|||
"/tpdeny " + request.requestId)
|
||||
);
|
||||
|
||||
target.sendMessage(Components.parse(
|
||||
target.sendMessage(Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.pendingTeleportHere,
|
||||
targetContext,
|
||||
placeholders
|
||||
));
|
||||
|
||||
source.sendFeedback(() -> Components.parse(
|
||||
source.sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.requestSent,
|
||||
playerContext
|
||||
), false);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.teleport;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.core.TeleportTracker;
|
||||
import cc.reconnected.server.util.Components;
|
||||
|
@ -33,7 +34,7 @@ public class TeleportDenyCommand {
|
|||
var request = playerRequests.pollLast();
|
||||
|
||||
if (request == null) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.noPending,
|
||||
playerContext
|
||||
), false);
|
||||
|
@ -54,7 +55,7 @@ public class TeleportDenyCommand {
|
|||
|
||||
var request = playerRequests.stream().filter(req -> req.requestId.equals(uuid)).findFirst().orElse(null);
|
||||
if (request == null) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.unavailable,
|
||||
playerContext
|
||||
), false);
|
||||
|
@ -87,14 +88,14 @@ public class TeleportDenyCommand {
|
|||
|
||||
if (otherPlayer != null) {
|
||||
var otherContext = PlaceholderContext.of(otherPlayer);
|
||||
otherPlayer.sendMessage(Components.parse(
|
||||
otherPlayer.sendMessage(Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.requestRefused,
|
||||
otherContext,
|
||||
Map.of("player", player.getDisplayName())
|
||||
), false);
|
||||
}
|
||||
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.teleportRequest.requestRefusedResult,
|
||||
playerContext
|
||||
), false);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.tell;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
@ -30,7 +31,7 @@ public class ReplyCommand {
|
|||
|
||||
if (!TellCommand.lastSender.containsKey(senderName)) {
|
||||
var playerContext = PlaceholderContext.of(context.getSource());
|
||||
source.sendFeedback(() -> Components.parse(
|
||||
source.sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.tell.noLastSenderReply,
|
||||
playerContext
|
||||
), false);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.tell;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
@ -62,7 +63,7 @@ public class TellCommand {
|
|||
);
|
||||
var sourceContext = PlaceholderContext.of(source);
|
||||
|
||||
source.sendFeedback(() -> Components.parse(
|
||||
source.sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.tell.playerNotFound,
|
||||
sourceContext,
|
||||
placeholders
|
||||
|
@ -84,7 +85,7 @@ public class TellCommand {
|
|||
}
|
||||
|
||||
|
||||
var you = Components.parse(RccServer.CONFIG.textFormats.commands.tell.you);
|
||||
var you = Placeholder.parse(RccServer.CONFIG.textFormats.commands.tell.you);
|
||||
|
||||
var placeholdersToSource = Map.of(
|
||||
"sourcePlayer", you,
|
||||
|
@ -104,22 +105,22 @@ public class TellCommand {
|
|||
"message", parsedMessage
|
||||
);
|
||||
|
||||
var sourceText = Components.parse(
|
||||
var sourceText = Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.tell.message,
|
||||
sourceContext,
|
||||
placeholdersToSource
|
||||
);
|
||||
var targetText = Components.parse(
|
||||
var targetText = Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.tell.message,
|
||||
targetContext,
|
||||
placeholdersToTarget
|
||||
);
|
||||
var genericText = Components.parse(
|
||||
var genericText = Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.tell.message,
|
||||
serverContext,
|
||||
placeholders
|
||||
);
|
||||
var spyText = Components.parse(
|
||||
var spyText = Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.tell.messageSpy,
|
||||
serverContext,
|
||||
placeholders
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.commands.warp;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
@ -41,14 +42,14 @@ public class WarpCommand {
|
|||
var playerContext = PlaceholderContext.of(player);
|
||||
|
||||
if (!warps.containsKey(name)) {
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.warp.warpNotFound,
|
||||
playerContext
|
||||
), false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
context.getSource().sendFeedback(() -> Components.parse(
|
||||
context.getSource().sendFeedback(() -> Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.warp.teleporting,
|
||||
playerContext,
|
||||
Map.of(
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
package cc.reconnected.server.config;
|
||||
|
||||
import cc.reconnected.server.RccServer;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class ConfigManager {
|
||||
private static final Gson gson = new GsonBuilder()
|
||||
.disableHtmlEscaping()
|
||||
.setPrettyPrinting()
|
||||
.setDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX")
|
||||
.create();
|
||||
private static final Path configFilePath = FabricLoader.getInstance().getConfigDir().resolve(RccServer.MOD_ID + ".json");
|
||||
private static Config config = null;
|
||||
|
||||
public static Config load() throws IOException {
|
||||
if (!configFilePath.toFile().exists()) {
|
||||
config = new Config();
|
||||
save();
|
||||
return config;
|
||||
}
|
||||
var bf = new BufferedReader(new FileReader(configFilePath.toFile(), StandardCharsets.UTF_8));
|
||||
config = gson.fromJson(bf, Config.class);
|
||||
bf.close();
|
||||
save();
|
||||
return config;
|
||||
}
|
||||
|
||||
public static void save() {
|
||||
var json = gson.toJson(config);
|
||||
try (var fw = new FileWriter(configFilePath.toFile(), StandardCharsets.UTF_8)) {
|
||||
fw.write(json);
|
||||
} catch (Exception e) {
|
||||
RccServer.LOGGER.error("Error saving the RccServer config file.", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.core;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.api.events.PlayerActivityEvents;
|
||||
import cc.reconnected.server.api.events.RccEvents;
|
||||
|
@ -55,7 +56,7 @@ public class AfkTracker {
|
|||
|
||||
var playerContext = PlaceholderContext.of(player);
|
||||
|
||||
RccServer.getInstance().broadcast(Components.parse(
|
||||
RccServer.getInstance().broadcast(Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.afk.goneAfk,
|
||||
playerContext
|
||||
));
|
||||
|
@ -66,7 +67,7 @@ public class AfkTracker {
|
|||
|
||||
var playerContext = PlaceholderContext.of(player);
|
||||
|
||||
RccServer.getInstance().broadcast(Components.parse(
|
||||
RccServer.getInstance().broadcast(Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.commands.afk.returnAfk,
|
||||
playerContext
|
||||
));
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
package cc.reconnected.server.core;
|
||||
|
||||
import cc.reconnected.server.RccServer;
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
public class HttpApiServer {
|
||||
private static HttpApiServer instance;
|
||||
|
||||
public static HttpApiServer getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private static float currentTps = 0;
|
||||
private static float currentMspt = 0;
|
||||
private static int currentPlayerCount = 0;
|
||||
|
||||
public static void register() {
|
||||
if (!RccServer.CONFIG.httpApi.enableHttpApi)
|
||||
return;
|
||||
|
||||
try {
|
||||
instance = new HttpApiServer();
|
||||
} catch (IOException e) {
|
||||
RccServer.LOGGER.error("Could not start HTTP API server", e);
|
||||
return;
|
||||
}
|
||||
new Thread(() -> instance.httpServer().start());
|
||||
|
||||
ServerLifecycleEvents.SERVER_STOPPING.register(server -> {
|
||||
RccServer.LOGGER.info("Stopping HTTP services");
|
||||
instance.httpServer().stop(0);
|
||||
});
|
||||
|
||||
ServerTickEvents.END_SERVER_TICK.register(server -> {
|
||||
currentMspt = server.getTickTime();
|
||||
if (currentMspt != 0) {
|
||||
currentTps = Math.min(20, 1000 / currentMspt);
|
||||
}
|
||||
});
|
||||
|
||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
|
||||
currentPlayerCount = server.getCurrentPlayerCount() + 1;
|
||||
});
|
||||
|
||||
ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> {
|
||||
currentPlayerCount = server.getCurrentPlayerCount() - 1;
|
||||
});
|
||||
}
|
||||
|
||||
private final HttpServer server;
|
||||
|
||||
public HttpServer httpServer() {
|
||||
return this.server;
|
||||
}
|
||||
|
||||
private HttpApiServer() throws IOException {
|
||||
server = HttpServer.create(new InetSocketAddress(RccServer.CONFIG.httpApi.httpPort), 0);
|
||||
server.createContext("/tps", new TPSHandler());
|
||||
server.createContext("/mspt", new MSPTHandler());
|
||||
server.createContext("/player", new PlayerCountHandler());
|
||||
server.setExecutor(null);
|
||||
}
|
||||
|
||||
static class TPSHandler implements HttpHandler {
|
||||
@Override
|
||||
public void handle(HttpExchange t) throws IOException {
|
||||
var tps = String.valueOf(currentTps);
|
||||
t.sendResponseHeaders(200, tps.length());
|
||||
var body = t.getResponseBody();
|
||||
body.write(tps.getBytes());
|
||||
body.close();
|
||||
}
|
||||
}
|
||||
|
||||
static class MSPTHandler implements HttpHandler {
|
||||
@Override
|
||||
public void handle(HttpExchange t) throws IOException {
|
||||
var tps = String.valueOf(currentTps);
|
||||
t.sendResponseHeaders(200, tps.length());
|
||||
var body = t.getResponseBody();
|
||||
body.write(tps.getBytes());
|
||||
body.close();
|
||||
}
|
||||
}
|
||||
|
||||
static class PlayerCountHandler implements HttpHandler {
|
||||
@Override
|
||||
public void handle(HttpExchange t) throws IOException {
|
||||
var tps = String.valueOf(currentPlayerCount);
|
||||
t.sendResponseHeaders(200, tps.length());
|
||||
var body = t.getResponseBody();
|
||||
body.write(tps.getBytes());
|
||||
body.close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.core.customChat;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import eu.pb4.placeholders.api.PlaceholderContext;
|
||||
|
@ -28,7 +29,7 @@ public class CustomChatMessage {
|
|||
Text messageText = Components.chat(message, player);
|
||||
|
||||
var playerContext = PlaceholderContext.of(player);
|
||||
var text = Components.parse(
|
||||
var text = Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.chatFormat,
|
||||
playerContext,
|
||||
Map.of(
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.core.customChat;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import eu.pb4.placeholders.api.PlaceholderContext;
|
||||
|
@ -11,7 +12,7 @@ import java.util.Map;
|
|||
public class CustomConnectionMessage {
|
||||
public static Text onJoin(ServerPlayerEntity player) {
|
||||
var playerContext = PlaceholderContext.of(player);
|
||||
return Components.parse(
|
||||
return Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.joinFormat,
|
||||
playerContext
|
||||
);
|
||||
|
@ -19,7 +20,7 @@ public class CustomConnectionMessage {
|
|||
|
||||
public static Text onJoinRenamed(ServerPlayerEntity player, String previousName) {
|
||||
var playerContext = PlaceholderContext.of(player);
|
||||
return Components.parse(
|
||||
return Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.joinRenamedFormat,
|
||||
playerContext,
|
||||
Map.of("previousName", Text.of(previousName))
|
||||
|
@ -28,7 +29,7 @@ public class CustomConnectionMessage {
|
|||
|
||||
public static Text onLeave(ServerPlayerEntity player) {
|
||||
var playerContext = PlaceholderContext.of(player);
|
||||
return Components.parse(
|
||||
return Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.leaveFormat,
|
||||
playerContext
|
||||
);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.core.customChat;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import eu.pb4.placeholders.api.PlaceholderContext;
|
||||
|
@ -14,7 +15,7 @@ public class CustomDeathMessage {
|
|||
var deathMessage = instance.getDeathMessage();
|
||||
var playerContext = PlaceholderContext.of(player);
|
||||
|
||||
return Components.parse(
|
||||
return Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.deathFormat,
|
||||
playerContext,
|
||||
Map.of("message", deathMessage)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.reconnected.server.core.customChat;
|
||||
|
||||
import cc.reconnected.library.text.Placeholder;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import eu.pb4.placeholders.api.PlaceholderContext;
|
||||
|
@ -19,7 +20,7 @@ public class CustomEmoteMessage {
|
|||
|
||||
Text messageText = Components.chat(message, player);
|
||||
|
||||
var text = Components.parse(
|
||||
var text = Placeholder.parse(
|
||||
RccServer.CONFIG.textFormats.emoteFormat,
|
||||
playerContext,
|
||||
Map.of(
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
package cc.reconnected.server.parser;
|
||||
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import eu.pb4.placeholders.api.node.DirectTextNode;
|
||||
import eu.pb4.placeholders.api.node.LiteralNode;
|
||||
import eu.pb4.placeholders.api.node.TextNode;
|
||||
import eu.pb4.placeholders.api.node.parent.ParentNode;
|
||||
import eu.pb4.placeholders.api.parsers.NodeParser;
|
||||
import net.minecraft.text.ClickEvent;
|
||||
import net.minecraft.text.HoverEvent;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class LinkParser implements NodeParser {
|
||||
public static final Pattern URL_REGEX = Pattern.compile("https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)");
|
||||
|
||||
@Override
|
||||
public TextNode[] parseNodes(TextNode node) {
|
||||
if (node instanceof LiteralNode literalNode) {
|
||||
var input = literalNode.value();
|
||||
var list = new ArrayList<TextNode>();
|
||||
var inputLength = input.length();
|
||||
|
||||
var matcher = URL_REGEX.matcher(input);
|
||||
int pos = 0;
|
||||
|
||||
while (matcher.find()) {
|
||||
if (inputLength <= matcher.start()) {
|
||||
break;
|
||||
}
|
||||
|
||||
String betweenText = input.substring(pos, matcher.start());
|
||||
|
||||
if (!betweenText.isEmpty()) {
|
||||
list.add(new LiteralNode(betweenText));
|
||||
}
|
||||
|
||||
var link = matcher.group();
|
||||
|
||||
var url = Text.of(link);
|
||||
|
||||
var placeholders = Map.of(
|
||||
"url", url,
|
||||
"label", url
|
||||
);
|
||||
|
||||
var display = Components.parse(
|
||||
RccServer.CONFIG.textFormats.link,
|
||||
placeholders
|
||||
);
|
||||
|
||||
var hover = Components.parse(
|
||||
RccServer.CONFIG.textFormats.linkHover,
|
||||
placeholders
|
||||
);
|
||||
|
||||
var text = Text.empty()
|
||||
.append(display)
|
||||
.setStyle(Style.EMPTY
|
||||
.withHoverEvent(
|
||||
new HoverEvent(HoverEvent.Action.SHOW_TEXT, hover)
|
||||
)
|
||||
.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link))
|
||||
);
|
||||
|
||||
list.add(new DirectTextNode(text));
|
||||
|
||||
pos = matcher.end();
|
||||
}
|
||||
|
||||
if (pos < inputLength) {
|
||||
var text = input.substring(pos, inputLength);
|
||||
if (!text.isEmpty()) {
|
||||
list.add(new LiteralNode(text));
|
||||
}
|
||||
}
|
||||
|
||||
return list.toArray(TextNode[]::new);
|
||||
} else if (node instanceof ParentNode parentNode) {
|
||||
var list = new ArrayList<TextNode>();
|
||||
|
||||
for (var child : parentNode.getChildren()) {
|
||||
list.addAll(List.of(this.parseNodes(child)));
|
||||
}
|
||||
|
||||
return new TextNode[]{
|
||||
parentNode.copyWith(list.toArray(TextNode[]::new))
|
||||
};
|
||||
}
|
||||
|
||||
return TextNode.array(node);
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package cc.reconnected.server.parser;
|
||||
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.util.Components;
|
||||
import eu.pb4.placeholders.api.node.TextNode;
|
||||
import eu.pb4.placeholders.api.node.parent.ClickActionNode;
|
||||
import eu.pb4.placeholders.api.node.parent.FormattingNode;
|
||||
import eu.pb4.placeholders.api.node.parent.HoverNode;
|
||||
import net.minecraft.text.ClickEvent;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class MarkdownComponentParser {
|
||||
public static TextNode spoilerFormatting(TextNode[] textNodes) {
|
||||
var text = TextNode.asSingle(textNodes);
|
||||
return new HoverNode<>(
|
||||
TextNode.array(
|
||||
new FormattingNode(TextNode.array(TextNode.of("\u258C".repeat(text.toText().getString().length()))), Formatting.DARK_GRAY)
|
||||
),
|
||||
HoverNode.Action.TEXT, text);
|
||||
}
|
||||
|
||||
public static TextNode quoteFormatting(TextNode[] textNodes) {
|
||||
return new ClickActionNode(
|
||||
TextNode.array(
|
||||
new HoverNode<>(
|
||||
TextNode.array(new FormattingNode(textNodes, Formatting.GRAY)),
|
||||
HoverNode.Action.TEXT, TextNode.of("Click to copy"))
|
||||
),
|
||||
ClickEvent.Action.COPY_TO_CLIPBOARD, TextNode.asSingle(textNodes)
|
||||
);
|
||||
}
|
||||
|
||||
public static TextNode urlFormatting(TextNode[] textNodes, TextNode url) {
|
||||
var placeholders = Map.of(
|
||||
"label", TextNode.wrap(textNodes).toText(),
|
||||
"url", url.toText()
|
||||
);
|
||||
var text = Components.parse(RccServer.CONFIG.textFormats.link, placeholders);
|
||||
var hover = Components.parse(RccServer.CONFIG.textFormats.linkHover, placeholders);
|
||||
|
||||
return new HoverNode<>(TextNode.array(
|
||||
new ClickActionNode(
|
||||
TextNode.array(
|
||||
TextNode.convert(text)
|
||||
),
|
||||
ClickEvent.Action.OPEN_URL, url)),
|
||||
HoverNode.Action.TEXT, TextNode.convert(hover)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package cc.reconnected.server.parser;
|
||||
|
||||
import eu.pb4.placeholders.api.parsers.MarkdownLiteParserV1;
|
||||
import eu.pb4.placeholders.api.parsers.NodeParser;
|
||||
|
||||
import static eu.pb4.placeholders.api.parsers.MarkdownLiteParserV1.MarkdownFormat;
|
||||
|
||||
|
||||
public class MarkdownParser {
|
||||
public static final MarkdownFormat[] ALL = new MarkdownFormat[]{
|
||||
MarkdownFormat.QUOTE,
|
||||
MarkdownFormat.BOLD,
|
||||
MarkdownFormat.ITALIC,
|
||||
MarkdownFormat.UNDERLINE,
|
||||
MarkdownFormat.STRIKETHROUGH,
|
||||
MarkdownFormat.SPOILER,
|
||||
MarkdownFormat.URL
|
||||
};
|
||||
|
||||
public static final NodeParser defaultParser = createParser(ALL);
|
||||
|
||||
public static NodeParser createParser(MarkdownFormat[] capabilities) {
|
||||
var mdParser = new MarkdownLiteParserV1(
|
||||
MarkdownComponentParser::spoilerFormatting,
|
||||
MarkdownComponentParser::quoteFormatting,
|
||||
MarkdownComponentParser::urlFormatting,
|
||||
capabilities
|
||||
);
|
||||
|
||||
return NodeParser.merge(mdParser, new LinkParser());
|
||||
}
|
||||
}
|
|
@ -1,16 +1,12 @@
|
|||
package cc.reconnected.server.util;
|
||||
|
||||
import cc.reconnected.library.text.parser.MarkdownParser;
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.parser.MarkdownParser;
|
||||
import eu.pb4.placeholders.api.PlaceholderContext;
|
||||
import eu.pb4.placeholders.api.Placeholders;
|
||||
import eu.pb4.placeholders.api.TextParserUtils;
|
||||
import eu.pb4.placeholders.api.node.TextNode;
|
||||
import eu.pb4.placeholders.api.parsers.NodeParser;
|
||||
import eu.pb4.placeholders.api.parsers.PatternPlaceholderParser;
|
||||
import eu.pb4.placeholders.api.parsers.TextParserV1;
|
||||
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
|
||||
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
@ -65,31 +61,6 @@ public class Components {
|
|||
return Text.Serializer.fromJson(json);
|
||||
}
|
||||
|
||||
public static Text parse(String text) {
|
||||
return TextParserUtils.formatText(text);
|
||||
}
|
||||
|
||||
public static Text parse(TextNode textNode, PlaceholderContext context, Map<String, Text> placeholders) {
|
||||
var predefinedNode = Placeholders.parseNodes(textNode, PatternPlaceholderParser.PREDEFINED_PLACEHOLDER_PATTERN, placeholders);
|
||||
return Placeholders.parseText(predefinedNode, context);
|
||||
}
|
||||
|
||||
public static Text parse(Text text, PlaceholderContext context, Map<String, Text> placeholders) {
|
||||
return parse(TextNode.convert(text), context, placeholders);
|
||||
}
|
||||
|
||||
public static Text parse(String text, PlaceholderContext context, Map<String, Text> placeholders) {
|
||||
return parse(parse(text), context, placeholders);
|
||||
}
|
||||
|
||||
public static Text parse(String text, PlaceholderContext context) {
|
||||
return parse(parse(text), context, Map.of());
|
||||
}
|
||||
|
||||
public static Text parse(String text, Map<String, Text> placeholders) {
|
||||
return Placeholders.parseText(parse(text), PatternPlaceholderParser.PREDEFINED_PLACEHOLDER_PATTERN, placeholders);
|
||||
}
|
||||
|
||||
public static Text chat(SignedMessage message, ServerPlayerEntity player) {
|
||||
var luckperms = RccServer.getInstance().luckPerms();
|
||||
|
||||
|
|
Loading…
Reference in a new issue