Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Town command blacklisting #4849

Merged
merged 21 commits into from
Apr 26, 2021
Merged

Town command blacklisting #4849

merged 21 commits into from
Apr 26, 2021

Conversation

ggvbo
Copy link
Contributor

@ggvbo ggvbo commented Apr 3, 2021

Description:

Allows blocking commands while inside a town.


New Nodes/Commands/ConfigOptions:

CONFIG OPTIONS

  • global_town_settings.town_command_blacklisting.enabled
  • global_town_settings.town_command_blacklisting.blacklisted_commands
  • global_town_settings.town_command_blacklisting.limited_commands

PERM NODES

  • towny.admin.town_commands.blacklist_bypass

Relevant Towny Issue ticket:

Closes #4835


  • I have tested this pull request for defects on a server.

By making this pull request, I represent that I have the right to waive copyright and related rights to my contribution, and agree that all copyright and related rights in my contributions are waived, and I acknowledge that the TownyAdvanced organization has the copyright to use and modify my contribution under the Towny License for perpetuity.

@longemen3000
Copy link

if allowed, this can use the same event handler than the jail command blacklist, to avoid calling the handler twice per command

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 3, 2021

if allowed, this can use the same event handler than the jail command blacklist, to avoid calling the handler twice per command

After looking at the code I believe this does make sense, but I decided to have two separate handlers because they both do different stuff, similar to how there's multiple EventHandlers for the PlayerMoveEvent event.

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 3, 2021

Note this is still missing the inside an town logic (which may be easily doable using TownyAPI) , I'll add it tomorrow since I don't have access to my computer rn.

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 3, 2021

image
Seems to be working, I will mark this as ready for review once I get it more polished

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 3, 2021

It seems the limited command feature is not working correctly, I'll try to find an fix and commit it so the PR can be marked as ready for review

@ggvbo ggvbo marked this pull request as ready for review April 13, 2021 20:18
@ggvbo ggvbo requested a review from LlmDl April 13, 2021 20:18
Copy link
Member

@LlmDl LlmDl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something has happened to the chinese, es-419 and french language files. They will need to be replaced with the Master branch and then have the new lines re-added.

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 19, 2021

lang files should be ok now, i checked them out from the main repo and i re added the strings

@ggvbo
Copy link
Contributor Author

ggvbo commented Apr 22, 2021

I'm testing the latest commits once i'm able to use my laptop and will try to reply as soon as I can

@LlmDl
Copy link
Member

LlmDl commented Apr 25, 2021

I'll give this a final rebase to resolve the conflict in TownySettings and then merge this tomorrow probably.

ggvbo and others added 7 commits April 26, 2021 08:56
- Requests from Warriorrrr are made.
- Moves town-blocked commands above the personally-owned commands test
to reduce the required returns later on.
- Switches to the PermissionSource hasOwnTown and hasTownOwned
permission tests.
@LlmDl LlmDl added this to the 0.97.0.0 milestone Apr 26, 2021
@LlmDl LlmDl merged commit 8b3b72a into TownyAdvanced:master Apr 26, 2021
LlmDl added a commit that referenced this pull request Apr 26, 2021
    - Allows blocking commands inside towns and limiting them to plots
owned by the players only.
    - Useful for limiting sethome/home commands to plots owned by the
players themselves and not someone else.
    - Admins and players with the
towny.admin.town_commands.blacklist_bypass permission node will not be
hindered.
    - Closes #4835.
  - New Config Option:
global_town_settings.town_command_blacklisting.enabled
    - Default: false
    - Allows blocking commands inside towns through the
town_blacklisted_commands setting.
    - This boolean allows you to disable this feature altogether if you
don't need it.
  - New Config Option:
global_town_settings.town_command_blacklisting.town_blacklisted_commands
    - Default: somecommandhere,othercommandhere
    - Comma separated list of commands which cannot be run inside of any
town.
  - New Config Option:
global_town_settings.town_command_blacklisting.player_owned_plot_limited_commands
    - Default : sethome,home
    - This allows the usage of blacklisted commands only in plots
personally-owned by the player.
    - Players with the towny.claimed.townowned.* permission node will be
able to run these commands inside of town-owned land. This would include
mayors, assistants and possibly a builder rank.
    - Players with the towny.claimed.owntown.* permission node (given to
mayors/assistants usually, will also not be limited by this command
blacklist.
  - New Permission Node: towny.admin.town_commands.blacklist_bypass
    - Child Node of towny.admin
    - Allows admins to not be restricted by either command-blocking
lists.
  - Fix entity-vs-entity combat always being allowed, courtesy of
Warriorrrr with PR #4893.
  - Update korean.yml, courtesy of yumjunstar with PR #4889.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion: Blocked Commands
4 participants