diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java index 495a0c98..381f6dd7 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -4,6 +4,7 @@ import io.lumine.mythic.lib.MythicLib; import io.lumine.mythic.lib.UtilityMethods; import io.lumine.mythic.lib.version.SpigotPlugin; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.social.PartyManager; import net.Indyuce.mmocore.api.ConfigFile; import net.Indyuce.mmocore.manager.ActionBarManager; @@ -250,45 +251,10 @@ public class MMOCore extends JavaPlugin { // load guild data after loading player data dataProvider.getGuildManager().load(); - // Command - try { - final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap"); - - bukkitCommandMap.setAccessible(true); - CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer()); - - FileConfiguration config = new ConfigFile("commands").getConfig(); - - if (config.contains("player")) - commandMap.register("mmocore", new PlayerStatsCommand(config.getConfigurationSection("player"))); - if (config.contains("attributes")) - commandMap.register("mmocore", new AttributesCommand(config.getConfigurationSection("attributes"))); - if (config.contains("class")) - commandMap.register("mmocore", new ClassCommand(config.getConfigurationSection("class"))); - if (config.contains("waypoints")) - commandMap.register("mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints"))); - if (config.contains("quests")) - commandMap.register("mmocore", new QuestsCommand(config.getConfigurationSection("quests"))); - if (config.contains("skills")) - commandMap.register("mmocore", new SkillsCommand(config.getConfigurationSection("skills"))); - if (config.contains("friends")) - commandMap.register("mmocore", new FriendsCommand(config.getConfigurationSection("friends"))); - if (config.contains("party")) - commandMap.register("mmocore", new PartyCommand(config.getConfigurationSection("party"))); - if (config.contains("guild")) - commandMap.register("mmocore", new GuildCommand(config.getConfigurationSection("guild"))); - if (config.contains("skill-trees")) - commandMap.register("mmocore", new SkillTreeCommand(config.getConfigurationSection("skill-trees"))); - if (hasEconomy() && economy.isValid()) { - if (config.contains("withdraw")) - commandMap.register("mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw"))); - if (config.contains("deposit")) - commandMap.register("mmocore", new DepositCommand(config.getConfigurationSection("deposit"))); - } - } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) { - ex.printStackTrace(); - } + // Toggleable Commands + ToggleableCommand.register(); + // Register MMOCore command what soever MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot(); getCommand("mmocore").setExecutor(mmoCoreCommand); getCommand("mmocore").setTabCompleter(mmoCoreCommand); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 31a8fc3a..1e960f4a 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -125,7 +125,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc private final Map tableItemClaims = new HashMap<>(); // NON-FINAL player data stuff made public to facilitate field change - public boolean noCooldown, statsLoaded; + public boolean noCooldown, statsLoaded, pvpMode; public CombatRunnable combat; /** diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java index 853029d1..a418202d 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/AttributesCommand.java @@ -1,21 +1,19 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.event.MMOCommandEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -public class AttributesCommand extends BukkitCommand { +public class AttributesCommand extends RegisteredCommand { public AttributesCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Opens the attribute menu."); + super(config, ToggleableCommand.ATTRIBUTES); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java index 4618beae..05908c22 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/ClassCommand.java @@ -1,21 +1,19 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.event.MMOCommandEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -public class ClassCommand extends BukkitCommand { +public class ClassCommand extends RegisteredCommand { public ClassCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Select a new class."); + super(config, ToggleableCommand.CLASS); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java index 75c8bd69..cd96fee6 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/DepositCommand.java @@ -1,19 +1,17 @@ package net.Indyuce.mmocore.command; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.gui.eco.DepositMenu; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -public class DepositCommand extends BukkitCommand { +public class DepositCommand extends RegisteredCommand { public DepositCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Opens the currency deposit menu."); + super(config, ToggleableCommand.DEPOSIT); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java index 61c67587..d230ea74 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/FriendsCommand.java @@ -3,6 +3,8 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.social.FriendRequest; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.social.Request; @@ -10,19 +12,15 @@ import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; import org.jetbrains.annotations.Nullable; import java.util.UUID; -public class FriendsCommand extends BukkitCommand { +public class FriendsCommand extends RegisteredCommand { public FriendsCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Opens the friends menu."); + super(config, ToggleableCommand.FRIENDS); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java index f8e39ee2..3db0e437 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/GuildCommand.java @@ -2,6 +2,8 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.social.Request; @@ -11,20 +13,15 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; import org.jetbrains.annotations.Nullable; import java.util.UUID; -public class GuildCommand extends BukkitCommand { - +public class GuildCommand extends RegisteredCommand { public GuildCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Opens the guilds menu."); + super(config, ToggleableCommand.GUILD); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java index b1ec471a..d36ac5b2 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PartyCommand.java @@ -2,6 +2,8 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.event.MMOCommandEvent; import net.Indyuce.mmocore.api.player.social.Request; @@ -12,20 +14,15 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; import org.jetbrains.annotations.Nullable; import java.util.UUID; -public class PartyCommand extends BukkitCommand { - +public class PartyCommand extends RegisteredCommand { public PartyCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Opens the party menu."); + super(config, ToggleableCommand.PARTY); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java index 65fcfef6..af2b8cef 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PlayerStatsCommand.java @@ -1,34 +1,32 @@ package net.Indyuce.mmocore.command; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; +import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -public class PlayerStatsCommand extends BukkitCommand { - public PlayerStatsCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Show player stats."); - } +public class PlayerStatsCommand extends RegisteredCommand { + public PlayerStatsCommand(ConfigurationSection config) { + super(config, ToggleableCommand.PLAYER); + } - @Override - public boolean execute(CommandSender sender, String label, String[] args) { - if (!(sender instanceof Player)) { - sender.sendMessage(ChatColor.RED + "This command is for players only."); - return true; - } - - PlayerData data = PlayerData.get((Player) sender); - MMOCommandEvent event = new MMOCommandEvent(data, "profile"); - Bukkit.getServer().getPluginManager().callEvent(event); - if(!event.isCancelled()) InventoryManager.PLAYER_STATS.newInventory(data).open(); - return true; - } + @Override + public boolean execute(CommandSender sender, String label, String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is for players only."); + return true; + } + + PlayerData data = PlayerData.get((Player) sender); + MMOCommandEvent event = new MMOCommandEvent(data, "profile"); + Bukkit.getServer().getPluginManager().callEvent(event); + if (!event.isCancelled()) InventoryManager.PLAYER_STATS.newInventory(data).open(); + return true; + } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PvpModeCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PvpModeCommand.java new file mode 100644 index 00000000..e3901248 --- /dev/null +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/PvpModeCommand.java @@ -0,0 +1,76 @@ +package net.Indyuce.mmocore.command; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.api.player.social.Request; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; +import net.Indyuce.mmocore.guild.provided.GuildInvite; +import net.Indyuce.mmocore.manager.InventoryManager; +import org.apache.commons.lang.Validate; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.OfflinePlayer; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.Nullable; + +import java.util.UUID; + +public class PvpModeCommand extends RegisteredCommand { + public PvpModeCommand(ConfigurationSection config) { + super(config, ToggleableCommand.PVP_MODE); + } + + @Override + public boolean execute(CommandSender sender, String label, String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage(ChatColor.RED + "This command is for players only."); + return true; + } + + PlayerData data = PlayerData.get((OfflinePlayer) sender); + MMOCommandEvent event = new MMOCommandEvent(data, "guild"); + Bukkit.getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) return true; + + if (args.length > 1) { + + final @Nullable GuildInvite invite; + if (args.length > 1) + + // Search by request ID + try { + final UUID uuid = UUID.fromString(args[1]); + final Request req = MMOCore.plugin.requestManager.getRequest(uuid); + Validate.isTrue(!req.isTimedOut() && req instanceof GuildInvite); + invite = (GuildInvite) req; + Validate.isTrue(MMOCore.plugin.dataProvider.getGuildManager().isRegistered(invite.getGuild())); + } catch (Exception exception) { + return true; + } + + // Search by target player + else + invite = MMOCore.plugin.requestManager.findRequest(data, GuildInvite.class); + + // No invite found with given identifier/target player + if (invite == null) + return true; + + if (args[0].equalsIgnoreCase("accept")) + invite.accept(); + if (args[0].equalsIgnoreCase("deny")) + invite.deny(); + return true; + } + + if (data.inGuild()) + InventoryManager.GUILD_VIEW.newInventory(data).open(); + else + InventoryManager.GUILD_CREATION.newInventory(data).open(); + return true; + } +} diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java index c4018404..7946c3e9 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/QuestsCommand.java @@ -1,20 +1,18 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.event.MMOCommandEvent; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -public class QuestsCommand extends BukkitCommand { +public class QuestsCommand extends RegisteredCommand { public QuestsCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Opens the quests menu."); + super(config, ToggleableCommand.QUESTS); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillTreeCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillTreesCommand.java similarity index 76% rename from MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillTreeCommand.java rename to MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillTreesCommand.java index 9fca6e5e..ae53e0d9 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillTreeCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillTreesCommand.java @@ -1,23 +1,20 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.MMOCore; -import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.event.MMOCommandEvent; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.InventoryManager; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; -public class SkillTreeCommand extends BukkitCommand { - public SkillTreeCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Opens the skills menu."); +public class SkillTreesCommand extends RegisteredCommand { + public SkillTreesCommand(ConfigurationSection config) { + super(config, ToggleableCommand.SKILL_TREES); } @Override @@ -37,8 +34,5 @@ public class SkillTreeCommand extends BukkitCommand { MMOCore.plugin.configManager.getSimpleMessage("no-skill-tree").send(player); return true; } - } - - } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java index f5a0fd77..25429f56 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/SkillsCommand.java @@ -2,20 +2,18 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.event.MMOCommandEvent; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -public class SkillsCommand extends BukkitCommand { +public class SkillsCommand extends RegisteredCommand { public SkillsCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Opens the skills menu."); + super(config, ToggleableCommand.SKILLS); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java index e7bc6f3e..4ffd2645 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WaypointsCommand.java @@ -1,20 +1,18 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.api.player.PlayerData; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import net.Indyuce.mmocore.manager.InventoryManager; import net.Indyuce.mmocore.api.event.MMOCommandEvent; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; -public class WaypointsCommand extends BukkitCommand { +public class WaypointsCommand extends RegisteredCommand { public WaypointsCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Open the waypoints menu."); + super(config, ToggleableCommand.WAYPOINTS); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java index 361b38b2..52e2fe76 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/WithdrawCommand.java @@ -1,23 +1,21 @@ package net.Indyuce.mmocore.command; import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.command.api.RegisteredCommand; +import net.Indyuce.mmocore.command.api.ToggleableCommand; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Sound; import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.eco.Withdraw; -public class WithdrawCommand extends BukkitCommand { +public class WithdrawCommand extends RegisteredCommand { public WithdrawCommand(ConfigurationSection config) { - super(config.getString("main")); - - setAliases(config.getStringList("aliases")); - setDescription("Creates a withdraw request."); + super(config, ToggleableCommand.WITHDRAW); } @Override diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/api/CommandVerbose.java similarity index 98% rename from MMOCore-API/src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java rename to MMOCore-API/src/main/java/net/Indyuce/mmocore/command/api/CommandVerbose.java index f0df977a..52d9d572 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/CommandVerbose.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/api/CommandVerbose.java @@ -1,4 +1,4 @@ -package net.Indyuce.mmocore.command; +package net.Indyuce.mmocore.command.api; import io.lumine.mythic.lib.UtilityMethods; import net.Indyuce.mmocore.MMOCore; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/api/RegisteredCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/api/RegisteredCommand.java new file mode 100644 index 00000000..dc7077c3 --- /dev/null +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/api/RegisteredCommand.java @@ -0,0 +1,14 @@ +package net.Indyuce.mmocore.command.api; + +import org.bukkit.command.defaults.BukkitCommand; +import org.bukkit.configuration.ConfigurationSection; +import org.jetbrains.annotations.NotNull; + +public abstract class RegisteredCommand extends BukkitCommand { + public RegisteredCommand(@NotNull ConfigurationSection config, ToggleableCommand command) { + super(config.getString("main")); + + setAliases(config.getStringList("aliases")); + setDescription(config.getString("description", command.getDescription())); + } +} diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/api/ToggleableCommand.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/api/ToggleableCommand.java new file mode 100644 index 00000000..8e43385a --- /dev/null +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/api/ToggleableCommand.java @@ -0,0 +1,112 @@ +package net.Indyuce.mmocore.command.api; + +import net.Indyuce.mmocore.MMOCore; +import net.Indyuce.mmocore.api.ConfigFile; +import net.Indyuce.mmocore.command.*; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandMap; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.file.FileConfiguration; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.File; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.logging.Level; + +/** + * Commands which can be disabled using commands.yml + */ +public enum ToggleableCommand { + PLAYER("player", "Displays player stats", config -> new PlayerStatsCommand(config), "p", "profile"), + ATTRIBUTES("attributes", "Display and manage attributes", config -> new AttributesCommand(config), "att", "stats"), + CLASS("class", "Select a new class", config -> new ClassCommand(config), "c"), + WAYPOINTS("waypoints", "Display discovered waypoints", config -> new WaypointsCommand(config), "wp"), + QUESTS("quests", "Display available quests", config -> new QuestsCommand(config), "q", "journal"), + SKILLS("skills", "Spend skill points to unlock new skills", config -> new SkillsCommand(config), "s"), + FRIENDS("friends", "Show online/offline friends", config -> new FriendsCommand(config), "f"), + PARTY("party", "Invite players in a party to split exp", config -> new PartyCommand(config)), + GUILD("guild", "Show players in current guild", config -> new GuildCommand(config)), + WITHDRAW("withdraw", "Withdraw money into coins and notes", config -> new WithdrawCommand(config), v -> MMOCore.plugin.hasEconomy() && MMOCore.plugin.economy.isValid(), "w"), + SKILL_TREES("skiltrees", "Open up the skill tree menu", config -> new SkillTreesCommand(config), "st", "trees", "tree"), + DEPOSIT("deposit", "Open the currency deposit menu", config -> new DepositCommand(config), "d"), + PVP_MODE("pvpmode", "Toggle on/off PVP mode.", config -> new PvpModeCommand(config), "pvp"); + + private final String mainLabel; + private final String description; + private final Function generator; + private final List aliases; + private final Predicate enabled; + + ToggleableCommand(@NotNull String mainLabel, @NotNull String description, @NotNull Function generator, @NotNull String... aliases) { + this(mainLabel, description, generator, null, aliases); + } + + ToggleableCommand(@NotNull String mainLabel, @NotNull String description, @NotNull Function generator, @Nullable Predicate enabled, @NotNull String... aliases) { + this.mainLabel = mainLabel; + this.description = description; + this.generator = generator; + this.aliases = Arrays.asList(aliases); + this.enabled = enabled == null ? v -> true : enabled; + } + + public String getMainLabel() { + return mainLabel; + } + + public String getDescription() { + return description; + } + + public List getAliases() { + return aliases; + } + + public String getConfigPath() { + return name().toLowerCase().replace("_", "-"); + } + + public boolean isEnabled() { + return enabled.test(null); + } + + public static void register() { + + // Load default config file + if (!new File(MMOCore.plugin.getDataFolder(), "commands.yml").exists()) { + final ConfigFile config = new ConfigFile("commands"); + + for (ToggleableCommand cmd : values()) { + final String path = cmd.getConfigPath(); + config.getConfig().set(path + ".main", cmd.mainLabel); + config.getConfig().set(path + ".aliases", cmd.aliases); + config.getConfig().set(path + ".description", cmd.description); + } + + config.save(); + } + + + try { + + // Find command map + final Field commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap"); + commandMapField.setAccessible(true); + final CommandMap commandMap = (CommandMap) commandMapField.get(Bukkit.getServer()); + + // Enable commands individually + final FileConfiguration config = new ConfigFile("commands").getConfig(); + for (ToggleableCommand cmd : values()) + if (cmd.isEnabled() && config.contains(cmd.getConfigPath())) + commandMap.register("mmocore", cmd.generator.apply(config.getConfigurationSection(cmd.getConfigPath()))); + + } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, "Unable to register custom commands:"); + exception.printStackTrace(); + } + } +} diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java index 1ac32bcb..13a7cca3 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/AttributeCommandTreeNode.java @@ -4,7 +4,7 @@ import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java index 4061a7a1..34b6ce91 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ClassCommandTreeNode.java @@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import net.Indyuce.mmocore.api.player.profess.SavedClassInformation; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java index 24baa701..ec3b1180 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ExperienceCommandTreeNode.java @@ -8,7 +8,7 @@ import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.Profession; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot; import net.Indyuce.mmocore.util.TriConsumer; import org.apache.commons.lang.Validate; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java index 44c9c366..eec3935a 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ForceClassCommandTreeNode.java @@ -3,7 +3,7 @@ package net.Indyuce.mmocore.command.rpg.admin; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.profess.PlayerClass; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java index 8f1ef05b..b69cba20 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/LevelCommandTreeNode.java @@ -7,7 +7,7 @@ import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.PlayerProfessions; import net.Indyuce.mmocore.experience.Profession; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import net.Indyuce.mmocore.util.TriConsumer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java index 9f5d47ed..7db453fe 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/NoCooldownCommandTreeNode.java @@ -1,7 +1,7 @@ package net.Indyuce.mmocore.command.rpg.admin; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java index 45b8b661..f72cad59 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/PointsCommandTreeNode.java @@ -4,7 +4,7 @@ import java.util.function.BiConsumer; import java.util.function.Function; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java index 6b21f046..8f96947b 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResetCommandTreeNode.java @@ -10,7 +10,7 @@ import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java index becc1605..88e53545 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/ResourceCommandTreeNode.java @@ -5,7 +5,7 @@ import io.lumine.mythic.lib.command.api.Parameter; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/SkillCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/SkillCommandTreeNode.java index 65e480e6..869c44e5 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/SkillCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/SkillCommandTreeNode.java @@ -5,7 +5,7 @@ import io.lumine.mythic.lib.command.api.Parameter; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.skill.RegisteredSkill; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import net.Indyuce.mmocore.skill.ClassSkill; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/SkillTreePointsCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/SkillTreePointsCommandTreeNode.java index 56a45ab6..0cd195d0 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/SkillTreePointsCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/admin/SkillTreePointsCommandTreeNode.java @@ -4,7 +4,7 @@ import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import net.Indyuce.mmocore.util.TriConsumer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/LockCommandTreeNode.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/LockCommandTreeNode.java index 721b2fee..458eae0e 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/LockCommandTreeNode.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/command/rpg/waypoint/LockCommandTreeNode.java @@ -4,7 +4,7 @@ import io.lumine.mythic.lib.command.api.CommandTreeNode; import io.lumine.mythic.lib.command.api.Parameter; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import net.Indyuce.mmocore.waypoint.Waypoint; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java index 139e0e41..efa2c729 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/comp/vault/VaultEconomy.java @@ -1,32 +1,37 @@ package net.Indyuce.mmocore.comp.vault; +import net.Indyuce.mmocore.MMOCore; +import net.milkbowl.vault.economy.Economy; +import org.bukkit.Bukkit; +import org.jetbrains.annotations.Nullable; + import java.util.logging.Level; -import net.Indyuce.mmocore.MMOCore; -import org.bukkit.Bukkit; - -import net.milkbowl.vault.economy.Economy; - public class VaultEconomy { - private Economy economy; - public VaultEconomy() { - try { - economy = Bukkit.getServicesManager().getRegistration(Economy.class).getProvider(); - MMOCore.log(Level.INFO, "Hooked onto Vault"); - } catch (Exception exception) { - MMOCore.plugin.getLogger().log(Level.WARNING, "Vault was found but MMOCore was unable to successfully find/load an economy plugin."); - } - } + @Nullable + private final Economy economy; - /* - * checks if an economy plugin was found. - */ - public boolean isValid() { - return economy != null; - } + public VaultEconomy() { + Economy eco; + try { + eco = Bukkit.getServicesManager().getRegistration(Economy.class).getProvider(); + MMOCore.log(Level.INFO, "Hooked onto Vault"); + } catch (Exception exception) { + MMOCore.plugin.getLogger().log(Level.WARNING, "Vault was found but MMOCore was unable to successfully find/load an economy plugin."); + eco = null; + } + this.economy = eco; + } - public Economy getEconomy() { - return economy; - } + /** + * @return If an economy plugin was found + */ + public boolean isValid() { + return economy != null; + } + + public Economy getEconomy() { + return economy; + } } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SkillList.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SkillList.java index 2eefa626..0c0ee123 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SkillList.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SkillList.java @@ -15,6 +15,7 @@ import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem; import net.Indyuce.mmocore.skill.ClassSkill; import net.Indyuce.mmocore.skill.RegisteredSkill; import net.Indyuce.mmocore.api.SoundEvent; +import org.apache.commons.lang.Validate; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; @@ -28,7 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Level; -public class SkillList extends EditableInventory { +public class SkillList extends EditableInventory { public SkillList() { super("skill-list"); } @@ -340,6 +341,7 @@ public class SkillList extends EditableInventory { skills = new ArrayList<>(playerData.getProfess().getSkills()); skillSlots = getEditable().getByFunction("skill").getSlots(); + Validate.notNull(getEditable().getByFunction("active-slot"), "Your skill GUI config file is out-of-date, please regenerate it."); activeSlotSlots = getEditable().getByFunction("active-slot").getSlots(); passiveSlotSlots = getEditable().getByFunction("passive-slot").getSlots(); selected = skills.get(page * skillSlots.size()); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java index 2ffe1464..15a301e4 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/ConfigManager.java @@ -7,7 +7,7 @@ import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.util.input.ChatInput; import net.Indyuce.mmocore.api.util.input.PlayerInput; import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType; -import net.Indyuce.mmocore.command.CommandVerbose; +import net.Indyuce.mmocore.command.api.CommandVerbose; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; @@ -92,7 +92,6 @@ public class ConfigManager { loadDefaultFile("restrictions.yml"); loadDefaultFile("sounds.yml"); loadDefaultFile("loot-chests.yml"); - loadDefaultFile("commands.yml"); loadDefaultFile("exp-tables.yml"); loadDefaultFile("exp-sources.yml"); loadDefaultFile("triggers.yml"); diff --git a/MMOCore-Dist/src/main/resources/default/commands.yml b/MMOCore-Dist/src/main/resources/default/commands.yml deleted file mode 100644 index 618cd337..00000000 --- a/MMOCore-Dist/src/main/resources/default/commands.yml +++ /dev/null @@ -1,36 +0,0 @@ -player: - main: "player" - aliases: ["p", "profile"] -attributes: - main: "attributes" - aliases: ["att", "stats"] -class: - main: "class" - aliases: ["c"] -waypoints: - main: "waypoints" - aliases: ["wp"] -quests: - main: "quests" - aliases: ["q", "journal"] -skills: - main: "skills" - aliases: ["s"] -friends: - main: "friends" - aliases: ["f"] -party: - main: "party" - aliases: [] -guild: - main: "guild" - aliases: [] -withdraw: - main: "withdraw" - aliases: ["w"] -skill-trees: - main: "skilltrees" - aliase: ["st"] -deposit: - main: "deposit" - aliases: ["d"] \ No newline at end of file diff --git a/MMOCore-Dist/src/main/resources/plugin.yml b/MMOCore-Dist/src/main/resources/plugin.yml index 1fe51576..f8c5234e 100644 --- a/MMOCore-Dist/src/main/resources/plugin.yml +++ b/MMOCore-Dist/src/main/resources/plugin.yml @@ -3,24 +3,24 @@ version: ${project.version} main: net.Indyuce.mmocore.MMOCore author: Indyuce description: ${project.description} -loadbefore: [MMOItems] -depend: [MythicLib] -softdepend: [Vault,MythicMobs,PlaceholderAPI,Residence,Citizens,ProtocolLib] +loadbefore: [ MMOItems ] +depend: [ MythicLib ] +softdepend: [ Vault,MythicMobs,PlaceholderAPI,Residence,Citizens,ProtocolLib ] api-version: 1.13 commands: - mmocore: - description: Main command. - aliases: [rpg] + mmocore: + description: Main command. + aliases: [ rpg ] permissions: - mmocore.admin: - description: Access to /mmocore - default: op - mmocore.waypoints: - description: Access to /waypoints - default: op - mmocore.currency: - description: Access to /deposit and /withdraw - default: op - mmocore.class-select: - description: Access to /class - default: op \ No newline at end of file + mmocore.admin: + description: Access to /mmocore + default: op + mmocore.waypoints: + description: Access to /waypoints + default: op + mmocore.currency: + description: Access to /deposit and /withdraw + default: op + mmocore.class-select: + description: Access to /class + default: op