Skip to content

Commit

Permalink
Removed several Siege features not needed for Raids
Browse files Browse the repository at this point in the history
  • Loading branch information
NinjaMandalorian committed Apr 3, 2023
1 parent 168851e commit 81e0ca4
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions src/main/java/me/ShermansWorld/AlathraWar/Raid.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import java.util.ArrayList;


/* RAID EXPLANATION
Raids are run by raiding parties, who gather at a separate town,
Expand Down Expand Up @@ -45,6 +44,7 @@

/**
* This is based on the existing Siege Class
*
* @author AubriTheHuman
* @author NinjaMandalorian
* @author ShermansWorld
Expand All @@ -71,17 +71,17 @@ public class Raid {

// Constructs raid for staging phase
public Raid(final int id, final War war, final Town town, final String raiders, final String defenders,
final boolean side1AreRaiders, final boolean side2AreRaiders) {
final boolean side1AreRaiders, final boolean side2AreRaiders) {
/*
this.raidTicks = 0;
this.bukkitId = new int[1];
this.raiderPlayers = new ArrayList<String>();
this.defenderPlayers = new ArrayList<String>();
this.war = war;
this.town = town;
this.raiders = raiders;
this.id = id;
*/
* this.raidTicks = 0;
* this.bukkitId = new int[1];
* this.raiderPlayers = new ArrayList<String>();
* this.defenderPlayers = new ArrayList<String>();
* this.war = war;
* this.town = town;
* this.raiders = raiders;
* this.id = id;
*/
}

public void start() {
Expand All @@ -97,21 +97,15 @@ public void start() {
// Creates 10 second looping function for Raid
this.bukkitId[0] = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask((Plugin) Main.getInstance(),
(Runnable) new Runnable() {
int homeBlockControl = 0;

@Override
public void run() {
if (homeBlock != null) {
town.setHomeBlock(homeBlock);
town.setSpawn(townSpawn);
}
if (Raid.this.side1AreRaiders) {
Raid.this.raiderPlayers = Raid.this.war.getSide1Players();
Raid.this.defenderPlayers = Raid.this.war.getSide2Players();
} else {
Raid.this.raiderPlayers = Raid.this.war.getSide2Players();
Raid.this.defenderPlayers = Raid.this.war.getSide1Players();
}

// 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) {
Expand All @@ -126,7 +120,7 @@ public void run() {
(Object) Raid.this.raidTicks);
Main.raidData.saveConfig();


// Raid update
if (Raid.this.raidTicks % 6000 == 0) {
Bukkit.broadcastMessage(String.valueOf(Helper.Chatlabel()) + "Report on the raid of "
+ Raid.this.town.getName() + ":");
Expand All @@ -144,12 +138,11 @@ public void run() {
// End of raid
public void stop() {
Bukkit.getScheduler().cancelTask(this.bukkitId[0]);
RaidCommands.raids.remove(this); //im not making this rn -Aubri
RaidCommands.raids.remove(this); // im not making this rn -Aubri
Main.raidData.getConfig().set("Raids." + String.valueOf(this.id), (Object) null);
Main.raidData.saveConfig();
}


/**
* Need to add call to KillsListener (defined seperate from Siege)
*/
Expand Down

0 comments on commit 81e0ca4

Please sign in to comment.