diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..65f7076 --- /dev/null +++ b/build.ps1 @@ -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 .. \ No newline at end of file diff --git a/src/main/java/rip/iwakura/civilcore/commands/TeamChatCommand.java b/src/main/java/rip/iwakura/civilcore/commands/TeamChatCommand.java index 0a729e0..c931b6a 100644 --- a/src/main/java/rip/iwakura/civilcore/commands/TeamChatCommand.java +++ b/src/main/java/rip/iwakura/civilcore/commands/TeamChatCommand.java @@ -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; }