1.15.2 server socket

Discussion in 'Spigot Plugin Development' started by lolbob2win, Feb 20, 2020.

  1. hi I’m trying to bind a serversocket to my spigot server, but it says the port is already used. Does this mean here’s is already a server socket running? If so, how can I get that socket?
     
  2. Why are you trying to do this?
    I don't understand your question.
     
  3. The port of your server socket cannot be the same as the server port or any other port in use. If you're using an online hosting service check what ports you have available.
     
    • Like Like x 1
  4. oof that's kinda hard since im using a shared host
    sending commands across servers
     
  5. Shouldn't be too hard to find a port that is not in use. You have a lot to choose from.
     
  6. well yeah, but my other servers need to know what port the socket is running on. is there a way to send messages to another server w/o dealing with ports?

    is it possible to send a custom Minecraft packet from bungeecord to spigot or from a spigot server to another? edit: even w/o players online
     
    #6 lolbob2win, Feb 22, 2020
    Last edited: Feb 22, 2020
  7. Bungeecord messaging channel
     
  8. I created a plugin where you have to enter the addresses of the other servers including the port the ServerSocket object of their plugin runs on in a configuration file. You also have to register the port the ServerSocket object of this plugin will use there.
     
  9. w/o playersonline
     
  10. would creating a fake entityplayer make the spigot/bungee messaging stuff work? Would the data still send even if the fake player is the only one "online"?
     
  11. I do not know. You can try it. You can also try to use what I suggested.
     
  12. i can try both andsee what happens
     
  13. i thought this would work, but creating an entityplayer doesn't seem to change the online player count.

    Code (Text):
            MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
            WorldServer nmsWorld = ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle();
            GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "3fi48hyfkdihjfh");
            EntityPlayer npc = new EntityPlayer(nmsServer, nmsWorld, gameProfile, new PlayerInteractManager(nmsWorld));
            npc.setLocation(0, 0, 0, 0, 0);
    do you know how to create an entityplayer that affects the Bukkit#getOnlinePlayers() Collection?
     
  14. You are trying to use NMS?
    NMS makes your plugin version dependant.
    Maybe you are ok with this, and don't care.
    Just for me I don't like my plugin to be version dependant.
     
  15. To change the count can't you just add a player to the list.
    Code (Text):
    Bukkit.getOnlinePlayers().add(*player*);
     
    • Funny Funny x 1
  16. I really hope that this is a joke.
    No you can't.
     
  17. LOL, k sorry for jokin around.