/** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */ protected void actionPerformed(GuiButton button) throws IOException { if (button.enabled) { if (button.id == 2) { this.serverData.setResourceMode(ServerData.ServerResourceMode.values()[(this.serverData.getResourceMode().ordinal() + 1) % ServerData.ServerResourceMode.values().length]); this.serverResourcePacks.displayString = I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText(); } else if (button.id == 1) { this.parentScreen.confirmClicked(false, 0); } else if (button.id == 0) { this.serverData.serverName = this.serverNameField.getText(); this.serverData.serverIP = this.serverIPField.getText(); this.parentScreen.confirmClicked(true, 0); } } }
public static int getProtocolVersion() { if(WurstClient.INSTANCE.options.mc112x_compatibility == 2) return 340; else if(WurstClient.INSTANCE.options.mc112x_compatibility == 1) return 338; NavigableMap<Integer, String> protocols = WMinecraft.PROTOCOLS; // use default if using Wurst-Bot if(WurstBot.isEnabled()) return protocols.lastKey(); ServerData server = lastServer.getServerData(); // use default if ping failed if(!server.pinged || server.pingToServer < 0) return protocols.lastKey(); // use default if server protocol is not supported if(!protocols.containsKey(server.version)) return protocols.lastKey(); // use server protocol return server.version; }
@Override public void execute(String[] args) throws CmdError { if(args.length != 1) syntaxError(); Minecraft mc = Minecraft.getMinecraft(); mc.addScheduledTask(() -> { mc.displayGuiScreen(new GuiConnecting(new GuiWurstMainMenu(), mc, new ServerData("", args[0], false))); System.out.println( "Joined " + args[0] + " as " + mc.session.getUsername()); }); }
public ServerData get(final GuiMultiplayer mpgui) { final String targetServerIP = Config.getConfig().targetServerIP.get(); if (mpgui!=this.mpgui_cache||!StringUtils.equals(this.targetIP_cache, targetServerIP)) { this.target = getServerData(mpgui, getTarget(mpgui, this.targetIP_cache = targetServerIP)); this.mpgui_cache = mpgui; } return this.target; }
public void replaceList(List list) { if (ourList == list) return; ourList = list; ourList.add(new CreeperHostEntry(ourParent, new ServerData("", "127.0.0.1", false), true)); }
protected CreeperHostEntry(GuiMultiplayer p_i45048_1_, ServerData serverIn) { super(p_i45048_1_, serverIn); ourMP = p_i45048_1_; serverIcon = Config.getInstance().isServerHostMenuImage() ? CreeperHost.instance.getImplementation().getMenuIcon() : new ResourceLocation("creeperhost", "textures/nobrandmp.png"); cross = new String(Character.toChars(10006)); stringWidth = this.mc.fontRendererObj.getStringWidth(cross); }
private int getTarget(final GuiMultiplayer mpgui, final String serverIP) { final int count = this.compat.countServers(mpgui); for (int i = 0; i<count; i++) { final ServerData serverData = this.compat.getServerData(mpgui, i); if (StringUtils.equals(serverIP, serverData.serverIP)) return i; } return -1; }
public void connectToSelected() { GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.func_148193_k() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.func_148193_k()); if (guilistextended$iguilistentry instanceof ServerListEntryNormal) { this.connectToServer(((ServerListEntryNormal)guilistextended$iguilistentry).getServerData()); } else if (guilistextended$iguilistentry instanceof ServerListEntryLanDetected) { LanServerDetector.LanServer lanserverdetector$lanserver = ((ServerListEntryLanDetected)guilistextended$iguilistentry).getLanServer(); this.connectToServer(new ServerData(lanserverdetector$lanserver.getServerMotd(), lanserverdetector$lanserver.getServerIpPort(), true)); } }
protected ServerListEntryNormal(GuiMultiplayer p_i45048_1_, ServerData serverIn) { this.owner = p_i45048_1_; this.server = serverIn; this.mc = Minecraft.getMinecraft(); this.serverIcon = new ResourceLocation("servers/" + serverIn.serverIP + "/icon"); this.icon = (DynamicTexture)this.mc.getTextureManager().getTexture(this.serverIcon); }
public static void updateLastServerFromDirectConnect( GuiMultiplayer guiMultiplayer, ServerData serverData) { currentServerIP = serverData.serverIP; if(!currentServerIP.contains(":")) currentServerIP += ":25565"; lastServer = new ServerListEntryNormal(guiMultiplayer, serverData); }
private String getServerIP() { ServerData serverData = mc.getCurrentServerData(); if (serverData == null) { return null; } return serverData.serverIP; }
public void ping(final String ip, final int port) { server = new ServerData("", ip + ":" + port, false); new Thread("Wurst Server Connector #" + threadNumber.incrementAndGet()) { @Override public void run() { ServerPinger pinger = new ServerPinger(); try { logger.info("Pinging " + ip + ":" + port + "..."); pinger.ping(server); logger.info("Ping successful: " + ip + ":" + port); }catch(UnknownHostException e) { logger.info("Unknown host: " + ip + ":" + port); failed = true; }catch(Exception e2) { logger.info("Ping failed: " + ip + ":" + port); failed = true; } pinger.clearPendingNetworks(); done = true; } }.start(); }
public void set(final ServerData serverData) { if (serverData==null) { setIP(null); this.target = null; Config.getConfig().save(); } else { setIP(serverData.serverIP); this.target = serverData; } }
protected ServerListEntryNormal(GuiMultiplayer p_i45048_1_, ServerData p_i45048_2_) { this.field_148303_c = p_i45048_1_; this.field_148301_e = p_i45048_2_; this.mc = Minecraft.getMinecraft(); this.field_148306_i = new ResourceLocation("servers/" + p_i45048_2_.serverIP + "/icon"); this.field_148305_h = (DynamicTexture)this.mc.getTextureManager().getTexture(this.field_148306_i); }
public void connectToSelected() { GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.getSelected() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.getSelected()); if (guilistextended$iguilistentry instanceof ServerListEntryNormal) { this.connectToServer(((ServerListEntryNormal)guilistextended$iguilistentry).getServerData()); } else if (guilistextended$iguilistentry instanceof ServerListEntryLanDetected) { LanServerInfo lanserverinfo = ((ServerListEntryLanDetected)guilistextended$iguilistentry).getServerData(); this.connectToServer(new ServerData(lanserverinfo.getServerMotd(), lanserverinfo.getServerIpPort(), true)); } }
private void setupNew() { ServerData sd = mc.getCurrentServerData(); if (sd != null) { this.config = new JSONConfiguration(String.format("/waypoints/%s.json", sd.serverIP.replace(":", "_"))); this.load(); } else { waypoints = new ArrayList<>(); } }
public synchronized static IServerData getCurrentServer() { if (Minecraft.getMinecraft().getCurrentServerData() == null) { return null; } if (iServerCache != null && Minecraft.getMinecraft().getCurrentServerData() != null) { if (iServerCache.serverIP.equals(Minecraft.getMinecraft().getCurrentServerData().serverIP)) { return iServerCache; } } ServerData sd = Minecraft.getMinecraft().getCurrentServerData(); iServerCache = new IServerData(sd.serverName, sd.serverIP, sd.isOnLAN()); iServerCache.gameVersion = sd.gameVersion; return iServerCache; }
public void connectToServer(GuiScreen guiMultiplayer, ServerData serverEntry) { ExtendedServerListData extendedData = serverDataTag.get(serverEntry); if (extendedData != null && extendedData.isBlocked) { showGuiScreen(new GuiAccessDenied(guiMultiplayer, serverEntry)); } else { showGuiScreen(new GuiConnecting(guiMultiplayer, client, serverEntry)); } }
private ServerData getServerData(final GuiMultiplayer mpgui, final int index) { if (index<0) return null; final IGuiListEntry guilistextended$iguilistentry = this.compat.getListEntry(mpgui, index); if (guilistextended$iguilistentry instanceof ServerListEntryNormal) return this.compat.getServerData((ServerListEntryNormal) guilistextended$iguilistentry); return null; }
@Override public void connectToServer(final GuiMultiplayer mpgui, final ServerData serverData) { mpgui.func_146791_a(serverData); }
/** * @return Server being connected/disconnected to/from */ public final ServerData getServerData() { return this.serverData; }
public Disconnect(EventState state, boolean forced, ServerData serverData) { super(serverData); this.state = state; this.forced = forced; }
@Override public ServerData getServerEntry(Order order) { return new ServerData(order.name + ".PlayAt.CH", order.name + ".playat.ch", false); }
@Override public void addServerData(ServerData p_78849_1_) { servers.add(p_78849_1_ instanceof ServerDataPublic); super.addServerData(p_78849_1_); }
public ServerListEntryNormalPubConstructor(GuiMultiplayer p_i45048_1_, ServerData serverIn) { super(p_i45048_1_, serverIn); }
@Override public void addServerData(ServerData server) { this.servers.add((ServerDataPublic) server); }
@Override public void func_147413_a(int index, ServerData server) { }
protected MockServerListEntryNormal(GuiMultiplayer p_i45048_1_, ServerData serverIn) { super(p_i45048_1_, serverIn); }
@Override public boolean getPinged(final ServerData serverData) { return serverData.pinged; }
@Override public void func_148195_a(ServerList p_148195_1_) { super.func_148195_a(p_148195_1_); ourList.add(new CreeperHostEntry(ourParent, new ServerData("", "127.0.0.1", false), true)); }