[Solved] Updating...

Discussion in 'Spigot Plugin Development' started by TimeVisualSales, May 14, 2015.

Thread Status:
Not open for further replies.
  1. I didn't know what to put for the title but, how would I update this code below because it doesn't update and it wont allow me to use a bukkitrunnable as loads of errors occur.
    Code (Text):
              try {
                Socket sock = new Socket("198.135.190.100", 25861);
                DataOutputStream out = new DataOutputStream(sock.getOutputStream());
                DataInputStream in = new DataInputStream(sock.getInputStream());
                out.write(0xFE);
                int b;
                final StringBuffer str = new StringBuffer();
                while ((b = in.read()) != -1) {
                    if (b != 0 && b > 16 && b != 255 && b != 23 && b != 24) {
                        // Not sure what use the two characters are so I omit them
                        str.append((char) b);
                        System.out.println(b + ":" + ((char) b));
                    }
                }
                String[] data = str.toString().split("┬ž");
                final String serverMotd = data[0];
                int onlinePlayers = Integer.parseInt(data[1]);
                int maxPlayers = Integer.parseInt(data[2]);
                System.out.println(String.format(
                "MOTD: \"%s\"\nOnline Players: %d/%d", serverMotd,
                onlinePlayers, maxPlayers));
                if (serverMotd.equalsIgnoreCase("Online")){
                    ItemStack factions1 = new ItemStack(Material.EMERALD_BLOCK);
                    ItemMeta factions11 = factions1.getItemMeta();
                    factions11.setDisplayName("┬žaSurvivalGames");
                    ArrayList<String> lore = new ArrayList<String>();
                    lore.add(serverMotd);
                    factions11.setLore(lore);
                    factions1.setItemMeta(factions11);
                    menu.setItem(1, factions1);
                }
               
                if (serverMotd.equalsIgnoreCase("Offline")){
                    ItemStack factions1 = new ItemStack(Material.REDSTONE_BLOCK);
                    ItemMeta factions11 = factions1.getItemMeta();
                    factions11.setDisplayName("┬žaSurvivalGames");
                    ArrayList<String> lore = new ArrayList<String>();
                    lore.add(serverMotd);
                    factions11.setLore(lore);
                    factions1.setItemMeta(factions11);
                    menu.setItem(1, factions1);
                }
                } catch (UnknownHostException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                }        
     
  2. JamesJ

    Supporter

  3. In eclipse
     
  4. JamesJ

    Supporter

    What are the errors.. (facepalm)
     
  5. Ow wait, might have fixed it...
     
Thread Status:
Not open for further replies.