Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-5815

Type converting to null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Minor Minor
    • None
    • None
    • Windows 10 & centos, spigot 1.16.1

    • 1.16.1
    • Yes

      the [org|eclipse-javadoc:%E2%98%82=NationsatWar/C:%5C/Users%5C/mtthw%5C/.m2%5C/repository%5C/org%5C/spigotmc%5C/spigot-api%5C/1.15.2-R0.1-SNAPSHOT%5C/spigot-api-1.15.2-R0.1-SNAPSHOT.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.spigotmc=/=/maven.artifactId=/spigot-api=/=/maven.version=/1.15.2-R0.1-SNAPSHOT=/=/maven.scope=/provided=/%3Corg].[bukkit|eclipse-javadoc:%E2%98%82=NationsatWar/C:%5C/Users%5C/mtthw%5C/.m2%5C/repository%5C/org%5C/spigotmc%5C/spigot-api%5C/1.15.2-R0.1-SNAPSHOT%5C/spigot-api-1.15.2-R0.1-SNAPSHOT.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.spigotmc=/=/maven.artifactId=/spigot-api=/=/maven.version=/1.15.2-R0.1-SNAPSHOT=/=/maven.scope=/provided=/%3Corg.bukkit].[entity|eclipse-javadoc:%E2%98%82=NationsatWar/C:%5C/Users%5C/mtthw%5C/.m2%5C/repository%5C/org%5C/spigotmc%5C/spigot-api%5C/1.15.2-R0.1-SNAPSHOT%5C/spigot-api-1.15.2-R0.1-SNAPSHOT.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.spigotmc=/=/maven.artifactId=/spigot-api=/=/maven.version=/1.15.2-R0.1-SNAPSHOT=/=/maven.scope=/provided=/%3Corg.bukkit.entity].[Villager|eclipse-javadoc:%E2%98%82=NationsatWar/C:%5C/Users%5C/mtthw%5C/.m2%5C/repository%5C/org%5C/spigotmc%5C/spigot-api%5C/1.15.2-R0.1-SNAPSHOT%5C/spigot-api-1.15.2-R0.1-SNAPSHOT.jar=/maven.pomderived=/true=/=/maven.pomderived=/true=/=/maven.groupId=/org.spigotmc=/=/maven.artifactId=/spigot-api=/=/maven.version=/1.15.2-R0.1-SNAPSHOT=/=/maven.scope=/provided=/%3Corg.bukkit.entity(Villager.class%E2%98%83Villager].Type enum value is being converted to null when being passed into a constructor.

       

       

      private Type type;
      
      public Nation(Type type){
      //stuff
      this.type = type;
      }

       

      creating the object:

      Nation gaul = new Nation(Type.SWAMP);
      

      Leads to the following exception:

      [10:27:40] [Server thread/ERROR]: Error occurred while enabling nationsatwar v1.1 (Is it up to date?)
      java.lang.IllegalArgumentException: The validated object is null
              at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[server.jar:git-Spigot-758abbe-38de0b8]
              at org.apache.commons.lang.Validate.notNull(Validate.java:178) ~[server.jar:git-Spigot-758abbe-38de0b8]
              at org.bukkit.craftbukkit.v1_16_R1.entity.CraftVillager.setVillagerType(CraftVillager.java:57) ~[server.jar:git-Spigot-758abbe-38de0b8]
              at net.mcnations.nationsatwar.general.packets.npcs.Architect.spawnEntity(Architect.java:108) ~[?:?]
      
      

      line 108 in the Architect class is the following:

      architectVillager.setVillagerType(nation.getBiomeType());
      

      When I print biomeType in the constructor, it is null. As we can see, it is clearly NOT null when being passed into the constructor (Type.SWAMP). However, when I type Type.SWAMP as a constant inside the constructor, it works - no errors.

      https://paste.md-5.net/utodeqemah.java

      full initializing of object:

      https://paste.md-5.net/gukigijute.cs

      Whats going on here?

            Unassigned Unassigned
            Maklegend Matthew Arnold
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: