advanced /invsort options

This commit is contained in:
BuildTools 2019-04-29 19:30:45 +02:00
parent 502474556d
commit 6cca548619
3 changed files with 25 additions and 5 deletions

View File

@ -5,7 +5,7 @@
<groupId>de.jeffclan</groupId>
<artifactId>JeffChestSort</artifactId>
<version>4.0</version>
<version>4.1-beta2</version>
<packaging>jar</packaging>
<name>JeffChestSort</name>

View File

@ -1,5 +1,6 @@
package de.jeffclan.JeffChestSort;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -51,7 +52,26 @@ public class JeffChestSortCommandExecutor implements CommandExecutor {
Player p = (Player) sender;
plugin.sortInventory(p.getInventory(), 9, 35);
int start = 9;
int end = 35;
if(args.length>0) {
if(args[0].equalsIgnoreCase("all")) {
start=0;
end=35;
} else if(args[0].equalsIgnoreCase("hotbar")) {
start=0;
end=8;
} else if(args[0].equalsIgnoreCase("inv")) {
start=9;
end=35;
} else {
p.sendMessage(ChatColor.RED+"Error: unknown option \""+args[0]+"\". Valid values are \"inv\", \"hotbar\" and \"all\".");
return true;
}
}
plugin.sortInventory(p.getInventory(), start, end);
p.sendMessage(plugin.messages.MSG_PLAYERINVSORTED);
return true;

View File

@ -1,6 +1,6 @@
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
name: ChestSort
version: 4.0
version: 4.1-beta2
api-version: 1.13
description: Allows automatic chest sorting
author: mfnalex
@ -16,8 +16,8 @@ commands:
aliases: sort
permission: chestsort.use
invsort:
description: Sorts the player's inventory except hotbar, armor slots and items in hands
usage: /<command>
description: Sorts the player's inventory. When no option is specified, only the regular inventory (excluding the hotbar) is sorted.
usage: /<command> [inv|hotbar|all]
aliases: [isort,inventorysort]
permission: chestsort.use.inventory
permissions: