Refrigerators

Discussion in 'Archived: Plugin Requests' started by Lummox, Mar 22, 2013.

  1. Plugin category: Roleplay

    Suggested name: Refrigerators

    What I want:
    This is a plugin for "refrigerators" with chests, to keep food and not are put in poor condition.

    Foods have to get into ice chests, to can withstand longer in good condition.

    There are three types of "freezer", each extends the life of food as the ice you have.

    Baul simple, with a row of ice. (Small)

    [​IMG]

    Baul simple, with a row of ice and another row of snow. (Medium)

    [​IMG]

    Baul double edged ice and snow. (Large)

    [​IMG]



    Each is configured to extend the life of food, from the configuration file.

    Example of configuration file:
    * (Real hours = H - real Minutes = M):

    Code:
    Time to get in poor condition the food: 10M
    Small refrigerator: 6H
    - Time before putting on the food in poor condition: 15M
    Economy: <true> <false>
    - Cost: 100
    Refrigerator medium: 12H
    - Time before putting on the food in poor condition: 20M
    Economy: <true> <false>
    - Cost: 200
    Large refrigerator: 24H
    - Time before putting on the food in poor condition: 30M
    Economy: <true> <false>
    - Cost: 500
    * This is the time it takes food to get in poor condition since that is picked up.

    This means, that by introducing a block of ice or snow, in a refrigerator (fridge "small", for example), the food continues for 6 hours in good condition .... after 6 hours, the ice blocks disappear, having to replace the blocks to keep "cooling". If you do not replace in the set time, the food gets messed up and becomes zombie meat.

    To create a refrigerator, it would be as follows:

    1) You create a chest, with the combination of ice/snow, put above.
    2) Writer /refrigerator create <small> <medium> <large>
    3) Click on the chest that will turn into a refrigerator.
    4) If OK, a message "You have created a refrigerator <small> <medium> <large>"

    Should also be able configurase if it costs money to create a cooler, be able to set the price separately.

    Ideas for commands:
    /refrigerator create <small> <medium> <large>
    *Create a refrigerator

    Ideas for permissions:
    freezerchest.use -> Ability to use refrigerators
    freezerchest.create -> Create refrigerators
    freezerchest.exempt -> Forwarding pay for creating refrigerators

    When I'd like it by:
    I can wait the time required to create this plugin.
     
  2. Offline

    Scyntrus

    Just a heads up, the custom gui is not possible without spout, since that's client side. This in general is quite unrealistic. Making food items turn into zombie meat is harder than it sounds. You have to keep track of all the food items in the map and set a timer that measures the lifetime of the food.

    tldr: don't get your hopes up.
     
  3. Where you seen a "customized GUI"?. Spout is not needed for this plugin ...
     
  4. Offline

    Scyntrus

    Sorry, I realize now that's just your texturepack.
     
    Compressions likes this.
  5. Offline

    PogoStick29

    Inventory inv = Bukkit.getServer().createInventory(null, 9, "Chest name.");
    Null refers to the inventory holder; there isn't one.
    9 refers to the number of slots. It needs to be a multiple of 9.
    "Chest name." is self explanatory ;)
     
    MrBluebear3 likes this.
  6. Offline

    GodzOfMadness

    PogoStick29 He just didn't realize that it was a texture pack
     
  7. Offline

    PogoStick29

    Ah ;)
     
  8. Scyntrus Minimise the use of timers by utilising Long (time) values to keep track of the item's life. Compare old and present Long values with events such as InventoryClickEvent and PlayerInteractEvent to be more efficient :)
     
    MrBluebear3 and GodzOfMadness like this.
  9. Offline

    Scyntrus

    I'm not actually going to do this, I was just adding input. But, theoretically speaking, how would you keep track of all the food items? I don't see any way of doing this except looping through every inventory holder in the world and setting a damage value.
     
  10. Offline

    GodzOfMadness

    Guys if you forgot this is the plugin requests forum. No need to change this post into a programming conversation
     
  11. Offline

    Scyntrus

    A programmer would be more likely to take on a project if they knew where to start.
     
    MeneXia likes this.
  12. Offline

    GodzOfMadness

    Scyntrus Yea but it doesn't help if people are talking about your mistake of thinking it was a custom gui
     

  13. Only when you pick up. The plantation, not start counting until the pick up.

    Start counting from the user enters the food in their inventory (pick up ground).
     
  14. We'll stick to the idea that every item will have a Long time value stored instead of timer usage, and then hook into events for Long time value checking.

    Consider how many ways food can enter a player's inventory:
    • Picking up food (PlayerPickupItemEvent)
    • Commands that add food into player's inventory (?)
    Other events that can be used to check the state of the food (whether the food is spoiled or not, by getting the difference between the present Long values and the initial Long value, and checking if that difference is greater than x minutes, specified in the config):
    • When the player opens his/her personal inventory or a storage inventory (i.e. chest) (InventoryOpenEvent)
    • If the food was added artificially through the use of commands, it would not have a Long time value, thus we can also use InventoryClickEvent to check if the item has a value or not, and input one if it doesn't.
    Now, some potential caveats:
    • To keep things realistic, food on the quickbar can become spoiled when checking with the events above. This can be visually weird for some players (i.e. they have a cooked porkchop in their quickbar, and when they open a chest, it suddenly becomes zombie meat, when they think that just a second ago, it was fresh).
    A potential solution to this not to check the items in the quickbar and only check the ones in the upper inventory of the player. However, if the server owner's players understand the whole concept of refrigerators, then this shouldn't be a problem.
     
  15. Nobody wants to try? :'(
     

Share This Page