raid purges self on completion, polishes

This commit is contained in:
Aubri Seebauer committed 2023-04-20 20:45:38 -04:00
1 parent 40061cf40a
commit 6586d92046
7 files changed
+74 -84

No files matched your search

@@ -100,7 +100,7 @@ public class Raid {
* @param raidTicks * @param raidTicks
*/ */
public Raid(final War war, final Town raidedTown, final Town gatherTown, public Raid(final War war, final Town raidedTown, final Town gatherTown,
final boolean side1AreRaiders, final int raidTicks, Player owner) { final boolean side1AreRaiders, final int raidTicks, OfflinePlayer owner) {
this.bukkitId = new int[1]; this.bukkitId = new int[1];
this.war = war; this.war = war;
@@ -129,7 +129,7 @@ public class Raid {
* @param activeRaiders * @param activeRaiders
* @param phase * @param phase
*/ */
public Raid(final War war, final Town raidedTown, final Town gatherTown, final boolean side1AreRaiders, final int raidTicks, ArrayList<String> activeRaiders, RaidPhase phase, Player owner) { public Raid(final War war, final Town raidedTown, final Town gatherTown, final boolean side1AreRaiders, final int raidTicks, ArrayList<String> activeRaiders, RaidPhase phase, OfflinePlayer owner) {
this(war, raidedTown, gatherTown, side1AreRaiders, raidTicks, owner); this(war, raidedTown, gatherTown, side1AreRaiders, raidTicks, owner);
this.activeRaiders = activeRaiders; this.activeRaiders = activeRaiders;
this.setRaidPhase(phase); this.setRaidPhase(phase);
@@ -145,7 +145,7 @@ public class Raid {
* @param side1AreRaiders * @param side1AreRaiders
*/ */
public Raid(final War war, final Town raidedTown, final Town gatherTown, public Raid(final War war, final Town raidedTown, final Town gatherTown,
final boolean side1AreRaiders, Player owner) { final boolean side1AreRaiders, OfflinePlayer owner) {
this.bukkitId = new int[1]; this.bukkitId = new int[1];
this.activeRaiders = activeRaiders == null ? new ArrayList<>() : activeRaiders; this.activeRaiders = activeRaiders == null ? new ArrayList<>() : activeRaiders;
this.war = war; this.war = war;
@@ -191,9 +191,9 @@ public class Raid {
//set the last raided time to now //set the last raided time to now
raidedTown.addMetaData(new LongDataField("lastRaided", (System.currentTimeMillis() / 1000))); raidedTown.addMetaData(new LongDataField("lastRaided", (System.currentTimeMillis() / 1000)));
if(war.getSide1Players().contains(owner.getName())) { if(war.getSide1Players().contains(owner.getName())) {
war.setLastRaidTimeSide1((System.currentTimeMillis() / 1000)); war.setLastRaidTimeSide1((int) (System.currentTimeMillis() / 1000));
} else if(war.getSide2Players().contains(owner.getName())) { } else if(war.getSide2Players().contains(owner.getName())) {
war.setLastRaidTimeSide2((System.currentTimeMillis() / 1000)); war.setLastRaidTimeSide2((int) (System.currentTimeMillis() / 1000));
} else { } else {
} }
@@ -273,10 +273,12 @@ public class Raid {
Main.warLogger.log(String.format("A townblock has been looted for $%.2f", lb.value)); Main.warLogger.log(String.format("A townblock has been looted for $%.2f", lb.value));
//Broadcast to the whole raid //Broadcast to the whole raid
for (String s : activeRaiders) { for (String s : activeRaiders) {
Bukkit.getPlayer(s).sendMessage(Helper.Chatlabel() + String.format("A townblock has been looted for $%.2f and +10 points. (Added to pool)", lb.value)); Player pl = Bukkit.getPlayer(s);
if(pl != null) pl.sendMessage(Helper.Chatlabel() + String.format("A townblock has been looted for $%.2f and +10 points. (Added to pool)", lb.value));
} }
for (String s : defenderPlayers) { for (String s : defenderPlayers) {
Bukkit.getPlayer(s).sendMessage(Helper.Chatlabel() + String.format("A townblock has been looted for $%.2f and +10 points. (Added to pool)", lb.value)); Player pl = Bukkit.getPlayer(s);
if(pl != null) pl.sendMessage(Helper.Chatlabel() + String.format("A townblock has been looted for $%.2f and +10 points. (Added to pool)", lb.value));
} }
this.save(); this.save();
@@ -285,10 +287,12 @@ public class Raid {
//if not make a new property for it //if not make a new property for it
this.addLootedChunk(wc); this.addLootedChunk(wc);
for (String s : activeRaiders) { for (String s : activeRaiders) {
Bukkit.getPlayer(s).sendMessage(Helper.Chatlabel() + "Raiders have started looting a town block!"); Player pl = Bukkit.getPlayer(s);
if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Raiders have started looting a town block!");
} }
for (String s : defenderPlayers) { for (String s : defenderPlayers) {
Bukkit.getPlayer(s).sendMessage(Helper.Chatlabel() + "Raiders have started looting a town block!"); Player pl = Bukkit.getPlayer(s);
if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Raiders have started looting a town block!");
} }
} }
@@ -335,16 +339,12 @@ public class Raid {
//award negative score //award negative score
this.subtractPointsFromRaidScore(40); this.subtractPointsFromRaidScore(40);
for (final String playerName : this.getActiveRaiders()) { for (final String playerName : this.getActiveRaiders()) {
try { Player pl = Bukkit.getPlayer(playerName);
Bukkit.getPlayer(playerName).sendMessage(String.valueOf(Helper.Chatlabel()) + "Raider killed! -40 Raid Score"); if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Raider killed! -40 Raid Score");
} catch (NullPointerException ex3) {
}
} }
for (final String playerName : this.getDefenderPlayers()) { for (final String playerName : this.getDefenderPlayers()) {
try { Player pl = Bukkit.getPlayer(playerName);
Bukkit.getPlayer(playerName).sendMessage(String.valueOf(Helper.Chatlabel()) + "Raider killed! -40 Raid Score"); if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Raider killed! -40 Raid Score");
} catch (NullPointerException ex4) {
}
} }
//tp to gather town spawn //tp to gather town spawn
@@ -365,16 +365,12 @@ public class Raid {
public void defenderKilledInCombat(PlayerDeathEvent event) { public void defenderKilledInCombat(PlayerDeathEvent event) {
this.addPointsToRaidScore(20); this.addPointsToRaidScore(20);
for (final String playerName : this.getActiveRaiders()) { for (final String playerName : this.getActiveRaiders()) {
try { Player pl = Bukkit.getPlayer(playerName);
Bukkit.getPlayer(playerName).sendMessage(String.valueOf(Helper.Chatlabel()) + "Defender killed! +20 Raid Score"); if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Defender killed! +20 Raid Score");
} catch (NullPointerException ex5) {
}
} }
for (final String playerName : this.getDefenderPlayers()) { for (final String playerName : this.getDefenderPlayers()) {
try { Player pl = Bukkit.getPlayer(playerName);
Bukkit.getPlayer(playerName).sendMessage(String.valueOf(Helper.Chatlabel()) + "Defender killed! +20 Raid Score"); if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Defender killed! +20 Raid Score");
} catch (NullPointerException ex6) {
}
} }
//tp to raid town spawn //tp to raid town spawn
@@ -392,16 +388,12 @@ public class Raid {
//award negative score //award negative score
for (final String playerName : this.getActiveRaiders()) { for (final String playerName : this.getActiveRaiders()) {
try { Player pl = Bukkit.getPlayer(playerName);
Bukkit.getPlayer(playerName).sendMessage(String.valueOf(Helper.Chatlabel()) + "Raider killed before combat, no points awarded and death treated normally."); if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Raider killed before combat, no points awarded and death treated normally.");
} catch (NullPointerException ex3) {
}
} }
for (final String playerName : this.getDefenderPlayers()) { for (final String playerName : this.getDefenderPlayers()) {
try { Player pl = Bukkit.getPlayer(playerName);
Bukkit.getPlayer(playerName).sendMessage(String.valueOf(Helper.Chatlabel()) + "Raider killed before combat, no points awarded and death treated normally."); if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Raider killed before combat, no points awarded and death treated normally.");
} catch (NullPointerException ex4) {
}
} }
//tp to gather town spawn //tp to gather town spawn
@@ -416,6 +408,7 @@ public class Raid {
} }
//teleport the killer back to the raided towns spawn //teleport the killer back to the raided towns spawn
if(killed.getKiller() != null) {
if (this.getDefenders().contains(killed.getKiller().getName())) { if (this.getDefenders().contains(killed.getKiller().getName())) {
try { try {
killed.getKiller().teleport(this.getRaidedTown().getSpawn()); killed.getKiller().teleport(this.getRaidedTown().getSpawn());
@@ -425,22 +418,19 @@ public class Raid {
} }
} }
} }
}
/** /**
* Defender killed out of combat * Defender killed out of combat
*/ */
public void defenderKilledOutofCombat(PlayerDeathEvent event) { public void defenderKilledOutofCombat(PlayerDeathEvent event) {
for (final String playerName : this.getActiveRaiders()) { for (final String playerName : this.getActiveRaiders()) {
try { Player pl = Bukkit.getPlayer(playerName);
Bukkit.getPlayer(playerName).sendMessage(String.valueOf(Helper.Chatlabel()) + "Defender killed before combat, no points awarded and death treated normally."); if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Defender killed before combat, no points awarded and death treated normally.");
} catch (NullPointerException ex5) {
}
} }
for (final String playerName : this.getDefenderPlayers()) { for (final String playerName : this.getDefenderPlayers()) {
try { Player pl = Bukkit.getPlayer(playerName);
Bukkit.getPlayer(playerName).sendMessage(String.valueOf(Helper.Chatlabel()) + "Defender killed before combat, no points awarded and death treated normally."); if(pl != null) pl.sendMessage(String.valueOf(Helper.Chatlabel()) + "Defender killed before combat, no points awarded and death treated normally.");
} catch (NullPointerException ex6) {
}
} }
//tp to raid town spawn //tp to raid town spawn
@@ -451,7 +441,7 @@ public class Raid {
} }
//teleport the killer back to the gather towns spawn //teleport the killer back to the gather towns spawn
if (killed.getKiller() instanceof Player) { if (killed.getKiller() != null) {
if (this.getActiveRaiders().contains(killed.getKiller().getName())) { if (this.getActiveRaiders().contains(killed.getKiller().getName())) {
try { try {
killed.getKiller().teleport(this.getGatherTown().getSpawn()); killed.getKiller().teleport(this.getGatherTown().getSpawn());
@@ -824,6 +814,7 @@ public class Raid {
for (String playerName : getActiveRaiders()) { for (String playerName : getActiveRaiders()) {
try { try {
Player p = Bukkit.getPlayer(playerName); Player p = Bukkit.getPlayer(playerName);
if(p != null) {
ArrayList<WorldCoord> cluster = Helper.getCluster(Raid.this.getGatherTown().getHomeBlock().getWorldCoord()); ArrayList<WorldCoord> cluster = Helper.getCluster(Raid.this.getGatherTown().getHomeBlock().getWorldCoord());
if (!cluster.contains(WorldCoord.parseWorldCoord(p))) { if (!cluster.contains(WorldCoord.parseWorldCoord(p))) {
if (p.equals(owner)) { if (p.equals(owner)) {
@@ -836,11 +827,8 @@ public class Raid {
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "To rejoin, do /raid join [war] [town]"); p.sendMessage(String.valueOf(Helper.Chatlabel()) + "To rejoin, do /raid join [war] [town]");
} }
} }
} catch (NullPointerException e) { }
e.printStackTrace(); } catch (NullPointerException | TownyException e) {
} catch (NotRegisteredException e) {
e.printStackTrace();
} catch (TownyException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@@ -888,11 +876,14 @@ public class Raid {
+ Raid.this.getRaidedTown().getName() + ":"); + Raid.this.getRaidedTown().getName() + ":");
Bukkit.broadcastMessage( Bukkit.broadcastMessage(
"Raid Score - " + String.valueOf(Raid.this.raidScore)); "Raid Score - " + String.valueOf(Raid.this.raidScore));
Bukkit.broadcastMessage(
"Chunks Looted - " + String.valueOf(Raid.this.lootedChunks.size()) + "/" + raidedTown.getTownBlocks().size());
} }
//Looting chunks //Looting chunks
for (String name : Raid.this.getActiveRaiders()) { for (String name : Raid.this.getActiveRaiders()) {
Player p = Bukkit.getPlayer(name); Player p = Bukkit.getPlayer(name);
if(p != null) {
WorldCoord wc = WorldCoord.parseWorldCoord(p); WorldCoord wc = WorldCoord.parseWorldCoord(p);
if (p.isSneaking()) { if (p.isSneaking()) {
//check if our chunk is looted, if so skip this player //check if our chunk is looted, if so skip this player
@@ -910,18 +901,10 @@ public class Raid {
p.sendMessage(Helper.Chatlabel() + "This space is not part of the raided town, you cannot loot this area."); p.sendMessage(Helper.Chatlabel() + "This space is not part of the raided town, you cannot loot this area.");
} }
} }
// for (LootBlock c : Raid.this.lootedChunks.values()) {
// if (c.worldCoord.equals(wc)) {
// looted = true;
// p.sendMessage(Helper.Chatlabel() + "This chunk is already looted, try another.");
// continue;
// }
// }
} }
} }
} }
}
} }
}; };
} }
@@ -24,8 +24,8 @@ public class War {
// References // References
private ArrayList<Siege> sieges = new ArrayList<Siege>(); private ArrayList<Siege> sieges = new ArrayList<Siege>();
private ArrayList<Raid> raids = new ArrayList<Raid>(); private ArrayList<Raid> raids = new ArrayList<Raid>();
private long lastRaidTimeSide1 = 0; private int lastRaidTimeSide1 = 0;
private long lastRaidTimeSide2 = 0; private int lastRaidTimeSide2 = 0;
/** /**
* War Constructor * War Constructor
@@ -226,19 +226,19 @@ public class War {
return returnList; return returnList;
} }
public void setLastRaidTimeSide1(long lastRaidTime) { public void setLastRaidTimeSide1(int lastRaidTime) {
this.lastRaidTimeSide1 = lastRaidTime; this.lastRaidTimeSide1 = lastRaidTime;
} }
public long getLastRaidTimeSide1() { public int getLastRaidTimeSide1() {
return this.lastRaidTimeSide1; return this.lastRaidTimeSide1;
} }
public void setLastRaidTimeSide2(long lastRaidTime) { public void setLastRaidTimeSide2(int lastRaidTime) {
this.lastRaidTimeSide2 = lastRaidTime; this.lastRaidTimeSide2 = lastRaidTime;
} }
public long getLastRaidTimeSide2() { public int getLastRaidTimeSide2() {
return this.lastRaidTimeSide2; return this.lastRaidTimeSide2;
} }
} }
@@ -1338,12 +1338,12 @@ public class AdminCommands implements CommandExecutor {
} else if (args[3].equalsIgnoreCase("set")) { } else if (args[3].equalsIgnoreCase("set")) {
if (args.length >= 7) { if (args.length >= 7) {
if (args[6].equals(w.getSide1())) { if (args[6].equals(w.getSide1())) {
w.setLastRaidTimeSide1(Long.parseLong(args[6])); w.setLastRaidTimeSide1(Integer.parseInt(args[6]));
p.sendMessage(Helper.Chatlabel() + "Set last raid time in war " + args[4] + " to " + args[6]); p.sendMessage(Helper.Chatlabel() + "Set last raid time in war " + args[4] + " to " + args[6]);
Main.warLogger.log(Helper.Chatlabel() + "Set last raid time in war " + args[4] + " to " + args[6]); Main.warLogger.log(Helper.Chatlabel() + "Set last raid time in war " + args[4] + " to " + args[6]);
return finalizeWar(w); return finalizeWar(w);
} else if (args[6].equals(w.getSide2())) { } else if (args[6].equals(w.getSide2())) {
w.setLastRaidTimeSide2(Long.parseLong(args[6])); w.setLastRaidTimeSide2(Integer.parseInt(args[6]));
p.sendMessage(Helper.Chatlabel() + "Set last raid time in war " + args[4] + " to " + args[6]); p.sendMessage(Helper.Chatlabel() + "Set last raid time in war " + args[4] + " to " + args[6]);
Main.warLogger.log(Helper.Chatlabel() + "Set last raid time in war " + args[4] + " to " + args[6]); Main.warLogger.log(Helper.Chatlabel() + "Set last raid time in war " + args[4] + " to " + args[6]);
return finalizeWar(w); return finalizeWar(w);
@@ -1359,12 +1359,12 @@ public class AdminCommands implements CommandExecutor {
if (args.length >= 6) { if (args.length >= 6) {
if (args[5].equals(w.getSide1())) { if (args[5].equals(w.getSide1())) {
w.setLastRaidTimeSide1(0L); w.setLastRaidTimeSide1(0);
p.sendMessage(Helper.Chatlabel() + "Reset last raid time in war " + args[4]); p.sendMessage(Helper.Chatlabel() + "Reset last raid time in war " + args[4]);
Main.warLogger.log(Helper.Chatlabel() + "Reset last raid time in war " + args[4]); Main.warLogger.log(Helper.Chatlabel() + "Reset last raid time in war " + args[4]);
return finalizeWar(w); return finalizeWar(w);
} else if (args[5].equals(w.getSide2())) { } else if (args[5].equals(w.getSide2())) {
w.setLastRaidTimeSide2(0L); w.setLastRaidTimeSide2(0);
p.sendMessage(Helper.Chatlabel() + "Reset last raid time in war " + args[4]); p.sendMessage(Helper.Chatlabel() + "Reset last raid time in war " + args[4]);
Main.warLogger.log(Helper.Chatlabel() + "Reset last raid time in war " + args[4]); Main.warLogger.log(Helper.Chatlabel() + "Reset last raid time in war " + args[4]);
return finalizeWar(w); return finalizeWar(w);
@@ -577,7 +577,7 @@ public class AdminTabCompletion implements TabCompleter {
if (args.length > 6) { if (args.length > 6) {
return empty; return empty;
} else { } else {
return NameUtil.filterByStart(CommandHelper.getWarSides(args[4]), args[6]); return NameUtil.filterByStart(CommandHelper.getWarSides(args[4]), args[5]);
} }
} else { } else {
if (args.length > 6) { if (args.length > 6) {
@@ -129,6 +129,14 @@ public class RaidCommands implements CommandExecutor {
//if this is run as admin, shift our check forward a slot //if this is run as admin, shift our check forward a slot
if (raidedTown.getName().equalsIgnoreCase(args[2 + (admin ? 1 : 0)]) && gatherTown != null) { if (raidedTown.getName().equalsIgnoreCase(args[2 + (admin ? 1 : 0)]) && gatherTown != null) {
//check if the town were attempting to raid is in the war
if(!war.getSide1Towns().contains(raidedTown.getName()) && !war.getSide2Towns().contains(raidedTown.getName())) {
if (admin) p.sendMessage(String.valueOf(Helper.Chatlabel()) + "The town you are trying to raid is not part of the war!");
raidOwner.sendMessage(String.valueOf(Helper.Chatlabel()) + "The town you are trying to raid is not part of the war!");
return;
}
townExists = true; townExists = true;
Raid raid2; Raid raid2;
@@ -5,23 +5,17 @@ import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town; import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.WorldCoord; import com.palmergames.bukkit.towny.object.WorldCoord;
import com.palmergames.bukkit.towny.object.metadata.CustomDataField; import com.palmergames.bukkit.towny.object.metadata.CustomDataField;
import com.palmergames.bukkit.towny.object.metadata.IntegerDataField;
import com.palmergames.bukkit.towny.object.metadata.LongDataField; import com.palmergames.bukkit.towny.object.metadata.LongDataField;
import me.ShermansWorld.AlathraWar.Main; import me.ShermansWorld.AlathraWar.Main;
import me.ShermansWorld.AlathraWar.Raid; import me.ShermansWorld.AlathraWar.Raid;
import me.ShermansWorld.AlathraWar.Siege;
import me.ShermansWorld.AlathraWar.War; import me.ShermansWorld.AlathraWar.War;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.io.File; import java.io.File;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
public class RaidData { public class RaidData {
// Static Raid list for all active raids // Static Raid list for all active raids
@@ -91,27 +85,30 @@ public class RaidData {
Town gatherTown = TownyAPI.getInstance().getTown((String) fileData.get("gatherTown")); Town gatherTown = TownyAPI.getInstance().getTown((String) fileData.get("gatherTown"));
boolean attackBoolean = Boolean.parseBoolean((String) fileData.get("side1AreRaiders")); boolean attackBoolean = Boolean.parseBoolean((String) fileData.get("side1AreRaiders"));
//THIS MAY OR MAY NOT WORK //THIS MAY OR MAY NOT WORK
OfflinePlayer p = Bukkit.getOfflinePlayer((String) fileData.get("owner")); OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(UUID.fromString((String) fileData.get("owner")));
Raid raid = new Raid(war, raidedTown, gatherTown, attackBoolean, p.getPlayer()); if(raidedTown == null || gatherTown == null) {
return null;
}
Raid raid = new Raid(war, raidedTown, gatherTown, attackBoolean, offlinePlayer);
//Extra properties, if any are missing the raid doesnt exist yet //Extra properties, if any are missing the raid doesnt exist yet
if (fileData.get("raidTicks") != null && fileData.get("raidPhase") != null && fileData.get("activeRaiders") != null && fileData.get("lootedChunks") != null) { if (fileData.get("raidTicks") != null && fileData.get("raidPhase") != null && fileData.get("activeRaiders") != null && fileData.get("lootedChunks") != null) {
//active properties //active properties
raid.setRaidPhase(RaidPhase.getByName((String) fileData.get("raidPhase"))); raid.setRaidPhase(RaidPhase.getByName((String) fileData.get("raidPhase")));
raid.setRaidTicks((Integer) fileData.get("raidTicks")); raid.setRaidTicks((int) fileData.get("raidTicks"));
raid.setActiveRaiders((ArrayList<String>) fileData.get("activeRaiders")); raid.setActiveRaiders((ArrayList<String>) fileData.get("activeRaiders"));
//looted chunks //looted chunks
HashMap<String, Object> o = (HashMap<String, Object>) fileData.get("lootedChunks"); ArrayList<Object> o = (ArrayList<Object>) fileData.get("lootedChunks");
for (String s : o.keySet()) { for (Object hm : o) {
//grab the chunk //grab the chunk
HashMap<String, Object> chunk = (HashMap<String, Object>) o.get(s); HashMap<String, Object> chunk = (HashMap<String, Object>) hm;
//grab data for this chunk //grab data for this chunk
//worldcoord is its own map //worldcoord is its own map
HashMap<String, Object> wc = (HashMap<String, Object>) chunk.get("worldCoord"); HashMap<String, Object> wc = (HashMap<String, Object>) chunk.get("worldCoord");
WorldCoord worldCoordc = WorldCoord.parseWorldCoord((String) wc.get("world"), ((Integer) wc.get("x")), ((Integer) wc.get("z"))); WorldCoord worldCoordc = WorldCoord.parseWorldCoord((String) wc.get("world"), ((int) wc.get("x")), ((int) wc.get("z")));
int ticks = (int) chunk.get("ticks"); int ticks = (int) chunk.get("ticks");
double value = (double) chunk.get("value"); double value = (double) chunk.get("value");
boolean finished = (boolean) chunk.get("finished"); boolean finished = (boolean) chunk.get("finished");
@@ -133,7 +130,8 @@ public class RaidData {
Raid raid = fromMap(war, map); Raid raid = fromMap(war, map);
returnList.add(raid); returnList.add(raid);
RaidData.addRaid(raid);
raid.resume();
} }
return returnList; return returnList;
} }
@@ -83,6 +83,7 @@ public class WarData
returnList.add(fileWar); returnList.add(fileWar);
} catch (Exception e) { } catch (Exception e) {
Main.warLogger.log("Failed to load " + file.getName()); Main.warLogger.log("Failed to load " + file.getName());
e.printStackTrace();
} }
} }
@@ -107,8 +108,8 @@ public class WarData
if(fileData.get("lastRaidTimeSide1") != null && fileData.get("lastRaidTimeSide2") != null) { if(fileData.get("lastRaidTimeSide1") != null && fileData.get("lastRaidTimeSide2") != null) {
war.setLastRaidTimeSide1((long) fileData.get("lastRaidTimeSide1")); war.setLastRaidTimeSide1((int) fileData.get("lastRaidTimeSide1"));
war.setLastRaidTimeSide2((long) fileData.get("lastRaidTimeSide2")); war.setLastRaidTimeSide2((int) fileData.get("lastRaidTimeSide2"));
} }