OtherDrops

226k Downloads

[2.8b.573] Aliases: java.lang.NullPointerException using aliases making more than 1 drop

h3oCharles opened this issue ยท 3 comments

commented

Using aliases with multiple files, you cant have 1 alias to be bound to more than 1 drop at same time. Otherwise you get java.lang.NullPointerException after reloading the config files and plugin is not able to run

Or maybe did I just wrote the script wrong way?

Here is an example script exploiting the bug:

aliases:
    - &default  # alias "default" is suposed to:
    - drop: SPONGE/1/5% # drop 1 sponge with 5% chance
      sound: LEVEL_UP # and emit LEVEL_UP sound
      message: '&6[OtherDrops] &b&lPora na szczescie!' # AND display this message
    - drop: BAT/1 # It will also drop a bat
    - drop: XP/1-30 # give 30XP
    - drop: MONEY/1-30 # give 30 Money
      message: '&6[OtherDrops] &a&l+ %q $!' # with this message telling how much money dropped
    - &bone # second alias
    - drop: BONE/1-4 # drops 1 to max 4 bones
      sound: SKELETON_HURT # with sound of SKELETON_HURT
    - drop: INK_SACK:15/1-8 # and drops 1-8 ink sac with data of 15, which is Bone Meal
      sound: SKELETON_HURT # and emits this sound

otherdrops:
    ZOMBIE: # when zombie dies
        - *default # executes default alias
        - *bone # and bone alias
commented

The aliases are part of the YAML markup language that Bukkit utilises for config files - I haven't created them. If you want to check the validity of your aliases try the YAML checker (http://yaml-online-parser.appspot.com/) - you'll see both Zombie drops show as "null" with the config above.

You should double-check the aliases page here: http://dev.bukkit.org/bukkit-plugins/otherdrops/pages/aliases/ - you need to use a dropgroup to place multiple drops/messages under one alias.

aliases:
    - &default  # alias "default" is supposed to:
      dropgroup: blah
      drops: 
        - drop: [SPONGE/1/5%, BAT/1, XP/1-30]
          sound: LEVEL_UP # and emit LEVEL_UP sound
          message: '&6[OtherDrops] &b&lPora na szczescie!' # AND display this message

        - drop: MONEY/1-30 # give 30 Money
          message: '&6[OtherDrops] &a&l+ %q $!' # with this message telling how much money dropped

    - &bone # second alias
      drop: [BONE/1-4, INK_SACK@15/1-8] # drops 1 to max 4 bones
      sound: SKELETON_HURT # with sound of SKELETON_HURT

otherdrops:
    ZOMBIE: # when zombie dies
        - *default # executes default alias
        - *bone # and bone alias
commented

So I did something wrong. Thanks for the help.

commented

Closing