mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 20:59:39 +01:00
Closes gh-17. (Wow, War finally has classes) You can now delete extra loadouts. Can't shoot arrows when still standing inside spawn (to prevent arrow spam by class switchers).
This commit is contained in:
parent
9cc39281d7
commit
dc4b770aaa
@ -370,6 +370,20 @@ public class War extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
returnMessage.append(" " + loadoutName + " respawn loadout updated.");
|
returnMessage.append(" " + loadoutName + " respawn loadout updated.");
|
||||||
}
|
}
|
||||||
|
if (namedParams.containsKey("deleteloadout")) {
|
||||||
|
String loadoutName = namedParams.get("deleteloadout");
|
||||||
|
if (loadoutName.equals("default")) {
|
||||||
|
returnMessage.append(" Can't remove default loadout.");
|
||||||
|
} else {
|
||||||
|
HashMap<Integer, ItemStack> extraLoadout = warzone.getExtraLoadouts().get(loadoutName);
|
||||||
|
if (warzone.getExtraLoadouts().keySet().contains(loadoutName)) {
|
||||||
|
warzone.getExtraLoadouts().remove(loadoutName);
|
||||||
|
returnMessage.append(" " + loadoutName + " loadout removed.");
|
||||||
|
} else {
|
||||||
|
returnMessage.append(" " + loadoutName + " loadout not found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (namedParams.containsKey("reward")) {
|
if (namedParams.containsKey("reward")) {
|
||||||
this.inventoryToLoadout(player, warzone.getReward());
|
this.inventoryToLoadout(player, warzone.getReward());
|
||||||
returnMessage.append(" game end reward updated.");
|
returnMessage.append(" game end reward updated.");
|
||||||
@ -522,6 +536,20 @@ public class War extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
returnMessage.append(loadoutName + " respawn loadout updated.");
|
returnMessage.append(loadoutName + " respawn loadout updated.");
|
||||||
}
|
}
|
||||||
|
if (namedParams.containsKey("deleteloadout")) {
|
||||||
|
String loadoutName = namedParams.get("deleteloadout");
|
||||||
|
if (loadoutName.equals("default")) {
|
||||||
|
returnMessage.append(" Can't remove default loadout.");
|
||||||
|
} else {
|
||||||
|
HashMap<Integer, ItemStack> extraLoadout = this.getDefaultExtraLoadouts().get(loadoutName);
|
||||||
|
if (this.getDefaultExtraLoadouts().keySet().contains(loadoutName)) {
|
||||||
|
this.getDefaultExtraLoadouts().remove(loadoutName);
|
||||||
|
returnMessage.append(" " + loadoutName + " loadout removed.");
|
||||||
|
} else {
|
||||||
|
returnMessage.append(" " + loadoutName + " loadout not found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (namedParams.containsKey("reward")) {
|
if (namedParams.containsKey("reward")) {
|
||||||
this.inventoryToLoadout(player, this.getDefaultReward());
|
this.inventoryToLoadout(player, this.getDefaultReward());
|
||||||
returnMessage.append(" game end reward updated.");
|
returnMessage.append(" game end reward updated.");
|
||||||
|
@ -223,6 +223,12 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
event.setUseItemInHand(Result.ALLOW);
|
event.setUseItemInHand(Result.ALLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
|
||||||
|
if (zone != null && zone.getNewlyRespawned().containsKey(player.getName()) && player.getItemInHand().getType() == Material.BOW) {
|
||||||
|
event.setUseItemInHand(Result.DENY);
|
||||||
|
War.war.badMsg(player, "Can't shoot from inside the spawn.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +485,7 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
if (War.war.isLoaded() && event.isSneaking()) {
|
if (War.war.isLoaded() && event.isSneaking()) {
|
||||||
Warzone playerWarzone = Warzone.getZoneByLocation(event.getPlayer());
|
Warzone playerWarzone = Warzone.getZoneByLocation(event.getPlayer());
|
||||||
Team playerTeam = Team.getTeamByPlayerName(event.getPlayer().getName());
|
Team playerTeam = Team.getTeamByPlayerName(event.getPlayer().getName());
|
||||||
if (playerWarzone != null && playerTeam.getSpawnVolume().contains(event.getPlayer().getLocation())) {
|
if (playerWarzone != null && playerWarzone.getExtraLoadouts().keySet().size() > 0 && playerTeam.getSpawnVolume().contains(event.getPlayer().getLocation())) {
|
||||||
if (playerWarzone.getNewlyRespawned().keySet().contains(event.getPlayer().getName())) {
|
if (playerWarzone.getNewlyRespawned().keySet().contains(event.getPlayer().getName())) {
|
||||||
Integer currentIndex = playerWarzone.getNewlyRespawned().get(event.getPlayer().getName());
|
Integer currentIndex = playerWarzone.getNewlyRespawned().get(event.getPlayer().getName());
|
||||||
currentIndex = (currentIndex + 1) % (playerWarzone.getExtraLoadouts().keySet().size() + 1);
|
currentIndex = (currentIndex + 1) % (playerWarzone.getExtraLoadouts().keySet().size() + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user