raid creation bugs

This commit is contained in:
Aubri Seebauer committed 2023-04-18 17:25:02 -04:00
1 parent 23f61e99a4
commit 2a733fe867
4 files changed
+28 -13

No files matched your search

@@ -103,7 +103,7 @@ public class Raid {
final boolean side1AreRaiders, final int raidTicks, Player owner) {
this.bukkitId = new int[1];
// this.activeRaiders = activeRaiders == null ? new ArrayList<>() : activeRaiders;
this.activeRaiders = activeRaiders == null ? new ArrayList<>() : activeRaiders;
this.war = war;
this.raidTicks = raidTicks;
this.raidedTown = raidedTown;
@@ -145,7 +145,7 @@ public class Raid {
public Raid(final War war, final Town raidedTown, final Town gatherTown,
final boolean side1AreRaiders, Player owner) {
this.bukkitId = new int[1];
// this.activeRaiders = activeRaiders == null ? new ArrayList<>() : activeRaiders;
this.activeRaiders = activeRaiders == null ? new ArrayList<>() : activeRaiders;
this.war = war;
this.raidTicks = 0;
this.raidedTown = raidedTown;
@@ -198,6 +198,7 @@ public class Raid {
this.bukkitId[0] = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask((Plugin) Main.getInstance(),
getTickLoop(), 0L, incremental);
this.save();
}
@@ -767,6 +768,7 @@ public class Raid {
}
raidTicks += incremental;
//check for end
if (Raid.this.raidTicks >= RaidPhase.END.startTick && Raid.this.phase == RaidPhase.COMBAT) {
Raid.this.phase = RaidPhase.END;
}
@@ -781,6 +783,11 @@ public class Raid {
startCombat();
}
//check and start gather phase
if (Raid.this.raidTicks >= RaidPhase.GATHER.startTick && Raid.this.phase == RaidPhase.GATHER) {
startGather();
}
if (Raid.this.phase == RaidPhase.END) {
//TODO: fix raid scoring
//for raiders to win, they need a significant up from the defenders
@@ -1367,18 +1367,24 @@ public class AdminCommands implements CommandExecutor {
return true;
}
} else if (args[3].equalsIgnoreCase("reset")) {
if (args[6].equals(w.getSide1())) {
w.setLastRaidTimeSide1(0L);
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]);
return finalizeWar(w);
} else if (args[6].equals(w.getSide2())) {
w.setLastRaidTimeSide2(0L);
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]);
return finalizeWar(w);
if (args.length >= 6) {
if (args[5].equals(w.getSide1())) {
w.setLastRaidTimeSide1(0L);
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]);
return finalizeWar(w);
} else if (args[5].equals(w.getSide2())) {
w.setLastRaidTimeSide2(0L);
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]);
return finalizeWar(w);
} else {
p.sendMessage(Helper.color("c") + "Side not found!");
return true;
}
} else {
p.sendMessage(Helper.color("c") + "Side not found!");
p.sendMessage(Helper.color("c") + "Usage: /alathrawaradmin modify war raidTimeWar [add,set,reset] [town/war] [amt] [side]");
return true;
}
} else {
@@ -570,6 +570,7 @@ public class AdminTabCompletion implements TabCompleter {
if (args.length > 4) {
if (args.length > 5) {
if (args.length > 6) {
if (args.length > 7) {
return NameUtil.filterByStart(CommandHelper.getWarSides(args[4]), args[6]);
} else {
@@ -210,6 +210,7 @@ public class RaidCommands implements CommandExecutor {
//publish raid
Main.econ.withdrawPlayer(offlinePlayer, 1000);
raid2.addActiveRaider(raidOwner.getName());
RaidData.addRaid(raid2);
raid2.start(); //funny funny method haha
WarData.saveWar(raid2.getWar());