SteamWar/BungeeCore
Archiviert
13
2

Automatic Random arena when not specified
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-09-12 21:48:42 +02:00
Ursprung dbc9ed8b57
Commit 6fe4dbe13a
4 geänderte Dateien mit 3 neuen und 46 gelöschten Zeilen

Datei anzeigen

@ -87,34 +87,6 @@ public class FightCommand extends SWCommand {
sender.sendMessage(ChatMessageType.SYSTEM, start); sender.sendMessage(ChatMessageType.SYSTEM, start);
} }
private static void getMaps(ChatSender sender, String precommand, ArenaMode mode){
TextComponent start = new TextComponent();
TextComponent current = start;
if(mode.getMaps().size() > 1){
String command = precommand + mode.getChatName() + " Random";
start.setBold(true);
start.setColor(ChatColor.GRAY);
start.setText(sender.parseToPlain("FIGHT_ARENA_RANDOM") + " ");
start.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§e" + command)));
start.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command));
current = new TextComponent();
}
for(String map : mode.getMaps()){
String command = precommand + mode.getChatName() + " " + map;
current.setBold(true);
current.setColor(ChatColor.GRAY);
current.setText(map + " ");
current.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("§e" + command)));
current.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command));
if(current != start)
start.addExtra(current);
current = new TextComponent();
}
sender.sendMessage(ChatMessageType.SYSTEM, start);
}
private static boolean alreadyInArena(ProxiedPlayer player){ private static boolean alreadyInArena(ProxiedPlayer player){
Subserver subserver = Subserver.getSubserver(player); Subserver subserver = Subserver.getSubserver(player);
if(subserver != null && subserver.getType() == Servertype.ARENA){ if(subserver != null && subserver.getType() == Servertype.ARENA){
@ -136,16 +108,8 @@ public class FightCommand extends SWCommand {
return; return;
} }
if (map == null) { if (map == null)
if (arenaMode.getMaps().size() == 1) {
map = arenaMode.getRandomMap(); map = arenaMode.getRandomMap();
} else {
getMaps(sender, precommand, arenaMode);
return;
}
} else if (map.equalsIgnoreCase("random")) {
map = arenaMode.getRandomMap();
}
if (!allowMerging) { if (!allowMerging) {
callback.run(player, arenaMode, map); callback.run(player, arenaMode, map);

Datei anzeigen

@ -21,18 +21,16 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.ArenaMode; import de.steamwar.bungeecore.ArenaMode;
import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker; import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker;
import de.steamwar.sql.Punishment;
import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator; import de.steamwar.command.TypeValidator;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import de.steamwar.sql.Punishment;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List;
@UtilityClass @UtilityClass
public class TypeMappers { public class TypeMappers {
@ -78,7 +76,6 @@ public class TypeMappers {
@Override @Override
public String map(CommandSender commandSender, String[] previousArguments, String s) { public String map(CommandSender commandSender, String[] previousArguments, String s) {
if (previousArguments.length == 0) return null; if (previousArguments.length == 0) return null;
if (s.equalsIgnoreCase("random")) return "random";
return ArenaMode.getByChat(previousArguments[previousArguments.length - 1]).convertToRealMapName(s); return ArenaMode.getByChat(previousArguments[previousArguments.length - 1]).convertToRealMapName(s);
} }
@ -87,9 +84,7 @@ public class TypeMappers {
if (previousArguments.length == 0) return null; if (previousArguments.length == 0) return null;
ArenaMode arenaMode = ArenaMode.getByChat(previousArguments[previousArguments.length - 1]); ArenaMode arenaMode = ArenaMode.getByChat(previousArguments[previousArguments.length - 1]);
if (arenaMode == null) return null; if (arenaMode == null) return null;
List<String> stringList = new ArrayList<>(arenaMode.getMaps()); return arenaMode.getMaps();
stringList.add("random");
return stringList;
} }
}; };
} }

Datei anzeigen

@ -269,7 +269,6 @@ EVENTRESCHEDULE_STARTING=§aFight starts in 30s
#FightCommand #FightCommand
FIGHT_UNKNOWN_GAMEMODE=§cUnknown gamemode: {0} FIGHT_UNKNOWN_GAMEMODE=§cUnknown gamemode: {0}
FIGHT_UNKNOWN_ARENA=§cThe desired arena does not exist. FIGHT_UNKNOWN_ARENA=§cThe desired arena does not exist.
FIGHT_ARENA_RANDOM=Random
FIGHT_IN_ARENA=§cYou are already in an arena. FIGHT_IN_ARENA=§cYou are already in an arena.
FIGHT_BROADCAST=§7Click §ehere§7 to fight §e{0} §7against §e{1}! FIGHT_BROADCAST=§7Click §ehere§7 to fight §e{0} §7against §e{1}!
FIGHT_BROADCAST_HOVER=§aFight §eagainst §7{1} FIGHT_BROADCAST_HOVER=§aFight §eagainst §7{1}

Datei anzeigen

@ -253,7 +253,6 @@ EVENTRESCHEDULE_STARTING=§aKampf startet in 30s
#FightCommand #FightCommand
FIGHT_UNKNOWN_GAMEMODE=§cUnbekannter Spielmodus: {0} FIGHT_UNKNOWN_GAMEMODE=§cUnbekannter Spielmodus: {0}
FIGHT_UNKNOWN_ARENA=§cDie gewünschte Arena gibt es nicht. FIGHT_UNKNOWN_ARENA=§cDie gewünschte Arena gibt es nicht.
FIGHT_ARENA_RANDOM=Random
FIGHT_IN_ARENA=§cDu befindest dich bereits in einer Arena. FIGHT_IN_ARENA=§cDu befindest dich bereits in einer Arena.
FIGHT_BROADCAST=§7Klicke §ehier§7, um §e{0} §7gegen §e{1} §7zu §7kämpfen! FIGHT_BROADCAST=§7Klicke §ehier§7, um §e{0} §7gegen §e{1} §7zu §7kämpfen!
FIGHT_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen FIGHT_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen