From 44df4a8e1f08a6aacd3afe88b341f1249a0eb31f Mon Sep 17 00:00:00 2001 From: Efe Kurban Date: Mon, 15 Jan 2024 22:49:44 +0300 Subject: [PATCH] refactor DonationType to something sane, i guess --- .../modules/donations/model/DonationType.java | 77 ++++--------------- 1 file changed, 14 insertions(+), 63 deletions(-) diff --git a/bukkit/src/main/java/net/leaderos/plugin/modules/donations/model/DonationType.java b/bukkit/src/main/java/net/leaderos/plugin/modules/donations/model/DonationType.java index 5cc1af1f9..02584a8ba 100644 --- a/bukkit/src/main/java/net/leaderos/plugin/modules/donations/model/DonationType.java +++ b/bukkit/src/main/java/net/leaderos/plugin/modules/donations/model/DonationType.java @@ -1,73 +1,24 @@ package net.leaderos.plugin.modules.donations.model; +import lombok.AllArgsConstructor; +import lombok.Getter; + /** - * @author poyrazinan + * @author poyrazinan, efekurbann * @since 1.0 */ +@AllArgsConstructor +@Getter public enum DonationType { - LATEST, - TOP_ALLTIME, - TOP_ANNUAL, - TOP_MONTHLY, - TOP_DAILY; - /** - * Gets request type string - * @return String of request - */ - public String getRequest() { - switch (this) { - case LATEST: - return "latest"; - case TOP_ALLTIME: - return "top-alltime"; - case TOP_ANNUAL: - return "top-annual"; - case TOP_MONTHLY: - return "top-monthly"; - case TOP_DAILY: - return "top-daily"; - } - return null; - } + LATEST("latest", 'l', '1'), + TOP_ALLTIME("top-alltime", 'a', '2'), + TOP_ANNUAL("top-annual", 'y', '3'), + TOP_MONTHLY("top-monthly", 'm', '4'), + TOP_DAILY("top-daily", 'd', '5'); - /** - * Gets gui char - * @return char of gui - */ - public char getGuiChar() { - switch (this) { - case LATEST: - return 'l'; - case TOP_ALLTIME: - return 'a'; - case TOP_ANNUAL: - return 'y'; - case TOP_MONTHLY: - return 'm'; - case TOP_DAILY: - return 'd'; - } - return 'l'; - } + private final String request; + private final char guiChar; + private final char guiInfoChar; - /** - * Gets gui info char - * @return char of gui info - */ - public char getGuiInfoChar() { - switch (this) { - case LATEST: - return '1'; - case TOP_ALLTIME: - return '2'; - case TOP_ANNUAL: - return '3'; - case TOP_MONTHLY: - return '4'; - case TOP_DAILY: - return '5'; - } - return '1'; - } }