diff --git a/build.gradle b/build.gradle index 11046e3..1701d97 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ allprojects { } dependencies { - compileOnly 'com.willfp:eco:3.1.0' + compileOnly 'com.willfp:eco:3.3.0' compileOnly 'org.jetbrains:annotations:19.0.0' diff --git a/eco-core/core-plugin/src/main/java/com/willfp/illusioner/IllusionerPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/illusioner/IllusionerPlugin.java index 3f4aee2..17a099d 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/illusioner/IllusionerPlugin.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/illusioner/IllusionerPlugin.java @@ -4,7 +4,7 @@ import com.willfp.eco.util.command.AbstractCommand; import com.willfp.eco.util.integrations.IntegrationLoader; import com.willfp.eco.util.plugin.AbstractEcoPlugin; import com.willfp.eco.util.protocollib.AbstractPacketAdapter; -import com.willfp.illusioner.commands.CommandIldebug; +import com.willfp.illusioner.commands.CommandIldrop; import com.willfp.illusioner.commands.CommandIlreload; import com.willfp.illusioner.config.IllusionerConfigs; import com.willfp.illusioner.illusioner.IllusionerManager; @@ -92,8 +92,8 @@ public class IllusionerPlugin extends AbstractEcoPlugin { @Override public List getCommands() { return Arrays.asList( - new CommandIldebug(this), - new CommandIlreload(this) + new CommandIlreload(this), + new CommandIldrop(this) ); } diff --git a/eco-core/core-plugin/src/main/java/com/willfp/illusioner/commands/CommandIldebug.java b/eco-core/core-plugin/src/main/java/com/willfp/illusioner/commands/CommandIldebug.java deleted file mode 100644 index c55765a..0000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/illusioner/commands/CommandIldebug.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.willfp.illusioner.commands; - -import com.willfp.eco.util.command.AbstractCommand; -import com.willfp.eco.util.plugin.AbstractEcoPlugin; -import com.willfp.illusioner.IllusionerPlugin; -import com.willfp.illusioner.illusioner.IllusionerManager; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class CommandIldebug extends AbstractCommand { - /** - * Instantiate a new executor for /ildebug. - * - * @param plugin The plugin to manage the execution for. - */ - public CommandIldebug(@NotNull final IllusionerPlugin plugin) { - super(plugin, "ildebug", "illusioner.debug", false); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - this.getPlugin().getLog().info("--------------- BEGIN DEBUG ----------------"); - if (sender instanceof Player) { - Player player = (Player) sender; - player.sendMessage("Held Item: " + player.getInventory().getItemInMainHand().toString()); - this.getPlugin().getLog().info(""); - - this.getPlugin().getLog().info("Held Item: " + player.getInventory().getItemInMainHand().toString()); - this.getPlugin().getLog().info(""); - } - - this.getPlugin().getLog().info("Options: " + IllusionerManager.OPTIONS.toString()); - - this.getPlugin().getLog().info("Running Version: " + IllusionerPlugin.getInstance().getDescription().getVersion()); - this.getPlugin().getLog().info(""); - - this.getPlugin().getLog().info("Server Information: "); - this.getPlugin().getLog().info("Players Online: " + Bukkit.getServer().getOnlinePlayers().size()); - this.getPlugin().getLog().info("Bukkit IP: " + Bukkit.getIp()); - this.getPlugin().getLog().info("Running Version: " + Bukkit.getVersion() + ", Bukkit Version: " + Bukkit.getBukkitVersion() + ", Alt Version: " + Bukkit.getServer().getVersion()); - this.getPlugin().getLog().info("Motd: " + Bukkit.getServer().getMotd()); - this.getPlugin().getLog().info("--------------- END DEBUG ----------------"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/illusioner/commands/CommandIldrop.java b/eco-core/core-plugin/src/main/java/com/willfp/illusioner/commands/CommandIldrop.java new file mode 100644 index 0000000..70344df --- /dev/null +++ b/eco-core/core-plugin/src/main/java/com/willfp/illusioner/commands/CommandIldrop.java @@ -0,0 +1,39 @@ +package com.willfp.illusioner.commands; + +import com.willfp.eco.util.command.AbstractCommand; +import com.willfp.illusioner.IllusionerPlugin; +import com.willfp.illusioner.config.IllusionerConfigs; +import com.willfp.illusioner.illusioner.IllusionerManager; +import org.bukkit.Material; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public class CommandIldrop extends AbstractCommand { + /** + * Instantiate a new executor for /ildrop. + * + * @param plugin The plugin to manage the execution for. + */ + public CommandIldrop(@NotNull final IllusionerPlugin plugin) { + super(plugin, "ildrop", "illusioner.drop", true); + } + + @Override + public void onExecute(@NotNull final CommandSender sender, + @NotNull final List args) { + Player player = (Player) sender; + ItemStack itemStack = player.getInventory().getItemInMainHand(); + if (itemStack.getType() == Material.AIR) { + player.sendMessage(this.getPlugin().getLangYml().getMessage("no-item-held")); + return; + } + + IllusionerConfigs.DROPS.getConfig().set(String.valueOf(IllusionerManager.OPTIONS.getDrops().size()), itemStack); + player.sendMessage(this.getPlugin().getLangYml().getMessage("added-drop")); + player.sendMessage(this.getPlugin().getLangYml().getMessage("reload-plugin")); + } +} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/illusioner/config/configs/Drops.java b/eco-core/core-plugin/src/main/java/com/willfp/illusioner/config/configs/Drops.java index e36bdcc..a337dbe 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/illusioner/config/configs/Drops.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/illusioner/config/configs/Drops.java @@ -1,14 +1,13 @@ package com.willfp.illusioner.config.configs; -import com.willfp.eco.util.config.BaseConfig; -import com.willfp.eco.util.plugin.AbstractEcoPlugin; +import com.willfp.eco.util.config.StaticBaseConfig; import com.willfp.illusioner.IllusionerPlugin; -public class Drops extends BaseConfig { +public class Drops extends StaticBaseConfig { /** * Instantiate drops.yml. */ public Drops() { - super("drops", false, IllusionerPlugin.getInstance()); + super("drops", IllusionerPlugin.getInstance()); } } diff --git a/eco-core/core-plugin/src/main/resources/drops.yml b/eco-core/core-plugin/src/main/resources/drops.yml index 54b0ff8..cbdb4d5 100644 --- a/eco-core/core-plugin/src/main/resources/drops.yml +++ b/eco-core/core-plugin/src/main/resources/drops.yml @@ -1,22 +1 @@ -# EXAMPLE DROP - SET YOUR OWN! -'1': - ==: org.bukkit.inventory.ItemStack - v: 2584 - type: NETHERITE_SWORD - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ok - enchants: - ARROW_DAMAGE: 1 -# Example second drop -'2': - ==: org.bukkit.inventory.ItemStack - v: 2584 - type: DIAMOND_SWORD - meta: - ==: ItemMeta - meta-type: UNSPECIFIC - display-name: ok - enchants: - ARROW_DAMAGE: 1 \ No newline at end of file +# Add drops with /ildrop diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index c144af1..cb09dc9 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -2,4 +2,7 @@ messages: prefix: "&9&lIllusioner &f» " no-permission: "&cYou don't have permission to do this!" not-player: "&cThis command must be run by a player" - reloaded: "Reloaded!" \ No newline at end of file + reloaded: "Reloaded!" + no-item-held: "&cYou aren't holding an item!" + added-drop: "Added drop to Illusioner" + reload-plugin: "Run /ilreload to reload illusioner!" \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml index f627552..ed3920c 100644 --- a/eco-core/core-plugin/src/main/resources/plugin.yml +++ b/eco-core/core-plugin/src/main/resources/plugin.yml @@ -10,9 +10,9 @@ commands: ilreload: description: Reloads config permission: illusioner.reload - ildebug: - description: Debug information - permission: illusioner.debug + ildrop: + description: Adds the item in your hand as a drop + permission: illusioner.drop permissions: illusioner.*: @@ -21,14 +21,10 @@ permissions: children: illusioner.reload: true illusioner.updateannounce: true - illusioner.ecodebug: true illusioner.updateannounce: description: Informs admins of a new update default: op illusioner.reload: description: Allows reloading the config - default: op - illusioner.ecodebug: - description: Allows the use of /ildebug to print verbose debug information to console - default: op + default: op \ No newline at end of file