Ajout de la commande /admin

This commit is contained in:
Marc Baloup 2015-01-24 23:49:23 -05:00
parent f95a459bde
commit a4a138b9dc
5 changed files with 53 additions and 0 deletions

View File

@ -65,6 +65,10 @@ commands:
usage: /automessager [id] usage: /automessager [id]
permission: pandacraft.automessager permission: pandacraft.automessager
aliases: [am] aliases: [am]
admin:
description: Administration
usage: /admin <reload|version>
permission: pandacraft.admin
@ -141,6 +145,11 @@ permissions:
description: Utiliser la commande automessager description: Utiliser la commande automessager
default: op default: op
# à ajouter ######################
pandacraft.admin:
description: Utiliser la commande admin
default: op
pandacraft.antispam.exempt: pandacraft.antispam.exempt:
description: Ignoré par le système anti-spam description: Ignoré par le système anti-spam

View File

@ -1,6 +1,8 @@
package net.mc_pandacraft.java.plugin.pandacraftutils.commands; package net.mc_pandacraft.java.plugin.pandacraftutils.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; 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 String getCommandName() { return commandName; }
public abstract boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args);
} }

View File

@ -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;
}
}

View File

@ -41,7 +41,9 @@ public class CommandsManager {
* Initialisation des commandes * Initialisation des commandes
*/ */
add(new Command_Selection()); add(new Command_Selection());
add(new CommandAdmin());
add(new CommandAfk()); add(new CommandAfk());
add(new CommandAutomessager());
add(new CommandBroadcast()); add(new CommandBroadcast());
add(new CommandCubo()); add(new CommandCubo());
add(new CommandList()); add(new CommandList());

View File

@ -66,6 +66,7 @@ public class AutoMessagesManager extends BukkitRunnable {
} }
} while(!messages.get(id).hasPlayerPermission(op.getPlayer())); } while(!messages.get(id).hasPlayerPermission(op.getPlayer()));
// affichage du message
if (atLeastOnePermitted) { if (atLeastOnePermitted) {
op.setAutomessage_last_message_id(id); op.setAutomessage_last_message_id(id);
op.updateAutomessage_last_message_time(); op.updateAutomessage_last_message_time();