* Added a list command.

This commit is contained in:
Steffion 2013-08-28 14:11:10 +02:00
parent 9f571aa181
commit 4d3467a259
4 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,37 @@
package nl.Steffion.BlockHunt.Commands;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.W;
import nl.Steffion.BlockHunt.Managers.ConfigC;
import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
public class CMDlist extends DefaultCMD {
@Override
public boolean exectue(Player player, Command cmd, String label,
String[] args) {
if (PlayerM.hasPerm(player, PermsC.list, true)) {
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-" + W.pluginName);
if (W.arenaList.size() >= 1) {
for (Arena arena : W.arenaList) {
MessageM.sendMessage(player, "&7Available arena(s):", false);
MessageM.sendMessage(player, "%A" + arena.arenaName, false);
}
} else {
MessageM.sendMessage(player, "&7&oNo arenas available...",
false);
MessageM.sendMessage(player,
"&7&oCreate an arena first please.", false);
}
MessageM.sendFMessage(player, ConfigC.chat_headerhigh, false,
"header-&oArenas list");
}
return true;
}
}

View File

@ -58,6 +58,14 @@ public enum CommandC {
ConfigC.help_leave,
1,
W.pluginName + " <leave|l>"),
LIST ("BlockHunt%list_",
"BlockHunt%li_",
new CMDlist(),
ConfigC.commandEnabled_list,
PermsC.list,
ConfigC.help_list,
1,
W.pluginName + " <list|li>"),
START ("BlockHunt%start_",
"BlockHunt%go_",
new CMDstart(),

View File

@ -20,6 +20,7 @@ public enum ConfigC {
commandEnabled_reload (true, W.config),
commandEnabled_join (true, W.config),
commandEnabled_leave (true, W.config),
commandEnabled_list (true, W.config),
commandEnabled_start (true, W.config),
commandEnabled_wand (true, W.config),
commandEnabled_create (true, W.config),
@ -64,6 +65,7 @@ public enum ConfigC {
help_reload ("%NReloads all configs.", W.messages),
help_join ("%NJoins a " + W.pluginName + " game.", W.messages),
help_leave ("%NLeave a " + W.pluginName + " game.", W.messages),
help_list ("%NShows a list of available arenas.", W.messages),
help_start ("%NForces an arena to start.", W.messages),
help_wand ("%NGives you the wand selection tool.", W.messages),
help_create ("%NCreates an arena from your selection.", W.messages),

View File

@ -23,6 +23,7 @@ public class PlayerM {
joinfull (main + "joinfull", PType.MODERATOR),
joinsign (main + "joinsign", PType.PLAYER),
leave (main + "leave", PType.PLAYER),
list (main + "list", PType.PLAYER),
start (main + "start", PType.MODERATOR),
create (main + "create", PType.ADMIN),
set (main + "set", PType.MODERATOR),