@Override
  public void processCommand(ICommandSender var1, String[] var2) {
    if (var2.length > 1) {
      throw new WrongUsageException(this.getCommandUsage(var1), new Object[0]);
    }

    EntityPlayer player;

    if (var2.length == 1) {
      player = getPlayer(var1, var2[0]);
    } else {
      player = getCommandSenderAsPlayer(var1);
    }

    if (player == null) return;

    SkillData.For(player).incrementSpellPoints(SkillPointTypes.RED);
    SkillData.For(player)
        .learn(
            SkillManager.instance.getSkill("AugmentedCasting").getID() + SkillManager.TALENT_OFFSET,
            3);
    SkillData.For(player).forceSync();

    func_152373_a(
        var1,
        this,
        "Unlocking augmented casting for " + player.getCommandSenderName(),
        new Object[0]);
  }
Ejemplo n.º 2
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);
    }
    // ================================================================================
  }
Ejemplo n.º 3
0
 @SubscribeEvent
 public void onPlayerChangedDimension(PlayerChangedDimensionEvent event) {
   // kill any summoned creatures, eventually respawn them in the new dimension
   if (!event.player.worldObj.isRemote) {
     storeExtendedPropertiesForDimensionChange(event.player);
     List list = event.player.worldObj.loadedEntityList;
     for (Object o : list) {
       if (o instanceof EntityLivingBase
           && EntityUtilities.isSummon((EntityLivingBase) o)
           && EntityUtilities.getOwner((EntityLivingBase) o) == event.player.getEntityId()) {
         ((EntityLivingBase) o).setDead();
       }
     }
     ExtendedProperties.For(event.player).setDelayedSync(40);
     AffinityData.For(event.player).setDelayedSync(40);
     SkillData.For(event.player).setDelayedSync(40);
   }
 }
Ejemplo n.º 4
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);
    // ================================================================================
  }
Ejemplo n.º 5
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);
      }
    }
    // ================================================================================
  }