WynnCraft: Loot Chest

Discussion in 'Plugin Development' started by YellowKamel, Apr 11, 2014.

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

    YellowKamel

    Does anyone know the Server: play.wynncraft.com and his an idea how there Looting Chest System works? If anyone can tell me it would be really great :D. Thanks.
    - YellowKamel

    PS: Anyone.... please :'(

    Anyone....

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. Offline

    Zethariel

    Don't bump so often. Please be patient. Also, if you know how it is named, why don't you look for an API or the plugin description?
     
  3. Offline

    MrMax555

    You can make it with a Listener:
    @EventHandler public void onInventoryClose(InventoryCloseEvent e){ if(e.getInventory().getHolder() instanceof Chest){ if(e.getPlayer().isOp() == false){ Chest chest = (Chest) e.getInventory().getHolder(); chest.getBlock().setType(Material.AIR); } } }
     
  4. Offline

    YellowKamel

    The Problem is, that the WynnCraft Plugin is not officialy released, and there no page on bukkit for it.
    Its only on this Server yet.
     
  5. Offline

    Zethariel

    YellowKamel Then how do you expect anyone to know how it works? [pig]
     
  6. Offline

    YellowKamel

    Sorry, I want to correct myself: "Can anyone imagine how it works?". Better?

    For those people who actually dont know the WynnCraft Loot Chest System, what it does it spawns on different places Chests, that contain different random items. If someone open the chest he can loot it and after he close the chest again it disappears.

    bump, bump, bunnies, bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  7. Offline

    coasterman10

    8 minutes between bumps...

    Anyways, what you want to do to create a lootable chest is to create some sort of loot table database with all the loot you want to give and what probability of spawning each one, and randomly select items to put into the chest. Placement of the chest is up to you.
     
  8. Offline

    YellowKamel

    I.. really dont know what you mean can you give me an example?

    and another bumb, the last for today...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  9. Offline

    Glumpz

    One bump per 24 hours, end of story.
     
  10. Offline

    CreepahMC

    There already is a plugin out there called Loot that has the same capabilities as WynnCraft's chest loot system. Since WynnCraft is 100% custom, you can't really get a plugin exactly like it unless you recode a plugin identical to WynnCraft's.

    EDIT: Loot is outdated, use PhatLoots. Basically a remake of Loot.
     
  11. Offline

    Mr.PuddinPop

    u should maek a loot chest object:
    Code:java
    1. public class LootChest {
    2.  
    3. private int loot_level;
    4. private Location loc;
    5.  
    6. public LootChest(int loot_level, Location loc){
    7. this.loot_level = loot_level;
    8. this.loc = loc;
    9. }
    10.  
    11. public int getLootLevel(){
    12. return this.loot_level;
    13. }
    14.  
    15. public Location getLocation(){
    16. return this.loc;
    17. }
    18. }


    then u haev to make a manager fer the object (u should make more methods in this class):
    Code:java
    1. class LootChestManager{
    2.  
    3. ArrayList<LootChest> chests = new ArrayList<LootChest>();
    4.  
    5. public void addChest(LootChest chest){
    6. chests.add(chest);
    7. }
    8.  
    9. public void destoryLootChest(LootChest chest){
    10. Location loc = chest.getLocation();
    11. loc.getBlock().setType(Material.AIR);
    12. chests.remove(chest);
    13. }
    14.  
    15. public void setContents(LootChest chest){
    16. switch (chest.getLootLevel()){
    17. case 1:
    18. //Set non rare contents (Recommend using a random ItemStack[] generator)
    19. break;
    20. case 2:
    21. //set better stuff inside
    22. break;
    23. default:
    24. //set default stuffs
    25. break;
    26.  
    27. }
    28. }
    29.  
    30. public boolean isLootChest(Block block){
    31. boolean value = false;
    32. for(LootChest chest : chests){
    33. if(chest.getLocation().equals(block.getLocation())){
    34. value = true;
    35. }
    36. }
    37. return value;
    38. }
    39. }
     
Thread Status:
Not open for further replies.

Share This Page