From 85bfacc9ec231ce350cd98ad81fefebce6e88940 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Fri, 17 Apr 2020 17:14:12 +0200 Subject: [PATCH] Improve timeframe requirement check message --- .../erethon/dungeonsxl/config/DMessage.java | 7 +++++++ .../requirement/TimeframeRequirement.java | 19 ++++++++++++++----- core/src/main/resources/languages/english.yml | 8 ++++++++ core/src/main/resources/languages/french.yml | 10 +++++++++- core/src/main/resources/languages/german.yml | 8 ++++++++ 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/config/DMessage.java b/core/src/main/java/de/erethon/dungeonsxl/config/DMessage.java index a9c70708..a76f3e93 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/config/DMessage.java +++ b/core/src/main/java/de/erethon/dungeonsxl/config/DMessage.java @@ -95,6 +95,13 @@ public enum DMessage implements Message { CMD_TEST_HELP("cmd.test.help"), CMD_UNINVITE_HELP("cmd.uninvite.help"), CMD_UNINVITE_SUCCESS("cmd.uninvite.success"), + DAY_OF_WEEK_0("dayOfWeek.0"), + DAY_OF_WEEK_1("dayOfWeek.1"), + DAY_OF_WEEK_2("dayOfWeek.2"), + DAY_OF_WEEK_3("dayOfWeek.3"), + DAY_OF_WEEK_4("dayOfWeek.4"), + DAY_OF_WEEK_5("dayOfWeek.5"), + DAY_OF_WEEK_6("dayOfWeek.6"), ERROR_BED("error.bed"), ERROR_CHEST_IS_OPENED("error.chestIsOpened"), ERROR_CMD("error.cmd"), diff --git a/core/src/main/java/de/erethon/dungeonsxl/requirement/TimeframeRequirement.java b/core/src/main/java/de/erethon/dungeonsxl/requirement/TimeframeRequirement.java index b4bb0c2d..2e3c12ed 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/requirement/TimeframeRequirement.java +++ b/core/src/main/java/de/erethon/dungeonsxl/requirement/TimeframeRequirement.java @@ -42,7 +42,12 @@ public class TimeframeRequirement implements Requirement { WEDNESDAY, THURSDAY, FRIDAY, - SATURDAY + SATURDAY; + + @Override + public String toString() { + return DMessage.valueOf("DAY_OF_WEEK_" + ordinal()).getMessage(); + } } public static class Timeframe { @@ -138,22 +143,26 @@ public class TimeframeRequirement implements Requirement { for (Timeframe timeframe : weekdays) { ChatColor color = isInDayTimeframe(timeframe) ? ChatColor.GREEN : ChatColor.DARK_RED; if (!first) { - builder.append(" | ").color(ChatColor.WHITE); + builder.append(" & ").color(ChatColor.WHITE); } else { first = false; } - builder.append(timeframe.getStart() + "-" + timeframe.getEnd()).color(color); + if (timeframe.getStart() != timeframe.getEnd()) { + builder.append(timeframe.getStart() + "-" + timeframe.getEnd()).color(color); + } else { + builder.append(timeframe.getStart().toString()).color(color); + } } first = true; for (Timeframe timeframe : daytimes) { ChatColor color = isInHourTimeframe(timeframe) ? ChatColor.GREEN : ChatColor.DARK_RED; if (!first) { - builder.append(" | ").color(ChatColor.WHITE); + builder.append(" & ").color(ChatColor.WHITE); } else { first = false; if (!weekdays.isEmpty()) { - builder.append(" & ").color(ChatColor.WHITE); + builder.append(" | ").color(ChatColor.WHITE); } } builder.append(timeframe.getStart() + "-" + timeframe.getEnd()).color(color); diff --git a/core/src/main/resources/languages/english.yml b/core/src/main/resources/languages/english.yml index 93f4ac9f..70af4acf 100644 --- a/core/src/main/resources/languages/english.yml +++ b/core/src/main/resources/languages/english.yml @@ -107,6 +107,14 @@ cmd: uninvite: help: "/dxl uninvite [player] [map] - Uninvite a player from editing a map" success: "&4&v1&6's permission to edit the map &4&v2&6 has been removed successfully." +dayOfWeek: + 0: "Sunday" + 1: "Monday" + 2: "Tuesday" + 3: "Wednesday" + 4: "Thursday" + 5: "Friday" + 6: "Saturday" error: bed: "&4You cannot use a bed while in a dungeon." blockOwnTeam: "&4This block belongs to your own group." diff --git a/core/src/main/resources/languages/french.yml b/core/src/main/resources/languages/french.yml index c090cdff..ad329f93 100644 --- a/core/src/main/resources/languages/french.yml +++ b/core/src/main/resources/languages/french.yml @@ -103,6 +103,14 @@ cmd: uninvite: help: "/dxl uninvite [player] [dungeon] - Désinvite un joueur à éditer un donjon" success: "&4&v1&6 a été désinviter avec succès à éditer la carte &4&v1&6." +dayOfWeek: + 0: "Dimanche" + 1: "Lundi" + 2: "Mardi" + 3: "Mercredi" + 4: "Jeudi" + 5: "Vendredi" + 6: "Samedi" error: bed: "&4Vous ne pouvez utiliser un lit en étant dans un donjon." blockOwnTeam: "&4Ce bloque appartient à votre groupe." @@ -178,7 +186,7 @@ button: player: blockInfo: "&6Block ID: &2&v1" checkpointReached: "&6Point de sauvegarde atteint." - death: "&6Vous êtes mort, vies restantes: &2&v1" + death: "&4&v1 &6est mort, vies restantes: &4&v2" deathKick: "&2&v1&6 est mort et a perdu sa dernière vie." finishedDungeon: "&6Vous avez terminé le donjon avec succès." finished_Floor: "&6Vous avez terminé l'étage avec succès." diff --git a/core/src/main/resources/languages/german.yml b/core/src/main/resources/languages/german.yml index 83716d51..ccd988f5 100644 --- a/core/src/main/resources/languages/german.yml +++ b/core/src/main/resources/languages/german.yml @@ -107,6 +107,14 @@ cmd: uninvite: help: "/dxl uninvite [player] [map] - Lädt einen Spieler davon aus, eine Welt zu bearbeiten" success: "&4&v1&6's Berechtigung zum Bearbeiten der Welt &4&v2&6 wurde erfolgreich entfernt." +dayOfWeek: + 0: "Sonntag" + 1: "Montag" + 2: "Dienstag" + 3: "Mittwoch" + 4: "Donnerstag" + 5: "Freitag" + 6: "Samstag" error: bed: "&4Du kannst im Dungeon kein Bett benutzen." blockOwnTeam: "&4Dieser Block gehört zu Deiner eigenen Gruppe."