Ajout de la commande /admin
This commit is contained in:
parent
f95a459bde
commit
a4a138b9dc
@ -65,6 +65,10 @@ commands:
|
||||
usage: /automessager [id]
|
||||
permission: pandacraft.automessager
|
||||
aliases: [am]
|
||||
admin:
|
||||
description: Administration
|
||||
usage: /admin <reload|version>
|
||||
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:
|
||||
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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());
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user