mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-22 00:19:30 +00:00
Removed debug and added /ildrop to add drops with a command
This commit is contained in:
@@ -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'
|
||||
|
||||
|
||||
@@ -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<AbstractCommand> getCommands() {
|
||||
return Arrays.asList(
|
||||
new CommandIldebug(this),
|
||||
new CommandIlreload(this)
|
||||
new CommandIlreload(this),
|
||||
new CommandIldrop(this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String> 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 ----------------");
|
||||
}
|
||||
}
|
||||
@@ -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<String> 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"));
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
# Add drops with /ildrop
|
||||
|
||||
@@ -3,3 +3,6 @@ messages:
|
||||
no-permission: "&cYou don't have permission to do this!"
|
||||
not-player: "&cThis command must be run by a player"
|
||||
reloaded: "Reloaded!"
|
||||
no-item-held: "&cYou aren't holding an item!"
|
||||
added-drop: "Added drop to Illusioner"
|
||||
reload-plugin: "Run /ilreload to reload illusioner!"
|
||||
@@ -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,7 +21,6 @@ permissions:
|
||||
children:
|
||||
illusioner.reload: true
|
||||
illusioner.updateannounce: true
|
||||
illusioner.ecodebug: true
|
||||
|
||||
illusioner.updateannounce:
|
||||
description: Informs admins of a new update
|
||||
@@ -29,6 +28,3 @@ permissions:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user