From 1e9dae8dbe2a20fb1c112f024d047c87ed5a6715 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Wed, 14 Jan 2015 21:43:19 -0500 Subject: [PATCH] Ajout de certains alias de commandes + ajout de la commande /broadcast --- make_jar.jardesc | 2 +- resources/plugin.yml | 13 +++++++-- .../plugin/pandacraftutils/ConfigManager.java | 18 ++++++++++++ .../pandacraftutils/PandacraftUtils.java | 7 +++++ .../broadcast/CommandBroadcast.java | 29 +++++++++++++++++++ 5 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/broadcast/CommandBroadcast.java diff --git a/make_jar.jardesc b/make_jar.jardesc index 1887591..70e1eef 100644 --- a/make_jar.jardesc +++ b/make_jar.jardesc @@ -1,6 +1,6 @@ - + diff --git a/resources/plugin.yml b/resources/plugin.yml index c527e58..b3d27ef 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -1,6 +1,6 @@ name: PandacraftUtils main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils -version: 2.9 +version: 2.10 @@ -54,10 +54,14 @@ commands: description: Gère les protections de la map Survie usage: /cubo permission: pandacraft.cubo + broadcast: + description: Envoi un message sur tout le serveur + usage: /broadcast + permission: pandacraft.broadcast - +# les permissions marqués par le commentaire "# à ajouter" sont à ajouter dans le fichier d'organisation des permissions permissions: @@ -119,6 +123,11 @@ permissions: pandacraft.afk.exempt.autoafk: description: Ne pas être auto AFK default: false + +# à ajouter ###################### + pandacraft.broadcast: + description: Utiliser la commande broadcast + default: op pandacraft.antispam.exempt: diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java index a1c7e6c..322f3b1 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/ConfigManager.java @@ -216,6 +216,24 @@ public class ConfigManager { alias.put("replaceWith", "/ptime"); alias.put("permissions", "pandacraft.grade.users"); CommandAlias_alias.add(alias); + + alias = new HashMap(); + alias.put("initialCommand", "/shop"); + alias.put("replaceWith", "/warp shop"); + alias.put("permissions", "*"); // tout le monde + CommandAlias_alias.add(alias); + + alias = new HashMap(); + alias.put("initialCommand", "/tete"); + alias.put("replaceWith", "/heads nick"); + alias.put("permissions", "*"); + CommandAlias_alias.add(alias); + + alias = new HashMap(); + alias.put("initialCommand", "/inscription"); + alias.put("replaceWith", "/mail send marcbal Inscription"); + alias.put("permissions", "pandacraft.grade.not_default"); + CommandAlias_alias.add(alias); /* Map alias = new HashMap(); alias.put("initialCommand", ""); diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java index 224764a..2fa96f0 100644 --- a/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/PandacraftUtils.java @@ -11,6 +11,7 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.cheat_protect.no_pvp.NoPvpP import net.mc_pandacraft.java.plugin.pandacraftutils.login_message.LoginLogoutManager; import net.mc_pandacraft.java.plugin.pandacraftutils.player_count_list.PacketOutServerInfoListener; import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands._command_alias.CommandAliasManager; +import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.broadcast.CommandBroadcast; import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.list.CommandList; import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.me.CommandMe; import net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.ping.CommandPing; @@ -42,6 +43,7 @@ public class PandacraftUtils extends JavaPlugin { public CommandWandSelection commandWandSelection; public CommandStaff commandStaff; public CommandCubo commandCubo; + public CommandBroadcast commandBroadcast; public CommandAliasManager commandAliasManager; public SpawnTimeManager spawnTimeManager; @@ -80,6 +82,7 @@ public class PandacraftUtils extends JavaPlugin { commandWandSelection = new CommandWandSelection(this); commandStaff = new CommandStaff(this); commandCubo = new CommandCubo(this); + commandBroadcast = new CommandBroadcast(this); commandAliasManager = new CommandAliasManager(this); spawnTimeManager = new SpawnTimeManager(this); @@ -102,6 +105,10 @@ public class PandacraftUtils extends JavaPlugin { commandPing = null; commandMe = null; commandSpeedMessage = null; + commandWandSelection = null; + commandStaff = null; + commandCubo = null; + commandBroadcast = null; commandAliasManager = null; spawnTimeManager = null; diff --git a/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/broadcast/CommandBroadcast.java b/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/broadcast/CommandBroadcast.java new file mode 100644 index 0000000..dd65f9e --- /dev/null +++ b/src/net/mc_pandacraft/java/plugin/pandacraftutils/simple_commands/broadcast/CommandBroadcast.java @@ -0,0 +1,29 @@ +package net.mc_pandacraft.java.plugin.pandacraftutils.simple_commands.broadcast; + +import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils; + +import org.apache.commons.lang.StringUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +public class CommandBroadcast implements CommandExecutor { + + private PandacraftUtils plugin; + + public CommandBroadcast(PandacraftUtils pl) { + plugin = pl; + plugin.getCommand("broadcast").setExecutor(this); + } + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { + if (args.length == 0) return false; + + plugin.getServer().broadcastMessage(ChatColor.YELLOW+"["+ChatColor.WHITE+"Pandacraft"+ChatColor.YELLOW+"] " + ChatColor.translateAlternateColorCodes('&', StringUtils.join(args, ' '))); + + return true; + } + +}