Improve timeframe requirement check message

This commit is contained in:
Daniel Saukel 2020-04-17 17:14:12 +02:00
parent 1cecd77d80
commit 85bfacc9ec
5 changed files with 46 additions and 6 deletions

View File

@ -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"),

View File

@ -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<T> {
@ -138,22 +143,26 @@ public class TimeframeRequirement implements Requirement {
for (Timeframe<Weekday> 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<Integer> 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);

View File

@ -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."

View File

@ -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."

View File

@ -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."