Beispiel #1
0
  public static void storeExtendedPropertiesForDimensionChange(EntityPlayer player) {
    // extended properties
    // ================================================================================
    if (!storedExtProps_death.containsKey(player.getDisplayName())) {
      if (storedExtProps_dimension.containsKey(player.getDisplayName()))
        storedExtProps_dimension.remove(player.getDisplayName());

      NBTTagCompound saveExprop = new NBTTagCompound();
      ExtendedProperties.For(player).saveNBTData(saveExprop);

      storedExtProps_dimension.put(player.getDisplayName(), saveExprop);
    }
    // ================================================================================
    // rift storage
    // ================================================================================
    if (!riftStorage_death.containsKey(player.getDisplayName())) {
      if (riftStorage_dimension.containsKey(player.getDisplayName()))
        riftStorage_dimension.remove(player.getDisplayName());

      NBTTagCompound saveRift = new NBTTagCompound();
      RiftStorage.For(player).saveNBTData(saveRift);

      riftStorage_dimension.put(player.getDisplayName(), saveRift);
    }
    // ================================================================================
    // affinity storage
    // ================================================================================
    if (!affinityStorage_death.containsKey(player.getDisplayName())) {
      if (affinityStorage_dimension.containsKey(player.getDisplayName()))
        affinityStorage_dimension.remove(player.getDisplayName());

      NBTTagCompound saveAffinity = new NBTTagCompound();
      AffinityData.For(player).saveNBTData(saveAffinity);

      affinityStorage_dimension.put(player.getDisplayName(), saveAffinity);
    }
    // ================================================================================
    // spell knowledge storage
    // ================================================================================
    if (!spellKnowledgeStorage_death.containsKey(player.getDisplayName())) {
      if (spellKnowledgeStorage_dimension.containsKey(player.getDisplayName()))
        spellKnowledgeStorage_dimension.remove(player.getDisplayName());

      NBTTagCompound spellKnowledge = new NBTTagCompound();
      SkillData.For(player).saveNBTData(spellKnowledge);

      spellKnowledgeStorage_dimension.put(player.getDisplayName(), spellKnowledge);
    }
    // ================================================================================
  }
Beispiel #2
0
  public static void storeExtendedPropertiesForRespawn(EntityPlayer player) {
    // extended properties
    // ================================================================================
    if (storedExtProps_death.containsKey(player.getDisplayName()))
      storedExtProps_death.remove(player.getDisplayName());

    NBTTagCompound save = new NBTTagCompound();
    ExtendedProperties.For(player).saveNBTData(save);

    storedExtProps_death.put(player.getDisplayName(), save);

    // ================================================================================
    // rift storage
    // ================================================================================
    if (riftStorage_death.containsKey(player.getDisplayName()))
      riftStorage_death.remove(player.getDisplayName());
    NBTTagCompound saveRift = new NBTTagCompound();
    RiftStorage.For(player).saveNBTData(saveRift);

    riftStorage_death.put(player.getDisplayName(), saveRift);

    // ================================================================================
    // affinity storage
    // ================================================================================
    if (affinityStorage_death.containsKey(player.getDisplayName()))
      affinityStorage_death.remove(player.getDisplayName());
    NBTTagCompound saveAffinity = new NBTTagCompound();
    AffinityData.For(player).saveNBTData(saveAffinity);

    affinityStorage_death.put(player.getDisplayName(), saveAffinity);
    // ================================================================================
    // affinity storage
    // ================================================================================
    if (spellKnowledgeStorage_death.containsKey(player.getDisplayName()))
      spellKnowledgeStorage_death.remove(player.getDisplayName());
    NBTTagCompound saveSpellKnowledge = new NBTTagCompound();
    SkillData.For(player).saveNBTData(saveSpellKnowledge);

    spellKnowledgeStorage_death.put(player.getDisplayName(), saveSpellKnowledge);
    // ================================================================================
  }
Beispiel #3
0
  @SubscribeEvent
  public void onPlayerRespawn(PlayerRespawnEvent event) {
    // extended properties
    // ================================================================================
    if (storedExtProps_death.containsKey(event.player.getDisplayName())) {
      NBTTagCompound stored = storedExtProps_death.get(event.player.getDisplayName());
      storedExtProps_death.remove(event.player.getDisplayName());

      ExtendedProperties.For(event.player).loadNBTData(stored);
      ExtendedProperties.For(event.player).setDelayedSync(40);
    } else if (storedExtProps_dimension.containsKey(event.player.getDisplayName())) {
      NBTTagCompound stored = storedExtProps_dimension.get(event.player.getDisplayName());
      storedExtProps_dimension.remove(event.player.getDisplayName());

      ExtendedProperties.For(event.player).loadNBTData(stored);
      ExtendedProperties.For(event.player).setDelayedSync(40);
    }
    // ================================================================================
    // rift storage
    // ================================================================================
    if (riftStorage_death.containsKey(event.player.getDisplayName())) {
      NBTTagCompound stored = riftStorage_death.get(event.player.getDisplayName());
      riftStorage_death.remove(event.player.getDisplayName());

      RiftStorage.For(event.player).loadNBTData(stored);
    } else if (riftStorage_dimension.containsKey(event.player.getDisplayName())) {
      NBTTagCompound stored = riftStorage_dimension.get(event.player.getDisplayName());
      riftStorage_dimension.remove(event.player.getDisplayName());

      RiftStorage.For(event.player).loadNBTData(stored);
    }
    // ================================================================================
    // affinity data
    // ================================================================================
    if (affinityStorage_death.containsKey(event.player.getDisplayName())) {
      NBTTagCompound stored = affinityStorage_death.get(event.player.getDisplayName());
      affinityStorage_death.remove(event.player.getDisplayName());

      AffinityData.For(event.player).loadNBTData(stored);
    } else if (affinityStorage_dimension.containsKey(event.player.getDisplayName())) {
      NBTTagCompound stored = affinityStorage_dimension.get(event.player.getDisplayName());
      affinityStorage_dimension.remove(event.player.getDisplayName());

      AffinityData.For(event.player).loadNBTData(stored);
    }
    // ================================================================================
    // spell knowledge data
    // ================================================================================
    if (spellKnowledgeStorage_death.containsKey(event.player.getDisplayName())) {
      NBTTagCompound stored = spellKnowledgeStorage_death.get(event.player.getDisplayName());
      spellKnowledgeStorage_death.remove(event.player.getDisplayName());

      SkillData.For(event.player).loadNBTData(stored);
    } else if (spellKnowledgeStorage_dimension.containsKey(event.player.getDisplayName())) {
      NBTTagCompound stored = spellKnowledgeStorage_dimension.get(event.player.getDisplayName());
      spellKnowledgeStorage_dimension.remove(event.player.getDisplayName());

      SkillData.For(event.player).loadNBTData(stored);
    }
    // ================================================================================
    // soulbound items
    // ================================================================================
    if (soulbound_Storage.containsKey(event.player.getDisplayName())) {
      HashMap<Integer, ItemStack> soulboundItems =
          soulbound_Storage.get(event.player.getDisplayName());
      for (Integer i : soulboundItems.keySet()) {
        if (i < event.player.inventory.getSizeInventory())
          event.player.inventory.setInventorySlotContents(i, soulboundItems.get(i));
        else event.player.entityDropItem(soulboundItems.get(i), 0);
      }
    }
    // ================================================================================
  }