Add config option per arena to toggle the protection of seekers.
Arena option "seekerProtection": - true = seekers can NOT be hurt/killed by hiders - false = seekers can be hurt/killed by hiders
This commit is contained in:
parent
04056623d4
commit
a4a7450530
@ -28,6 +28,7 @@ public class Arena implements ConfigurationSerializable {
|
||||
public int gameTime;
|
||||
public int timeUntilHidersSword;
|
||||
public int blockAnnouncerTime;
|
||||
public boolean seekerProtection;
|
||||
public ArrayList<ItemStack> disguiseBlocks;
|
||||
public LocationSerializable lobbyWarp;
|
||||
public LocationSerializable hidersWarp;
|
||||
@ -47,7 +48,7 @@ public class Arena implements ConfigurationSerializable {
|
||||
public Scoreboard scoreboard;
|
||||
|
||||
public Arena(String arenaName, LocationSerializable pos1, LocationSerializable pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart,
|
||||
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime, ArrayList<ItemStack> disguiseBlocks,
|
||||
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime, boolean seekerProtection, ArrayList<ItemStack> disguiseBlocks,
|
||||
LocationSerializable lobbyWarp, LocationSerializable hidersWarp, LocationSerializable seekersWarp, LocationSerializable spawnWarp,
|
||||
List<String> seekersWinCommands, List<String> hidersWinCommands, List<String> allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens,
|
||||
List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) {
|
||||
@ -135,13 +136,13 @@ public class Arena implements ConfigurationSerializable {
|
||||
public static Arena deserialize(Map<String, Object> map) {
|
||||
LocationSerializable loc = new LocationSerializable(Bukkit.getWorld("world"), 0, 0, 0, 0, 0);
|
||||
return new Arena((String) M.g(map, "arenaName", "UNKNOWN_NAME"), (LocationSerializable) M.g(map, "pos1", loc), (LocationSerializable) M.g(map, "pos2", loc),
|
||||
(Integer) M.g(map, "maxPlayers", 12), (Integer) M.g(map, "minPlayers", 3), (Integer) M.g(map, "amountSeekersOnStart", 1), (Integer) M.g(map,
|
||||
"timeInLobbyUntilStart", 90), (Integer) M.g(map, "waitingTimeSeeker", 20), (Integer) M.g(map, "gameTime", 200), (Integer) M.g(map,
|
||||
"timeUntilHidersSword", 30), (Integer) M.g(map, "blockAnnouncerTime", 45), (ArrayList<ItemStack>) M.g(map, "disguiseBlocks", new ArrayList<ItemStack>()), (LocationSerializable) M.g(map,
|
||||
"lobbyWarp", loc), (LocationSerializable) M.g(map, "hidersWarp", loc), (LocationSerializable) M.g(map, "seekersWarp", loc),
|
||||
(LocationSerializable) M.g(map, "spawnWarp", loc), (ArrayList<String>) M.g(map, "seekersWinCommands", new ArrayList<String>()), (ArrayList<String>) M.g(
|
||||
map, "hidersWinCommands", new ArrayList<String>()), (ArrayList<String>) M.g(map, "allowedCommands", new ArrayList<String>()), (Integer) M.g(map,
|
||||
"seekersTokenWin", 10), (Integer) M.g(map, "hidersTokenWin", 50), (Integer) M.g(map, "killTokens", 8), new ArrayList<Player>(),
|
||||
(Integer) M.g(map, "maxPlayers", 12), (Integer) M.g(map, "minPlayers", 3), (Integer) M.g(map, "amountSeekersOnStart", 1), (Integer) M.g(map, "timeInLobbyUntilStart", 90),
|
||||
(Integer) M.g(map, "waitingTimeSeeker", 20), (Integer) M.g(map, "gameTime", 200), (Integer) M.g(map, "timeUntilHidersSword", 30),
|
||||
(Integer) M.g(map, "blockAnnouncerTime", 45), (Boolean) M.g(map, "seekerProtection", false),(ArrayList<ItemStack>) M.g(map, "disguiseBlocks", new ArrayList<ItemStack>()),
|
||||
(LocationSerializable) M.g(map, "lobbyWarp", loc), (LocationSerializable) M.g(map, "hidersWarp", loc), (LocationSerializable) M.g(map, "seekersWarp", loc),
|
||||
(LocationSerializable) M.g(map, "spawnWarp", loc), (ArrayList<String>) M.g(map, "seekersWinCommands", new ArrayList<String>()),
|
||||
(ArrayList<String>) M.g(map, "hidersWinCommands", new ArrayList<String>()), (ArrayList<String>) M.g(map, "allowedCommands", new ArrayList<String>()),
|
||||
(Integer) M.g(map, "seekersTokenWin", 10), (Integer) M.g(map, "hidersTokenWin", 50), (Integer) M.g(map, "killTokens", 8), new ArrayList<Player>(),
|
||||
ArenaState.WAITING, 0, new ArrayList<Player>(), Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ public class CMDcreate extends DefaultCMD {
|
||||
} else {
|
||||
if (W.pos1.get(player) != null && W.pos2.get(player) != null) {
|
||||
if (W.pos1.get(player).getWorld().equals(W.pos2.get(player).getWorld())) {
|
||||
Arena arena = new Arena(args[1], W.pos1.get(player), W.pos2.get(player), 12, 3, 1, 50, 20, 300, 30, 45, new ArrayList<ItemStack>(), null, null, null,
|
||||
Arena arena = new Arena(args[1], W.pos1.get(player), W.pos2.get(player), 12, 3, 1, 50, 20, 300, 30, 45, false, new ArrayList<ItemStack>(), null, null, null,
|
||||
null, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), 10, 50, 8, new ArrayList<Player>(), ArenaState.WAITING,
|
||||
0, new ArrayList<Player>(), Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
W.arenas.getFile().set(args[1], arena);
|
||||
|
@ -46,7 +46,7 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
||||
} else {
|
||||
if (arena.seekers.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
} else if (arena.playersInArena.contains(player) && arena.playersInArena.contains(event.getDamager())
|
||||
} else if (arena.seekerProtection && arena.playersInArena.contains(player) && arena.playersInArena.contains(event.getDamager())
|
||||
&& !arena.seekers.contains(event.getDamager()) && !arena.seekers.contains(player)) {
|
||||
event.setCancelled(true);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user