forked from SteamWar/SteamWar
Offer fight instead of local in /chat on arenas
This commit is contained in:
@@ -30,6 +30,7 @@ import de.steamwar.messages.PlayerChatter;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import de.steamwar.velocitycore.chat.ChatChannel;
|
||||
import de.steamwar.velocitycore.chat.ChatManager;
|
||||
import de.steamwar.velocitycore.chat.LocalChannel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -84,6 +85,7 @@ public class ChatCommand extends SWCommand {
|
||||
return switch (s.toLowerCase()) {
|
||||
case "global" -> ChatManager.getGlobal();
|
||||
case "local" -> sender.getPlayer() == null ? null : ChatManager.currentLocal(sender.getPlayer());
|
||||
case "fight" -> onArena(sender) ? ChatManager.currentLocal(sender.getPlayer()) : null;
|
||||
case "team", "tc" -> sender.user().getTeam() != 0 ? ChatManager.team(sender.user().getTeam()) : null;
|
||||
case "serverteam", "stc" -> sender.user().hasPerm(UserPerm.TEAM) ? ChatManager.getServerTeam() : null;
|
||||
default -> arena(sender, s);
|
||||
@@ -97,7 +99,8 @@ public class ChatCommand extends SWCommand {
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(Chatter sender, PreviousArguments previousArguments, String s) {
|
||||
List<String> channels = new ArrayList<>(List.of("global", "local"));
|
||||
// On arenas the local chat is the fight chat
|
||||
List<String> channels = new ArrayList<>(List.of("global", onArena(sender) ? "fight" : "local"));
|
||||
if (sender.user().getTeam() != 0) channels.add("team");
|
||||
if (sender.user().hasPerm(UserPerm.TEAM)) channels.add("serverteam");
|
||||
if (sender.user().hasPerm(UserPerm.MODERATION)) {
|
||||
@@ -108,6 +111,13 @@ public class ChatCommand extends SWCommand {
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean onArena(Chatter sender) {
|
||||
if (sender.getPlayer() == null) return false;
|
||||
|
||||
LocalChannel local = ChatManager.currentLocal(sender.getPlayer());
|
||||
return local != null && local.isArena();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moderators can address the fight chat of every fight server by its server name.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user