fixed some stuff!

This commit is contained in:
Aubri Seebauer committed 2023-04-24 17:59:30 -04:00
1 parent 1e19d8eaf6
commit bdc3962dbf
4 files changed
+69 -56

No files matched your search

@@ -20,6 +20,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.sql.Timestamp;
import java.util.Random;
public class AdminCommands implements CommandExecutor {
@@ -368,8 +369,9 @@ public class AdminCommands implements CommandExecutor {
args[3]
};
//find the player
Player target = p;
if (Bukkit.getPlayer(args[3]) != null) {
p = Bukkit.getPlayer(args[3]);
target = Bukkit.getPlayer(args[3]);
} else {
p.sendMessage(Helper.color("c") + args[3] + " does not exist!");
p.sendMessage(Helper.color("&cUsage: /alathrawaradmin force join war [player] [war] [side]"));
@@ -830,6 +832,15 @@ public class AdminCommands implements CommandExecutor {
} else if (args[5].equalsIgnoreCase("looted")) {
WorldCoord wc = WorldCoord.parseWorldCoord(p.getWorld().getName(), (int) Double.parseDouble(args[7]), (int) Double.parseDouble(args[8]));
Raid.LootBlock lb = r.getLootedChunks().get(wc);
//The base value can be abjusted
if(!lb.finished && Boolean.parseBoolean(args[6])) {
lb.value = new Random().nextDouble() * 100;
//score for looting
r.addPointsToRaidScore(10);
p.sendMessage(Helper.Chatlabel() + "Gave value and score because flag was false before.");
Main.warLogger.log("Gave value and score because flag was false before.");
}
lb.finished = Boolean.parseBoolean(args[6]);
p.sendMessage(Helper.Chatlabel() + "Set finished flag for a chunk [" + args[7] + "," + args[8] + "] in raid against " + args[4] + " in war " + args[3] + " to " + args[6]);
Main.warLogger.log("Set finished flag for a chunk [" + args[7] + "," + args[8] + "] in raid against " + args[4] + " in war " + args[3] + " to " + args[6]);
@@ -407,17 +407,16 @@ public class RaidCommands implements CommandExecutor {
if (raid.getWar().getName().equalsIgnoreCase(args[1])) {
if (!raid.getWar().getSide1Players().contains(p.getName()) && !raid.getWar().getSide2Players().contains(p.getName())) {
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You are not in this war! Type /war join [war] [side]");
return;
}
if (raid.getOwner().getName().equals(p.getName())) {
//check if gather phase
if (raid.getPhase() == RaidPhase.GATHER || raid.getPhase() == RaidPhase.START || raid.getPhase() == RaidPhase.TRAVEL || raid.getPhase() == RaidPhase.COMBAT) {
if (raid.getGatherTown().hasTownBlock(WorldCoord.parseWorldCoord(p))) {
//force defender victory
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The raid on " + raid.getRaidedTown().getName() + " has been abandoned by " + raid.getRaiders());
Main.warLogger.log(p.getName() + " abandoned the raid on " + raid.getRaidedTown().getName() + " they started at " + raid.getGatherTown().getName());
raid.defendersWin(raid.getRaidScore());
}
//force defender victory
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The raid on " + raid.getRaidedTown().getName() + " has been abandoned by " + raid.getRaiders());
Main.warLogger.log(p.getName() + " abandoned the raid on " + raid.getRaidedTown().getName() + " they started at " + raid.getGatherTown().getName());
raid.defendersWin(raid.getRaidScore());
} else {
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You cannot abandon the raid on " + raid.getRaidedTown().getName() + "! It has a problem!");
}
@@ -426,9 +425,8 @@ public class RaidCommands implements CommandExecutor {
}
}
} else {
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "This raid does not exist!");
}
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "This raid does not exist!");
}
private static void listRaids(Player p, String[] args) {