code that i havnt tested, gn chat

This commit is contained in:
grng 2024-07-25 00:35:52 +01:00
parent fc27e415f4
commit 08cfd82d09
2 changed files with 41 additions and 3 deletions

10
build.ps1 Normal file
View file

@ -0,0 +1,10 @@
# Check if the test_server directory exists, if not, create it
if (-not (Test-Path -Path test_server)) {
New-Item -ItemType Directory -Path test_server
}
# mvn clean package dependency:copy -DskipTests -DoutputDirectory=test_server/plugins
Set-Location -Path test_server
java -jar server.jar -nogui
Set-Location -Path ..

View file

@ -30,9 +30,9 @@ public class TeamChatCommand implements CommandExecutor {
Player p = (Player) sender;
if (civilCore.teamChatRegister.contains(p)) {
/*if (civilCore.teamChatRegister.contains(p)) {
civilCore.teamChatRegister.remove(p);
p.sendMessage(ChatColor.RED + "Team chat has been disabled.");
p.sendMessage(ChatColor.GREEN + "You are now in the " + ChatColor.GOLD + "GLOBAL" + ChatColor.GREEN + " channel");
return true;
}
@ -41,7 +41,35 @@ public class TeamChatCommand implements CommandExecutor {
return true;
}
civilCore.teamChatRegister.add(p);
p.sendMessage(ChatColor.GREEN + "Team chat has been enabled.");
p.sendMessage(ChatColor.GREEN + "You are now in the " + ChatColor.GOLD + "TEAM" + ChatColor.GREEN + " channel");*/
// /c [msg] -> if team chat toggled: broadcast to global chat, if global chat toggled send to team
// /tc or /c -> switch between global chat & team chat
if (args.length == 0) {
if (civilCore.teamChatRegister.contains(p)) {
civilCore.teamChatRegister.remove(p);
p.sendMessage(ChatColor.GREEN + "You are now in the " + ChatColor.GOLD + "GLOBAL" + ChatColor.GREEN + " channel");
return true;
} else {
civilCore.teamChatRegister.add(p);
p.sendMessage(ChatColor.GREEN + "You are now in the " + ChatColor.GOLD + "TEAM" + ChatColor.GREEN + " channel");
return true;
}
}
String message = String.join(" ", args);
if (civilCore.teamChatRegister.contains(p)) {
civilCore.teamChatRegister.remove(p);
Bukkit.broadcastMessage(ChatColor.DARK_GREEN + "TEAM > " + ChatColor.GREEN + p.getName() + ": " + message);
civilCore.teamChatRegister.add(p);
} else {
civilCore.teamChatRegister.add(p);
Bukkit.broadcastMessage(p.getName() + ": " + message);
civilCore.teamChatRegister.remove(p);
}
return true;
}