Archiviert
1
0

Add ServerTeamchatCommand MultiLang

Dieser Commit ist enthalten in:
Chaoscaot 2021-01-19 01:54:50 +01:00
Ursprung c15f4a8e62
Commit 0d6eecbbd4
3 geänderte Dateien mit 10 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -53,7 +53,6 @@ import java.util.logging.Level;
public class BungeeCore extends Plugin { public class BungeeCore extends Plugin {
public static final String SERVER_TEAMCHAT_PREFIX = "§8STC §e";
public static final String TEAMCHAT_PREFIX = "§8TC §e"; public static final String TEAMCHAT_PREFIX = "§8TC §e";
public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy"); public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy");

Datei anzeigen

@ -19,7 +19,7 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
@ -37,27 +37,26 @@ public class ServerTeamchatCommand extends BasicCommand {
ProxiedPlayer player = (ProxiedPlayer) sender; ProxiedPlayer player = (ProxiedPlayer) sender;
if(args.length == 0){ if(args.length == 0){
player.sendMessage(BungeeCore.CHAT_PREFIX + "/stc [Nachricht an das Team]"); Message.sendPrefixless("STC_SYNTAX", player);
return; return;
} }
StringBuilder msgBuilder = new StringBuilder(); StringBuilder msgBuilder = new StringBuilder();
msgBuilder.append(BungeeCore.SERVER_TEAMCHAT_PREFIX).append(sender.getName()).append("» §r");
for (String arg : args){ for (String arg : args){
msgBuilder.append(arg).append(" "); msgBuilder.append(arg).append(" ");
} }
String msg = msgBuilder.toString(); String msg = msgBuilder.toString();
msg = ChatColor.translateAlternateColorCodes('&', msg); msg = ChatColor.translateAlternateColorCodes('&', msg);
sendToTeam(msg); sendToTeam(msg, player);
} }
} }
public static void sendToTeam(String message){ public static void sendToTeam(String message, ProxiedPlayer sender){
for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
if ((target.hasPermission("bungeecore.teamchat")) if ((target.hasPermission("bungeecore.teamchat"))
&& target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN){ && target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN){
BungeeCore.send(target, message); Message.send("STC_FORMAT", target, sender.getName(), message);
} }
} }
} }

Datei anzeigen

@ -279,4 +279,8 @@ REGELN_WG_HOVER=§7https://steamwar.de/spielmodi/wargear-regelwerk/
REGELN_WG_URL=https://steamwar.de/spielmodi/wargear-regelwerk/ REGELN_WG_URL=https://steamwar.de/spielmodi/wargear-regelwerk/
REGELN_WS=§eWarShip§8-§7Regelwerk REGELN_WS=§eWarShip§8-§7Regelwerk
REGELN_WS_HOVER=§7https://steamwar.de/spielmodi/warship-regelwerk/ REGELN_WS_HOVER=§7https://steamwar.de/spielmodi/warship-regelwerk/
REGELN_WS_URL=https://steamwar.de/spielmodi/warship-regelwerk/ REGELN_WS_URL=https://steamwar.de/spielmodi/warship-regelwerk/
#ServerTeamchatCommand
STC_SYNTAX=/stc [Nachricht an das Team]
STC_FORMAT=§8STC §e{0}» §r{1}