1.16.5 Cannot make a static reference to a non-static field

Discussion in 'Spigot Plugin Development' started by MoonNetwork, Jun 12, 2021.

  1. I am working on a custom Workshop project. It will works with a timer. I mean there will be a product time. So I
    used hashmap.

    Code (Text):

        private HashMap<UUID, Long> wait = new HashMap<UUID, Long>();
        private int waittime = 10;

    full code: https://paste.md-5.net/yuxadecosa.java

    But program says something like that. Whats wrong I didnt understand.
  2. Sorry my mistake these are photos.

  3. Presumably you're accessing the wait field from a static context. It also looks like you're trying to access it from an event, which means your event is static for some reason. Remove the static keyword from your listener method.
    • Agree Agree x 1