SteamWar/BungeeCore
Archiviert
13
2

Adding server list

Dieser Commit ist enthalten in:
Lixfel 2019-07-12 15:47:51 +02:00
Ursprung 607ba097e4
Commit cbae6bdef1

Datei anzeigen

@ -1,7 +1,5 @@
package de.steamwar.bungeecore;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import de.steamwar.bungeecore.commands.BauCommand;
import de.steamwar.bungeecore.sql.BannedUserIPs;
import de.steamwar.bungeecore.sql.WarkingUser;
@ -13,13 +11,12 @@ 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 net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.Connection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.*;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
public class PlayerListener implements Listener {
@ -113,10 +110,22 @@ public class PlayerListener implements Listener {
break;
}
for(Subserver subserver : Subserver.getServerList()){
if(subserver.getType() == Servertype.ARENA){
Iterator<ProxiedPlayer> it = subserver.getServer().getPlayers().iterator();
if(it.hasNext()){
TextComponent tc = new TextComponent(BungeeCore.ChatPrefix + "§7Klicke §ehier§7, um §e" + subserver.getServer().getName() + " §7beizutreten");
tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eArena beitreten").create()));
tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + it.next().getName()));
player.sendMessage(tc);
}
}
}
if(player.getPendingConnection().getVersion() < 335){
player.sendMessage(BungeeCore.ChatPrefix + "§cWir empfehlen die Minecraft-Version 1.12.2");
}
/*
ByteArrayDataOutput output = ByteStreams.newDataOutput();
output.writeUTF("FML|HS");
@ -128,7 +137,7 @@ public class PlayerListener implements Listener {
player.sendData("REGISTER", output.toByteArray());
}
player.sendData("FML|HS", new byte[]{0, 2, 0, 0, 0, 0});
player.sendData("FML|HS", new byte[]{0, 2, 0, 0, 0, 0});*/
}
/** To redirect players to the lobby in case of server closure. */
@ -249,7 +258,7 @@ public class PlayerListener implements Listener {
}
}
@EventHandler
/*@EventHandler
public void onPluginMessageEvent(PluginMessageEvent e){
System.out.println(e.getSender().getAddress().getHostString() + " " + e.getTag() + " " + Arrays.toString(e.getData()));
@ -336,5 +345,5 @@ public class PlayerListener implements Listener {
} while ((read & 0b10000000) != 0);
return numRead;
}
}*/
}