10.2.0 release

This commit is contained in:
mfnalex 2021-06-20 21:23:42 +02:00
parent 70522f9fdd
commit 5a251848c5
7 changed files with 25 additions and 1 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
## 10.2.0
- Added config option "allow-commands"
## 10.1.0 ## 10.1.0
- Added config option "prevent-sorting-null-inventories" - Added config option "prevent-sorting-null-inventories"
- Updated Chinese (Traditional) translation - Updated Chinese (Traditional) translation

View File

@ -9,7 +9,7 @@
<name>ChestSort</name> <name>ChestSort</name>
<url>https://www.chestsort.de</url> <url>https://www.chestsort.de</url>
<description>Allows automatic chest sorting!</description> <description>Allows automatic chest sorting!</description>
<version>10.1.0</version> <version>10.2.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>

View File

@ -723,6 +723,7 @@ public class ChestSortPlugin extends JavaPlugin {
getConfig().addDefault("additional-hotkeys.right-click", false); getConfig().addDefault("additional-hotkeys.right-click", false);
getConfig().addDefault("dump", false); getConfig().addDefault("dump", false);
getConfig().addDefault("log", false); getConfig().addDefault("log", false);
getConfig().addDefault("allow-commands", true);
getConfig().addDefault("hook-crackshot", true); getConfig().addDefault("hook-crackshot", true);
getConfig().addDefault("hook-crackshot-prefix", "crackshot_weapon"); getConfig().addDefault("hook-crackshot-prefix", "crackshot_weapon");

View File

@ -28,6 +28,11 @@ public class ChestSortCommand implements CommandExecutor {
return false; return false;
} }
if(!plugin.getConfig().getBoolean("allow-commands")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
// Reload command // Reload command
if(args.length>0 && args[0].equalsIgnoreCase("reload")) { if(args.length>0 && args[0].equalsIgnoreCase("reload")) {
if(!sender.hasPermission("chestsort.reload")) { if(!sender.hasPermission("chestsort.reload")) {

View File

@ -24,6 +24,11 @@ public class InvSortCommand implements CommandExecutor {
Player p = null; Player p = null;
if(!plugin.getConfig().getBoolean("allow-commands")) {
sender.sendMessage(command.getPermissionMessage());
return true;
}
if(args.length>0 && args[0].equalsIgnoreCase("help")) { if(args.length>0 && args[0].equalsIgnoreCase("help")) {
return false; return false;
} }

View File

@ -3,6 +3,7 @@ package de.jeff_media.chestsort.commands;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.jeff_media.chestsort.ChestSortPlugin;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -11,6 +12,7 @@ public class TabCompleter implements org.bukkit.command.TabCompleter {
static final String[] chestsortOptions = { "toggle","on","off","hotkeys","help" }; static final String[] chestsortOptions = { "toggle","on","off","hotkeys","help" };
static final String[] invsortOptions = { "toggle","on","off","all", "hotbar", "inv","help" }; static final String[] invsortOptions = { "toggle","on","off","all", "hotbar", "inv","help" };
private final ChestSortPlugin plugin = ChestSortPlugin.getInstance();
private List<String> getMatchingOptions(String entered, String[] options) { private List<String> getMatchingOptions(String entered, String[] options) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
@ -26,6 +28,10 @@ public class TabCompleter implements org.bukkit.command.TabCompleter {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) { public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if(!plugin.getConfig().getBoolean("allow-commands")) {
return null;
}
String entered = ""; String entered = "";
if(args.length>0) { if(args.length>0) {
entered = args[args.length-1]; entered = args[args.length-1];

View File

@ -76,6 +76,10 @@ sorting-enabled-by-default: false
# once to enable automatic inventory sorting. # once to enable automatic inventory sorting.
inv-sorting-enabled-by-default: false inv-sorting-enabled-by-default: false
# You can prevent players from using the /chestsort and /invsort commands by setting
# this to false.
allow-commands: true
# when set to true, players with sorting DISABLED will be # when set to true, players with sorting DISABLED will be
# shown a message on how to enable automatic chest sorting # shown a message on how to enable automatic chest sorting
# when they use a chest for the first time. # when they use a chest for the first time.