Improve RoundState command to handle null ROUND_STATE values gracefully
This commit is contained in:
parent
f0d3a20283
commit
4bf6ca9dc4
|
|
@ -2,6 +2,7 @@ package com.alttd.hunger_games.commands.subcommands;
|
|||
|
||||
import com.alttd.hunger_games.commands.SubCommand;
|
||||
import com.alttd.hunger_games.config.Messages;
|
||||
import com.alttd.hunger_games.data_objects.ROUND_STATE;
|
||||
import com.alttd.hunger_games.services.RoundService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
|
|
@ -16,9 +17,10 @@ public class RoundState extends SubCommand {
|
|||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, String[] args) {
|
||||
ROUND_STATE roundState = roundService.getRoundState();
|
||||
commandSender.sendRichMessage(Messages.ROUND_STATE.ROUND_STATE,
|
||||
Placeholder.parsed("round_state",
|
||||
roundService.getRoundState().getHumandReadableName()));
|
||||
roundState == null ? "null" : roundState.getHumandReadableName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user