From 01f40b9440f58a410dc63b91cb3cf04fe57b90ff Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 23 Nov 2020 18:26:04 +0100 Subject: [PATCH] Changing Messages --- src/de/steamwar/bungeecore/sql/Punishment.java | 3 ++- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 16 ++++++++++------ src/de/steamwar/messages/BungeeCore.properties | 5 +++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 72e5c0a..e39f854 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.sql; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import java.sql.ResultSet; import java.sql.SQLException; @@ -136,7 +137,7 @@ public class Punishment { public String getBantime(Timestamp endTime, boolean perma) { if(perma) - return "Permanent"; + return Message.parse("BAN_PERMA", SteamwarUser.get(user).getPlayer()); else return endTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT); } diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 0916686..62dc67c 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.sql; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.commands.WebregisterCommand; import de.steamwar.bungeecore.listeners.ConnectionListener; import net.md_5.bungee.api.ProxyServer; @@ -148,6 +149,10 @@ public class SteamwarUser { return team; } + public ProxiedPlayer getPlayer() { + return BungeeCore.get().getProxy().getPlayer(uuid); + } + public boolean isBanned() { if(!punishments.containsKey(Punishment.PunishmentType.Ban)) return false; @@ -172,20 +177,19 @@ public class SteamwarUser { public TextComponent banMessage(){ Punishment punishment = punishments.get(Punishment.PunishmentType.Ban); if (punishment.isPerma()) { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gebannt. §r§lGrund§r: §c" + punishment.getReason()); + return BungeeCore.stringToText(Message.parsePrefixed("BANNED_MESSAGE_PERMA", getPlayer(), punishment.getReason())); } else { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " + - punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gebannt. §r§lGrund§r: §c" + punishment.getReason()); + return BungeeCore.stringToText(Message.parsePrefixed("BANNED_MESSAGE_UNTIL", getPlayer(), punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT), + punishment.getReason())); } } public TextComponent muteMessage(){ Punishment punishment = punishments.get(Punishment.PunishmentType.Mute); if (punishment.isPerma()) { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gemuted. §r§lGrund§r: §c" + punishment.getReason()); + return BungeeCore.stringToText(Message.parsePrefixed("MUTED_MESSAGE_PERMA", getPlayer(), punishment.getReason())); } else { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " + - punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gemuted. §r§lGrund§r: §c" + punishment.getReason()); + return BungeeCore.stringToText(Message.parsePrefixed("MUTED_MESSAGE_UNTIL",getPlayer(), punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT), punishment.getReason())); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 8f2a672..8d08c2c 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -68,7 +68,12 @@ USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] ALERT=§f{0} BAN_TEAM_BANNED=§c {0} wurde von {1} {2} gebannt. §f§lGrund: §f{3} +BANNED_MESSAGE_PERMA=§cDu bist permanent gebannt. §r§lGrund§r: §c{0} +BANNED_MESSAGE_UNTIL=Du bist bis zum {0} gebannt. §r§lGrund§r: §c{1} MUTE_TEAM_MUTED=§c {0} wurde von {1} {2} gemuted. §f§lGrund: §f{3} +MUTED_MESSAGE_PERMA=§cDu bist permanent gemuted. §r§lGrund§r: §c{0} +MUTED_MESSAGE_UNTIL=Du bist bis zum {0} gemuted. §r§lGrund§r: §c{1} +BAN_CHANGED={0} verändert von {1} von BAN_INVALID_TIME=§cUngültige Zeitangabe. BAN_PERMA=Permanent BAN_UNTIL=bis zum