sxcybot

Discord bot for OSRS based channels
git clone git://git.wimdupont.com/sxcybot.git
Log | Files | Refs | README | LICENSE

commit 0f334d6f8042e1e2e728114693fa9bfb8065bd69
parent fa1888b159b2c90cfca09693e858f496e8ec0bfe
Author: Wim Dupont <wim@wimdupont.com>
Date:   Thu,  5 Jan 2023 17:31:02 +0100

version bump

Diffstat:
Mpom.xml | 2+-
Msrc/main/java/com/sxcy/sxcybot/services/guild/pvmrole/impl/PvmRoleAssignerServiceImpl.java | 16++++++----------
Msrc/main/java/com/sxcy/sxcybot/util/EditListenerUtil.java | 17++++++-----------
3 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/pom.xml b/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> - <version>3.0.0</version> + <version>3.0.1</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.sxcy</groupId> diff --git a/src/main/java/com/sxcy/sxcybot/services/guild/pvmrole/impl/PvmRoleAssignerServiceImpl.java b/src/main/java/com/sxcy/sxcybot/services/guild/pvmrole/impl/PvmRoleAssignerServiceImpl.java @@ -81,16 +81,12 @@ public class PvmRoleAssignerServiceImpl implements PvmRoleAssignerService { } private String getRolename(PvmRole pvmRole, ChannelDetail channelDetail) { - switch (pvmRole) { - case GENERAL: - return channelDetail.getPvmRoleGeneral(); - case RAIDS: - return channelDetail.getPvmRoleRaids(); - case WILDERNESS: - return channelDetail.getPvmRoleWilderness(); - default: - return "Something went wrong."; - } + return switch (pvmRole) { + case GENERAL -> channelDetail.getPvmRoleGeneral(); + case RAIDS -> channelDetail.getPvmRoleRaids(); + case WILDERNESS -> channelDetail.getPvmRoleWilderness(); + default -> "Something went wrong."; + }; } private void addRoleToWinner(Guild guild, Member member, Role role, MessageChannel textChannel, String rsn) { diff --git a/src/main/java/com/sxcy/sxcybot/util/EditListenerUtil.java b/src/main/java/com/sxcy/sxcybot/util/EditListenerUtil.java @@ -27,19 +27,14 @@ public class EditListenerUtil { editListenerDto.getPrivateChannel().sendMessageEmbeds(embedBuilder.build()).queue(); eventWaiterUtil.waitForPrivateChannelEvent(commandReceiver -> { switch (commandReceiver.getMessage().getContentRaw()) { - case "1": - editListenerDto.getAddListener().proces(commandReceiver, editListenerDto.getEvent()); - break; - case "2": - editListenerDto.getDeleteListener().proces(commandReceiver, editListenerDto.getEvent()); - break; - case "3": + case "1" -> editListenerDto.getAddListener().proces(commandReceiver, editListenerDto.getEvent()); + case "2" -> editListenerDto.getDeleteListener().proces(commandReceiver, editListenerDto.getEvent()); + case "3" -> { if (editListenerDto.getUpdateListener() != null) editListenerDto.getUpdateListener().proces(commandReceiver, editListenerDto.getEvent()); - break; - default: - editListenerDto.getPrivateChannel().sendMessage("Unknown command, please try again.").queue(); - break; + } + default -> + editListenerDto.getPrivateChannel().sendMessage("Unknown command, please try again.").queue(); } }, editListenerDto.getEvent(), editListenerDto.getPrivateChannel()); }