public class BattleBuilder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
allowSpectators |
protected boolean |
disableExp |
protected java.util.Map<java.lang.Class<? extends BattleEvent>,java.util.function.BiConsumer<? extends BattleEvent,BattleController>> |
eventHandlers |
protected boolean |
freezeBattle |
protected boolean |
removeFromTempParties |
protected BattleRules |
rules |
protected TeamSelectionRegistry.Builder |
selectionBuilder |
protected long |
startDelayMillis |
protected boolean |
startSync |
protected BattleParticipant[] |
teamOne |
protected boolean |
teamSelection |
protected BattleParticipant[] |
teamTwo |
Modifier and Type | Method and Description |
---|---|
protected <A extends BattleEvent> |
addTask(BattleController controller,
java.lang.Class<? extends BattleEvent> eventClass,
java.util.function.BiConsumer<? extends BattleEvent,BattleController> task) |
BattleBuilder |
allowSpectators()
Allows spectators for the battle
|
BattleBuilder |
allowSpectators(boolean allowSpectators)
Sets if spectating the battle is allowed
|
static BattleBuilder |
builder()
Gets a new instance of the builder
|
BattleBuilder |
disableExp()
Disables exp gain during the battle
|
BattleBuilder |
disallowSpectators()
Prevents players from spectating the battle
|
BattleBuilder |
endHandler(java.util.function.BiConsumer<BattleEndEvent,BattleController> endConsumer)
Adds a consumer to run when the battle ends
|
<E extends BattleEvent> |
eventHandler(java.lang.Class<E> eventClass,
java.util.function.BiConsumer<E,BattleController> eventHandler)
Adds a consumer to run for any given battle event
|
BattleBuilder |
expEnabled()
Enables exp gain during the battle (defaults to true)
|
BattleBuilder |
frozen()
This sets the battle to be frozen when it is created meaning nothing will happen.
|
protected void |
handleClearingTemporaryMode(BattleEndEvent event,
BattleController battleController) |
BattleBuilder |
ignoreTempParties()
The battle builder will not remove the player from temporary party mode if they are in it at the end of the battle
|
BattleBuilder |
noSelection()
Disables the team selection screen before the battle begins (default false)
|
BattleBuilder |
notFrozen()
This sets the battle to not be frozen when it is created (default)
|
BattleBuilder |
removeFromTempParty()
Sets the battle builder to remove the player from the temporary party mode if they are in it at the end of the battle
|
BattleBuilder |
rules(BattleRules rules)
Sets the battle rules
|
protected void |
setupController(BattleController controller) |
java.util.concurrent.CompletableFuture<BattleController> |
start()
Starts the battle
|
BattleBuilder |
startAsync()
Sets the start battle logic to run off the Minecraft server's main thread
|
protected java.util.concurrent.CompletableFuture<BattleController> |
startBattle() |
BattleBuilder |
startDelay(long startDelay,
java.util.concurrent.TimeUnit timeUnit)
Adds a delay in the specified unit before the battle will begin
|
BattleBuilder |
startHandler(java.util.function.BiConsumer<BattleStartedEvent.Pre,BattleController> startConsumer)
Adds a consumer to run when the battle begins
|
BattleBuilder |
startSync()
Sets the start battle logic to run on the Minecraft server's main thread
|
BattleBuilder |
teamOne(BattleParticipant... teamOne)
Sets the first team
|
BattleBuilder |
teamSelection()
Enables the team selection screen before the battle begins
|
BattleBuilder |
teamSelection(boolean teamSelection)
Sets if the team selection screen will show before battle
|
BattleBuilder |
teamSelectionBuilder(TeamSelectionRegistry.Builder selectionBuilder)
Sets the builder, and settings, for the team selection screen
|
BattleBuilder |
teamTwo(BattleParticipant... teamTwo)
Sets the second team
|
protected BattleParticipant[] teamOne
protected BattleParticipant[] teamTwo
protected BattleRules rules
protected java.util.Map<java.lang.Class<? extends BattleEvent>,java.util.function.BiConsumer<? extends BattleEvent,BattleController>> eventHandlers
protected boolean disableExp
protected boolean allowSpectators
protected boolean teamSelection
protected TeamSelectionRegistry.Builder selectionBuilder
protected long startDelayMillis
protected boolean startSync
protected boolean removeFromTempParties
protected boolean freezeBattle
public BattleBuilder teamOne(BattleParticipant... teamOne)
teamOne
- The first teampublic BattleBuilder teamTwo(BattleParticipant... teamTwo)
teamTwo
- The second teampublic BattleBuilder rules(BattleRules rules)
rules
- The battle rulespublic BattleBuilder endHandler(java.util.function.BiConsumer<BattleEndEvent,BattleController> endConsumer)
endConsumer
- The consumer to runpublic BattleBuilder startHandler(java.util.function.BiConsumer<BattleStartedEvent.Pre,BattleController> startConsumer)
startConsumer
- The consumer to runpublic <E extends BattleEvent> BattleBuilder eventHandler(java.lang.Class<E> eventClass, java.util.function.BiConsumer<E,BattleController> eventHandler)
E
- The event typeeventClass
- The event classeventHandler
- The handler to run for the given eventpublic BattleBuilder disableExp()
public BattleBuilder expEnabled()
public BattleBuilder allowSpectators()
public BattleBuilder disallowSpectators()
public BattleBuilder allowSpectators(boolean allowSpectators)
allowSpectators
- if spectating is allowedpublic BattleBuilder teamSelection()
public BattleBuilder noSelection()
public BattleBuilder teamSelection(boolean teamSelection)
teamSelection
- If selection should occurpublic BattleBuilder teamSelectionBuilder(TeamSelectionRegistry.Builder selectionBuilder)
selectionBuilder
- The selection screen settings builderpublic BattleBuilder startDelay(long startDelay, java.util.concurrent.TimeUnit timeUnit)
startDelay
- The delaytimeUnit
- The unit for the delaypublic BattleBuilder startSync()
public BattleBuilder startAsync()
public BattleBuilder removeFromTempParty()
public BattleBuilder ignoreTempParties()
public BattleBuilder frozen()
public BattleBuilder notFrozen()
public java.util.concurrent.CompletableFuture<BattleController> start()
protected java.util.concurrent.CompletableFuture<BattleController> startBattle()
protected void setupController(BattleController controller)
protected void handleClearingTemporaryMode(BattleEndEvent event, BattleController battleController)
protected <A extends BattleEvent> void addTask(BattleController controller, java.lang.Class<? extends BattleEvent> eventClass, java.util.function.BiConsumer<? extends BattleEvent,BattleController> task)
public static BattleBuilder builder()