Error when dissalowing 1.8+ players to join

Discussion in 'Spigot Plugin Development' started by Lookups, Jul 11, 2018.

  1. Hello, i'm trying to make a plugin that dissalows players to join if they are on a 1.8+ client,
    however i'm getting an error (EVENTEXCEPTION) & (NPE - NULLPOINTEREXCEPTION):

    Code (Text):
            at$1.execute( ~[TapSpigot.jar:git-PaperSpigot-ea452ce]
            at org.bukkit.plugin.RegisteredListener.callEvent( ~[TapSpigot.jar:git-PaperSpigot-ea452ce]
            at org.bukkit.plugin.SimplePluginManager.fireEvent( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at org.bukkit.plugin.SimplePluginManager.callEvent( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at net.minecraft.server.v1_7_R4.PlayerList.attemptLogin( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at net.minecraft.server.v1_7_R4.LoginListener.c( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at net.minecraft.server.v1_7_R4.LoginListener.a( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at net.minecraft.server.v1_7_R4.NetworkManager.a( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at net.minecraft.server.v1_7_R4.ServerConnection.c( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at net.minecraft.server.v1_7_R4.MinecraftServer.v( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at net.minecraft.server.v1_7_R4.DedicatedServer.v( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at net.minecraft.server.v1_7_R4.MinecraftServer.u( [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at [TapSpigot.jar:git-PaperSpigot-ea452ce]
            at [TapSpigot.jar:git-PaperSpigot-ea452ce]
    Caused by: java.lang.NullPointerException
            at nv6.invisraid.listeners.JoinEvent.onLogin( ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
            at$1.execute( ~[TapSpigot.jar:git-PaperSpigot-ea452ce]
            ... 13 more
    Code of Line 19 & The whole loginclass

    Code (Text):

        public void onLogin(PlayerLoginEvent event) {
          CraftPlayer player = (CraftPlayer) event.getPlayer();
          if (((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() >= 47) {
            event.disallow(Result.KICK_BANNED, "§cSorry, your client version is not supported by our server.\n§cPlease consider using Minecraft 1.7.\n§7This is due to issues with the 1.8+ clients.");
          } else {
              if (((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() < 47) {
                  player.sendMessage("§cThis server is using the plugin called §9InvisRaid §7b1.1 §cmade by NV6");


    Help would be appriciated!
    • Funny Funny x 3
  2. If you're running on a 1.7 server, then why would 1.8 players be able to join in the first place? If you only want 1.7 players remove whatever plugin allows them to connect. Simple?
    • Agree Agree x 1
  3. gzx


    Try using PlayerJoinEvent instead of PlayerLoginEvent. It's possible that the networkManager is not initialized until after the players logs in.
  4. Mh, i'm using a 1.7.10 spigot, I don't have plugins that allow 1.8 players to join.
  5. gzx


    Then 1.8 players won't be able to join your server. You don't need to make a plugin to block those clients.