Class ChatResponse
-
- All Implemented Interfaces:
public abstract class ChatResponse
A chat response.
-
-
Constructor Summary
Constructors Constructor Description ChatResponse()
-
Method Summary
Modifier and Type Method Description final Level
getLevel()
final Unit
setLevel(Level level)
final Player
getSender()
final Unit
setSender(Player sender)
Integer
getDelay()
Boolean
getCaseSensitive()
Boolean
isFullMessage()
abstract List<String>
getTriggers()
A list of strings that trigger this response. final Boolean
check(String message)
Check if this response matches the message based on the conditions. abstract Unit
respond(Level level, Player sender)
Called when the chat response is triggered. final Unit
execute(Level level, Player sender)
Call the chat response (internal). final Unit
doWork(Integer afterTicks, Function0<Unit> action)
Do some work after a set number of ticks. final Unit
onServer(Function1<ServerLevel, Unit> action)
Only execute the given block if we are on the server-side. final Unit
broadcast(Component msg, Boolean bypassHiddenChat)
Broadcast a chat message to all players on the server. final EventConditionBuilder<Level, Player>
condition()
Create a condition builder to do some work. final Unit
playSound(Vec3 pos, SoundEvent sound, Float volume, Float pitch, Boolean distanceDelay)
Play a sound at a given position in the current level. final Unit
playSound(Level level, Vec3 pos, SoundEvent sound, Float volume, Float pitch, Boolean distanceDelay)
Play a sound at a given position in a specific level. final Unit
playGlobalSound(SoundEvent sound, Float volume, Float pitch)
Play a sound to all players in the current level. final Unit
playGlobalSound(Level level, SoundEvent sound, Float volume, Float pitch)
Play a sound to all players in a specific level. -
-
Method Detail
-
getLevel
final Level getLevel()
-
getSender
final Player getSender()
-
getCaseSensitive
Boolean getCaseSensitive()
-
isFullMessage
Boolean isFullMessage()
-
getTriggers
abstract List<String> getTriggers()
A list of strings that trigger this response.
-
check
final Boolean check(String message)
Check if this response matches the message based on the conditions.
-
respond
abstract Unit respond(Level level, Player sender)
Called when the chat response is triggered.
-
doWork
final Unit doWork(Integer afterTicks, Function0<Unit> action)
Do some work after a set number of ticks.
-
onServer
final Unit onServer(Function1<ServerLevel, Unit> action)
Only execute the given block if we are on the server-side.
-
broadcast
final Unit broadcast(Component msg, Boolean bypassHiddenChat)
Broadcast a chat message to all players on the server.
-
condition
final EventConditionBuilder<Level, Player> condition()
Create a condition builder to do some work.
-
playSound
final Unit playSound(Vec3 pos, SoundEvent sound, Float volume, Float pitch, Boolean distanceDelay)
Play a sound at a given position in the current level.
-
playSound
final Unit playSound(Level level, Vec3 pos, SoundEvent sound, Float volume, Float pitch, Boolean distanceDelay)
Play a sound at a given position in a specific level.
-
playGlobalSound
final Unit playGlobalSound(SoundEvent sound, Float volume, Float pitch)
Play a sound to all players in the current level.
-
playGlobalSound
final Unit playGlobalSound(Level level, SoundEvent sound, Float volume, Float pitch)
Play a sound to all players in a specific level.
-
-
-
-