feat: Send message to chat when item is used
This commit is contained in:
@ -68,6 +68,23 @@ public class Message {
|
||||
yield "Hráč " + author.getName() + " sice získal item, ale měl plný inventář a tím pádem ho navždy ztratil.";
|
||||
}
|
||||
}
|
||||
case ITEM_USED -> {
|
||||
try {
|
||||
var response = apiService.getItemInfo(playerKey, Long.valueOf(content)).execute();
|
||||
|
||||
var body = response.body();
|
||||
|
||||
if (!body.getSuccess()) {
|
||||
yield "Hráč " + Cli.Colors.BLUE + author.getName() + Cli.Colors.RESET + " využil item unknown.";
|
||||
}
|
||||
|
||||
var item = body.getData().get();
|
||||
|
||||
yield "Hráč " + Cli.Colors.BLUE + author.getName() + Cli.Colors.RESET + " využil item " + Cli.Colors.BLUE + item + Cli.Colors.RESET + ".";
|
||||
} catch (IOException e) {
|
||||
yield "Hráč " + Cli.Colors.BLUE + author.getName() + Cli.Colors.RESET + " využil item unknown.";
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -5,5 +5,6 @@ public enum MessageType {
|
||||
MOVE_TO_ROOM,
|
||||
GOT_ITEM,
|
||||
LOST_ITEM,
|
||||
ITEM_USED,
|
||||
JOINED,
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class CommandPalette {
|
||||
return switch (command.getCommandType()) {
|
||||
case CUSTOM -> selectedOption;
|
||||
case EXIT -> {
|
||||
System.out.println("Exiting game...");
|
||||
Cli.info("Odpojuji se ze hry...");
|
||||
System.exit(0);
|
||||
|
||||
yield 0;
|
||||
|
Reference in New Issue
Block a user