diff --git a/resources/plugin.yml b/resources/plugin.yml index d17285a..0eb82db 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -65,6 +65,10 @@ commands: usage: /automessager [id] permission: pandacraft.automessager aliases: [am] + admin: + description: Administration + usage: /admin + permission: pandacraft.admin @@ -140,6 +144,11 @@ permissions: pandacraft.automessager: description: Utiliser la commande automessager default: op + +# à ajouter ###################### + pandacraft.admin: + description: Utiliser la commande admin + default: op pandacraft.antispam.exempt: diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/AbstractCommandExecutor.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/AbstractCommandExecutor.java index 2b10aa3..b317bce 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/AbstractCommandExecutor.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/AbstractCommandExecutor.java @@ -1,6 +1,8 @@ package net.mc_pandacraft.java.plugin.pandacraftutils.commands; +import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; @@ -27,5 +29,8 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; public String getCommandName() { return commandName; } + public abstract boolean onCommand(CommandSender sender, Command cmd, String label, + String[] args); + } diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandAdmin.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandAdmin.java new file mode 100644 index 0000000..2a17e79 --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandAdmin.java @@ -0,0 +1,36 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.commands; + +import net.mc_pandacraft.java.plugin.pandacraftutils.ConfigManager; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +public class CommandAdmin extends AbstractCommandExecutor { + + public CommandAdmin() { + super("admin"); + } + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String label, + String[] args) { + if (args.length == 0) return false; + + + if (args[0].equalsIgnoreCase("reload")) { + ConfigManager.reloadConfig(); + sender.sendMessage(ChatColor.GREEN+"La configuration de PandacraftUtils viens d'être rechargée"); + return true; + } + if (args[0].equalsIgnoreCase("version")) { + sender.sendMessage(ChatColor.GREEN+plugin.getName()+" v"+plugin.getDescription().getVersion()); + return true; + } + + + return false; + } + + +} diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandsManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandsManager.java index 3364174..2404864 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandsManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/commands/CommandsManager.java @@ -41,7 +41,9 @@ public class CommandsManager { * Initialisation des commandes */ add(new Command_Selection()); + add(new CommandAdmin()); add(new CommandAfk()); + add(new CommandAutomessager()); add(new CommandBroadcast()); add(new CommandCubo()); add(new CommandList()); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/AutoMessagesManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/AutoMessagesManager.java index 7496b39..29968c6 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/AutoMessagesManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/modules/AutoMessagesManager.java @@ -66,6 +66,7 @@ public class AutoMessagesManager extends BukkitRunnable { } } while(!messages.get(id).hasPlayerPermission(op.getPlayer())); + // affichage du message if (atLeastOnePermitted) { op.setAutomessage_last_message_id(id); op.updateAutomessage_last_message_time();