From c65027b6fb5247fd06ef5f8cf04c3ce8d527ffe6 Mon Sep 17 00:00:00 2001 From: Kappeh Date: Wed, 9 Sep 2026 20:59:45 +0100 Subject: [PATCH] Add NetworkJoinMessages --- compose.yml | 1 + .../plugins/networkjoinmessages/config.yml | 268 ++++++++++++++++++ .../plugins/networkjoinmessages/discord.yml | 161 +++++++++++ .../plugins/networkjoinmessages/joined.mv.db | Bin 0 -> 20480 bytes .../networkjoinmessages/player_data.mv.db | Bin 0 -> 20480 bytes 5 files changed, 430 insertions(+) create mode 100644 velocity/config/plugins/networkjoinmessages/config.yml create mode 100644 velocity/config/plugins/networkjoinmessages/discord.yml create mode 100644 velocity/config/plugins/networkjoinmessages/joined.mv.db create mode 100644 velocity/config/plugins/networkjoinmessages/player_data.mv.db diff --git a/compose.yml b/compose.yml index 45a6c63..9f473ba 100755 --- a/compose.yml +++ b/compose.yml @@ -58,6 +58,7 @@ services: carbon:yGY2bbis luckperms:tamnmXad miniplaceholders:Kpbing8i + networkjoinmessages:1MJzJZCs signedvelocity:OxMy0xf6 velocitab:aWnzUwbr labels: diff --git a/velocity/config/plugins/networkjoinmessages/config.yml b/velocity/config/plugins/networkjoinmessages/config.yml new file mode 100644 index 0000000..dfac4b6 --- /dev/null +++ b/velocity/config/plugins/networkjoinmessages/config.yml @@ -0,0 +1,268 @@ +# This configuration supports both legacy color codes and MiniMessage! +# For documentation on MiniMessage visit https://docs.advntr.dev/minimessage/format.html + +# Set server aliases +Servers: + lobby: Lobby + survival: Survival Server + mining: Mining Server + staff: Click to TP!'>Staff Server + ???: Unknown Server +Messages: + # These player placeholders work in any of the following three message types + # %player% - Player username + # %displayname% - Custom name the player has according to the proxy + # %player_prefix% - Player prefix (requires LuckPerms on the proxy) + # %player_suffix% - Player suffix (requires LuckPerms on the proxy) + + # These placeholders are available for the swap server message + # %to% - Server they are heading to + # %to_clean% - Server they are heading to without formatting + # %from% - Server they are coming from + # %from_clean% - Server they are coming from without formatting + # %playercount_from% - Amount of players where they are coming from + # %playercount_to% - Amount of players where they are heading to + # %playercount_network% - Amount of players on the network + + # Message sent when a player swaps servers - leave blank to use the list of messages defined below + SwapServerMessage: + + # A list of swap messages to be selected at random each time a player swaps servers + # IMPORTANT - SwapServerMessage (directly above) must be empty to enable this option + SwapServerMessages: [] + + # These placeholders are available for the join and leave network messages + # %server_name% - Name of the server they connected to + # %server_name_clean% - Name of the server they connected to without formatting + # %playercount_server% - Amount of players on the sever they joined or left + # %playercount_network% - Amount of players on the network + + # Message sent when a player joins the network for the first time - leave blank to use the list of messages defined below + FirstJoinNetworkMessage: "%carbon_displayname% has connected to the network." + + # A list of first join messages to be selected at random each time a player joins for the first time + # IMPORTANT - FirstJoinNetworkMessage (directly above) must be empty to enable this option + FirstJoinNetworkMessages: [] + + # Message sent when a player joins the network - leave blank to use the list of messages defined below + JoinNetworkMessage: "%carbon_displayname% has connected to the network." + + # A list of join messages to be selected at random each time a player joins + # IMPORTANT - JoinNetworkMessage (directly above) must be empty to enable this option + JoinNetworkMessages: [] + + # Message sent when a player leaves the network - leave blank to use the list of messages defined below + LeaveNetworkMessage: "%carbon_displayname% has disconnected to the network." + + # A list of leave messages to be selected at random each time a player leaves + # IMPORTANT - LeaveNetworkMessage (directly above) must be empty to enable this option + LeaveNetworkMessages: [] + + # Configurable Command Messages! + Commands: + NoMoreArgumentsNeeded: No more arguments needed. + NoPermission: You do not have the permission to use this command. + Spoof: + NoArgument: | + Arguments: + - join + - leave + - swap + SwapNoArgument: | + Arguments: + - join + - leave + - swap + Please specify TO and FROM + ToggleSilentNoPerm: You do not have the permission to join the server silently. + ToggleSilent: Your silent mode has now been set to %state% + JoinNotification: |- + [NetworkJoin] You joined the server while silenced or vanished. + If vanished, unvanish, or if silenced use /njoinspoof toggle + to re-enable join, leave, and swap messages. + ToggleJoin: + MissingFirstArgument: |- + Please specify which messages you would like to disable/enable. + Valid arguments are: join, leave, swap, all + MissingState: |- + Please specify which state you would like to enter. + Valid arguments are: on / off or true / false. + Confirmation: Receive messages for %mode% has been set to %state% + TargetNotFound: Could not find a player with name %player% + MustSpecifyPlayer: You must specify the target player when running from console + ConfirmationOther: Set receive messages for %mode% on %player% to %state% + Reload: + ConfigReloaded: Config Reloaded! + Misc: + SilentPrefix: [Silent] + ConsoleSilentSwap: Swap message was silenced. %player% %from% -> %to% + ConsoleSilentJoin: Join message was silenced. %player% joined the network + ConsoleSilentLeave: Leave message was silenced. %player% left the network +Settings: + # As PAPIProxyBridge is unable to parse placeholders for offline players, a cache for the leave network message must + # be implemented. For placeholders that frequently change such as experience level, armor rating, etc. you may wish + # for this cache to update more often. + # Designate how long in seconds the leave network message will be cached or use 0 to only update cache on join and + # server swap. + LeaveNetworkMessageCacheDuration: 45 + + # Designate how long, in milliseconds, the plugin will wait before sending the leave network message for a player. + # This allows them to rejoin with no join message and cancel the sending of the leave network message altogether. + # Helps prevent spam from players with a weak internet connection. 1500 is recommended. + LeaveJoinBufferDuration: 0 + + # Should players with the networkjoinmessages.silent permission be silenced by default? + # It will be set to this for all players after a reboot. They can toggle it for themselves with the /njoinspoof toggle command + SilentJoinDefaultState: true + + # Storage backend + # SQL - External SQL server (MySQL, MariaDB, or PostgreSQL). Requires filling in the SQL section below. + # H2 - Embedded SQL database (default). Best for most servers; no setup required. + # TEXT - Plain text file (joined.txt). Easiest to inspect and edit by hand. (Player data will still use H2) + # Changing this option requires a restart. Data is migrated automatically except when migrating from SQL. + FirstJoinStorageType: H2 + + # Storage backend for player data + # Same as above, except valid options are H2 and SQL only. TEXT is not available for this interface. + PlayerDataStorageType: H2 + + # External SQL server settings — only used when StorageType is SQL. + # Changes here require a restart. + SQL: + # Hostname or IP address of the SQL server. + Host: localhost + # Port — MySQL/MariaDB default is 3306, PostgreSQL default is 5432. + Port: 3306 + # Name of the database to use. Must already exist. + Database: database + TablePrefix: njm_ + Username: njm_user + Password: '' + # SQL driver to use. Accepted values: mysql, mariadb, postgresql + Driver: mysql + # Whether to require SSL/TLS for the connection (MySQL/MariaDB only). + UseSSL: false + # Seconds to wait when checking if the connection is still alive. + ConnectionTimeout: 5 + + # Should players ignore messages by default? Re-enable with /njointoggle. + # Changes require a restart to affect players who joined the proxy + IgnoreJoinByDefault: false + IgnoreSwapByDefault: false + IgnoreLeaveByDefault: false + + # Should the following messages be enabled? + SwapServerMessageEnabled: false + FirstJoinNetworkMessageEnabled: false + JoinNetworkMessageEnabled: true + LeaveNetworkMessageEnabled: true + # Should other players with the networkjoinmessages.silent permission be notified of players moving silently? + NotifyAdminsOnSilentMove: true + + # NOTE: These do not affect silenced players. Silenced move messages will be seen by all players with the permission. + SwapServerMessageViewableBy: + # Should the swap server message be seen by the server they swapped to? + ServerJoined: true + + # Should the swap server message be seen by the server they swapped from? + ServerLeft: true + + # Should the swap server message be seen by the other servers? + OtherServer: true + FirstJoinNetworkMessageViewableBy: + # Should the Join Network message be seen by the server they Joined? + ServerJoined: true + + # Should theJoin Network message be seen by the other servers? + OtherServer: true + JoinNetworkMessageViewableBy: + # Should the Join Network message be seen by the server they Joined? + ServerJoined: true + + # Should theJoin Network message be seen by the other servers? + OtherServer: true + LeaveNetworkMessageViewableBy: + # Should the Leave Network message be seen by the server they left? + ServerLeft: true + + # Should the Leave Network message be seen by the other servers? + OtherServer: true + + # Servers in this list will not trigger messages. + # Servers listed here are case-sensitive. Check your bungee config to see how you have them listed! + ServerBlacklist: + - SomeServerName + - SomeOtherServerName + # Should the blacklist list be the only servers allowed to trigger messages? (Reverse the check) + UseBlacklistAsWhitelist: false + # When a player swaps from A to B, which one should we check? JOINED, LEFT, BOTH, ANY + # Behaviour will change depending on the blacklist being in blacklist or whitelist mode. + # example: If you set this to JOINED: BlacklistMode will prevent the message from going through if the joined server is going through. + # WhitelistMode will only allow it if the joined server is in the list. + # IF set to ANY or both, ANY of them must be blacklisted/whitelisted, or BOTH of them must ble blacklisted/whitelisted. + SwapServerMessageRequires: ANY + # IgnoreFirstJoinMessagesList - Players on these servers will not see a message when someone joins the network for the first time. + # The global message will still be triggered if someone joins these servers directly. + # Case-sensitive! + IgnoreFirstJoinMessagesList: + - SomeServerNameThatShouldNotSeeFirstJoinNetworkMessages + - SomeOtherServerName + # IgnoreJoinMessagesList - Players on these servers will not see a message when someone joins the network. + # The global message will still be triggered if someone joins these servers directly. + # Case-sensitive! + IgnoreJoinMessagesList: + - SomeServerNameThatShouldNotSeeJoinNetworkMessages + - SomeOtherServerName + # IgnoreLeaveMessagesList - Players on these servers will not see a message when someone leaves the network. + # The global message will still be triggered if someone leaves these servers directly. + # Case-sensitive! + IgnoreLeaveMessagesList: + - SomeServerNameThatShouldNotSeeLeaveNetworkMessages + - SomeOtherServerName + +OtherPlugins: + PAPIProxyBridge: + # The maximum amount of time in milliseconds to wait for PlaceholderAPI placeholders before timing out + RequestTimeout: 1500 + SayanVanish: + # Vanished players will not trigger messages aside from + # silent messages sent to players with networkjoinmessages.silent permission + TreatVanishedPlayersAsSilent: true + # Vanished players will not be counted in the player count placeholders + RemoveVanishedPlayersFromPlayerCount: true + # Send silent messages to players with the permission sayanvanish.vanish.use (permission must be set on the proxy) + NotifyVanishEnabledPlayersOnSilentMove: false + PremiumVanish: + # Vanished players will not trigger messages aside from + # silent messages sent to players with networkjoinmessages.silent permission + TreatVanishedPlayersAsSilent: true + # Vanished players will not be counted in the player count placeholders + RemoveVanishedPlayersFromPlayerCount: true + # Spoof a join message automatically when a player stops being vanished (shows) + SpoofJoinMessageOnShow: true + # Spoof a leave message automatically when a player vanishes (hides) + SpoofLeaveMessageOnHide: true + # Treats a player with the permission pv.joinvanished as vanished on join (permission must be set on the proxy) + # This is to be used in conjunction with the PremiumVanish 'AutoVanishOnJoin' option + TreatVanishedOnJoin: false + # Send silent messages to players with the permission pv.use or pv.see (permission must be set on the proxy) + NotifyVanishEnabledPlayersOnSilentMove: false + # Instead of sending silent messages to all players with pv.use or pv.see, only send silent messages to players with + # a greater than or equal to see level than the player who triggered the message's use level. + # Simply put, this setting respects the layered use/see permissions set with PremiumVanish. + # Requires players to rejoin upon changes to their level or setting this setting to true + NotifyRespectVanishLevels: false + # What should be the highest level for both PremiumVanish permissions? + # Lower amounts might improve performance with more players since they reduce the amount of permission checks + MaxLevel: 100 + LimboAPI: + # No swap messages for players swapping to or from limbo servers + SuppressSwapMessages: true + # No join messages for players joining limbo servers + SuppressJoinMessages: false + # No leave messages for players leaving from limbo servers + SuppressLeaveMessages: false + +debug: false +# Do not touch this +config-version: 14 diff --git a/velocity/config/plugins/networkjoinmessages/discord.yml b/velocity/config/plugins/networkjoinmessages/discord.yml new file mode 100644 index 0000000..6647906 --- /dev/null +++ b/velocity/config/plugins/networkjoinmessages/discord.yml @@ -0,0 +1,161 @@ +# This is the configuration for an optional discord webhook integration +# Here you can provide a discord webhook url for notifications :) + +# Whether to enable the integration +Enabled: false + +# The webhook url - if you need help check out these resources +# https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks +# https://youtu.be/fKksxz2Gdnc?si=jxY0gr1tiPXiPsgf +WebhookUrl: https://discord.com/api/webhooks/00000000000000000000/example-replace-this + +# The picture that will replace %embedavatarurl% throughout this config +# Available placeholders are %uuid% & %player% +EmbedAvatarUrl: https://mc-heads.net/avatar/%uuid% + +# All rules/settings in config.yml are honored here as well +# Configuration for swap-server, first-join, join, and leave messages is below +# Anything that is supposed to be a url MUST be either blank or a valid url!!! + +# Available placeholders for swap are: +# %embedavatarurl% - Defined above +# %player% - The player's username +# %displayname% - The custom name the player has according to bungee +# %to% - The server they are heading to +# %to_clean% - The server they are heading to without color codes +# %from% - The server they are coming from +# %from_clean% - The server they are coming from without color codes +# %playercount_from% - The amount of players where they are coming from +# %playercount_to% - The amount of players where they are heading to +# %playercount_network% - The amount of players on the network + +# Available placeholders for join/leave are: +# %embedavatarurl% - Defined above +# %player% - The player's username +# %displayname% - The custom name the player has according to bungee +# %server_name% - The name of the server they connected to +# %server_name_clean% - The name of the server they connected to without color codes +# %playercount_server% - The playercount of the server they are on +# %playercount_network% - The amount of players on the network +Messages: + SwapServer: + # Whether to enable the message + Enabled: true + # Lets you define a custom name and/or pfp url just for this message type + CustomWebhook: + Enabled: false + Name: '' + AvatarUrl: '' + # The message content + Content: '' + Embed: + Enabled: true + Color: '#444444' + Author: + ImageUrl: '%embedavatarurl%' + Name: '%player% swapped servers' + Url: '' + ThumbnailUrl: '' + Title: + Text: '' + Url: '' + Description: '' + # Format is "title;value;inline" (eg. "Who joined?;%displayname%;true") or "blank" to add a blank field + Fields: + - From;%from_clean%;true + - To;%to_clean%;true + ImageUrl: '' + Footer: + Text: '' + IconUrl: '' + Timestamp: false + FirstJoinNetwork: + # Whether to enable the message + Enabled: true + # Lets you define a custom name and/or pfp url just for this message type + CustomWebhook: + Enabled: false + Name: '' + AvatarUrl: '' + # The message content + Content: '' + Embed: + Enabled: true + Color: '#553a8c' + Author: + ImageUrl: '%embedavatarurl%' + Name: '%player% joined the network for the first time!' + Url: '' + ThumbnailUrl: '' + Title: + Text: '' + Url: '' + Description: '' + # Format is "title;value;inline" (eg. "Who joined?;%displayname%;true") or "blank" to add a blank field + Fields: [] + ImageUrl: '' + Footer: + Text: '' + IconUrl: '' + Timestamp: false + JoinNetwork: + # Whether to enable the message + Enabled: true + # Lets you define a custom name and/or pfp url just for this message type + CustomWebhook: + Enabled: false + Name: '' + AvatarUrl: '' + # The message content + Content: '' + Embed: + Enabled: true + Color: '#3d8c40' + Author: + ImageUrl: '%embedavatarurl%' + Name: '%player% joined the network' + Url: '' + ThumbnailUrl: '' + Title: + Text: '' + Url: '' + Description: '' + # Format is "title;value;inline" (eg. "Who joined?;%displayname%;true") or "blank" to add a blank field + Fields: [] + ImageUrl: '' + Footer: + Text: '' + IconUrl: '' + Timestamp: false + LeaveNetwork: + # Whether to enable the message + Enabled: true + # Lets you define a custom name and/or pfp url just for this message type + CustomWebhook: + Enabled: false + Name: '' + AvatarUrl: '' + # The message content + Content: '' + Embed: + Enabled: true + Color: '#ff0000' + Author: + ImageUrl: '%embedavatarurl%' + Name: '%player% left the network' + Url: '' + ThumbnailUrl: '' + Title: + Text: '' + Url: '' + Description: '' + # Format is "title;value;inline" (eg. "Who joined?;%displayname%;true") or "blank" to add a blank field + Fields: [] + ImageUrl: '' + Footer: + Text: '' + IconUrl: '' + Timestamp: false + +# Do not touch this +config-version: 2 diff --git a/velocity/config/plugins/networkjoinmessages/joined.mv.db b/velocity/config/plugins/networkjoinmessages/joined.mv.db new file mode 100644 index 0000000000000000000000000000000000000000..11b90a0d348f2f7a4948eb2de044741077dd84ae GIT binary patch literal 20480 zcmeHPy>lZ)7N61H8sWv(&$Ww5KbtDc}gM*Z>n*R6j2d#|Of z0O?_W7(Gbi_WplpU>b&@NB55g4+2+@#+1ag8<@oK+{m_3MD^Zqd_dyB(vRu*aDO;} zV!b|%qx*CmVCqD!>4wXSd?W%A0f~S_Kq4R!kO)WwBmxoviGV~vA|Mg?TOhEN^8PfI z{Qqw;FH#7JfJ8tdAQ6xVNCYGT5&?;TL_i`S5s(O6Bm$|EzfT8&sgKA#dI(`Fb-@z9!3G`8rnrZ$xQ-Z`AE5@ zDyp)wic!}#Ekf6Q%SY=N6SVGocDUX%vDNMR5pi7S)z`>qMDIgIr2MKr0Tmak2Nl$B zmCp-GQF)AEQ?^CyJa#~1Qr_<_C3uug9w8ptJPLUfeWr3;ZE?54(r5AQ?;q10hIN85 z$2xhp4e1nhfhPwa3-C<=e%I?_{b+D>nB2>NiRg(;CB7{#WH^(l5pxnn`Y?))Mr073 z1cv*e5YZ7L;u#SkHxZF92Ld-jQV~5!^QAE(B)m2Z6XqseArA7$8G<=%vG}H$70gr3 zYbI~Wa(yJy2J)xru;&}s#Ck-&htss>Mp#h_-zm!4n~HJ;rqcZ$0(h!B!!f|UO-8F5 z{b9Hb6S>+s8Bv(*pRYWlUcIWQg)9HKsywH?aHn1CXq&BCrBmD6*sV9J8bY|Fl~xdc zsqMCFEv^2t*1XlxYIo}GPFpLLw05P@(O!H}+p4s;lDJact~a08w3T;NQE#)dxmBxb zoyta|rj>SfHyZWLQn|F#sNAi!+Iz3wsy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