diff --git a/ChestsPlusPlus_Main/pom.xml b/ChestsPlusPlus_Main/pom.xml
index af86f43..06199cd 100644
--- a/ChestsPlusPlus_Main/pom.xml
+++ b/ChestsPlusPlus_Main/pom.xml
@@ -45,6 +45,11 @@
jitpack.io
https://jitpack.io
+
+
+ aikar
+ https://repo.aikar.co/content/groups/aikar/
+
@@ -68,7 +73,15 @@
1.2.3-SNAPSHOT
-
+
+
+ org.jetbrains
+ annotations
+ 16.0.1
+
+
+
+
@@ -86,6 +99,16 @@
master-SNAPSHOT
+
+ co.aikar
+ acf-paper
+ 0.5.0-SNAPSHOT
+
+
+
org.bstats
bstats-bukkit
@@ -175,6 +198,14 @@
com.github.WesJD.AnvilGUI
com.jamesdpeters.minecraft.chests
+
+ co.aikar.commands
+ com.jamesdpeters.minecraft.chests.acf
+
+
+ co.aikar.locales
+ com.jamesdpeters.minecraft.chests.locales
+
diff --git a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/ChestsPlusPlus.java b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/ChestsPlusPlus.java
index 65a9954..66fec1d 100644
--- a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/ChestsPlusPlus.java
+++ b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/ChestsPlusPlus.java
@@ -1,5 +1,6 @@
package com.jamesdpeters.minecraft.chests;
+import co.aikar.commands.PaperCommandManager;
import com.jamesdpeters.minecraft.chests.api.ApiSpecific;
import com.jamesdpeters.minecraft.chests.commands.AutoCraftCommand;
import com.jamesdpeters.minecraft.chests.commands.ChestLinkCommand;
@@ -98,10 +99,31 @@ public class ChestsPlusPlus extends JavaPlugin {
Api.register(this);
ApiSpecific.init();
+ PaperCommandManager manager = new PaperCommandManager(this);
+ manager.registerCommand(new ChestLinkCommand());
+ manager.registerCommand(new AutoCraftCommand());
+ manager.registerCommand(new ChestsPlusPlusCommand());
+
//Register commands
- new ChestLinkCommand().register(this);
- new AutoCraftCommand().register(this);
- new ChestsPlusPlusCommand().register(this);
+// new ChestLinkCommand().register(this);
+// new AutoCraftCommand().register(this);
+// new ChestsPlusPlusCommand().register(this);
+
+// SimpleCommandMap commandMap = new SimpleCommandMap(getServer());
+ // Check for disabled aliases
+// PluginConfig.DISABLED_ALIASES.get().forEach(alias -> {
+// getDescription().getCommands().forEach((commandName, map) -> {
+// PluginCommand command = getCommand(commandName);
+// List aliases = command.getAliases();
+// // Check if command contains the alias before removing.
+// if(aliases.contains(alias)) {
+// System.out.println("Removed command? : "+command.unregister(commandMap));
+// aliases.remove(alias);
+// command.setAliases(aliases);
+// command.register(commandMap);
+// }
+// });
+// });
//Load storage
SpigotConfig.load(this);
diff --git a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/commands/ChestLinkCommand.java b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/commands/ChestLinkCommand.java
index 1c4372d..f35438f 100644
--- a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/commands/ChestLinkCommand.java
+++ b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/commands/ChestLinkCommand.java
@@ -1,29 +1,27 @@
package com.jamesdpeters.minecraft.chests.commands;
-import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
+import co.aikar.commands.BaseCommand;
+import co.aikar.commands.CommandIssuer;
+import co.aikar.commands.annotation.CatchUnknown;
+import co.aikar.commands.annotation.CommandAlias;
+import co.aikar.commands.annotation.CommandPermission;
+import co.aikar.commands.annotation.Default;
+import co.aikar.commands.annotation.HelpCommand;
+import co.aikar.commands.annotation.Subcommand;
import com.jamesdpeters.minecraft.chests.lang.Message;
-import com.jamesdpeters.minecraft.chests.menus.ChestLinkMenu;
-import com.jamesdpeters.minecraft.chests.menus.PartyMenu;
-import com.jamesdpeters.minecraft.chests.misc.Messages;
import com.jamesdpeters.minecraft.chests.misc.Permissions;
import com.jamesdpeters.minecraft.chests.misc.Utils;
import com.jamesdpeters.minecraft.chests.serialize.Config;
-import com.jamesdpeters.minecraft.chests.sort.SortMethod;
-import com.jamesdpeters.minecraft.chests.storage.chestlink.ChestLinkStorage;
-import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
-import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-public class ChestLinkCommand extends ServerCommand {
+@CommandAlias("chestlink|cl")
+public class ChestLinkCommand extends BaseCommand {
private enum OPTIONS {
ADD("/chestlink add ", Message.COMMAND_CHESTLINK_ADD.getString()),
@@ -57,264 +55,287 @@ public class ChestLinkCommand extends ServerCommand {
}
- @Override
- public String getCommandName() {
- return "chestlink";
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (!(sender instanceof Player)) {
- sender.sendMessage("Only a player can use this command");
- return false;
- }
-
- Player player = (Player) sender;
- if (args != null && args.length > 0) {
- try {
- switch (OPTIONS.valueOf(args[0].toUpperCase())) {
- case HELP:
- for (OPTIONS option : OPTIONS.values()) {
- if (!option.equals(OPTIONS.HELP)) {
- player.sendMessage(ChatColor.RED + option.commandHelp);
- player.sendMessage(ChatColor.WHITE + option.description);
- }
- }
- return true;
- case ADD:
- if (args.length > 1) {
- if (sender.hasPermission(Permissions.ADD) && !Utils.isBlacklistedWorld(player.getWorld())) {
- Block targetBlock = player.getTargetBlockExact(5);
- if (targetBlock != null)
- Config.getChestLink().createStorage(player, targetBlock, args[1], true);
- else Config.getChestLink().getMessages().mustLookAtBlock(player);
- return true;
- } else {
- Messages.NO_PERMISSION(player);
- return true;
- }
- } else {
- player.sendMessage(ChatColor.RED + OPTIONS.ADD.commandHelp);
- player.sendMessage(ChatColor.RED + OPTIONS.ADD.description);
- return true;
- }
- case OPEN:
- if (args.length > 1) {
- if (sender.hasPermission(Permissions.OPEN) && sender.hasPermission(Permissions.OPEN_REMOTE) && !Utils.isBlacklistedWorld(player.getWorld())) {
- ChestLinkStorage invs;
- if (args[1].contains(":")) {
- invs = Config.getChestLink().getStorage(player, args[1]);
- } else {
- invs = Config.getChestLink().getStorage(player.getUniqueId(), args[1]);
- }
- if (invs != null) Utils.openChestInventory(player, invs.getInventory());
- return true;
- } else {
- Messages.NO_PERMISSION(player);
- return true;
- }
- } else {
- player.sendMessage(ChatColor.RED + OPTIONS.OPEN.commandHelp);
- player.sendMessage(ChatColor.RED + OPTIONS.OPEN.description);
- return true;
- }
- case MENU:
- if (sender.hasPermission(Permissions.MENU) && !Utils.isBlacklistedWorld(player.getWorld())) {
- ChestLinkMenu.getMenu(player).open(player);
- return true;
- } else {
- Messages.NO_PERMISSION(player);
- return true;
- }
- case LIST:
- Config.getChestLink().getMessages().listStorageGroups(player);
- return true;
- case REMOVE:
- if (args.length > 1) {
- if (sender.hasPermission(Permissions.REMOVE)) {
- Config.getChestLink().removeStorage(player, args[1]);
- return true;
- } else {
- Messages.NO_PERMISSION(player);
- return true;
- }
- } else {
- player.sendMessage(ChatColor.RED + OPTIONS.REMOVE.commandHelp);
- player.sendMessage(ChatColor.RED + OPTIONS.REMOVE.description);
- return true;
- }
- case SORT:
- if (args.length > 1) {
- if (sender.hasPermission(Permissions.SORT)) {
- ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[1]);
- if (storage != null) {
- storage.setSortMethod(Enum.valueOf(SortMethod.class, args[2]));
- storage.sort();
- Messages.SORT(player, storage);
- }
- return true;
- } else {
- Messages.NO_PERMISSION(player);
- return true;
- }
- } else {
- player.sendMessage(ChatColor.RED + OPTIONS.SORT.commandHelp);
- player.sendMessage(ChatColor.RED + OPTIONS.SORT.description);
- return true;
- }
- case MEMBER:
- return memberCommand(args, sender);
- case SETPUBLIC: {
- if (args.length > 2) {
- ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[1]);
- if (storage != null) {
- boolean setpublic = Boolean.parseBoolean(args[2]);
- storage.setPublic(setpublic);
- storage.getStorageType().getMessages().setPublic(player, storage);
- return true;
- } else {
- Bukkit.broadcastMessage("Storage null");
- }
- } else {
- player.sendMessage(ChatColor.RED + OPTIONS.SETPUBLIC.commandHelp);
- player.sendMessage(ChatColor.RED + OPTIONS.SETPUBLIC.description);
- return true;
- }
- }
- case RENAME: {
- if (args.length > 2) {
- String group = args[1];
- String newIdentifier = args[2];
- if (!Config.getChestLink().renameStorage(player, group, newIdentifier)) {
- player.sendMessage(ChatColor.RED + OPTIONS.RENAME.commandHelp);
- player.sendMessage(ChatColor.RED + OPTIONS.RENAME.description);
- }
- return true;
- }
- }
- case PARTY:
- PartyMenu.getMenu(player).getMenu().open(player);
- return true;
- }
- } catch (IllegalArgumentException exception) {
- return false;
+ @Subcommand("help")
+ @CatchUnknown @Default
+ @HelpCommand
+ public void doHelp(CommandIssuer issuer, String... args) {
+ for (OPTIONS option : OPTIONS.values()) {
+ if (!option.equals(OPTIONS.HELP)) {
+ issuer.sendMessage(ChatColor.RED + option.commandHelp);
+ issuer.sendMessage(ChatColor.WHITE + option.description);
}
}
-
- return false;
}
- @Override
- public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
- if ((sender instanceof Player)) {
- Player player = (Player) sender;
-
- if (args.length == 1) {
- return OPTIONS.valuesList;
- }
- if (args.length == 2) {
- try {
- switch (OPTIONS.valueOf(args[0].toUpperCase())) {
- case ADD:
- case OPEN:
- return Config.getChestLink().getOpenableStorageList(player, args[1]);
- case REMOVE:
- case SORT:
- case RENAME:
- return Config.getChestLink().getStorageList(player, args[1]);
- case MEMBER:
- return Stream.of("add", "remove", "list", "add-to-all", "remove-from-all").filter(s -> s.contains(args[1])).collect(Collectors.toList());
- }
- } catch (IllegalArgumentException ignored) {
- }
- }
- if (args.length == 3) {
- try {
- switch (OPTIONS.valueOf(args[0].toUpperCase())) {
- case MEMBER:
- if (args[1].equals("add-to-all")) return Utils.filterList(Utils.getAllPlayers(), args[2]);
- if (args[1].equals("remove-from-all"))
- return Utils.filterList(Utils.getAllPlayers(), args[2]);
- return Config.getChestLink().getStorageList(player, args[2]);
- case SORT:
- return SortMethod.valuesList;
- }
- } catch (IllegalArgumentException ignored) {
- }
- }
- if (args.length == 4) {
- try {
- switch (OPTIONS.valueOf(args[0].toUpperCase())) {
- case MEMBER:
- return Utils.filterList(Utils.getAllPlayers(), args[3]);
- }
- } catch (IllegalArgumentException ignored) {
- }
- }
- return Collections.singletonList("");
+ @Subcommand("add")
+ @CommandPermission(Permissions.ADD)
+ public static void add(Player player, String... args){
+ if (!Utils.isBlacklistedWorld(player.getWorld())) {
+ Block targetBlock = player.getTargetBlockExact(5);
+ if (targetBlock != null)
+ Config.getChestLink().createStorage(player, targetBlock, args[1], true);
+ else Config.getChestLink().getMessages().mustLookAtBlock(player);
}
- return null;
}
- private static boolean memberCommand(String[] args, CommandSender sender) {
- Player player = (Player) sender;
- if (args.length > 3) {
- if (sender.hasPermission(Permissions.MEMBER)) {
- if (args[1].equals("add")) {
- Bukkit.getScheduler().runTaskAsynchronously(ChestsPlusPlus.PLUGIN, () -> {
- OfflinePlayer toAdd = Bukkit.getOfflinePlayer(args[3]);
- ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[2]);
- if (storage != null && storage.addMember(toAdd))
- storage.getStorageType().getMessages().addedMember(player, storage, args[3]);
- else Config.getChestLink().getMessages().unableToAddMember(player, args[3]);
- });
- return true;
- } else if (args[1].equals("remove")) {
- Bukkit.getScheduler().runTaskAsynchronously(ChestsPlusPlus.PLUGIN, () -> {
- OfflinePlayer toAdd = Bukkit.getOfflinePlayer(args[3]);
- ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[2]);
- if (storage != null && storage.removeMember(toAdd))
- storage.getStorageType().getMessages().removedMember(player, storage, args[3]);
- else Config.getChestLink().getMessages().unableToRemoveMember(player, args[3]);
- });
- return true;
- } else {
- player.sendMessage(ChatColor.RED + OPTIONS.MEMBER.commandHelp);
- player.sendMessage(ChatColor.RED + OPTIONS.MEMBER.description);
- }
- } else {
- Messages.NO_PERMISSION(player);
- }
- return true;
- } else if (args.length > 2) {
- if (sender.hasPermission(Permissions.MEMBER)) {
- if (args[1].equals("list")) {
- ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[2]);
- if (storage != null) {
- storage.getStorageType().getMessages().listMembers(player, storage);
- return true;
- }
- } else if (args[1].equals("add-to-all")) {
- Bukkit.getScheduler().runTaskAsynchronously(ChestsPlusPlus.PLUGIN, () -> {
- OfflinePlayer toAdd = Bukkit.getOfflinePlayer(args[2]);
- Config.getChestLink().getStorageMap(player.getUniqueId()).forEach((s, storage) -> storage.addMember(toAdd));
- Config.getChestLink().getMessages().addMemberToAll(player, toAdd);
- });
- return true;
- } else if (args[1].equals("remove-from-all")) {
- Bukkit.getScheduler().runTaskAsynchronously(ChestsPlusPlus.PLUGIN, () -> {
- OfflinePlayer toAdd = Bukkit.getOfflinePlayer(args[2]);
- Config.getChestLink().getStorageMap(player.getUniqueId()).forEach((s, storage) -> storage.removeMember(toAdd));
- Config.getChestLink().getMessages().removeMemberFromAll(player, toAdd);
- });
- return true;
- }
- }
- } else {
- player.sendMessage(ChatColor.RED + OPTIONS.MEMBER.commandHelp);
- player.sendMessage(ChatColor.RED + OPTIONS.MEMBER.description);
- return true;
- }
- return false;
- }
+ // @Override
+// public String getCommandName() {
+// return "chestlink";
+// }
+//
+// @Override
+// public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+// if (!(sender instanceof Player)) {
+// sender.sendMessage("Only a player can use this command");
+// return false;
+// }
+//
+// Player player = (Player) sender;
+// if (args != null && args.length > 0) {
+// try {
+// switch (OPTIONS.valueOf(args[0].toUpperCase())) {
+// case HELP:
+// for (OPTIONS option : OPTIONS.values()) {
+// if (!option.equals(OPTIONS.HELP)) {
+// player.sendMessage(ChatColor.RED + option.commandHelp);
+// player.sendMessage(ChatColor.WHITE + option.description);
+// }
+// }
+// return true;
+// case ADD:
+// if (args.length > 1) {
+// if (sender.hasPermission(Permissions.ADD) && !Utils.isBlacklistedWorld(player.getWorld())) {
+// Block targetBlock = player.getTargetBlockExact(5);
+// if (targetBlock != null)
+// Config.getChestLink().createStorage(player, targetBlock, args[1], true);
+// else Config.getChestLink().getMessages().mustLookAtBlock(player);
+// return true;
+// } else {
+// Messages.NO_PERMISSION(player);
+// return true;
+// }
+// } else {
+// player.sendMessage(ChatColor.RED + OPTIONS.ADD.commandHelp);
+// player.sendMessage(ChatColor.RED + OPTIONS.ADD.description);
+// return true;
+// }
+// case OPEN:
+// if (args.length > 1) {
+// if (sender.hasPermission(Permissions.OPEN) && sender.hasPermission(Permissions.OPEN_REMOTE) && !Utils.isBlacklistedWorld(player.getWorld())) {
+// ChestLinkStorage invs;
+// if (args[1].contains(":")) {
+// invs = Config.getChestLink().getStorage(player, args[1]);
+// } else {
+// invs = Config.getChestLink().getStorage(player.getUniqueId(), args[1]);
+// }
+// if (invs != null) Utils.openChestInventory(player, invs.getInventory());
+// return true;
+// } else {
+// Messages.NO_PERMISSION(player);
+// return true;
+// }
+// } else {
+// player.sendMessage(ChatColor.RED + OPTIONS.OPEN.commandHelp);
+// player.sendMessage(ChatColor.RED + OPTIONS.OPEN.description);
+// return true;
+// }
+// case MENU:
+// if (sender.hasPermission(Permissions.MENU) && !Utils.isBlacklistedWorld(player.getWorld())) {
+// ChestLinkMenu.getMenu(player).open(player);
+// return true;
+// } else {
+// Messages.NO_PERMISSION(player);
+// return true;
+// }
+// case LIST:
+// Config.getChestLink().getMessages().listStorageGroups(player);
+// return true;
+// case REMOVE:
+// if (args.length > 1) {
+// if (sender.hasPermission(Permissions.REMOVE)) {
+// Config.getChestLink().removeStorage(player, args[1]);
+// return true;
+// } else {
+// Messages.NO_PERMISSION(player);
+// return true;
+// }
+// } else {
+// player.sendMessage(ChatColor.RED + OPTIONS.REMOVE.commandHelp);
+// player.sendMessage(ChatColor.RED + OPTIONS.REMOVE.description);
+// return true;
+// }
+// case SORT:
+// if (args.length > 1) {
+// if (sender.hasPermission(Permissions.SORT)) {
+// ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[1]);
+// if (storage != null) {
+// storage.setSortMethod(Enum.valueOf(SortMethod.class, args[2]));
+// storage.sort();
+// Messages.SORT(player, storage);
+// }
+// return true;
+// } else {
+// Messages.NO_PERMISSION(player);
+// return true;
+// }
+// } else {
+// player.sendMessage(ChatColor.RED + OPTIONS.SORT.commandHelp);
+// player.sendMessage(ChatColor.RED + OPTIONS.SORT.description);
+// return true;
+// }
+// case MEMBER:
+// return memberCommand(args, sender);
+// case SETPUBLIC: {
+// if (args.length > 2) {
+// ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[1]);
+// if (storage != null) {
+// boolean setpublic = Boolean.parseBoolean(args[2]);
+// storage.setPublic(setpublic);
+// storage.getStorageType().getMessages().setPublic(player, storage);
+// return true;
+// } else {
+// Bukkit.broadcastMessage("Storage null");
+// }
+// } else {
+// player.sendMessage(ChatColor.RED + OPTIONS.SETPUBLIC.commandHelp);
+// player.sendMessage(ChatColor.RED + OPTIONS.SETPUBLIC.description);
+// return true;
+// }
+// }
+// case RENAME: {
+// if (args.length > 2) {
+// String group = args[1];
+// String newIdentifier = args[2];
+// if (!Config.getChestLink().renameStorage(player, group, newIdentifier)) {
+// player.sendMessage(ChatColor.RED + OPTIONS.RENAME.commandHelp);
+// player.sendMessage(ChatColor.RED + OPTIONS.RENAME.description);
+// }
+// return true;
+// }
+// }
+// case PARTY:
+// PartyMenu.getMenu(player).getMenu().open(player);
+// return true;
+// }
+// } catch (IllegalArgumentException exception) {
+// return false;
+// }
+// }
+//
+// return false;
+// }
+//
+// @Override
+// public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
+// if ((sender instanceof Player)) {
+// Player player = (Player) sender;
+//
+// if (args.length == 1) {
+// return OPTIONS.valuesList;
+// }
+// if (args.length == 2) {
+// try {
+// switch (OPTIONS.valueOf(args[0].toUpperCase())) {
+// case ADD:
+// case OPEN:
+// return Config.getChestLink().getOpenableStorageList(player, args[1]);
+// case REMOVE:
+// case SORT:
+// case RENAME:
+// return Config.getChestLink().getStorageList(player, args[1]);
+// case MEMBER:
+// return Stream.of("add", "remove", "list", "add-to-all", "remove-from-all").filter(s -> s.contains(args[1])).collect(Collectors.toList());
+// }
+// } catch (IllegalArgumentException ignored) {
+// }
+// }
+// if (args.length == 3) {
+// try {
+// switch (OPTIONS.valueOf(args[0].toUpperCase())) {
+// case MEMBER:
+// if (args[1].equals("add-to-all")) return Utils.filterList(Utils.getAllPlayers(), args[2]);
+// if (args[1].equals("remove-from-all"))
+// return Utils.filterList(Utils.getAllPlayers(), args[2]);
+// return Config.getChestLink().getStorageList(player, args[2]);
+// case SORT:
+// return SortMethod.valuesList;
+// }
+// } catch (IllegalArgumentException ignored) {
+// }
+// }
+// if (args.length == 4) {
+// try {
+// switch (OPTIONS.valueOf(args[0].toUpperCase())) {
+// case MEMBER:
+// return Utils.filterList(Utils.getAllPlayers(), args[3]);
+// }
+// } catch (IllegalArgumentException ignored) {
+// }
+// }
+// return Collections.singletonList("");
+// }
+// return null;
+// }
+//
+// private static boolean memberCommand(String[] args, CommandSender sender) {
+// Player player = (Player) sender;
+// if (args.length > 3) {
+// if (sender.hasPermission(Permissions.MEMBER)) {
+// if (args[1].equals("add")) {
+// Bukkit.getScheduler().runTaskAsynchronously(ChestsPlusPlus.PLUGIN, () -> {
+// OfflinePlayer toAdd = Bukkit.getOfflinePlayer(args[3]);
+// ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[2]);
+// if (storage != null && storage.addMember(toAdd))
+// storage.getStorageType().getMessages().addedMember(player, storage, args[3]);
+// else Config.getChestLink().getMessages().unableToAddMember(player, args[3]);
+// });
+// return true;
+// } else if (args[1].equals("remove")) {
+// Bukkit.getScheduler().runTaskAsynchronously(ChestsPlusPlus.PLUGIN, () -> {
+// OfflinePlayer toAdd = Bukkit.getOfflinePlayer(args[3]);
+// ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[2]);
+// if (storage != null && storage.removeMember(toAdd))
+// storage.getStorageType().getMessages().removedMember(player, storage, args[3]);
+// else Config.getChestLink().getMessages().unableToRemoveMember(player, args[3]);
+// });
+// return true;
+// } else {
+// player.sendMessage(ChatColor.RED + OPTIONS.MEMBER.commandHelp);
+// player.sendMessage(ChatColor.RED + OPTIONS.MEMBER.description);
+// }
+// } else {
+// Messages.NO_PERMISSION(player);
+// }
+// return true;
+// } else if (args.length > 2) {
+// if (sender.hasPermission(Permissions.MEMBER)) {
+// if (args[1].equals("list")) {
+// ChestLinkStorage storage = Config.getChestLink().getStorage(player.getUniqueId(), args[2]);
+// if (storage != null) {
+// storage.getStorageType().getMessages().listMembers(player, storage);
+// return true;
+// }
+// } else if (args[1].equals("add-to-all")) {
+// Bukkit.getScheduler().runTaskAsynchronously(ChestsPlusPlus.PLUGIN, () -> {
+// OfflinePlayer toAdd = Bukkit.getOfflinePlayer(args[2]);
+// Config.getChestLink().getStorageMap(player.getUniqueId()).forEach((s, storage) -> storage.addMember(toAdd));
+// Config.getChestLink().getMessages().addMemberToAll(player, toAdd);
+// });
+// return true;
+// } else if (args[1].equals("remove-from-all")) {
+// Bukkit.getScheduler().runTaskAsynchronously(ChestsPlusPlus.PLUGIN, () -> {
+// OfflinePlayer toAdd = Bukkit.getOfflinePlayer(args[2]);
+// Config.getChestLink().getStorageMap(player.getUniqueId()).forEach((s, storage) -> storage.removeMember(toAdd));
+// Config.getChestLink().getMessages().removeMemberFromAll(player, toAdd);
+// });
+// return true;
+// }
+// }
+// } else {
+// player.sendMessage(ChatColor.RED + OPTIONS.MEMBER.commandHelp);
+// player.sendMessage(ChatColor.RED + OPTIONS.MEMBER.description);
+// return true;
+// }
+// return false;
+// }
}
diff --git a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/commands/ServerCommand.java b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/commands/ServerCommand.java
index d750a36..6f0cfd5 100644
--- a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/commands/ServerCommand.java
+++ b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/commands/ServerCommand.java
@@ -1,18 +1,20 @@
package com.jamesdpeters.minecraft.chests.commands;
+import co.aikar.commands.BaseCommand;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabCompleter;
import org.bukkit.plugin.java.JavaPlugin;
-public abstract class ServerCommand implements CommandExecutor, TabCompleter {
+public abstract class ServerCommand extends BaseCommand implements CommandExecutor, TabCompleter {
+
/**
* @param plugin Registers command to given plugin.
*/
public void register(JavaPlugin plugin) {
PluginCommand command = plugin.getCommand(getCommandName());
- if (command != null) {
+ if(command != null) {
command.setExecutor(this);
command.setTabCompleter(this);
}
diff --git a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/filters/ExtraTag.java b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/filters/ExtraTag.java
new file mode 100644
index 0000000..d72a878
--- /dev/null
+++ b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/filters/ExtraTag.java
@@ -0,0 +1,41 @@
+package com.jamesdpeters.minecraft.chests.filters;
+
+
+import com.jamesdpeters.minecraft.chests.ChestsPlusPlus;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Tag;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class ExtraTag implements Tag {
+
+ public static final Tag DYES = new ExtraTag("dyes", Material.BLACK_DYE, Material.RED_DYE, Material.GREEN_DYE, Material.BROWN_DYE, Material.BLUE_DYE, Material.PURPLE_DYE, Material.CYAN_DYE, Material.LIGHT_GRAY_DYE, Material.GRAY_DYE, Material.PINK_DYE, Material.LIME_DYE, Material.YELLOW_DYE, Material.LIGHT_BLUE_DYE, Material.MAGENTA_DYE, Material.ORANGE_DYE, Material.WHITE_DYE);
+ public static final Tag BEDS = new ExtraTag("beds", Material.BLACK_BED, Material.RED_BED, Material.GREEN_BED, Material.BROWN_BED, Material.BLUE_BED, Material.PURPLE_BED, Material.CYAN_BED, Material.LIGHT_GRAY_BED, Material.GRAY_BED, Material.PINK_BED, Material.LIME_BED, Material.YELLOW_BED, Material.LIGHT_BLUE_BED, Material.MAGENTA_BED, Material.ORANGE_BED, Material.WHITE_BED);
+
+ NamespacedKey namespacedKey;
+ Set values;
+
+ public ExtraTag(String tag, Material... materials){
+ namespacedKey = new NamespacedKey(ChestsPlusPlus.PLUGIN, tag);
+ values = new HashSet<>(Arrays.asList(materials));
+ }
+
+ @Override
+ public boolean isTagged(@NotNull Material item) {
+ return values.contains(item);
+ }
+
+ @Override
+ public Set getValues() {
+ return values;
+ }
+
+ @Override
+ public NamespacedKey getKey() {
+ return namespacedKey;
+ }
+}
diff --git a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/filters/ItemTypeUtil.java b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/filters/ItemTypeUtil.java
index 326ef42..0cae582 100644
--- a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/filters/ItemTypeUtil.java
+++ b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/filters/ItemTypeUtil.java
@@ -59,6 +59,8 @@ public class ItemTypeUtil {
tags.add(Tag.ITEMS_MUSIC_DISCS);
tags.add(Tag.ITEMS_COALS);
tags.add(Tag.ITEMS_ARROWS);
+
+ tags.add(ExtraTag.DYES);
}
public static boolean isSimilarTag(ItemStack is1, ItemStack is2){
diff --git a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/serialize/PluginConfig.java b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/serialize/PluginConfig.java
index e1289ec..3a6ae88 100644
--- a/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/serialize/PluginConfig.java
+++ b/ChestsPlusPlus_Main/src/main/java/com/jamesdpeters/minecraft/chests/serialize/PluginConfig.java
@@ -5,6 +5,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -39,6 +40,9 @@ public class PluginConfig {
public final static ListValue WORLD_BLACKLIST = new ListValue<>("world-blacklist", String.class, Collections.singletonList(""));
public final static Value LANG_FILE = new Value<>("language-file", String.class, "default");
+ public final static ListValue DISABLED_ALIASES = new ListValue<>("disabled-aliases", String.class, Arrays.asList("#cl", "#ac"));
+
+
/**
* Loads this @{@link Plugin}'s Config and adds default values if they don't exist.
*