Archiviert
1
0

Merge branch 'historic-change'

Dieser Commit ist enthalten in:
Lixfel 2020-05-10 19:01:10 +02:00
Commit 02ac53b9fd
6 geänderte Dateien mit 63 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -42,6 +42,7 @@ public class ArenaMode {
private final List<String> chatNames; private final List<String> chatNames;
private final String serverJar; private final String serverJar;
private final List<String> maps; private final List<String> maps;
private final boolean historic;
private ArenaMode(String internalName, Configuration config){ private ArenaMode(String internalName, Configuration config){
this.internalName = internalName; this.internalName = internalName;
@ -49,6 +50,7 @@ public class ArenaMode {
this.serverJar = config.getString("serverJar"); this.serverJar = config.getString("serverJar");
this.chatNames = config.getStringList("chatNames"); this.chatNames = config.getStringList("chatNames");
this.maps = config.getStringList("maps"); this.maps = config.getStringList("maps");
this.historic = config.getBoolean("historic");
allModes.add(this); allModes.add(this);
byInternal.put(internalName, this); byInternal.put(internalName, this);
@ -92,4 +94,8 @@ public class ArenaMode {
public boolean hasChatName(){ public boolean hasChatName(){
return !chatNames.isEmpty(); return !chatNames.isEmpty();
} }
public boolean isHistoric(){
return historic;
}
} }

Datei anzeigen

@ -92,6 +92,7 @@ public class BungeeCore extends Plugin {
new BugCommand(); new BugCommand();
new WhoisCommand(); new WhoisCommand();
new RegelnCommand(); new RegelnCommand();
new HistoricCommand();
new EventStarter(); new EventStarter();
new Broadcaster(); new Broadcaster();

Datei anzeigen

@ -35,7 +35,7 @@ public class ChallengeCommand extends BasicCommand {
return; return;
} }
FightCommand.createArena(sender, "/challenge " + target.getName() + " ", args, 1, (player, mode, map) -> { FightCommand.createArena(sender, "/challenge " + target.getName() + " ", args, 1, false, (player, mode, map) -> {
if(challenges.containsKey(target) && challenges.get(target).contains(player)){ if(challenges.containsKey(target) && challenges.get(target).contains(player)){
challenges.remove(target); challenges.remove(target);
challenges.remove(player); challenges.remove(player);

Datei anzeigen

@ -46,11 +46,11 @@ public class FightCommand extends BasicCommand {
return null; return null;
} }
private static void getModes(CommandSender sender, String precommand){ private static void getModes(CommandSender sender, String precommand, boolean historic){
TextComponent start = new TextComponent(); TextComponent start = new TextComponent();
TextComponent current = start; TextComponent current = start;
for(ArenaMode mode : ArenaMode.getAllModes()){ for(ArenaMode mode : ArenaMode.getAllModes()){
if(!mode.hasChatName()) if(!mode.hasChatName() || mode.isHistoric() != historic)
continue; continue;
String command = precommand + mode.getChatName(); String command = precommand + mode.getChatName();
current.setBold(true); current.setBold(true);
@ -104,7 +104,7 @@ public class FightCommand extends BasicCommand {
return false; return false;
} }
static void createArena(CommandSender sender, String precommand, String[] args, int startArg, FightCallback callback){ static void createArena(CommandSender sender, String precommand, String[] args, int startArg, boolean historic, FightCallback callback){
if(!(sender instanceof ProxiedPlayer)) if(!(sender instanceof ProxiedPlayer))
return; return;
@ -113,7 +113,7 @@ public class FightCommand extends BasicCommand {
return; return;
if(args.length < startArg+1){ if(args.length < startArg+1){
getModes(sender, precommand); getModes(sender, precommand, historic);
return; return;
} }
@ -139,7 +139,7 @@ public class FightCommand extends BasicCommand {
@Override @Override
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
createArena(sender, "/fight ", args, 0, (player, mode, map) -> { createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> {
Subserver arena = SubserverSystem.startArena(mode, map, 0, null, null, player.getUniqueId(), null); Subserver arena = SubserverSystem.startArena(mode, map, 0, null, null, player.getUniqueId(), null);
arena.sendPlayer(player); arena.sendPlayer(player);
TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§7, um §e" + mode.getDisplayName() + " §7gegen §e" + player.getName() + " §7zu §7kämpfen!"); TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§7, um §e" + mode.getDisplayName() + " §7gegen §e" + player.getName() + " §7zu §7kämpfen!");

Datei anzeigen

@ -41,6 +41,11 @@ public class HelpCommand extends BasicCommand {
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge")); tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge"));
sender.sendMessage(tc); sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Starte mit §8/§ehistoric §7einen historischen Kampf!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eHistorische Kämpfe").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/historic"));
sender.sendMessage(tc);
tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§8/§eteam§7 für das Teamsystem!"); tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§8/§eteam§7 für das Teamsystem!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eTeamverwaltung").create())); tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eTeamverwaltung").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team")); tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team"));

Datei anzeigen

@ -0,0 +1,45 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.ArenaMode;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.SubserverSystem;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import java.util.LinkedList;
public class HistoricCommand extends BasicCommand {
public HistoricCommand() {
super("historic", null);
}
@Override
public void execute(CommandSender sender, String[] args) {
FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> {
Subserver arena = SubserverSystem.startArena(mode, map, 0, null, null, player.getUniqueId(), null);
arena.sendPlayer(player);
TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Historischer §e" + mode.getDisplayName() + "§8-§7Kampf von §e" + player.getName() + " §8!");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aGegen §7" + player.getName() + " §ekämpfen").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()));
ProxyServer.getInstance().broadcast(tc);
});
}
@Override
public Iterable<String> onTabComplete(CommandSender commandSender, String[] args) {
if(args.length == 1){
return ArenaMode.getAllChatNames();
}else if(args.length == 2){
ArenaMode mode = ArenaMode.getByChat(args[1]);
if(mode == null)
return new LinkedList<>();
return mode.getMaps();
}
return new LinkedList<>();
}
}