Basic API help please.

Discussion in 'Plugin Development' started by Parsalin, Sep 1, 2014.

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

    Parsalin

    How would I set how much damage can be does while holding air? i sort of expected this to be easyer. Will it be when damage is caused ill have to check if its by player and set his damage stat then? ((i can do this but well dang...))

    What should I look at for modifying items in game. First just lore and such but further more details or is lore about the only way to do it? ((I am looking forward to attributes on items in 1.8))

    Id like to discuss the different ways to save data in java, and what would be the most efficient in minecraft. I see the most people say config files. I dont really plan to store alot just some simple variables but sort alot of them... if i go skills anyways. So tell me your opinions Each player added to a config file or can you suggest somthing else.


    Thanks to any help you can all offer.
     
  2. Offline

    macboinc

  3. Offline

    nzkiwi.5000

    Essential: http://wiki.bukkit.org/Plugin_Tutorial

    Set damage: Code a listener checking if the player is holding Material.AIR, then set the damage to what you want
    http://wiki.bukkit.org/Event_API_Reference

    Modding items in game: You can change the lore and the name of the item. I am also looking forward to attributes in 1.8
    https://forums.bukkit.org/threads/how-to-change-items-names.118126/
    https://forums.bukkit.org/threads/changing-item-description.120431/#post-1486239

    Different ways to store data: This topic is so big that you need to precise your question.
    Mainly use YAML config.
    If you want to store player data, make this:
    Code:
    player-uuid:
        var1: 15
        var2: false
        var3: 'Johnny'
    
    Please remember that you should store player's UUID instead of NAME, due to upcoming Name-change update
    Any other data: use your creativity!
    http://wiki.bukkit.org/Configuration_API_Reference
     
    Parsalin likes this.
  4. Offline

    Parsalin



    Thanks so much this is very helpful. I was aware of the uuid changes comming though.
    I am specificly trying to create a character sheet of info so things like damage output and damage mitigation. id rather not reference a config file every single time, but i can do that.
     
  5. Offline

    Gnat008

    Parsalin
    For data storage, I think the two most popular ways are yaml config files, and SQL. Though I don't see why you can't use another form, unless there is something I don't know about. Mainly depends on personal preference and the type/amount of data you are storing for efficiency.
     
  6. Offline

    nzkiwi.5000

    Referencing config is not so bad, because it's contents are stored i memory, so it's not a laggy IO operation. The only IO in configs are save() and load().

    Bukkit plugins are basically a type of java programs, so you can use your tricks from general java, like using Sockets, storing data in JSON or any data format and style. YAML and SQL is advised, because it's fast, and the first one is user-friendly.

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

    fireblast709

    SQL, fast? I surely hope you don't execute your MySQL on the main thread :p.
     
  8. Offline

    nzkiwi.5000

    sorry. meant yaml is fast :D
     
Thread Status:
Not open for further replies.

Share This Page