Custom InventoryView not respecting top inventory size

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • Environment:

      Windows 10

      OpenJDK 13.0.2 2020-01-14 (build 13.0.2+8)

    • git-Spigot-6de3d4b-a6f8093 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)
    • Yes

       I'm trying to create a custom InventoryView. I was able to do this back in 1.12 without issue. Unfortunately, in version 1.15.2, something is not working right. Maybe I do not understand the workflow for when things call 'player.openInventory(customInventoryView)'

      Anyways, I have created a simple test plugin to experiment with and demonstrate the issue.

      I have attached the full code.

       CustomInvView is the custom InventoryView.

      SimpleTest is the main plugin interface and implements the command.

       

      The plugin is very simple. I have a command 'invtest' that when called it will create a new CustomInvView and have the player open that inventory. It should spawn a top inventory with 54 item slots. Instead it only opens an inventory with 27 slots. What am I missing in this version of spigot as I was not having this issue in earlier versions!

      And here is a screenshot showing that smaller inventory.

      A couple interesting points.
      1) If I print the size of the top inventory for the CustomInvView it prints the correct value of 54.
      2) If I have the player specifically open the topInventory from the CustomInvView, then it looks right. However I do not want to do this because I want to detect the CustomInvView within an InventoryClickEvent as shown below:

      Example of how I plan on using the CustomInvView:

      @EventHandler
       public void inventoryClick(InventoryClickEvent e)
       { 
       if (e.getView() instanceof CustomInvView)
      { CustomInvView customInvView = (CustomInvView)e.getView(); // Do things that are specific to the custom inv }
      }
      

      Any ideas on why the CustomInvView does not have the requested 54 item slots?

        1. CustomInvView.java
          1 kB
          Tim Blattner
        2. plugin.yml
          0.2 kB
          Tim Blattner
        3. SimpleTest.java
          1 kB
          Tim Blattner

            Assignee:
            Unassigned
            Reporter:
            Tim Blattner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: