mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +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.");
|
||||
}
|
||||
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")) {
|
||||
this.inventoryToLoadout(player, warzone.getReward());
|
||||
returnMessage.append(" game end reward updated.");
|
||||
@ -521,6 +535,20 @@ public class War extends JavaPlugin {
|
||||
this.inventoryToLoadout(player, extraLoadout);
|
||||
}
|
||||
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")) {
|
||||
this.inventoryToLoadout(player, this.getDefaultReward());
|
||||
|
@ -222,6 +222,12 @@ public class WarPlayerListener extends PlayerListener {
|
||||
setter.placeCorner2(event.getClickedBlock());
|
||||
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()) {
|
||||
Warzone playerWarzone = Warzone.getZoneByLocation(event.getPlayer());
|
||||
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())) {
|
||||
Integer currentIndex = playerWarzone.getNewlyRespawned().get(event.getPlayer().getName());
|
||||
currentIndex = (currentIndex + 1) % (playerWarzone.getExtraLoadouts().keySet().size() + 1);
|
||||
|
Loading…
Reference in New Issue
Block a user