Adding to config

Discussion in 'Plugin Development' started by bronzzze, Apr 14, 2015.

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

    bronzzze

    How can I add
    Code:
       public BukkitTaskBomb(Main plugin, Entity grenade, int radius) {
            this.plugin = plugin;
            this.grenade = grenade;
            this.radius = radius;
        }
    this to make infinity grandes/bombs in config example config:
    Code:
    Smallgranade:
      radius: 5
    LargeGranade:
      radius:10
    ... Players add there more.
    I just can't explain better what I mean:/
     
  2. Offline

    mine-care

    @bronzzze so you want the info in the code above to be loaded by the config? or the other way arround?
     
  3. Offline

    sgavster

    You could use grenade.getName() or something, add that to the config, then put grenade.getName() + ".radius" + radius
     
  4. Offline

    bronzzze

    So like this
    Code:
     public BukkitTaskBomb(Main plugin, Entity grenade, int radius, String name) {
    and then
    Code:
    new BukkitTaskBomb(main, smallbitem, main.getConfig.getInt(2), smallbitem.getName()).runTaskLater(main, 20 * 2);
    @mine-care
    I want that player that uses this plugin add in config custom Granade with custom radius and display name.



    Edit:
    How to get entity Display name. granade.getName() not working


    Another Edit:
    Oh I could just make New ItemStack and set It display name in config right?
    Code:
    ItemStack small = new ItemStack(Material.SLIME_BALL);
                    ItemMeta smallM = small.getItemMeta();
                    smallM.setDisplayName(main.getConfig().getString("GranadeDisplayName"));
                    small.setItemMeta(smallM);
     
    Last edited: Apr 14, 2015
Thread Status:
Not open for further replies.

Share This Page