1. Hey!

    Ok, I have been developing a mod and its nearly complete, This mod is going to be a Hypixel Based Mod, meaning it only works on Hypixel.

    My only problem I have at the moment is I can not figure out how you would figure out what server your client is connected to.

    Now, I decompiled similar mods such as AutoGG made by 2Pi and this is what I have come across.

    Code:
        @SubscribeEvent
        public void playerLoggedIn(final FMLNetworkEvent.ClientConnectedToServerEvent event) {
            this.onHypixel = (!this.mc.func_71356_B() && event.manager.func_74430_c().toString().toLowerCase().contains("hypixel.net"));
        }
        
        @SubscribeEvent
        public void playerLoggedOut(final FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
            this.onHypixel = false;
        }
    I am mainly looking at playerLoggedIn as I dont know what those reObfuscated terms are.

    If anyone could give me a lending hand.. that would be amazing.
     
    #1
  2. RankTW

    RankTW Active Member

    AYS AYS
    Messages:
    137
    #2
  3. Dance

    Dance Well-Known Member

    Dance_Dog
    MVP+
    Messages:
    4,775
    May I suggest
    Code:
    .contains(".hypixel.net")
    in case the domain name has anything before “hypixel”?
     
    #3
    • Disagree Disagree x 1
  4. RankTW

    RankTW Active Member

    AYS AYS
    Messages:
    137
    I don't get it, why?
    you can actually login hypixel with IP `hypixel.net`

    and if the domain has anything before “hypixel”
    Code:
    .contains("hypixel.net")
    It will still work, right?
     
    #4
  5. Dance

    Dance Well-Known Member

    Dance_Dog
    MVP+
    Messages:
    4,775
    I’m suggesting this just for 100% safety. For instance, whatever.ilovehypixel.net would get accepted as “onHypixel”.

    However, I didn’t realize that hypixel.net on its own could get you connected. In that case, checking if it contains “.hypixel.net” or equals “hypixel.net” should do the trick.
     
    #5
  6. This is how I've historically done this:

    Code:
    Minecraft mc = Minecraft.getMinecraft();
    if (mc.getCurrentServerData() != null && mc.getCurrentSererData().serverIP != null) {
         if (mc.getCurrentServerData().serverIP.equals("mc.hypixel.net")) {
              //do stuff
         }
    }
    
     
    #6
  7. #7
  8. Regex never hurt anybody... Hypixel has an infinite number of subdomains, you can connect with anything you want (luaq.hypixel.net), it doesn't matter. This picks up all of them.
    Code:
    Pattern hypixelPattern = Pattern.compile("(.*\\.)?hypixel\\.net", Pattern.CASE_INSENSITIVE);
    isOnHypixel = hypixelPattern.matcher(serverIp).matches();
     
    #8
  9. I didn't even think of that! I'll be updating my own code to use RegEx as soon as I get a chance! :cool: Thanks! :D
     
    #9
  10. No problem.

    Fun Fact: I had discovered that Hypixel had an infinite number of subdomains by accidentally typing play as "paly"
     
    #10

Share This Page