Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package net.smileycorp.raids.common.event;

import net.smileycorp.raids.common.raid.Raid;

public class CustomRaidEndEvent extends CustomRaidEvent {

private final boolean win;

public CustomRaidEndEvent(Raid raid, boolean win) {
super(raid);
this.win = win;
}

public boolean isWin() {
return win;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package net.smileycorp.raids.common.event;

import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.smileycorp.raids.common.raid.Raid;
import net.minecraftforge.fml.common.eventhandler.Event;

import javax.annotation.Nullable;
import java.util.List;

public abstract class CustomRaidEvent extends Event {

private final Raid raid;

protected CustomRaidEvent(Raid raid) {
this.raid = raid;
}

public Raid getRaid() {
return raid;
}

public World getWorld() {
return raid.getWorld();
}

@Nullable
public EntityPlayer getPlayer() {
return raid.getCreator();
}

public String getName() {
return raid.getRaidDisplayName();
}

public int getWaves() {
return raid.getNumGroups();
}

public BlockPos getPos() {
return raid.getCenter();
}

public boolean requireVillage() {
return raid.requiresVillageCheck();
}

public List<Class<? extends EntityLiving>> getDetectionWhiteList() {
return raid.getDetectionWhitelist();
}

public String getBossBar() {
return raid.getBossbarTitle();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package net.smileycorp.raids.common.event;

import net.smileycorp.raids.common.raid.Raid;
import net.minecraftforge.fml.common.eventhandler.Cancelable;

@Cancelable
public class CustomRaidStartEvent extends CustomRaidEvent {

public CustomRaidStartEvent(Raid raid) {
super(raid);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package net.smileycorp.raids.common.event;

import net.smileycorp.raids.common.raid.Raid;

public class CustomRaidTickEvent extends CustomRaidEvent {

private final int wave;
private Boolean endState;

public CustomRaidTickEvent(Raid raid, int wave) {
super(raid);
this.wave = Math.max(1, wave);
}

public int getWave() {
return wave;
}

public void setEnd(boolean win) {
endState = win;
}

public boolean shouldEndRaid() {
return endState != null;
}

public boolean endAsWin() {
return Boolean.TRUE.equals(endState);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package net.smileycorp.raids.common.event;

import net.smileycorp.raids.common.raid.Raid;

public class CustomRaidWaveEndEvent extends CustomRaidEvent {

private final int wave;

public CustomRaidWaveEndEvent(Raid raid, int wave) {
super(raid);
this.wave = wave;
}

public int getWave() {
return wave;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.smileycorp.raids.common.event;

import net.smileycorp.raids.common.raid.Raid;

public class CustomRaidWaveStartEvent extends CustomRaidEvent {

private int wave;

public CustomRaidWaveStartEvent(Raid raid, int wave) {
super(raid);
this.wave = Math.max(1, wave);
}

public int getWave() {
return wave;
}

public boolean setWave(int wave) {
if (wave <= 0) return false;
this.wave = wave;
return true;
}

}
Loading