Can it be done? An Odd Request.

Discussion in 'Plugin Development' started by danslayerx, Jun 27, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    danslayerx

    So I'm wondering is it possible using reflection or an alternative method to display on the MOTD the connection failed graphic? If you don't understand what I mean, this here.

    [​IMG]

    I've been wondering for a while, I'm sure it can be done in some way... but maybe not. Not everything can be done in Bukkit obviously, but well I'm interested to see.
     
  2. Offline

    thomasb454

    danslayerx
    Hi, your an Admin off Addon gaming?

    Anyways, I don't think it it possible, because if the server is sending not packets then..it can't be displayed (I'm not an expert, just saying what I think)
     
  3. Offline

    danslayerx


    Yes, I'm a director of AOG. Surprised anyone even knows what AOG is here! I wouldn't think it would be possible using the standard API supplied, however since the client must actively ping the target to receive a reputable value to whether it is 'alive' or not - I would assume you could possibly send a value that would show it as 'dead' depending on the IP-Address that is pinging the server.

    It seems possible in theory, just how one would execute IF it is possible is another question all together.
     
  4. Offline

    thomasb454

    danslayerx
    Mhmm, good point I can see where you are coming from.

    Yes, I'm a director of AOG. Surprised anyone even knows what AOG is here! XD
     
  5. Offline

    keto23

    This is a client-side message stored inside a language file.
     
  6. Offline

    skipperguy12

    Well... just read your own request... you want the SERVER to somehow change a CLIENT saying that it's offline. It's like pinging a computer with it's power plugged out, what do you expect? The offline computer to ping back?
     
    foodyling likes this.
  7. Offline

    hamgooof

    A very polite way of phrasing that.
    A better way may be to somehow cancel it, or alter the fields inside so that it doesn't return a packet if possible so that it sees that the server is offline.
     
  8. Offline

    kreashenz

    Has been done. Talk to MP5K about it. ( I think that's him :/ ) [EDIT] On second thought, he might not want to share it.
     
    danslayerx likes this.
  9. Offline

    danslayerx


    My request asks, if it's possible to display the graphic rather than actually having it display in a normal environment, forcing it to display not actually turning the server off in my case.

    It's a graphical display, there are ways of displaying it. The way I mentioned it previously was the method I assumed the server uses to physically display the image. However, I was asking if there was a way that would forcefully show the image rather than actively responding to the pinged message.

    Also keep in mind, I do expect the computer to ping back - I'm not denying that this sounds like a strange request, and I understand it's a client related action but surely for a specific users IP address you could deny the server to respond.

    So user A is on a list of IP-Addresses, he pings the server and the server checks the IP Address that pinged, notes its on a black-list and doesn't respond forcing the graphic to show 'no connection'.

    It certainly sounds like it could work in THEORY.

    kreashenz Thanks that's a vote of confidence! It seems more likely to work! I'll be sure to give him a message.
     
  10. Offline

    Ivan

    danslayerx
    When talking about the graphic, do you mean the image with the bars? If you're trying to change that to a custom image no that's not possible.
     
  11. Offline

    danslayerx


    Yes, and no. I do mean the image, but I mean change it to display the 'no connection image'. I don't want to turn the server off either, I want to make it so if a certain users IP pings the server it will not respond back.
     
  12. Offline

    kreashenz

    danslayerx So what you want is the (for example) the server is online, but the connection bar tells you "can't connect" or something like that?
     
  13. Offline

    Ivan

    The username will not be sent in a ping. Only the IP-adress, so you can't make it so only certain users will not receive a response on the request. You can grab their IP on their initial connect though.

    kreashenz
    I think he doesn't want to respond on a ServerListPing

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 2, 2016
  14. Offline

    danslayerx


    I'm aware of that, I was trying to simplifier for anyone else who wanted to pitch in.

    kreashenz Essentially, there is a list of 'black-listed' IP-Addresses. When any of those IP-Addresses ping the server it will not respond and in turn no packet is received showing that the server cannot be connected to. Any other IP Address that pings the server is fine and will be responded too.
     
  15. Offline

    Ivan

    You'll have to work with packets then. I think PacketLib has support for this.
     
  16. Offline

    danslayerx


    I thought that might be the case, I was rather hoping that I wouldn't have to use a library for this - but it may be the case.
     
  17. Offline

    flaaghara

    So the client sends a ping to the server to sees if it's online. If there is any response at all from the server then that must mean in some form the server has to be online to be able to reply. I'm not sure the name of the class which handles ping responses, but what you could do is have a list of IPs that are 'blacklisted', and every time the server gets a ping from an IP it checks the list; if that IP is on the list, it'll immediately end all interactions with that client. The key is to not ping back a blacklisted IP at all or else the client would know that the server is online.
     
  18. Offline

    travja

    The only thing that even comes close is ServerListPingEvent but it isn't cancellable... So without external libraries and basically modding the bukkit.jar it is most likely impossible to make it display unreached. The best you can do is change the motd to the default unreached message. Although the bars will still show.

    In addition, using the same event. You can edit the max players and the players on so that it doesn't display a count.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 2, 2016
  19. Offline

    MP5K

    Hello,
    Are u looking for something like that?
    I may Post such a plugin on dev.bukkit.org if someone wants me to. :3
    Show Spoiler

    Server List.JPG
     
  20. Offline

    skipperguy12

    MP5K
    That's amazing! :O
    Please post it! I'd love to see the code for that! :D
     
  21. Offline

    MP5K

    the problem with this plugin is that it allows you to fake the number of online players...
    and i think a lot of server owners would use that feature to cheat a lot of players wouldn't they?
    Show Spoiler

    Server List1.JPG
     
    Minecrell likes this.
  22. Offline

    keto23

    MP5K

    Could you post the snippet of code on here that makes the "[Maintainence]" message appear up there?
     
  23. Offline

    skipperguy12

    MP5K
    Can you show us just a bit of code? Or explain how you achieved that? It seems really impressive, about the server owners cheating their player count... I'm sure most server owners would only be able to use it if it's available on the plugins list, as long as there's no download, I don't think people (okay, maybe a few) will cheat their count :p
     
  24. Offline

    Minnymin3

  25. Offline

    russjr08

    If you could post a snippet, that would be great :) also, cheating players is already possible with the ServerListPingEvent / Editing Packets :p
     
  26. Offline

    Minecrell

    russjr08
    It is impossible with the ServerListPingEvent but editing packets is the way how it works :p
     
  27. Offline

    russjr08

    Oh. Oops :p
     
  28. Offline

    MP5K

    yes it uses the Packet 0xFE
    it modifies it by using ProtollLib
    the Motd it self and the Max Slots are set by the ServerListPing event.
    Code:java
    1. public final class ProtLBukkitMotdListener extends PacketAdapter{
    2.  
    3. private CraftMotdManager plugin;
    4.  
    5. public ProtLBukkitMotdListener(CraftMotdManager plugin){
    6. super(plugin.plugin, ConnectionSide.SERVER_SIDE, ListenerPriority.HIGHEST, Packets.Server.KICK_DISCONNECT);
    7. this.plugin = plugin;
    8. }
    9. @Override
    10. public void onPacketSending(PacketEvent event) {
    11. if(event.getPacketID() != Packets.Server.KICK_DISCONNECT) return; // check if packet 0xFE
    12. PacketContainer cont = event.getPacket(); // get Packet
    13.  
    14. String[] raw = cont.getStrings().read(0).split("\0"); // read strings
    15. if(raw.length != 6) return; // if not ServerPing return;
    16.  
    17. MotdAccount acc1 = plugin.getGlobalAccount(); //
    18.  
    19. if(acc1.getServerVersion() != null)
    20. raw[1] = acc1.getServerVersion().toString(); // write Protoll Version (current: 43)
    21.  
    22. if(acc1.getTitle() != null)
    23. raw[2] = acc1.getTitle(); // write the OutofDate Message
    24.  
    25. if(acc1.getOnlinePlayers() != null)
    26. raw[4] = acc1.getOnlinePlayers().toString(); // write the Online Players
    27.  
    28. String end = "";
    29. for(String str : raw){
    30. end += str + "\0";
    31. }
    32. end = end.substring(0, end.length() - 1);
    33. cont.getStrings().write(0, end);
    34. }
    35. }
     
  29. Offline

    Minecrell

    Comphenix likes this.
  30. Offline

    RainoBoy97

    I just tried it, setting the normal MOTD worked fine. But when I tried to set the server version it didnt :s
    Anything that I have done wrong?

    Show Spoiler

    Code:
    public void onEnable() {
    ServerListAPI api = new ServerListAPI(this);
    api.setServerVersion("why doesnt this workr :C");
    api.setOnlinePlayers(193);
    api.setMaxPlayers(29);
    }
    
     
Thread Status:
Not open for further replies.

Share This Page