Add /ma ready
This commit adds a new command, /ma ready (/ma rdy for short), as an alternative to the iron block for readying up after picking a class. Note that this conflicts with the shorthand for /ma notready, which no longer triggers on the word "ready", but only on "notready".
This commit is contained in:
@@ -64,6 +64,7 @@ public enum Msg {
|
|||||||
LOBBY_CLASS_PRICE("This class costs &c%&r (paid on arena start)."),
|
LOBBY_CLASS_PRICE("This class costs &c%&r (paid on arena start)."),
|
||||||
LOBBY_CLASS_TOO_EXPENSIVE("You can't afford that class (&c%&r)"),
|
LOBBY_CLASS_TOO_EXPENSIVE("You can't afford that class (&c%&r)"),
|
||||||
LOBBY_NO_SUCH_CLASS("There is no class named &c%&r."),
|
LOBBY_NO_SUCH_CLASS("There is no class named &c%&r."),
|
||||||
|
NOT_IN_LOBBY("You are not in the lobby"),
|
||||||
WARP_TO_ARENA("Warping to the arena not allowed!"),
|
WARP_TO_ARENA("Warping to the arena not allowed!"),
|
||||||
WARP_FROM_ARENA("Warping from the arena not allowed!"),
|
WARP_FROM_ARENA("Warping from the arena not allowed!"),
|
||||||
WAVE_DEFAULT("Wave &b#%&r!"),
|
WAVE_DEFAULT("Wave &b#%&r!"),
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.garbagemule.MobArena.commands.user.NotReadyCommand;
|
|||||||
import com.garbagemule.MobArena.commands.user.PickClassCommand;
|
import com.garbagemule.MobArena.commands.user.PickClassCommand;
|
||||||
import com.garbagemule.MobArena.commands.user.PlayerListCommand;
|
import com.garbagemule.MobArena.commands.user.PlayerListCommand;
|
||||||
import com.garbagemule.MobArena.commands.user.SpecCommand;
|
import com.garbagemule.MobArena.commands.user.SpecCommand;
|
||||||
|
import com.garbagemule.MobArena.commands.user.ReadyCommand;
|
||||||
import com.garbagemule.MobArena.framework.ArenaMaster;
|
import com.garbagemule.MobArena.framework.ArenaMaster;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@@ -252,6 +253,7 @@ public class CommandHandler implements CommandExecutor
|
|||||||
register(PlayerListCommand.class);
|
register(PlayerListCommand.class);
|
||||||
register(NotReadyCommand.class);
|
register(NotReadyCommand.class);
|
||||||
register(PickClassCommand.class);
|
register(PickClassCommand.class);
|
||||||
|
register(ReadyCommand.class);
|
||||||
|
|
||||||
// mobarena.admin
|
// mobarena.admin
|
||||||
register(EnableCommand.class);
|
register(EnableCommand.class);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
@CommandInfo(
|
@CommandInfo(
|
||||||
name = "notready",
|
name = "notready",
|
||||||
pattern = "notr.*|ready",
|
pattern = "notr.*",
|
||||||
usage = "/ma notready (<arena>)",
|
usage = "/ma notready (<arena>)",
|
||||||
desc = "see which players aren't ready",
|
desc = "see which players aren't ready",
|
||||||
permission = "mobarena.use.notready"
|
permission = "mobarena.use.notready"
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.garbagemule.MobArena.commands.user;
|
||||||
|
|
||||||
|
import com.garbagemule.MobArena.Msg;
|
||||||
|
import com.garbagemule.MobArena.commands.Command;
|
||||||
|
import com.garbagemule.MobArena.commands.CommandInfo;
|
||||||
|
import com.garbagemule.MobArena.commands.Commands;
|
||||||
|
import com.garbagemule.MobArena.framework.Arena;
|
||||||
|
import com.garbagemule.MobArena.framework.ArenaMaster;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@CommandInfo(
|
||||||
|
name = "join",
|
||||||
|
pattern = "ready|rdy",
|
||||||
|
usage = "/ma ready",
|
||||||
|
desc = "ready to start the battle",
|
||||||
|
permission = "mobarena.use.ready"
|
||||||
|
)
|
||||||
|
public class ReadyCommand implements Command {
|
||||||
|
@Override
|
||||||
|
public boolean execute(ArenaMaster am, CommandSender sender, String... args) {
|
||||||
|
if (!Commands.isPlayer(sender)) {
|
||||||
|
am.getGlobalMessenger().tell(sender, Msg.MISC_NOT_FROM_CONSOLE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = Commands.unwrap(sender);
|
||||||
|
|
||||||
|
Arena arena = am.getArenaWithPlayer(p);
|
||||||
|
if (arena == null) {
|
||||||
|
am.getGlobalMessenger().tell(p, Msg.NOT_IN_LOBBY);
|
||||||
|
} else if (!arena.inLobby(p)) {
|
||||||
|
arena.getMessenger().tell(p, Msg.NOT_IN_LOBBY);
|
||||||
|
} else if (arena.getArenaPlayer(p).getArenaClass() != null) {
|
||||||
|
arena.getMessenger().tell(p, Msg.LOBBY_PLAYER_READY);
|
||||||
|
arena.playerReady(p);
|
||||||
|
} else {
|
||||||
|
arena.getMessenger().tell(p, Msg.LOBBY_PICK_CLASS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user