-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added discord webhook * By Ewof
- Loading branch information
Showing
18 changed files
with
751 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/main/java/com/gmail/goosius/siegewar/events/SiegeCampStartEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.gmail.goosius.siegewar.events; | ||
import com.gmail.goosius.siegewar.enums.SiegeType; | ||
import com.gmail.goosius.siegewar.objects.SiegeCamp; | ||
import com.gmail.goosius.siegewar.settings.SiegeWarSettings; | ||
import com.palmergames.adventure.text.serializer.legacy.LegacyComponentSerializer; | ||
import com.palmergames.bukkit.towny.object.Nation; | ||
import com.palmergames.bukkit.towny.object.Town; | ||
import com.palmergames.bukkit.towny.object.TownBlock; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* An event that marks the start of a {@link SiegeCamp}. | ||
* | ||
* SiegeCamps precede Sieges, acting as a minigame of sorts, in which the | ||
* Siege-starter must gain an amount of points: | ||
* {@link SiegeWarSettings#getSiegeCampPointsForSuccess()}, in order for the | ||
* Siege to begin in earnest. This gives towns an opportunity to disrupt two | ||
* friendly towns from acting out a mock-siege, in order to get around being | ||
* sieged by actual enemies. | ||
* | ||
* @author ewof | ||
* @since 2.8.0 | ||
*/ | ||
public class SiegeCampStartEvent extends Event { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
private final SiegeCamp siegeCamp; | ||
private final String message; | ||
|
||
public SiegeCampStartEvent(SiegeCamp camp, String message) { | ||
super(!Bukkit.getServer().isPrimaryThread()); | ||
this.siegeCamp = camp; | ||
this.message = message; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
public Town getTownOfSiegeStarter() { | ||
return siegeCamp.getTownOfSiegeStarter(); | ||
} | ||
|
||
public Nation getNation() { | ||
return siegeCamp.getSiegeType().equals(SiegeType.REVOLT) ? (Nation) siegeCamp.getDefender() : (Nation) siegeCamp.getAttacker(); | ||
} | ||
|
||
public Block getFlag() { | ||
return siegeCamp.getBannerBlock(); | ||
} | ||
|
||
public TownBlock getTownBlock() { | ||
return siegeCamp.getTownBlock(); | ||
} | ||
|
||
public Town getTargetTown() { | ||
return siegeCamp.getTargetTown(); | ||
} | ||
|
||
public SiegeType getSiegeType() { | ||
return siegeCamp.getSiegeType(); | ||
} | ||
|
||
public String getMessage() { | ||
return LegacyComponentSerializer.legacySection().deserialize(message).content(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.