Searching for info in config by in game command

Discussion in 'Plugin Development' started by Jumbapablo, Sep 19, 2014.

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

    Jumbapablo

    This is what my configuration file looks like. Every time a new player not in the file mines any ore, it adds their name to the config and then tracks their ore count.

    Code:
    # This is Jumba's OreTracker Plugin! This plugin tracks how many of each ore
    # have been mined on the server!
    # need ot.reset permission for otreset command
    # need ot.track permission for ottrack command
    # need ot.save permission for otsave command
    # d = diamond l = lapis g = gold e = emerald
    # c = coal i = iron r = redstone q = quartz
    # Total ore count:
    diamond: 6
    gold: 3
    lapis: 0
    emerald: 0
    coal: 0
    iron: 0
    rstone: 1
    quartz: 0
    jumbapablo:
      d: 6
      g: 3
      l: 0
      e: 0
      c: 0
      i: 0
      r: 1
      q: 0
    Spike228:
      d: 6
      g: 3
      l: 5
      e: 1
      c: 2
      i: 0
      r: 1
      q: 57
    mikewebb22:
      d: 6
      g: 3
      l: 0
      e: 34
      c: 101
      i: 3
      r: 1
      q: 0 
    
    I want to create a command called /otptrack
    When an admin does /otptrack <playername>
    I want the plugin to search for that name they specified in the config and return the data under their name.

    Example:

    An admin does /otptrack mikewebb22

    The plugin searches the config for his name then returns a message to the sender saying:

    mikewebb22's ore list:
    d: 6
    g: 3
    l: 0
    e: 34
    c: 101
    i: 3
    r: 1
    q: 0

    How would I do this?
     
  2. Offline

    augustas656

    If you have no idea how to do anything or most of the things here I advise you to watch some tutorials, correct if I'm wrong. You can just search youtube, event handling, commands and config making. This isn't hard but takes a bit more than an average amount of code used to explain something simple.
     
  3. Offline

    Jumbapablo

    augustas656 I have been watching tutorials and have my plugin working. Currently it tracks each players ore count and a server owner can go into the config and see each player's ore count but I want to add the command in for simplicity. What would that be called? Basically my question is:
    If a person did /otptrack <playername>
    if (args .>=1 ) {
    }
    Look for any string in the config that matches what args was and then return all info under that string back to the sender.
     
  4. Offline

    Skionz

    Code:java
    1. config.getInt("PlayersName.diamond");
     
  5. Offline

    mythbusterma

    augustas656 Jumbapablo

    Alternative to watching terrible YouTube videos, you actually learn what you're doing. Follow the Java tutorial published by Oracle, then try Bukkit.
     
    es359 likes this.
  6. Offline

    Jumbapablo

    mythbusterma augustas656 Guys I am familiar with plugins. I just am stuck on how to do this particular type of thing.
     
  7. Offline

    mythbusterma

    Jumbapablo

    Someone "familiar with plugins" would know how to implement a simple command to read config files. Try again.
     
  8. Offline

    Jumbapablo

    mythbusterma I'd like to thank you for wasting my time... If you're not here to help then don't bother saying anything...
     
  9. Offline

    Totom3

  10. Offline

    mythbusterma

    Jumbapablo

    But I am here to help, and I gave you the best advice you'll ever find. Use the Java Trail from Oracle to learn Java, then follow the Bukkit tutorial linked by Totom3 .
     
  11. Offline

    Jumbapablo

    mythbusterma Thank you that did help out! I guess I just got a little impatient. Totom3 That helped as well.
    Thank you both! Both tutorials were helpful.
     
    mythbusterma likes this.
Thread Status:
Not open for further replies.

Share This Page