diff --git a/zander-velocity/README.md b/zander-velocity/README.md new file mode 100644 index 0000000..5e28b60 --- /dev/null +++ b/zander-velocity/README.md @@ -0,0 +1,16 @@ +# Zander Velocity + +Zander Velocity formats network-wide chat directly on the proxy. To surface readable rank data, ensure each LuckPerms group defines the following metadata: + +``` +lp group admin meta set displayname "Admin" +lp group admin meta set rank_description "Has full access to staff & server tools." +``` + +`displayname` appears in the hover title (falling back to the prefix text or `Member`), and `rank_description` appears in the hover description (falling back to `No description set for this rank.`). The proxy resolves the highest-priority prefix for each player and renders chat as: + +``` +[Rank] Username: message +``` + +The bracketed rank prefix is hoverable and shows the rank name and description. diff --git a/zander-velocity/pom.xml b/zander-velocity/pom.xml index 8b37212..57e086e 100644 --- a/zander-velocity/pom.xml +++ b/zander-velocity/pom.xml @@ -87,6 +87,17 @@ 3.4.0-SNAPSHOT provided + + net.luckperms + api + 5.4 + provided + + + net.kyori + adventure-text-minimessage + 4.17.0 + com.googlecode.json-simple json-simple diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/ZanderVelocityMain.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/ZanderVelocityMain.java index 15a42c3..18ac5b0 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/ZanderVelocityMain.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/ZanderVelocityMain.java @@ -41,7 +41,8 @@ name = "zander-velocity", version = "1.2.0", dependencies = { - @Dependency(id = "signedvelocity") + @Dependency(id = "signedvelocity"), + @Dependency(id = "luckperms") } ) public class ZanderVelocityMain { @@ -113,6 +114,5 @@ public ZanderVelocityMain( container.ifPresent(pluginContainer -> pluginContainer.getExecutorService().shutdown()); } - logger.info("Zander Proxy has started."); } } diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/discord.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/discord.java index cfc9159..84d65b7 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/discord.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/discord.java @@ -5,7 +5,6 @@ import com.velocitypowered.api.command.SimpleCommand; import dev.dejvokep.boostedyaml.route.Route; import io.github.ModularEnigma.Request; -import io.github.ModularEnigma.Response; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.format.NamedTextColor; @@ -38,7 +37,6 @@ public void execute(final Invocation invocation) { } catch (Exception e) { Component builder = Component.text("An error has occurred. Is the API down?").color(NamedTextColor.RED); source.sendMessage(builder); - System.out.println(e); } } } diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/report.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/report.java index 72825e5..5752ff6 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/report.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/report.java @@ -87,7 +87,6 @@ public void execute(Invocation invocation) { } catch (Exception e) { player.sendMessage(Component.text("An error has occurred. Is the API down?").color(NamedTextColor.RED)); - System.out.println(e); } } else { source.sendMessage(Component.text("Only players can use this command.").color(NamedTextColor.RED)); @@ -112,4 +111,4 @@ public List suggest(Invocation invocation) { return completions; } -} \ No newline at end of file +} diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/rules.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/rules.java index 438d97c..640db2d 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/rules.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/rules.java @@ -5,7 +5,6 @@ import com.velocitypowered.api.command.SimpleCommand; import dev.dejvokep.boostedyaml.route.Route; import io.github.ModularEnigma.Request; -import io.github.ModularEnigma.Response; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.format.NamedTextColor; @@ -37,7 +36,6 @@ public void execute(final Invocation invocation) { } catch (Exception e) { Component builder = Component.text("An error has occurred. Is the API down?").color(NamedTextColor.RED); source.sendMessage(builder); - System.out.println(e); } } } diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/website.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/website.java index 39af9b6..564034e 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/website.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/commands/website.java @@ -5,7 +5,6 @@ import com.velocitypowered.api.command.SimpleCommand; import dev.dejvokep.boostedyaml.route.Route; import io.github.ModularEnigma.Request; -import io.github.ModularEnigma.Response; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.format.NamedTextColor; @@ -37,7 +36,6 @@ public void execute(final Invocation invocation) { } catch (Exception e) { Component builder = Component.text("An error has occurred. Is the API down?").color(NamedTextColor.RED); source.sendMessage(builder); - System.out.println(e); } } } diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserChatEvent.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserChatEvent.java index 2140a07..1a16bc0 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserChatEvent.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserChatEvent.java @@ -1,6 +1,7 @@ package org.modularsoft.zander.velocity.events; import com.jayway.jsonpath.JsonPath; +import com.velocitypowered.api.event.PostOrder; import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.player.PlayerChatEvent; import com.velocitypowered.api.proxy.Player; @@ -8,26 +9,40 @@ import io.github.ModularEnigma.Request; import io.github.ModularEnigma.Response; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import net.luckperms.api.LuckPerms; +import net.luckperms.api.LuckPermsProvider; +import net.luckperms.api.cacheddata.CachedMetaData; +import net.luckperms.api.model.user.User; +import net.luckperms.api.node.NodeType; +import net.luckperms.api.node.types.MetaNode; import org.modularsoft.zander.velocity.ZanderVelocityMain; import org.modularsoft.zander.velocity.model.Filter; import org.modularsoft.zander.velocity.model.discord.DiscordChat; public class UserChatEvent { - @Subscribe + private final LuckPerms luckPerms = LuckPermsProvider.get(); + private final MiniMessage miniMessage = MiniMessage.miniMessage(); + + @Subscribe(order = PostOrder.LAST) public void UserChatEvent(PlayerChatEvent event) { Player player = event.getPlayer(); + String rawMessage = event.getMessage(); + Component originalMessage = Component.text(rawMessage); String BaseAPIURL = ZanderVelocityMain.getConfig().getString(Route.from("BaseAPIURL")); String APIKey = ZanderVelocityMain.getConfig().getString(Route.from("APIKey")); // Filter out commands. - if (event.getMessage().startsWith("/")) return; + if (rawMessage.startsWith("/")) return; // Check chat for blocked content try { Filter phrase = Filter.builder() - .content(event.getMessage().toString()) + .content(rawMessage) .build(); Request phraseReq = Request.builder() @@ -43,17 +58,16 @@ public void UserChatEvent(PlayerChatEvent event) { Boolean success = JsonPath.parse(phraseJson).read("$.success"); String phraseCaughtMessage = JsonPath.read(phraseJson, "$.message"); - ZanderVelocityMain.getLogger().info("[FILTER] Response (" + phraseRes.getStatusCode() + "): " + phraseRes.getBody()); - if (!success) { Component builder = Component.text(phraseCaughtMessage).color(NamedTextColor.RED); player.sendMessage(builder); event.setResult(PlayerChatEvent.ChatResult.denied()); + return; } else { DiscordChat chat = DiscordChat.builder() .username(player.getUsername()) .server(player.getCurrentServer().get().getServer().getServerInfo().getName()) - .content(event.getMessage().toString()) + .content(rawMessage) .build(); Request discordChatReq = Request.builder() @@ -64,12 +78,110 @@ public void UserChatEvent(PlayerChatEvent event) { .build(); Response discordChatReqRes = discordChatReq.execute(); - ZanderVelocityMain.getLogger().info("Response (" + discordChatReqRes.getStatusCode() + "): " + discordChatReqRes.getBody()); } + + Component formattedMessage = formatChatMessage(player, originalMessage); + player.getCurrentServer() + .map(serverConnection -> serverConnection.getServer()) + .ifPresentOrElse( + server -> server.getPlayersConnected().forEach(target -> target.sendMessage(formattedMessage)), + () -> player.sendMessage(formattedMessage) + ); + event.setResult(PlayerChatEvent.ChatResult.denied()); } catch (Exception e) { Component builder = Component.text("The chat filter could not be reached at this time, there maybe an issue with the API.").color(NamedTextColor.YELLOW); player.sendMessage(builder); - System.out.println(e); } } + + private Component formatChatMessage(Player player, Component originalMessage) { + User user = luckPerms.getPlayerAdapter(Player.class).getUser(player); + CachedMetaData metaData = user.getCachedData().getMetaData(); + Component rankPrefix = buildRankPrefix(user, metaData); + + return Component.text() + .append(rankPrefix) + .append(Component.space()) + .append(Component.text(player.getUsername())) + .append(Component.text(": ")) + .append(originalMessage) + .build(); + } + + private Component buildRankPrefix(User user, CachedMetaData metaData) { + String prefix = metaData.getPrefix(); + String rankNameMeta = getMetaValue(user, metaData, "displayname"); + String rankDescriptionMeta = getMetaValue(user, metaData, "rank_description"); + + String rankName = (rankNameMeta != null && !rankNameMeta.isBlank()) + ? rankNameMeta + : (prefix != null && !prefix.isBlank() ? prefix : "Member"); + String rankDescription = (rankDescriptionMeta != null && !rankDescriptionMeta.isBlank()) + ? rankDescriptionMeta + : "No description set for this rank."; + + rankName = stripLegacy(rankName); + rankDescription = stripLegacy(rankDescription); + + Component prefixComponent = buildPrefixComponent(prefix, rankName); + Component hoverText = Component.text() + .append(prefixComponent) + .append(Component.space()) + .append(Component.text(rankName).color(NamedTextColor.GOLD)) + .append(Component.newline()) + .append(Component.text(rankDescription).color(NamedTextColor.GRAY)) + .build(); + + return prefixComponent.hoverEvent(HoverEvent.showText(hoverText)); + } + + private String getMetaValue(User user, CachedMetaData metaData, String baseKey) { + MetaNode bestNode = null; + for (MetaNode node : user.getNodes(NodeType.META)) { + String key = node.getMetaKey(); + if (matchesMetaKey(key, baseKey)) { + if (bestNode == null || node.getPriority() > bestNode.getPriority()) { + bestNode = node; + } + } + } + + if (bestNode != null) { + String value = bestNode.getMetaValue(); + if (value != null && !value.isBlank()) { + return value; + } + } + + return metaData.getMetaValue(baseKey); + } + + private boolean matchesMetaKey(String key, String baseKey) { + if (key == null) { + return false; + } + if (key.equalsIgnoreCase(baseKey)) { + return true; + } + return key.regionMatches(true, 0, baseKey + ".", 0, baseKey.length() + 1); + } + + private Component buildPrefixComponent(String prefix, String rankName) { + if (prefix != null && !prefix.isBlank()) { + return LegacyComponentSerializer.legacyAmpersand().deserialize(prefix); + } + + String miniMessagePrefix = "[" + + escapeMiniMessageContent(rankName) + + "]"; + return miniMessage.deserialize(miniMessagePrefix); + } + + private String escapeMiniMessageContent(String input) { + return input.replace("<", "\\<").replace(">", "\\>"); + } + + private String stripLegacy(String input) { + return input.replaceAll("ยง.", "").replaceAll("&.", ""); + } } diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserCommandSpyEvent.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserCommandSpyEvent.java index 79311f5..135a54b 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserCommandSpyEvent.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserCommandSpyEvent.java @@ -5,7 +5,6 @@ import com.velocitypowered.api.proxy.Player; import dev.dejvokep.boostedyaml.route.Route; import io.github.ModularEnigma.Request; -import io.github.ModularEnigma.Response; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.modularsoft.zander.velocity.ZanderVelocityMain; @@ -25,8 +24,6 @@ public void onPlayerCommand(CommandExecuteEvent event) { String APIKey = ZanderVelocityMain.getConfig().getString(Route.from("APIKey")); String command = event.getCommand(); // Get the full command - ZanderVelocityMain.getLogger().info("Command: {}", command); - // Check if the command is one we need to log (ignore direct message commands) if (command.startsWith("msg") || command.startsWith("tell") || command.startsWith("w") || command.startsWith("message") || command.startsWith("r")) { @@ -50,12 +47,10 @@ public void onPlayerCommand(CommandExecuteEvent event) { .setRequestBody(commandSpy.toString()) .build(); - Response commandSpyRes = commandSpyReq.execute(); - ZanderVelocityMain.getLogger().info("Response (" + commandSpyRes.getStatusCode() + "): " + commandSpyRes.getBody()); + commandSpyReq.execute(); } catch (Exception e) { Component builder = Component.text("An error has occurred. Is the API down?").color(NamedTextColor.RED); player.disconnect(builder); - System.out.println(e); } } -} \ No newline at end of file +} diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserOnProxyPing.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserOnProxyPing.java index 2c0038a..ff1ba99 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserOnProxyPing.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserOnProxyPing.java @@ -53,8 +53,6 @@ public void onProxyPingEvent(ProxyPingEvent event) { pingBuilder.description(serverPingDescription); } catch (Exception e) { - System.out.print(e); - // Fallback MOTD in case of an exception String motdTopLine = ZanderVelocityMain.getConfig().getString(Route.from("announcementMOTDTopLine")); Component fallbackDescription = LegacyComponentSerializer.builder() @@ -68,4 +66,4 @@ public void onProxyPingEvent(ProxyPingEvent event) { // Set the modified ServerPing back to the event event.setPing(pingBuilder.build()); } -} \ No newline at end of file +} diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserSocialSpyEvent.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserSocialSpyEvent.java index 2320caa..4f02074 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserSocialSpyEvent.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/UserSocialSpyEvent.java @@ -6,7 +6,6 @@ import com.velocitypowered.api.proxy.ServerConnection; import dev.dejvokep.boostedyaml.route.Route; import io.github.ModularEnigma.Request; -import io.github.ModularEnigma.Response; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.modularsoft.zander.velocity.ZanderVelocityMain; @@ -30,8 +29,6 @@ public void onUserChatDMEvent(CommandExecuteEvent event) { Player player = (Player) event.getCommandSource(); String command = event.getCommand(); - logger.info("Command: {}", command); - // Check if the command is a direct message command if (command.contains("msg") || command.contains("tell") || command.contains("w") || command.contains("message") || command.contains("r")) { @@ -76,8 +73,7 @@ public void onUserChatDMEvent(CommandExecuteEvent event) { .setRequestBody(socialSpy.toString()) // Ensure proper serialization to JSON .build(); - Response socialSpyRes = socialSpyReq.execute(); - logger.info("Social Spy Response ({}): {}", socialSpyRes.getStatusCode(), socialSpyRes.getBody()); + socialSpyReq.execute(); } catch (Exception e) { logger.error("Error occurred while handling social spy request", e); @@ -85,4 +81,4 @@ public void onUserChatDMEvent(CommandExecuteEvent event) { } } } -} \ No newline at end of file +} diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnDisconnect.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnDisconnect.java index b560fbe..484367a 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnDisconnect.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnDisconnect.java @@ -6,7 +6,6 @@ import com.velocitypowered.api.proxy.ProxyServer; import dev.dejvokep.boostedyaml.route.Route; import io.github.ModularEnigma.Request; -import io.github.ModularEnigma.Response; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.modularsoft.zander.velocity.ZanderVelocityMain; @@ -38,8 +37,7 @@ public void UserDisconnectEvent (DisconnectEvent event) { .setRequestBody(destroySession.toString()) .build(); - Response destroySessionRes = destroySessionReq.execute(); - ZanderVelocityMain.getLogger().info("Response (" + destroySessionRes.getStatusCode() + "): " + destroySessionRes.getBody()); + destroySessionReq.execute(); } catch (Exception e) { Component builder = Component.text("An error has occurred. Is the API down?").color(NamedTextColor.RED); player.disconnect(builder); @@ -60,8 +58,7 @@ public void UserDisconnectEvent (DisconnectEvent event) { .setRequestBody(leave.toString()) .build(); - Response discordLeaveRes = discordLeaveReq.execute(); - ZanderVelocityMain.getLogger().info("Response (" + discordLeaveRes.getStatusCode() + "): " + discordLeaveRes.getBody()); + discordLeaveReq.execute(); } catch (Exception e) { Component builder = Component.text("An error has occurred. Is the API down?").color(NamedTextColor.RED); player.disconnect(builder); diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnLogin.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnLogin.java index 6eea4a9..20588fd 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnLogin.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnLogin.java @@ -5,7 +5,6 @@ import com.velocitypowered.api.proxy.Player; import dev.dejvokep.boostedyaml.route.Route; import io.github.ModularEnigma.Request; -import io.github.ModularEnigma.Response; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.modularsoft.zander.velocity.ZanderVelocityMain; @@ -36,8 +35,7 @@ public void UserLoginEvent (PostLoginEvent event) { .setRequestBody(createUser.toString()) .build(); - Response createUserRes = createUserReq.execute(); - ZanderVelocityMain.getLogger().info("Response (" + createUserRes.getStatusCode() + "): " + createUserRes.getBody()); + createUserReq.execute(); try { // @@ -55,8 +53,7 @@ public void UserLoginEvent (PostLoginEvent event) { .setRequestBody(createSession.toString()) .build(); - Response createSessionRes = createSessionReq.execute(); - ZanderVelocityMain.getLogger().info("Response (" + createSessionRes.getStatusCode() + "): " + createSessionRes.getBody()); + createSessionReq.execute(); // Send Discord API POST for join message DiscordJoin join = DiscordJoin.builder() @@ -70,8 +67,7 @@ public void UserLoginEvent (PostLoginEvent event) { .setRequestBody(join.toString()) .build(); - Response discordJoinRes = discordJoinReq.execute(); - ZanderVelocityMain.getLogger().info("Response (" + discordJoinRes.getStatusCode() + "): " + discordJoinRes.getBody()); + discordJoinReq.execute(); } catch (Exception e) { Component builder = Component.text("An error has occurred. Is the API down?").color(NamedTextColor.RED); player.disconnect(builder); diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnSwitch.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnSwitch.java index b39aeb7..be69596 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnSwitch.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/events/session/UserOnSwitch.java @@ -5,7 +5,6 @@ import com.velocitypowered.api.proxy.Player; import dev.dejvokep.boostedyaml.route.Route; import io.github.ModularEnigma.Request; -import io.github.ModularEnigma.Response; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import org.modularsoft.zander.velocity.ZanderVelocityMain; @@ -27,8 +26,6 @@ public void onServerConnect(ServerConnectedEvent event) { String BaseAPIURL = ZanderVelocityMain.getConfig().getString(Route.from("BaseAPIURL")); String APIKey = ZanderVelocityMain.getConfig().getString(Route.from("APIKey")); - logger.info("Player {} is switching to server {}", username, server); - // Handle Session Switch API try { SessionSwitch switchSession = SessionSwitch.builder() @@ -43,8 +40,7 @@ public void onServerConnect(ServerConnectedEvent event) { .setRequestBody(switchSession.toString()) // Ensure this method works properly .build(); - Response switchSessionRes = switchSessionReq.execute(); - logger.info("Session Switch Response ({}): {}", switchSessionRes.getStatusCode(), switchSessionRes.getBody()); + switchSessionReq.execute(); } catch (Exception e) { logger.error("Error during Session Switch API request", e); player.disconnect(Component.text("An error has occurred. Please try again later.").color(NamedTextColor.RED)); @@ -65,11 +61,10 @@ public void onServerConnect(ServerConnectedEvent event) { .setRequestBody(discordSwitch.toString()) // Ensure this method works properly .build(); - Response discordSwitchRes = discordSwitchReq.execute(); - logger.info("Discord Switch Response ({}): {}", discordSwitchRes.getStatusCode(), discordSwitchRes.getBody()); + discordSwitchReq.execute(); } catch (Exception e) { logger.error("Error during Discord Switch API request", e); player.sendMessage(Component.text("An error occurred, but you can still continue playing.").color(NamedTextColor.RED)); } } -} \ No newline at end of file +} diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/util/announcement/TipChatter.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/util/announcement/TipChatter.java index 129fff7..9fd525d 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/util/announcement/TipChatter.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/util/announcement/TipChatter.java @@ -44,11 +44,6 @@ public static void startAnnouncementTipTask() { String colourMessageFormat = JsonPath.read(json, "$.data[0].colourMessageFormat"); String link = JsonPath.read(json, "$.data[0].link"); - // Log the color message format and link - logger.info("Announcement Tip: {}", colourMessageFormat); - logger.info("Link: {}", link); - logger.info("JSON: {}", json); - // Broadcast the message to all online players ZanderVelocityMain.getProxy().getAllPlayers().forEach(player -> { // Send the message to each player @@ -64,7 +59,6 @@ public static void startAnnouncementTipTask() { } catch (Exception e) { // Handle exceptions here logger.error("Announcement Tip Failed, will try again later.", e); - System.out.println("Announcement Tip Failed, will try again in " + ZanderVelocityMain.getConfig().getString(Route.from("announcementTipInterval")) + " minutes."); } }, 0, ZanderVelocityMain.getConfig().getInt(Route.from("announcementTipInterval")), TimeUnit.MINUTES); } diff --git a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/util/api/Heartbeat.java b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/util/api/Heartbeat.java index ccc1bf8..c067d3d 100644 --- a/zander-velocity/src/main/java/org/modularsoft/zander/velocity/util/api/Heartbeat.java +++ b/zander-velocity/src/main/java/org/modularsoft/zander/velocity/util/api/Heartbeat.java @@ -34,8 +34,6 @@ public static void startHeartbeatTask() { Response res = req.execute(); String json = res.getBody(); Boolean heartbeat = JsonPath.read(json, "$.success"); - System.out.println("API Heartbeat Success"); - // Check if the heartbeat is not successful if (!heartbeat) { // Kick all players @@ -47,7 +45,6 @@ public static void startHeartbeatTask() { } } catch (Exception e) { // Handle exceptions here - e.printStackTrace(); ZanderVelocityMain.getLogger().error("API Heartbeat Failed, kicking all players until back online."); // Kick all players diff --git a/zander-velocity/src/main/resources/velocity-plugin.json b/zander-velocity/src/main/resources/velocity-plugin.json new file mode 100644 index 0000000..dd7fe25 --- /dev/null +++ b/zander-velocity/src/main/resources/velocity-plugin.json @@ -0,0 +1,19 @@ +{ + "id": "zander-velocity", + "name": "zander-velocity", + "version": "1.2.0", + "main": "org.modularsoft.zander.velocity.ZanderVelocityMain", + "authors": [ + "ModularSoft" + ], + "dependencies": [ + { + "id": "luckperms", + "optional": false + }, + { + "id": "signedvelocity", + "optional": true + } + ] +}