Changing historic modes to other command
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
861d87e259
Commit
bad085ffa1
@ -42,6 +42,7 @@ public class ArenaMode {
|
||||
private final List<String> chatNames;
|
||||
private final String serverJar;
|
||||
private final List<String> maps;
|
||||
private final boolean historic;
|
||||
|
||||
private ArenaMode(String internalName, Configuration config){
|
||||
this.internalName = internalName;
|
||||
@ -49,6 +50,7 @@ public class ArenaMode {
|
||||
this.serverJar = config.getString("serverJar");
|
||||
this.chatNames = config.getStringList("chatNames");
|
||||
this.maps = config.getStringList("maps");
|
||||
this.historic = config.getBoolean("historic");
|
||||
|
||||
allModes.add(this);
|
||||
byInternal.put(internalName, this);
|
||||
@ -92,4 +94,8 @@ public class ArenaMode {
|
||||
public boolean hasChatName(){
|
||||
return !chatNames.isEmpty();
|
||||
}
|
||||
|
||||
public boolean isHistoric(){
|
||||
return historic;
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ public class BungeeCore extends Plugin {
|
||||
new BugCommand();
|
||||
new WhoisCommand();
|
||||
new RegelnCommand();
|
||||
new HistoricCommand();
|
||||
|
||||
new EventStarter();
|
||||
new Broadcaster();
|
||||
|
@ -35,7 +35,7 @@ public class ChallengeCommand extends BasicCommand {
|
||||
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)){
|
||||
challenges.remove(target);
|
||||
challenges.remove(player);
|
||||
|
@ -46,11 +46,11 @@ public class FightCommand extends BasicCommand {
|
||||
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 current = start;
|
||||
for(ArenaMode mode : ArenaMode.getAllModes()){
|
||||
if(!mode.hasChatName())
|
||||
if(!mode.hasChatName() || mode.isHistoric() != historic)
|
||||
continue;
|
||||
String command = precommand + mode.getChatName();
|
||||
current.setBold(true);
|
||||
@ -104,7 +104,7 @@ public class FightCommand extends BasicCommand {
|
||||
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))
|
||||
return;
|
||||
|
||||
@ -113,7 +113,7 @@ public class FightCommand extends BasicCommand {
|
||||
return;
|
||||
|
||||
if(args.length < startArg+1){
|
||||
getModes(sender, precommand);
|
||||
getModes(sender, precommand, historic);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ public class FightCommand extends BasicCommand {
|
||||
|
||||
@Override
|
||||
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);
|
||||
arena.sendPlayer(player);
|
||||
TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§7, um §e" + mode.getDisplayName() + " §7gegen §e" + player.getName() + " §7zu §7kämpfen!");
|
||||
|
@ -41,6 +41,11 @@ public class HelpCommand extends BasicCommand {
|
||||
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge"));
|
||||
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.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eTeamverwaltung").create()));
|
||||
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team"));
|
||||
|
45
src/de/steamwar/bungeecore/commands/HistoricCommand.java
Normale Datei
45
src/de/steamwar/bungeecore/commands/HistoricCommand.java
Normale Datei
@ -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<>();
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren