plugin.yml with commands. /setwarhub and /warhub commands separated. Should now be able to delete everything from a lobby.

This commit is contained in:
taoneill 2011-01-16 13:34:18 -05:00
parent f099539e39
commit 3b137a76b6
3 changed files with 196 additions and 17 deletions

View File

@ -57,12 +57,15 @@ public class WarPlayerListener extends PlayerListener {
// Handle both /war <command> and /<war command>. I.e. "/war zone temple" == "/zone temple"
String[] arguments = null;
if(command.equals("/war")) {
if(command.equals("/war") && split.length > 0) {
command = split[1];
arguments = new String[split.length - 2];
for(int i = 1; i <= arguments.length; i++) {
arguments[i-1] = split[i];
}
} else if (command.equals("/war") ) {
player.sendMessage(war.str("War is on. Plese pick your battle." +
"Use /warhub, /zones and /zone."));
} else {
command = command.substring(1, command.length());
arguments = new String[split.length - 1];
@ -127,11 +130,12 @@ public class WarPlayerListener extends PlayerListener {
// /join <teamname>
else if(command.equals("join")) {
if(arguments.length < 1 || !war.inAnyWarzone(player.getLocation())
if(arguments.length < 1 || (!war.inAnyWarzone(player.getLocation()) && !war.inAnyWarzoneLobby(player.getLocation()))
|| (arguments.length > 0 && TeamMaterials.teamMaterialFromString(arguments[0]) == null)) {
player.sendMessage(war.str("Usage: /join <diamond/iron/gold/d/i/g>." +
" Teams are warzone specific." +
" You must be inside a warzone to join a team."));
" You must be inside a warzone or zone lobby to join a team." +
" Use as an alternative to walking through the team gate."));
} else {
// drop from old team if any
Team previousTeam = war.getPlayerTeam(player.getName());
@ -145,6 +149,12 @@ public class WarPlayerListener extends PlayerListener {
// join new team
String name = TeamMaterials.teamMaterialToString(TeamMaterials.teamMaterialFromString(arguments[0]));
Warzone warzone = war.warzone(player.getLocation());
ZoneLobby lobby = war.lobby(player.getLocation());
if(warzone == null && lobby != null) {
warzone = lobby.getZone();
} else {
lobby = warzone.getLobby();
}
List<Team> teams = warzone.getTeams();
boolean foundTeam = false;
for(Team team : teams) {
@ -188,7 +198,6 @@ public class WarPlayerListener extends PlayerListener {
event.setCancelled(true);
}
// /team <msg>
else if(command.equals("team")) {
if(!war.inAnyWarzone(player.getLocation())) {
@ -206,6 +215,22 @@ public class WarPlayerListener extends PlayerListener {
event.setCancelled(true);
}
// /warhub
else if(command.equals("warhub")) {
if(war.getWarHub() == null) {
player.sendMessage("No warhub on this War server. Try /zones and /zone.");
} else {
Team playerTeam = war.getPlayerTeam(player.getName());
if(playerTeam != null) { // was in zone
playerTeam.removePlayer(player.getName());
}
player.teleportTo(war.getWarHub().getLocation());
}
event.setCancelled(true);
}
if(war.isZoneMaker(player.getName())) {
// Mod commands : /nextbattle
@ -228,8 +253,8 @@ public class WarPlayerListener extends PlayerListener {
// Warzone maker commands: /setzone, /savezone, /setteam, /setmonument, /resetzone
// /warhub
else if(command.equals("warhub")) {
// /setwarhub
else if(command.equals("setwarhub")) {
WarHub hub = war.getWarHub();
if(hub != null) {
// reset existing hub
@ -450,14 +475,20 @@ public class WarPlayerListener extends PlayerListener {
event.setCancelled(true);
}
// /deletewarzone
// /deletezone
else if(command.equals("deletezone") || command.equals("deletewarzone")) {
if(!war.inAnyWarzone(player.getLocation())) {
if(!war.inAnyWarzone(player.getLocation()) && !war.inAnyWarzoneLobby(player.getLocation())) {
player.sendMessage(war.str("Usage: /deletewarzone." +
" Deletes the warzone. " +
"Must be in the warzone (try /warzones and /warzone). "));
} else {
Warzone warzone = war.warzone(player.getLocation());
ZoneLobby lobby = war.lobby(player.getLocation());
if(warzone == null && lobby != null) {
warzone = lobby.getZone();
} else {
lobby = warzone.getLobby();
}
for(Team t : warzone.getTeams()) {
t.getVolume().resetBlocks();
}
@ -513,13 +544,20 @@ public class WarPlayerListener extends PlayerListener {
// /deleteteam <teamname>
else if(command.equals("deleteteam")) {
if(arguments.length < 1 || !war.inAnyWarzone(player.getLocation())) {
if(arguments.length < 1 || (!war.inAnyWarzone(player.getLocation())
&& !war.inAnyWarzoneLobby(player.getLocation()))) {
player.sendMessage(war.str("Usage: /deleteteam <team-name>." +
" Deletes the team and its spawn. " +
"Must be in a warzone (try /zones and /zone). "));
"Must be in a warzone or lobby (try /zones and /zone). "));
} else {
String name = TeamMaterials.teamMaterialToString(TeamMaterials.teamMaterialFromString(arguments[0]));
Warzone warzone = war.warzone(player.getLocation());
ZoneLobby lobby = war.lobby(player.getLocation());
if(warzone == null && lobby != null) {
warzone = lobby.getZone();
} else {
lobby = warzone.getLobby();
}
List<Team> teams = warzone.getTeams();
Team team = null;
for(Team t : teams) {
@ -570,13 +608,20 @@ public class WarPlayerListener extends PlayerListener {
// /deletemonument <name>
else if(command.equals("deletemonument")) {
if(arguments.length < 1 || !war.inAnyWarzone(player.getLocation())) {
player.sendMessage(war.str("Usage: /deletemonument <team-name>." +
if(arguments.length < 1 || (!war.inAnyWarzone(player.getLocation())
&& !war.inAnyWarzoneLobby(player.getLocation()))) {
player.sendMessage(war.str("Usage: /deletemonument <name>." +
" Deletes the monument. " +
"Must be in a warzone (try /warzones and /warzone). "));
"Must be in a warzone or lobby (try /warzones and /warzone). "));
} else {
String name = arguments[0];
Warzone warzone = war.warzone(player.getLocation());
ZoneLobby lobby = war.lobby(player.getLocation());
if(warzone == null && lobby != null) {
warzone = lobby.getZone();
} else {
lobby = warzone.getLobby();
}
Monument monument = warzone.getMonument(name);
if(monument != null) {
monument.getVolume().resetBlocks();
@ -770,10 +815,16 @@ public class WarPlayerListener extends PlayerListener {
private String getAllTeamsMsg(Player player){
String teamsMessage = "Teams: ";
if(war.warzone(player.getLocation()).getTeams().isEmpty()){
Warzone warzone = war.warzone(player.getLocation());
ZoneLobby lobby = war.lobby(player.getLocation());
if(warzone == null && lobby != null) {
warzone = lobby.getZone();
} else {
lobby = warzone.getLobby();
}
if(warzone.getTeams().isEmpty()){
teamsMessage += "none.";
}
Warzone warzone = war.warzone(player.getLocation());
for(Team team :warzone.getTeams()) {
teamsMessage += team.getName() + " (" + team.getPoints() + " points, "+ team.getRemainingTickets() + "/" + warzone.getLifePool() + " lives left. ";
for(Player member : team.getPlayers()) {

View File

@ -1,3 +1,67 @@
name: War
main: bukkit.tommytony.war.War
version: 0.3
version: 0.3
commands:
war:
description: Prompts you to use /warhub, /zones and /zone. Can also be used as a prefix for all commands as a fallback if they are taken.
usage: /war, /war setzone ziggy northwest, /war warhub, /war zone ziggy, etc.
warzones:
description: Lists the warzones on the server. Each warzone is an independent TDM arena.
usage: /warzones
zones:
description: Shortcut for /warzones.
usage: /zones
warzone:
description: Teleports you to the specified warzone's lobby.
usage: /warzone ziggy
zone:
description: Shortcut for /warzone.
usage: /zone ziggy
warhub:
description: Teleports you to the warhub, if it exists. The warhub offers portals to reach each warzone on the server.
usage: /warhub
teams:
description: Lists the teams in the warzone. Must be standing in zone or in its lobby.
usage: /teams
join:
description: Use to change teams. Must be in zone. If in lobby, use to join a team as an alternative to walking in the team gate.
usage: /join <diamond/iron/gold/d/i/g>
leave:
description: Use to leave a battle or a zone. Teleports you back to the zone lobby. Must be in a team already and inside the zone.
usage: /leave
team:
description: Team chat.
usage: /team <Leeeroooy!!!>
nextbattle:
description: Zone makers only. Zone blocks are restored. Teams are respawned. Just as if a team's life pool had been exhausted.
usage: /nextbattle
setzone:
description: Zone makers only. Use to create and adjust the warzone outline. A zone area is defined by its Northwest and Southeast corners, up to the sky and down to adminium. When the second corner is set down correctly, the zone blocks are saved.
usage: /setzone <northwest/southeast/nw/se>, e.g. first: /setzone zig se, then: /setzone zig northwest
savezone:
description: Zone makers only. Use to persist any aesthetic or practical changes made to the zone after the last save. Puts down a default lobby if there are none already. Must be in warzone.
usage: /savezone
setzonelobby:
description: Zone makers only. Creates or changes the position of the warzone lobby.
usage: /setzonelobby <north/east/south/west/n/e/s/w>
setteam:
description: Zone makers only. Creates or moves a team spawn. The lobby is updated to reflect any new team. The only available teams are diamond, iron and gold. Must be inside zone.
usage: /setteam <diamond/iron/gold/d/i/g>
setmonument:
description: Zone makers only. Creates or moves a monument.
usage: /setmonument <monument-name>
resetzone:
description: Zone makers only. Reloads zone blocks from disk. Optionally specify a new team life pool value. Sends everyone back to the warzone lobby. Must be in zone or lobby.
usage: /resetzone
deletezone:
description: Zone makers only. Deletes the zone, resets all blocks. Must be in zone or lobby.
usage: /deletezone
deleteteam:
description: Zone makers only. Deletes the team. Team must exist.
usage: /deleteteam <d/i/g>
deletemonument:
description: Zone makers only. Deletes the monument.
usage: /deletemonument
setwarhub:
description: Zone makers only. Create or moves a West-facing wall of portals. One portal per warzone. Warzones get a portal back to the warhub.
usage: /setwarhub

View File

@ -1,3 +1,67 @@
name: War
main: bukkit.tommytony.war.War
version: 0.3
version: 0.3
commands:
war:
description: Prompts you to use /warhub, /zones and /zone. Can also be used as a prefix for all commands as a fallback if they are taken.
usage: /war, /war setzone ziggy northwest, /war warhub, /war zone ziggy, etc.
warzones:
description: Lists the warzones on the server. Each warzone is an independent TDM arena.
usage: /warzones
zones:
description: Shortcut for /warzones.
usage: /zones
warzone:
description: Teleports you to the specified warzone's lobby.
usage: /warzone ziggy
zone:
description: Shortcut for /warzone.
usage: /zone ziggy
warhub:
description: Teleports you to the warhub, if it exists. The warhub offers portals to reach each warzone on the server.
usage: /warhub
teams:
description: Lists the teams in the warzone. Must be standing in zone or in its lobby.
usage: /teams
join:
description: Use to change teams. Must be in zone. If in lobby, use to join a team as an alternative to walking in the team gate.
usage: /join <diamond/iron/gold/d/i/g>
leave:
description: Use to leave a battle or a zone. Teleports you back to the zone lobby. Must be in a team already and inside the zone.
usage: /leave
team:
description: Team chat.
usage: /team <Leeeroooy!!!>
nextbattle:
description: Zone makers only. Zone blocks are restored. Teams are respawned. Just as if a team's life pool had been exhausted.
usage: /nextbattle
setzone:
description: Zone makers only. Use to create and adjust the warzone outline. A zone area is defined by its Northwest and Southeast corners, up to the sky and down to adminium. When the second corner is set down correctly, the zone blocks are saved.
usage: /setzone <northwest/southeast/nw/se>, e.g. first: /setzone zig se, then: /setzone zig northwest
savezone:
description: Zone makers only. Use to persist any aesthetic or practical changes made to the zone after the last save. Puts down a default lobby if there are none already. Must be in warzone.
usage: /savezone
setzonelobby:
description: Zone makers only. Creates or changes the position of the warzone lobby.
usage: /setzonelobby <north/east/south/west/n/e/s/w>
setteam:
description: Zone makers only. Creates or moves a team spawn. The lobby is updated to reflect any new team. The only available teams are diamond, iron and gold. Must be inside zone.
usage: /setteam <diamond/iron/gold/d/i/g>
setmonument:
description: Zone makers only. Creates or moves a monument.
usage: /setmonument <monument-name>
resetzone:
description: Zone makers only. Reloads zone blocks from disk. Optionally specify a new team life pool value. Sends everyone back to the warzone lobby. Must be in zone or lobby.
usage: /resetzone
deletezone:
description: Zone makers only. Deletes the zone, resets all blocks. Must be in zone or lobby.
usage: /deletezone
deleteteam:
description: Zone makers only. Deletes the team. Team must exist.
usage: /deleteteam <d/i/g>
deletemonument:
description: Zone makers only. Deletes the monument.
usage: /deletemonument
setwarhub:
description: Zone makers only. Create or moves a West-facing wall of portals. One portal per warzone. Warzones get a portal back to the warhub.
usage: /setwarhub