Added 2FA command for ayonull's server list, added 'hide_down' flag to default server list
This commit is contained in:
parent
ed0af28196
commit
a91336f03e
9 changed files with 44 additions and 17 deletions
|
@ -60,6 +60,7 @@ import net.md_5.bungee.command.CommandSend;
|
|||
import net.md_5.bungee.command.CommandPerms;
|
||||
import net.md_5.bungee.command.CommandBungee;
|
||||
import net.md_5.bungee.command.CommandClearRatelimit;
|
||||
import net.md_5.bungee.command.CommandConfirmCode;
|
||||
import net.md_5.bungee.command.CommandAlert;
|
||||
import net.md_5.bungee.command.CommandIP;
|
||||
import net.md_5.bungee.command.CommandServer;
|
||||
|
@ -154,6 +155,7 @@ public class BungeeCord extends ProxyServer {
|
|||
this.getPluginManager().registerCommand(null, new CommandSend());
|
||||
this.getPluginManager().registerCommand(null, new CommandFind());
|
||||
this.getPluginManager().registerCommand(null, new CommandClearRatelimit());
|
||||
this.getPluginManager().registerCommand(null, new CommandConfirmCode());
|
||||
this.registerChannel("BungeeCord");
|
||||
Log.setOutput(new PrintStream(ByteStreams.nullOutputStream()));
|
||||
AnsiConsole.systemInstall();
|
||||
|
|
|
@ -19,6 +19,8 @@ public class QueryConnectionImpl implements QueryConnection {
|
|||
protected List<String> packetBuffer = new LinkedList();
|
||||
protected long creationTime;
|
||||
protected boolean keepAlive = false;
|
||||
|
||||
public static String confirmHash = null;
|
||||
|
||||
public QueryConnectionImpl(ListenerInfo listener, InetAddress addr, WebSocket socket, String accept) {
|
||||
this.listener = listener;
|
||||
|
|
|
@ -95,9 +95,9 @@ public class WebSocketListener extends WebSocketServer {
|
|||
if(o instanceof PendingSocket) {
|
||||
InetAddress realAddr = ((PendingSocket)o).realAddress;
|
||||
arg1 = arg1.trim().toLowerCase();
|
||||
QueryConnectionImpl con;
|
||||
if(arg1.startsWith("accept:")) {
|
||||
arg1 = arg1.substring(7).trim();
|
||||
QueryConnectionImpl con;
|
||||
WebsocketQueryEvent evt;
|
||||
if(arg1.startsWith("motd")) {
|
||||
if(info.isAllowMOTD()) {
|
||||
|
@ -121,7 +121,12 @@ public class WebSocketListener extends WebSocketServer {
|
|||
return;
|
||||
}
|
||||
}else {
|
||||
if(info.isAllowQuery()) {
|
||||
if(QueryConnectionImpl.confirmHash != null && arg1.equalsIgnoreCase(QueryConnectionImpl.confirmHash)) {
|
||||
QueryConnectionImpl.confirmHash = null;
|
||||
arg0.send("OK");
|
||||
arg0.close();
|
||||
return;
|
||||
}else if(info.isAllowQuery()) {
|
||||
if(ratelimitQuery != null && !BanList.isBlockedBan(realAddr)) {
|
||||
RateLimit l = ratelimitQuery.rateLimit(realAddr);
|
||||
if(l.blocked()) {
|
||||
|
|
|
@ -4,7 +4,7 @@ public class ConfigConstants {
|
|||
|
||||
public static boolean profanity = false;
|
||||
|
||||
public static final String version = "22w14d";
|
||||
public static final String version = "22w15a";
|
||||
public static final String mainMenuString = "eaglercraft " + version;
|
||||
|
||||
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";
|
||||
|
|
|
@ -248,7 +248,7 @@ public class Minecraft implements Runnable {
|
|||
|
||||
String s = EaglerAdapter.getServerToJoinOnLaunch();
|
||||
if(s != null) {
|
||||
this.displayGuiScreen(new GuiScreenEditProfile(new GuiConnecting(new GuiMainMenu(), this, new ServerData("Eaglercraft Server", s))));
|
||||
this.displayGuiScreen(new GuiScreenEditProfile(new GuiConnecting(new GuiMainMenu(), this, new ServerData("Eaglercraft Server", s, false))));
|
||||
}else {
|
||||
this.displayGuiScreen(new GuiScreenEditProfile(new GuiMainMenu()));
|
||||
}
|
||||
|
|
|
@ -174,14 +174,14 @@ public class GuiMultiplayer extends GuiScreen {
|
|||
this.joinServer(this.selectedServer);
|
||||
} else if (par1GuiButton.id == 4) {
|
||||
this.directClicked = true;
|
||||
this.mc.displayGuiScreen(new GuiScreenServerList(this, this.theServerData = new ServerData(StatCollector.translateToLocal("selectServer.defaultName"), "")));
|
||||
this.mc.displayGuiScreen(new GuiScreenServerList(this, this.theServerData = new ServerData(StatCollector.translateToLocal("selectServer.defaultName"), "", false)));
|
||||
} else if (par1GuiButton.id == 3) {
|
||||
this.addClicked = true;
|
||||
this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.theServerData = new ServerData(StatCollector.translateToLocal("selectServer.defaultName"), "")));
|
||||
this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.theServerData = new ServerData(StatCollector.translateToLocal("selectServer.defaultName"), "", false)));
|
||||
} else if (par1GuiButton.id == 7) {
|
||||
this.editClicked = true;
|
||||
ServerData var9 = this.internetServerList.getServerData(this.selectedServer);
|
||||
this.theServerData = new ServerData(var9.serverName, var9.serverIP);
|
||||
this.theServerData = new ServerData(var9.serverName, var9.serverIP, false);
|
||||
this.theServerData.setHideAddress(var9.isHidingAddress());
|
||||
this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.theServerData));
|
||||
} else if (par1GuiButton.id == 0) {
|
||||
|
|
|
@ -108,9 +108,9 @@ public class ItemRenderer {
|
|||
}
|
||||
|
||||
EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL);
|
||||
|
||||
EaglerAdapter.flipLightMatrix();
|
||||
}
|
||||
|
||||
EaglerAdapter.flipLightMatrix();
|
||||
|
||||
EaglerAdapter.glPopMatrix();
|
||||
}
|
||||
|
|
|
@ -46,13 +46,15 @@ public class ServerData {
|
|||
public boolean hasError = false;
|
||||
public List<String> playerList = new ArrayList();
|
||||
public int serverIconGL = -1;
|
||||
public final boolean isDefault;
|
||||
|
||||
/** Whether to hide the IP address for this server. */
|
||||
private boolean hideAddress = false;
|
||||
|
||||
public ServerData(String par1Str, String par2Str) {
|
||||
public ServerData(String par1Str, String par2Str, boolean isDefault) {
|
||||
this.serverName = par1Str;
|
||||
this.serverIP = par2Str;
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +96,7 @@ public class ServerData {
|
|||
* instance.
|
||||
*/
|
||||
public static ServerData getServerDataFromNBTCompound(NBTTagCompound par0NBTTagCompound) {
|
||||
ServerData var1 = new ServerData(par0NBTTagCompound.getString("name"), par0NBTTagCompound.getString("ip"));
|
||||
ServerData var1 = new ServerData(par0NBTTagCompound.getString("name"), par0NBTTagCompound.getString("ip"), par0NBTTagCompound.getBoolean("default"));
|
||||
var1.hideAddress = par0NBTTagCompound.getBoolean("hideAddress");
|
||||
return var1;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.minecraft.src;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -20,9 +21,12 @@ public class ServerList {
|
|||
|
||||
/** List of ServerData instances. */
|
||||
private final List<ServerData> servers = new ArrayList();
|
||||
private final List<ServerData> allServers = new ArrayList();
|
||||
|
||||
public static final List<ServerData> forcedServers = new ArrayList();
|
||||
private static final Set<String> motdLocks = new HashSet();
|
||||
|
||||
public static boolean hideDownDefaultServers = false;
|
||||
|
||||
public ServerList(Minecraft par1Minecraft) {
|
||||
this.mc = par1Minecraft;
|
||||
|
@ -32,13 +36,14 @@ public class ServerList {
|
|||
public static void loadDefaultServers(String base64) {
|
||||
try {
|
||||
NBTTagCompound nbt = CompressedStreamTools.readUncompressed(Base64.decodeBase64(base64));
|
||||
if(nbt.getBoolean("profanity")) {
|
||||
ConfigConstants.profanity = true;
|
||||
}
|
||||
ConfigConstants.profanity = nbt.getBoolean("profanity");
|
||||
hideDownDefaultServers = nbt.getBoolean("hide_down");
|
||||
forcedServers.clear();
|
||||
NBTTagList list = nbt.getTagList("servers");
|
||||
for (int i = 0; i < list.tagCount(); ++i) {
|
||||
forcedServers.add(ServerData.getServerDataFromNBTCompound((NBTTagCompound) list.tagAt(i)));
|
||||
NBTTagCompound tag = (NBTTagCompound) list.tagAt(i);
|
||||
tag.setBoolean("default", true);
|
||||
forcedServers.add(ServerData.getServerDataFromNBTCompound(tag));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -53,14 +58,18 @@ public class ServerList {
|
|||
public void loadServerList() {
|
||||
freeServerIcons();
|
||||
this.servers.clear();
|
||||
this.allServers.clear();
|
||||
for(ServerData dat : forcedServers) {
|
||||
dat.pingSentTime = -1l;
|
||||
dat.hasPing = false;
|
||||
this.servers.add(dat);
|
||||
this.allServers.add(dat);
|
||||
}
|
||||
NBTTagList servers = LocalStorageManager.gameSettingsStorage.getTagList("servers");
|
||||
for (int i = 0; i < servers.tagCount(); ++i) {
|
||||
this.servers.add(ServerData.getServerDataFromNBTCompound((NBTTagCompound) servers.tagAt(i)));
|
||||
ServerData dat = ServerData.getServerDataFromNBTCompound((NBTTagCompound) servers.tagAt(i));
|
||||
this.servers.add(dat);
|
||||
this.allServers.add(dat);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,6 +151,8 @@ public class ServerList {
|
|||
}
|
||||
|
||||
public void refreshServerPing() {
|
||||
this.servers.clear();
|
||||
this.servers.addAll(this.allServers);
|
||||
for(ServerData dat : servers) {
|
||||
if(dat.currentQuery != null && dat.currentQuery.isQueryOpen()) {
|
||||
dat.currentQuery.close();
|
||||
|
@ -153,7 +164,9 @@ public class ServerList {
|
|||
|
||||
public void updateServerPing() {
|
||||
int total = 0;
|
||||
for(ServerData dat : servers) {
|
||||
Iterator<ServerData> itr = servers.iterator();
|
||||
while(itr.hasNext()) {
|
||||
ServerData dat = itr.next();
|
||||
if(dat.pingSentTime <= 0l) {
|
||||
dat.pingToServer = -2l;
|
||||
String addr = dat.serverIP;
|
||||
|
@ -218,6 +231,9 @@ public class ServerList {
|
|||
dat.pingToServer = -1l;
|
||||
dat.hasPing = true;
|
||||
}
|
||||
if(ServerList.hideDownDefaultServers && dat.isDefault && dat.pingToServer == -1l && dat.hasPing == true) {
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
if(total >= 4) {
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue