Solved Metadata

Discussion in 'Plugin Development' started by messageofdeath, Jul 3, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    messageofdeath

    I have a
    entity.setMetadata("Stuff", new FixedMetadataValue(instance, new Horse(player, entity.getEntityId(), 0)));

    I can retrieve the metadata value during that time before it reloads. Once the server reloads the server sees the metadata "Stuff" still there but after reloads I can't change the Object to Horse. The error is like ClassCastException You cannot cast Horse to Horse. This only happens after reloads.

    Ask if you need for me to explain this better.
     
  2. Offline

    Virgoth098

    Horses are having problems right now as the latest dev build of 1.6.1. Horses aren't recognized as entities, that might be your problem.
     
  3. Offline

    messageofdeath

    Virgoth098
    Im using Cows right now to test my plugin but Im talking about metadata
     
  4. Offline

    nisovin

    When you /reload you end up with new "versions" of all of your classes. You won't be able to store your old Horse object in your new Horse variable because they aren't the same class type.
     
  5. Offline

    Technius

    If you want a more in-depth version of nisovin 's explanation, it's because /reload "unloads" all the plugins and then loads them again. Every plugin has its each ClassLoader(unless specified with the class-loader-of option). Every time a plugin is reloaded, its ClassLoader is discarded and a new one is created for newly loaded version of the plugin.
     
Thread Status:
Not open for further replies.

Share This Page