Fix #3422: 1.21.11: How to match Velocity command?#3476
Closed
kangobot[bot] wants to merge 1 commit intomasterfrom
Closed
Fix #3422: 1.21.11: How to match Velocity command?#3476kangobot[bot] wants to merge 1 commit intomasterfrom
kangobot[bot] wants to merge 1 commit intomasterfrom
Conversation
Collaborator
|
I'll have to test this one out before we can push it, will do it by today. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated fix proposed by AI analysis of the linked issue.
Changes
main/chatcontrol-proxy-core/src/main/java/org/mineacademy/chatcontrol/proxy/operator/ProxyRule.java: New class for proxy-level command rules matching. Extends ProxyOperator to inherit all operators (then deny, then warn, then command, then proxy, etc.). Adds regex pattern matching, sender conditions, and a RuleCheck inner class that processes rules against proxy commands.main/chatcontrol-proxy-core/src/main/java/org/mineacademy/chatcontrol/proxy/operator/ProxyRules.java: New class that manages proxy command rules. Extends RuleSetReader with keyword "match", loads from rules/command.rs. Mirrors ProxyPlayerMessages structure but for regex-based command rules.main/chatcontrol-proxy-core/src/main/resources/rules/command.rs: Default proxy command rules file. All rules are commented out by default, providing examples for users to customize. This file is extracted by RuleSetReader.loadFromFile() on first run.main/chatcontrol-proxy-core/src/main/java/org/mineacademy/chatcontrol/proxy/ProxyEvents.java: Add import for ProxyRulemain/chatcontrol-proxy-core/src/main/java/org/mineacademy/chatcontrol/proxy/ProxyEvents.java: Add EventHandledException import for handleCommand methodmain/chatcontrol-proxy-core/src/main/java/org/mineacademy/chatcontrol/proxy/ProxyEvents.java: Add handleCommand method that runs proxy command rules against the executed command and returns true if the command should be cancelledmain/chatcontrol-velocity/src/main/java/org/mineacademy/chatcontrol/velocity/listener/PlayerListener.java: Add import for CommandExecuteEventmain/chatcontrol-velocity/src/main/java/org/mineacademy/chatcontrol/velocity/listener/PlayerListener.java: Add Player import for command event handler type checkmain/chatcontrol-velocity/src/main/java/org/mineacademy/chatcontrol/velocity/listener/PlayerListener.java: Add command event handler that checks proxy command rules and denies if a rule matches with 'then deny'main/chatcontrol-bungeecord/src/main/java/org/mineacademy/chatcontrol/bungee/listener/PlayerListener.java: Extend the BungeeCord ChatEvent handler to also handle proxy command rules when the event is a command. Routes commands to ProxyEvents.handleCommand() and cancels the event if denied.main/chatcontrol-velocity/src/main/java/org/mineacademy/chatcontrol/velocity/VelocityControl.java: Add ProxyRules importmain/chatcontrol-velocity/src/main/java/org/mineacademy/chatcontrol/velocity/VelocityControl.java: Load proxy command rules on plugin reloadmain/chatcontrol-bungeecord/src/main/java/org/mineacademy/chatcontrol/bungee/BungeeControl.java: Add ProxyRules importmain/chatcontrol-bungeecord/src/main/java/org/mineacademy/chatcontrol/bungee/BungeeControl.java: Load proxy command rules on plugin reloadmain/chatcontrol-proxy-core/src/main/java/org/mineacademy/chatcontrol/proxy/operator/ProxyRule.java: Add $0, $1, $2 regex group reference support to match Bukkit rules syntax. Replace from highest group number down to avoid $1 replacing part of $10.main/chatcontrol-proxy-core/src/main/java/org/mineacademy/chatcontrol/proxy/operator/ProxyRule.java: Add @nonnull annotation to match parent method signature for consistencymain/chatcontrol-proxy-core/src/main/java/org/mineacademy/chatcontrol/proxy/operator/ProxyRule.java: Add NonNull import for the replaceVariablesLegacy override annotationThis is a draft PR — human review required before merging.