mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-04 06:28:51 +00:00
Fix cherrypicked raid file
This commit is contained in:
1 parent
dcad9611d6
commit
271648712d
1 file changed
+5
-27
@@ -1,7 +1,6 @@
|
|||||||
package me.ShermansWorld.AlathraWar;
|
package me.ShermansWorld.AlathraWar;
|
||||||
|
|
||||||
import com.palmergames.bukkit.towny.TownyAPI;
|
import com.palmergames.bukkit.towny.TownyAPI;
|
||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
|
||||||
import com.palmergames.bukkit.towny.exceptions.TownyException;
|
import com.palmergames.bukkit.towny.exceptions.TownyException;
|
||||||
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;
|
||||||
@@ -119,7 +118,7 @@ public class Raid {
|
|||||||
|
|
||||||
// Creates 10 second looping function for Raid
|
// Creates 10 second looping function for Raid
|
||||||
this.bukkitId[0] = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask((Plugin) Main.getInstance(),
|
this.bukkitId[0] = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask((Plugin) Main.getInstance(),
|
||||||
(Runnable) new Runnable() {
|
(Runnable) new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -148,27 +147,7 @@ public class Raid {
|
|||||||
Main.raidData.getConfig().set("Raids." + String.valueOf(Raid.this.id) + ".raidticks",
|
Main.raidData.getConfig().set("Raids." + String.valueOf(Raid.this.id) + ".raidticks",
|
||||||
(Object) Raid.this.raidTicks);
|
(Object) Raid.this.raidTicks);
|
||||||
Main.raidData.saveConfig();
|
Main.raidData.saveConfig();
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (homeBlock != null) {
|
|
||||||
town.setHomeBlock(homeBlock);
|
|
||||||
town.setSpawn(townSpawn);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If time runs out, stops scheduled task.
|
|
||||||
if (Raid.this.raidTicks >= Raid.this.MAXRAIDTICKS) {
|
|
||||||
Bukkit.getServer().getScheduler().cancelTask(Raid.this.bukkitId[0]);
|
|
||||||
if (Raid.this.raiderPoints > Raid.this.defenderPoints) {
|
|
||||||
Raid.this.raidersWin(Raid.this.owner);
|
|
||||||
} else {
|
|
||||||
Raid.this.defendersWin();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final Raid this$0 = Raid.this;
|
|
||||||
Raid.access$7(this$0, this$0.raidTicks + 200);
|
|
||||||
Main.raidData.getConfig().set("Raids." + String.valueOf(Raid.this.id) + ".raidticks",
|
|
||||||
(Object) Raid.this.raidTicks);
|
|
||||||
Main.raidData.saveConfig();
|
|
||||||
|
|
||||||
//check and start travel phase
|
//check and start travel phase
|
||||||
if (Raid.this.raidTicks >= RaidPhase.TRAVEL.startTick && Raid.this.phase != RaidPhase.TRAVEL) {
|
if (Raid.this.raidTicks >= RaidPhase.TRAVEL.startTick && Raid.this.phase != RaidPhase.TRAVEL) {
|
||||||
@@ -177,7 +156,7 @@ public class Raid {
|
|||||||
|
|
||||||
//check and start combat phase
|
//check and start combat phase
|
||||||
if (Raid.this.raidTicks >= RaidPhase.COMBAT.startTick && Raid.this.phase != RaidPhase.COMBAT) {
|
if (Raid.this.raidTicks >= RaidPhase.COMBAT.startTick && Raid.this.phase != RaidPhase.COMBAT) {
|
||||||
startCombat();
|
startCombat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -195,9 +174,9 @@ public class Raid {
|
|||||||
//Raid Travel phase behavior
|
//Raid Travel phase behavior
|
||||||
else if (Raid.this.phase == RaidPhase.TRAVEL) {
|
else if (Raid.this.phase == RaidPhase.TRAVEL) {
|
||||||
//Check if a player has arrived at the town (in it) and if so start combat
|
//Check if a player has arrived at the town (in it) and if so start combat
|
||||||
for(String player : raiderPlayers) {
|
for (String player : raiderPlayers) {
|
||||||
WorldCoord playercoord = WorldCoord.parseWorldCoord(Bukkit.getPlayer(player));
|
WorldCoord playercoord = WorldCoord.parseWorldCoord(Bukkit.getPlayer(player));
|
||||||
if(Raid.this.town.hasTownBlock(playercoord)) {
|
if (Raid.this.town.hasTownBlock(playercoord)) {
|
||||||
startCombat();
|
startCombat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,8 +196,7 @@ public class Raid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 0L, 200L);
|
}, 0L, 200L);
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// End of raid
|
// End of raid
|
||||||
public void stop() {
|
public void stop() {
|
||||||
|
|||||||
Reference in new issue
Block a user