mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2025-01-06 00:17:52 +01:00
4.0 update: inventory sorting
This commit is contained in:
parent
909b99cd65
commit
7e8bcd2f60
4
pom.xml
4
pom.xml
@ -5,11 +5,11 @@
|
||||
|
||||
<groupId>de.jeffclan</groupId>
|
||||
<artifactId>JeffChestSort</artifactId>
|
||||
<version>3.7.1</version>
|
||||
<version>4.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>JeffChestSort</name>
|
||||
<url>https://www.spigotmc.org/resources/1-11-1-13-chestsort-api.59773/</url>
|
||||
<url>https://www.chestsort.de</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -41,6 +41,21 @@ public class JeffChestSortCommandExecutor implements CommandExecutor {
|
||||
|
||||
return true;
|
||||
|
||||
} else if(command.getName().equalsIgnoreCase("invsort")) {
|
||||
// This command sorts the player's inventory
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(plugin.messages.MSG_PLAYERSONLY);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = (Player) sender;
|
||||
|
||||
plugin.sortInventory(p.getInventory(), 9, 35);
|
||||
p.sendMessage(plugin.messages.MSG_PLAYERINVSORTED);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -3,6 +3,7 @@ package de.jeffclan.JeffChestSort;
|
||||
import java.util.UUID;
|
||||
import java.io.File;
|
||||
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
@ -90,7 +91,7 @@ public class JeffChestSortListener implements Listener {
|
||||
// the chestsort.use permission and has /chestsort enabled)
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
|
||||
|
||||
// I don't know if this is neccesary. Have to check if getPlayer() always returns a player,
|
||||
// or if it might return an OfflinePlayer under some circumstances
|
||||
if (!(event.getPlayer() instanceof Player)) {
|
||||
|
@ -11,7 +11,7 @@ public class JeffChestSortMessages {
|
||||
|
||||
JeffChestSortPlugin plugin;
|
||||
|
||||
final String MSG_ACTIVATED, MSG_DEACTIVATED, MSG_COMMANDMESSAGE, MSG_COMMANDMESSAGE2, MSG_PLAYERSONLY;
|
||||
final String MSG_ACTIVATED, MSG_DEACTIVATED, MSG_COMMANDMESSAGE, MSG_COMMANDMESSAGE2, MSG_PLAYERSONLY, MSG_PLAYERINVSORTED;
|
||||
|
||||
|
||||
JeffChestSortMessages(JeffChestSortPlugin plugin) {
|
||||
@ -31,6 +31,9 @@ public class JeffChestSortMessages {
|
||||
|
||||
MSG_PLAYERSONLY = ChatColor.translateAlternateColorCodes('&', plugin.getConfig()
|
||||
.getString("message-error-players-only", "&cError: This command can only be run by players.&r"));
|
||||
|
||||
MSG_PLAYERINVSORTED = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString(
|
||||
"message-player-inventory-sorted", "&7Your inventory has been sorted."));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
JeffChestSortListener listener;
|
||||
String sortingMethod;
|
||||
ArrayList<String> disabledWorlds;
|
||||
int currentConfigVersion = 6;
|
||||
int currentConfigVersion = 7;
|
||||
boolean usingMatchingConfig = true;
|
||||
boolean debug = false;
|
||||
boolean verbose = true;
|
||||
@ -146,6 +146,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
getConfig().addDefault("show-message-when-using-chest-and-sorting-is-enabled", false);
|
||||
getConfig().addDefault("show-message-again-after-logout", true);
|
||||
getConfig().addDefault("sorting-method", "{category},{itemsFirst},{name},{color}");
|
||||
getConfig().addDefault("allow-player-inventory-sorting", false);
|
||||
getConfig().addDefault("check-for-updates", "true");
|
||||
getConfig().addDefault("auto-generate-category-files", true);
|
||||
getConfig().addDefault("verbose", true); // Prints some information in onEnable()
|
||||
@ -187,7 +188,6 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
// the Organizer to sort inventories when a player closes a chest, shulkerbox or barrel inventory
|
||||
listener = new JeffChestSortListener(this);
|
||||
|
||||
|
||||
// The sorting method will determine how stuff is sorted
|
||||
sortingMethod = getConfig().getString("sorting-method");
|
||||
|
||||
@ -197,7 +197,10 @@ public class JeffChestSortPlugin extends JavaPlugin {
|
||||
// Register the /chestsort command and associate it to a new CommandExecutor
|
||||
JeffChestSortCommandExecutor commandExecutor = new JeffChestSortCommandExecutor(this);
|
||||
this.getCommand("chestsort").setExecutor(commandExecutor);
|
||||
|
||||
|
||||
// Register the /invsort command
|
||||
this.getCommand("invsort").setExecutor(commandExecutor);
|
||||
|
||||
// Does anyone actually need this?
|
||||
if (verbose) {
|
||||
getLogger().info("Current sorting method: " + sortingMethod);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#
|
||||
# Please note that players will need the chestsort.use permission
|
||||
# or have to be OP to be able to use automatic chest sorting.
|
||||
# To use /invsort, the permission chestsort.use.inventory is required.
|
||||
#
|
||||
|
||||
# when set to false, new players will have to run /chestsort
|
||||
@ -121,6 +122,7 @@ message-when-using-chest2: "&7Hint: Type &6/chestsort&7 to disable automatic che
|
||||
message-sorting-disabled: "&7Automatic chest sorting has been &cdisabled&7."
|
||||
message-sorting-enabled: "&7Automatic chest sorting has been &aenabled&7."
|
||||
message-error-players-only: "&cError: This command can only be run by players."
|
||||
message-player-inventory-sorted: "&7Your inventory has been sorted."
|
||||
|
||||
##### Chinese - Thanks to qsefthuopq for translating! -> https://www.spigotmc.org/members/qsefthuopq.339953/
|
||||
#message-when-using-chest: "&7提示: 输入 &6/chestsort&7 来启用自动整理箱子."
|
||||
@ -184,4 +186,4 @@ message-error-players-only: "&cError: This command can only be run by players."
|
||||
#########################
|
||||
|
||||
# please do not change the following line manually!
|
||||
config-version: 6
|
||||
config-version: 7
|
||||
|
@ -1,10 +1,10 @@
|
||||
main: de.jeffclan.JeffChestSort.JeffChestSortPlugin
|
||||
name: ChestSort
|
||||
version: 3.7.1
|
||||
version: 4.0
|
||||
api-version: 1.13
|
||||
description: Allows automatic chest sorting
|
||||
author: mfnalex
|
||||
website: https://www.spigotmc.org/resources/1-13-chestsort.59773/
|
||||
website: https://www.chestsort.de
|
||||
prefix: ChestSort
|
||||
database: false
|
||||
loadbefore:
|
||||
@ -15,6 +15,13 @@ commands:
|
||||
usage: /<command>
|
||||
aliases: sort
|
||||
permission: chestsort.use
|
||||
invsort:
|
||||
description: Sorts the player's inventory except hotbar, armor slots and items in hands
|
||||
usage: /<command>
|
||||
aliases: [isort,inventorysort]
|
||||
permission: chestsort.use.inventory
|
||||
permissions:
|
||||
chestsort.use:
|
||||
description: Allows usage of automatic chest sorting
|
||||
chestsort.use.inventory:
|
||||
description: Allows usage of inventory sorting (/invsort)
|
Loading…
Reference in New Issue
Block a user