checkAnvil

Discussion in 'Plugin Requests' started by madtomic, Jul 30, 2019.

  1. Offline

    madtomic

    Plugin category: Mechnical

    Minecraft version: 1.12.2

    Suggested name:
    checkAnvil

    What I want: I would like a plugin that would let OP or player with permission to Shift+Right click on an anvil. It would then send the player a chat message telling the condition of the anvil.

    Condition: how many usages or durability left on the anvil.

    checkMsg: "&eThis anvil has %uses% uses left."

    Commands: none

    Permission: checkAnvil.admin

    Thank you for reading.
     
    Last edited: Jul 30, 2019
  2. Offline

    MrDaniel

    What do you mean condition? Percentage, amount of uses left, name?
     
  3. Offline

    madtomic

    Amount of uses left on that particular anvil that is being check.
     
  4. Offline

    MrDaniel

    This is theoretical impossible since a anvil doesn't have a specific amount of uses left, once you use a anvil it has a 12% chance to go down to it's worse condition, first chippped, then damadged, then destroyed. The average amount of uses is 25, if you want to, I can make it so each anvil has 25 uses before getting destroyed

    Source: https://minecraft.gamepedia.com/Anvil
     
  5. Offline

    madtomic

    Since there are 3 stages of anvil in the game. Is there anything in the server code that shine a light on this topic?

    Setting each anvil to have 25 uses would be the best way to do it. I guess, it would to nice to have the texture for different stage the anvil is currently in.

    100% - anvil
    50% - chipped_anvil
    25% - damaged_anvil

    Let me know what you think?
     
  6. Offline

    Kars

    @madtomic This is precicely how anvils work currently apart from the exact number of uses.
    What you want is possible but you would have to store the anvil data in a config file somewhere.
     
  7. Offline

    MrDaniel

    @madtomic

    I have came up with 2 ways of solving this problem, please let me know which one you would prefer,

    1) The Simple way:

    The way this works is that each stage in the anvil would have a set amount of uses that can be defined in the config. For example, in total, there is an average amount of 25 uses, 25 divided by 7 is 8.6, round that up to 9. So after using each stage of the anvil the amount of uses with the specific stage of anvil would decrease by 1, once it reaches 0, the anvil moves down a stage.

    If a player with the checkAnvil.admin permission types /anvilcheck and then punches an anvil it would show the amount of uses left.

    2) Increasing chance of breaking:

    This way of solving this problem is a similar way to the way minecraft handles anvils. If a player uses an anvil for the first time, there is a set chance of the anvil breaking, customizable in the config. Every time a player uses the anvil, the chance of the anvil moving down a stage would increase for the next time a player uses the anvil.

    If a player with the checkAnvil.admin permission types /anvilcheck and then punches an anvil it would show the percentage of the anvil breaking instead of the uses left, because there are no uses


    ------------------------------

    All of the anvil data would have to be stored in config.yml with all the locations of anvils that exist and listen to events such as /give anvil, crafting, taking out of creative inventory.
     
  8. Offline

    Kars

    @MrDaniel he wants a predefined amount of usages so you would store that amount and the amount of remaining uses for every anvil somewhere. If metadata or something similar can be used for this it wouldn't be that difficult. If not, good luck making a full proof system. You would have to deal with players using the anvil and then picking it up.
     
  9. Offline

    madtomic

    @MrDaniel

    Thanks for looking into this. I was simply asking a way to tell what the anvil condition is current in. I wanted to know while testing an anvil plugin.

    Both of your methods, have it's pros and cons. ideal method one would served me best hence a number can be extracted. Method two would not serve what I needed. Thanks to @Kars for your inputs to this.
     
  10. Offline

    Syes

    if you want i could give it a shot, although id have to predefine the amount of uses an anvil gets upon placement
     
  11. Offline

    madtomic

    @Syes

    Alright, I will be happy to see what is the best possible solution.
     

Share This Page