mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-03 22:15:24 +00:00
Swapped to OfflinePlayer
This commit is contained in:
1 parent
cac219e684
commit
84708bdec5
1 file changed
+6
-8
@@ -18,7 +18,6 @@ import me.ShermansWorld.AlathraWar.data.SiegeData;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
import com.palmergames.bukkit.towny.object.Town;
|
||||||
import com.palmergames.bukkit.towny.object.TownBlock;
|
import com.palmergames.bukkit.towny.object.TownBlock;
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ public class Siege {
|
|||||||
private boolean side1AreAttackers; // bool of if side1 being attacker
|
private boolean side1AreAttackers; // bool of if side1 being attacker
|
||||||
private int attackerPoints;
|
private int attackerPoints;
|
||||||
private int defenderPoints;
|
private int defenderPoints;
|
||||||
private Player siegeLeader;
|
private OfflinePlayer siegeLeader;
|
||||||
private int siegeTicks;
|
private int siegeTicks;
|
||||||
private TownBlock homeBlock;
|
private TownBlock homeBlock;
|
||||||
private Location townSpawn;
|
private Location townSpawn;
|
||||||
@@ -212,8 +211,8 @@ public class Siege {
|
|||||||
SiegeData.removeSiege(this);
|
SiegeData.removeSiege(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void attackersWin(final Player siegeLeader) {
|
public void attackersWin(final OfflinePlayer siegeLeader) {
|
||||||
final Resident resident = TownyAPI.getInstance().getResident(siegeLeader);
|
final Resident resident = TownyAPI.getInstance().getResident(siegeLeader.getUniqueId());
|
||||||
Nation nation = null;
|
Nation nation = null;
|
||||||
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The attackers have won the siege of " + this.town.getName() + "!");
|
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The attackers have won the siege of " + this.town.getName() + "!");
|
||||||
try {
|
try {
|
||||||
@@ -240,8 +239,7 @@ public class Siege {
|
|||||||
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The town of " + this.town.getName()
|
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The town of " + this.town.getName()
|
||||||
+ " has been placed under occupation by " + nation.getName() + "!");
|
+ " has been placed under occupation by " + nation.getName() + "!");
|
||||||
}
|
}
|
||||||
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(siegeLeader.getUniqueId());
|
Main.econ.depositPlayer(siegeLeader, 2500.0);
|
||||||
Main.econ.depositPlayer(offlinePlayer, 2500.0);
|
|
||||||
double amt = 0.0;
|
double amt = 0.0;
|
||||||
if (this.town.getAccount().getHoldingBalance() > 10000.0) {
|
if (this.town.getAccount().getHoldingBalance() > 10000.0) {
|
||||||
amt = Math.floor(this.town.getAccount().getHoldingBalance()) / 4.0;
|
amt = Math.floor(this.town.getAccount().getHoldingBalance()) / 4.0;
|
||||||
@@ -252,7 +250,7 @@ public class Siege {
|
|||||||
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The town of " + this.town.getName()
|
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "The town of " + this.town.getName()
|
||||||
+ " has been destroyed by " + this.getAttackers() + "!");
|
+ " has been destroyed by " + this.getAttackers() + "!");
|
||||||
TownyUniverse.getInstance().getDataSource().deleteTown(this.town);
|
TownyUniverse.getInstance().getDataSource().deleteTown(this.town);
|
||||||
Main.econ.depositPlayer(offlinePlayer, amt);
|
Main.econ.depositPlayer(siegeLeader, amt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.town.getAccount().withdraw(2500.0, "war loot");
|
this.town.getAccount().withdraw(2500.0, "war loot");
|
||||||
@@ -262,7 +260,7 @@ public class Siege {
|
|||||||
+ ", valuing $" + String.valueOf(amt));
|
+ ", valuing $" + String.valueOf(amt));
|
||||||
Main.warLogger.log("The town of " + this.town.getName() + " has been sacked by " + this.getAttackers()
|
Main.warLogger.log("The town of " + this.town.getName() + " has been sacked by " + this.getAttackers()
|
||||||
+ ", valuing $" + String.valueOf(amt));
|
+ ", valuing $" + String.valueOf(amt));
|
||||||
Main.econ.depositPlayer(offlinePlayer, amt);
|
Main.econ.depositPlayer(siegeLeader, amt);
|
||||||
|
|
||||||
stop();
|
stop();
|
||||||
clearBeacon();
|
clearBeacon();
|
||||||
|
|||||||
Reference in new issue
Block a user