Drop from list in config

Discussion in 'Plugin Development' started by MordorKing78, Dec 24, 2014.

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

    MordorKing78

    Hey, So what I want to do is when a player dies. There is a list in the config that will drop on the loc were the player died. But how would I do that?

    Example:
    Config:
    Drops:
    - 311
    - 321
    Ingame:
    -- Player Dies --
    Items of inventory drops and ID 311 and 321
     
  2. Offline

    adam753

    IDs are deprecated. Use material names instead.
    Code:
    List<String> drops = getConfig().getStringList("Drops")
    Then use Material.matchMaterial for each one.
     
  3. Offline

    BlizzardFyre

    His problem is not that he is using IDs, it is that he does not know how to do it. Use
    loc.getWorld().dropItemNaturally(loc, ItemStack);
     
  4. Offline

    adam753

    @BlizzardFyre
    If you only fix someone's existing problem rather than the method they're using, they're just going to be back 5 minutes later.
     
  5. Offline

    BlizzardFyre

    @adam753
    Do not tell people IDs are bad to use. YES they are deprecated. YES it is better to use Material. NO using IDs does not cause a problem
     
  6. Offline

    adam753

    @BlizzardFyre
    But I did also tell him how to solve his problem.
     
  7. Offline

    Xtreme727

    To loop through the items just do 'for (String string : <list name here>) {' in the case of ID's, assuming you would use an Integer list
     
Thread Status:
Not open for further replies.

Share This Page