mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-03 06:28:51 +00:00
fixed some stuff!
This commit is contained in:
1 parent
1e19d8eaf6
commit
bdc3962dbf
4 files changed
+69
-56
No files matched your search
@@ -455,6 +455,7 @@ public class Raid {
|
|||||||
//factor is 0.5 -> 3
|
//factor is 0.5 -> 3
|
||||||
double factor = ((raidScore - 800.0) / 100) + 0.5;
|
double factor = ((raidScore - 800.0) / 100) + 0.5;
|
||||||
if (factor > 3.0) factor = 3.0;
|
if (factor > 3.0) factor = 3.0;
|
||||||
|
if (factor < 0) factor = 0.0;
|
||||||
|
|
||||||
final Resident resident = TownyAPI.getInstance().getResident(owner.getUniqueId());
|
final Resident resident = TownyAPI.getInstance().getResident(owner.getUniqueId());
|
||||||
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The raiders from " + this.raiders
|
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The raiders from " + this.raiders
|
||||||
@@ -529,6 +530,7 @@ public class Raid {
|
|||||||
|
|
||||||
double factor = (3 - ((raidScore) / 200.0) - 0.5);
|
double factor = (3 - ((raidScore) / 200.0) - 0.5);
|
||||||
if (factor > 3.0) factor = 3.0;
|
if (factor > 3.0) factor = 3.0;
|
||||||
|
if (factor < 0) factor = 0.0;
|
||||||
|
|
||||||
String statement = "raided";
|
String statement = "raided";
|
||||||
if (factor <= 0.5) {
|
if (factor <= 0.5) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class AdminCommands implements CommandExecutor {
|
public class AdminCommands implements CommandExecutor {
|
||||||
|
|
||||||
@@ -368,8 +369,9 @@ public class AdminCommands implements CommandExecutor {
|
|||||||
args[3]
|
args[3]
|
||||||
};
|
};
|
||||||
//find the player
|
//find the player
|
||||||
|
Player target = p;
|
||||||
if (Bukkit.getPlayer(args[3]) != null) {
|
if (Bukkit.getPlayer(args[3]) != null) {
|
||||||
p = Bukkit.getPlayer(args[3]);
|
target = Bukkit.getPlayer(args[3]);
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(Helper.color("c") + args[3] + " does not exist!");
|
p.sendMessage(Helper.color("c") + args[3] + " does not exist!");
|
||||||
p.sendMessage(Helper.color("&cUsage: /alathrawaradmin force join war [player] [war] [side]"));
|
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")) {
|
} else if (args[5].equalsIgnoreCase("looted")) {
|
||||||
WorldCoord wc = WorldCoord.parseWorldCoord(p.getWorld().getName(), (int) Double.parseDouble(args[7]), (int) Double.parseDouble(args[8]));
|
WorldCoord wc = WorldCoord.parseWorldCoord(p.getWorld().getName(), (int) Double.parseDouble(args[7]), (int) Double.parseDouble(args[8]));
|
||||||
Raid.LootBlock lb = r.getLootedChunks().get(wc);
|
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]);
|
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]);
|
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]);
|
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().getName().equalsIgnoreCase(args[1])) {
|
||||||
if (!raid.getWar().getSide1Players().contains(p.getName()) && !raid.getWar().getSide2Players().contains(p.getName())) {
|
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]");
|
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())) {
|
if (raid.getOwner().getName().equals(p.getName())) {
|
||||||
//check if gather phase
|
//check if gather phase
|
||||||
if (raid.getPhase() == RaidPhase.GATHER || raid.getPhase() == RaidPhase.START || raid.getPhase() == RaidPhase.TRAVEL || raid.getPhase() == RaidPhase.COMBAT) {
|
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
|
||||||
//force defender victory
|
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The raid on " + raid.getRaidedTown().getName() + " has been abandoned by " + raid.getRaiders());
|
||||||
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());
|
||||||
Main.warLogger.log(p.getName() + " abandoned the raid on " + raid.getRaidedTown().getName() + " they started at " + raid.getGatherTown().getName());
|
raid.defendersWin(raid.getRaidScore());
|
||||||
raid.defendersWin(raid.getRaidScore());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(String.valueOf(Helper.Chatlabel()) + "You cannot abandon the raid on " + raid.getRaidedTown().getName() + "! It has a problem!");
|
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) {
|
private static void listRaids(Player p, String[] args) {
|
||||||
|
|||||||
@@ -41,7 +41,56 @@ public final class KillsListener implements Listener
|
|||||||
catch (NotRegisteredException ex2) {}
|
catch (NotRegisteredException ex2) {}
|
||||||
boolean playerCloseToHomeBlockSiege = false;
|
boolean playerCloseToHomeBlockSiege = false;
|
||||||
boolean playerCloseToHomeBlockRaid = false;
|
boolean playerCloseToHomeBlockRaid = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
//Raid logic
|
||||||
|
for (final Raid raid : RaidData.getRaids()) {
|
||||||
|
final int homeBlockXCoordRaided = raid.getRaidedTown().getHomeBlock().getCoord().getX() * 16;
|
||||||
|
final int homeBlockZCoordRaided = raid.getRaidedTown().getHomeBlock().getCoord().getZ() * 16;
|
||||||
|
// final int homeBlockXCoordGather = raid.getGatherTown().getHomeBlock().getCoord().getX() * 16;
|
||||||
|
// final int homeBlockZCoordGather = raid.getGatherTown().getHomeBlock().getCoord().getZ() * 16;
|
||||||
|
//Carryover from sieges
|
||||||
|
if (Math.abs(killed.getLocation().getBlockX() - homeBlockXCoordRaided) <= 200 && Math.abs(killed.getLocation().getBlockZ() - homeBlockZCoordRaided) <= 200) {
|
||||||
|
playerCloseToHomeBlockRaid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (raid.getDefenders().contains(killed.getName()) && ((town != null && town.equals(raid.getRaidedTown())) || playerCloseToHomeBlockRaid)) {
|
||||||
|
//There is seperate behavior if combat hasnt started
|
||||||
|
if (raid.getPhase() == RaidPhase.COMBAT && killer != null) {
|
||||||
|
if (raid.getActiveRaiders().contains(killer.getName())) {
|
||||||
|
this.raidKill(killed, event);
|
||||||
|
raid.defenderKilledInCombat(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//teleport back to raided spawn, without damaged gear
|
||||||
|
this.oocKill(killed, event);
|
||||||
|
raid.defenderKilledOutofCombat(event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (raid.getActiveRaiders().contains(killed.getName()) && ((town != null && town.equals(raid.getRaidedTown())) || playerCloseToHomeBlockRaid)) {
|
||||||
|
//There is seperate behavior if combat hasnt started
|
||||||
|
if (raid.getPhase() == RaidPhase.COMBAT && killer != null) {
|
||||||
|
if (raid.getDefenders().contains(killer.getName())) {
|
||||||
|
this.raidKill(killed, event);
|
||||||
|
raid.raiderKilledInCombat(event);
|
||||||
|
respawnqueue.put(killed.getUniqueId(), raid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//teleport back to gather town spawn, without damaged gear
|
||||||
|
//this is to disincentive people prekilling
|
||||||
|
this.oocKill(killed, event);
|
||||||
|
raid.raiderKilledOutofCombat(event);
|
||||||
|
respawnqueue.put(killed.getUniqueId(), raid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( (town != null && town.equals(raid.getRaidedTown()) || playerCloseToHomeBlockRaid) ) {
|
||||||
|
this.siegeKill(killed, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(killer == null) return;
|
||||||
|
|
||||||
for (final Siege siege : SiegeData.getSieges()) {
|
for (final Siege siege : SiegeData.getSieges()) {
|
||||||
final int homeBlockXCoord = siege.getTown().getHomeBlock().getCoord().getX() * 16;
|
final int homeBlockXCoord = siege.getTown().getHomeBlock().getCoord().getX() * 16;
|
||||||
final int homeBlockZCoord = siege.getTown().getHomeBlock().getCoord().getZ() * 16;
|
final int homeBlockZCoord = siege.getTown().getHomeBlock().getCoord().getZ() * 16;
|
||||||
@@ -95,53 +144,6 @@ public final class KillsListener implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Raid logic
|
|
||||||
for (final Raid raid : RaidData.getRaids()) {
|
|
||||||
final int homeBlockXCoordRaided = raid.getRaidedTown().getHomeBlock().getCoord().getX() * 16;
|
|
||||||
final int homeBlockZCoordRaided = raid.getRaidedTown().getHomeBlock().getCoord().getZ() * 16;
|
|
||||||
// final int homeBlockXCoordGather = raid.getGatherTown().getHomeBlock().getCoord().getX() * 16;
|
|
||||||
// final int homeBlockZCoordGather = raid.getGatherTown().getHomeBlock().getCoord().getZ() * 16;
|
|
||||||
//Carryover from sieges
|
|
||||||
if (Math.abs(killed.getLocation().getBlockX() - homeBlockXCoordRaided) <= 300 && Math.abs(killed.getLocation().getBlockZ() - homeBlockZCoordRaided) <= 300) {
|
|
||||||
playerCloseToHomeBlockRaid = true;
|
|
||||||
}
|
|
||||||
if (raid.getActiveRaiders().contains(killer.getName()) && ((town != null && town.equals(raid.getRaidedTown())) || playerCloseToHomeBlockRaid)) {
|
|
||||||
//There is seperate behavior if combat hasnt started
|
|
||||||
if (raid.getPhase() == RaidPhase.COMBAT) {
|
|
||||||
if (raid.getDefenderPlayers().contains(killed.getName())) {
|
|
||||||
this.raidKill(killed, event);
|
|
||||||
raid.defenderKilledInCombat(event);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//teleport back to raided spawn, without damaged gear
|
|
||||||
this.oocKill(killed, event);
|
|
||||||
raid.defenderKilledOutofCombat(event);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (raid.getDefenderPlayers().contains(killer.getName()) && ((town != null && town.equals(raid.getRaidedTown())) || playerCloseToHomeBlockRaid)) {
|
|
||||||
//There is seperate behavior if combat hasnt started
|
|
||||||
if (raid.getPhase() == RaidPhase.COMBAT) {
|
|
||||||
if (raid.getActiveRaiders().contains(killed.getName())) {
|
|
||||||
this.raidKill(killed, event);
|
|
||||||
raid.raiderKilledInCombat(event);
|
|
||||||
respawnqueue.put(killed.getUniqueId(), raid);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//teleport back to gather town spawn, without damaged gear
|
|
||||||
//this is to disincentive people prekilling
|
|
||||||
this.oocKill(killed, event);
|
|
||||||
raid.raiderKilledOutofCombat(event);
|
|
||||||
respawnqueue.put(killed.getUniqueId(), raid);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
if ( (town != null && town.equals(raid.getRaidedTown()) || playerCloseToHomeBlockRaid) ) {
|
|
||||||
this.siegeKill(killed, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (NullPointerException | TownyException ignored) {
|
catch (NullPointerException | TownyException ignored) {
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user