Skip to content

Commit

Permalink
BREAKING CHANGE: complete changes to new plugin name (perms, packages)
Browse files Browse the repository at this point in the history
  • Loading branch information
crashdemons committed Dec 9, 2020
1 parent 66e2549 commit f6549de
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 42 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AztecTabFilter

**IMPORTANT:** The name of this plugin has changed and the config and permissions are being renamed to match. If you used to use this plugin while it was named AztecTabCompleter and you don't want to change, you should use the code from the `old-name-support` branch, but this may not be updated as often.
**IMPORTANT:** The name of this plugin has changed and the config and permissions are being renamed to match. If you used to use this plugin while it was named AztecTabFilter and you don't want to change, you should use the code from the `old-name-support` branch, but this may not be updated as often.


Spigot 1.13-1.14.3 plugin that filters Command List Suggestions (initial tab complete) by allow/blocklists or groups.
Expand All @@ -21,9 +21,9 @@ Currently in 1.13, no `tab-complete` setting seems to stop all commands from bei
## Getting the plugin

### Downloading the Plugin pre-built
You can find released JARs (that can be added to your plugins folder) on the [Releases tab](https://github.com/crashdemons/AztecTabCompleter/releases) of this project.
You can find released JARs (that can be added to your plugins folder) on the [Releases tab](https://github.com/crashdemons/AztecTabFilter/releases) of this project.

If you want something a bit more shiny, you can check out our [development builds](https://ci.meme.tips/job/AztecTabCompleter/) available through Jenkins CI.
If you want something a bit more shiny, you can check out our [development builds](https://ci.meme.tips/job/AztecTabFilter/) available through Jenkins CI.

### Building the Project yourself
We've recently moved to using Maven! If you used build.xml or a Netbeans Project before, you may need to import the project again as a maven project / from existing POM.
Expand All @@ -46,12 +46,12 @@ Using permissions you can define access to different groups of suggestions, bypa

| Permission | Default Value | Description |
| ------------- | ------------- | ------------- |
| aztectabcompleter.* | True for Ops | Inherit all permissions except group behavior (may differ by permissions plugin) |
| aztectabcompleter.suggest | True | Allows the user to receive filtered suggestions. If you deny this permission, all suggestions are blocked. |
| aztectabcompleter.group.*group-name-here* | Undefined | Enables filtering for this user which is defined by this group-name in the configuration file |
| aztectabcompleter.bypass | True for Ops | Allows the user to bypass filtering, receiving all normal command-suggestions, unmodified. |
| aztectabcompleter.reload | True for Ops | Allows the user to access the /aztabreload command |
| aztectabcompleter.dump | True for Ops | Allows the user to access the /aztabdump command |
| aztectabfilter.* | True for Ops | Inherit all permissions except group behavior (may differ by permissions plugin) |
| aztectabfilter.suggest | True | Allows the user to receive filtered suggestions. If you deny this permission, all suggestions are blocked. |
| aztectabfilter.group.*group-name-here* | Undefined | Enables filtering for this user which is defined by this group-name in the configuration file |
| aztectabfilter.bypass | True for Ops | Allows the user to bypass filtering, receiving all normal command-suggestions, unmodified. |
| aztectabfilter.reload | True for Ops | Allows the user to access the /aztabreload command |
| aztectabfilter.dump | True for Ops | Allows the user to access the /aztabdump command |

### Configuration
The plugin configuration allows you to define whitelist/blacklist filtering of command-suggestions for everyone, or for specific groups, as well as the ability to tweak filtering order and behavior.
Expand Down Expand Up @@ -96,6 +96,6 @@ With this configuration we can see from the `filter-order` that the global black

`spawn` and `tpahere` would be allowed to be displayed to everyone, while the alias `etpahere` is hidden from suggestions.

For players with the `aztectabcompleter.group.moderator` permission, we can see similarly `vanish` is not displayed as a suggestion but the alias `v` is displayed. (assuming both are normally suggested).
For players with the `aztectabfilter.group.moderator` permission, we can see similarly `vanish` is not displayed as a suggestion but the alias `v` is displayed. (assuming both are normally suggested).

Additionally because the default action is *deny*, any commands not already in a whitelist (`visible-commands` or group equivalent) will be removed from suggestions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.crashdemons.aztectabcompleter;
package com.github.crashdemons.aztectabfilter;

import com.github.crashdemons.aztectabcompleter.filters.FilterArgs;
import com.github.crashdemons.aztectabcompleter.filters.FilterSet;
import com.github.crashdemons.aztectabfilter.filters.FilterArgs;
import com.github.crashdemons.aztectabfilter.filters.FilterSet;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -96,15 +96,15 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
}
String command = cmd.getName();
if (command.equalsIgnoreCase("aztabreload")) {
if (!sender.hasPermission("aztectabcompleter.reload")) {
if (!sender.hasPermission("aztectabfilter.reload")) {
sender.sendMessage("You don't have permission to do this.");
return true;
}
loadConfig();
sender.sendMessage("[AZTab] Config reloaded.");
return true;
}else if (command.equalsIgnoreCase("aztabdump")) {
if (!sender.hasPermission("aztectabcompleter.dump")) {
if (!sender.hasPermission("aztectabfilter.dump")) {
sender.sendMessage("You don't have permission to do this.");
return true;
}
Expand All @@ -122,7 +122,7 @@ public void onCommandSuggestion(PlayerCommandSendEvent event) {
return;
}
Player player = event.getPlayer();
if (player.hasPermission("aztectabcompleter.bypass")) {
if (player.hasPermission("aztectabfilter.bypass")) {
if(dumpFiltering) getLogger().info(player.getName()+" bypassed filtering by permission.");
return;
}
Expand All @@ -131,7 +131,7 @@ public void onCommandSuggestion(PlayerCommandSendEvent event) {
event.getCommands().clear();
return;
}
if (!player.hasPermission("aztectabcompleter.suggest")) {
if (!player.hasPermission("aztectabfilter.suggest")) {
if(dumpFiltering) getLogger().info(player.getName()+" denied suggestions by permission.");
event.getCommands().clear();
} else {
Expand Down Expand Up @@ -161,7 +161,7 @@ public void onPlayerCommandPreProcess(PlayerCommandPreprocessEvent event) {
}

Player player = event.getPlayer();
if (player.hasPermission("aztectabcompleter.bypass")) {
if (player.hasPermission("aztectabfilter.bypass")) {
if(dumpFiltering) getLogger().info(player.getName()+" bypassed command filtering by permission.");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.crashdemons.aztectabcompleter.filters;
package com.github.crashdemons.aztectabfilter.filters;

/**
* Filter class that defines a condition on which a filter matches or fails against input arguments, and decides the resulting action of the match.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.crashdemons.aztectabcompleter.filters;
package com.github.crashdemons.aztectabfilter.filters;

import com.github.crashdemons.aztectabcompleter.util.Pair;
import com.github.crashdemons.aztectabfilter.util.Pair;
import org.bukkit.entity.Player;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.crashdemons.aztectabcompleter.filters;
package com.github.crashdemons.aztectabfilter.filters;

import java.util.function.Predicate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.crashdemons.aztectabcompleter.filters;
package com.github.crashdemons.aztectabfilter.filters;

/**
* Defines an enumation of possible Filter outcomes that can be decided
Expand Down Expand Up @@ -36,7 +36,7 @@ public enum FilterResult {

/**
* The priority of the filter result where higher priority results override lower ones.
* @see #overrides(com.github.crashdemons.aztectabcompleter.filters.FilterResult)
* @see #overrides(com.github.crashdemons.aztectabfilter.filters.FilterResult)
*/
public final int priority;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.crashdemons.aztectabcompleter.filters;
package com.github.crashdemons.aztectabfilter.filters;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -254,7 +254,7 @@ private void loadGroups(ConfigurationSection config, boolean logoutput, List<Str
for (String groupname : groupnames) {
ConfigurationSection groupConfig = groups.getConfigurationSection(groupname);
FilterSet filterGroup = new FilterSet(this.plugin);
filterGroup.permission = "aztectabcompleter.group." + groupname;
filterGroup.permission = "aztectabfilter.group." + groupname;
//filterGroup.load(groupConfig);
filterGroup.loadLists(groupConfig, false);
filterGroups.put(groupname, filterGroup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.github.crashdemons.aztectabcompleter.util;
package com.github.crashdemons.aztectabfilter.util;

import java.util.Map;

Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ invisible-commands:
- particle

#defines groups that have differing command whitelists and blacklists
#give group permission with "aztectabcompleter.group.group-name-here"
#give group permission with "aztectabfilter.group.group-name-here"
#all applicable groups to a user will be checked for blacklist and whitelist matches if enabled in filter-order
#note: groups only have visible and invisible command lists, they do not have their own filter-order or default action.
#if you want a user to have multiple group's commands, give them the permission for each
Expand All @@ -51,9 +51,9 @@ groups:
#valid filtering mods:
# whitelist: allows any command that appears in 'visible-commands', skips other filtering if matched
# blacklist: denies any command that appears in 'invisible-commands', skips other filtering if matched
# group-whitelists: for each group the user has the "aztectabcompleter.group.group-name-here" permission for:
# group-whitelists: for each group the user has the "aztectabfilter.group.group-name-here" permission for:
# process the 'visible-commands' for the group as described above
# group-blacklists: for each group the user has the "aztectabcompleter.group.group-name-here" permission for:
# group-blacklists: for each group the user has the "aztectabfilter.group.group-name-here" permission for:
# process the 'invisible-commands' for the group as described above
# default configuration:
#filter-order: [blacklist,group-blacklists,whitelist,group-whitelists]
Expand Down
24 changes: 12 additions & 12 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: ${project.name}
main: com.github.crashdemons.aztectabcompleter.AZTabPlugin
main: com.github.crashdemons.aztectabfilter.AZTabPlugin
version: ${project.version}
author: crashdemons
description: Filters command tab-complete suggestions by whitelist.
Expand All @@ -13,33 +13,33 @@ commands:
description: reloads aztab config
usage: |
/aztabreload
permission: aztectabcompleter.reload
permission: aztectabfilter.reload
permission-message: You don't have permission for this command
aztabdump:
description: toggles dumping command filtering information to console
usage: /aztabdump
permission: aztectabcompleter.dump
permission: aztectabfilter.dump
permission-message: You don't have permission for this command

permissions:
aztectabcompleter.*:
aztectabfilter.*:
description: gives all permissions of the AZTab
default: op
children:
aztectabcompleter.reload: true
aztectabcompleter.bypass: true
aztectabcompleter.suggest: true
aztectabcompleter.dump: true
aztectabcompleter.suggest:
aztectabfilter.reload: true
aztectabfilter.bypass: true
aztectabfilter.suggest: true
aztectabfilter.dump: true
aztectabfilter.suggest:
description: Gives permission to see command suggestions at all (checked before filtering)
default: true
aztectabcompleter.reload:
aztectabfilter.reload:
description: Gives permission to reload AZTab config
default: op
aztectabcompleter.bypass:
aztectabfilter.bypass:
description: Gives permission to bypass command filtering by AZTab
default: op
aztectabcompleter.dump:
aztectabfilter.dump:
description: Gives permission to enable console logging of filter results
default: op

Expand Down

0 comments on commit f6549de

Please sign in to comment.