Need help with giving a item to everyone on the server

Discussion in 'Bukkit Help' started by bwfcwalshy, Apr 26, 2014.

Thread Status:
Not open for further replies.
  1. Ok so my plugin is to give everyone on the server a certain block or item every so ofton (choose id and amount and time in config) But its coming up with errors in my ItemStack and also i dont know how to give everyone my itemstack

    Main:
    Code:java
    1. package com.bwfcwalshy.lb;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.configuration.file.FileConfiguration;
    5. import org.bukkit.plugin.java.JavaPlugin;
    6.  
    7. public class Main extends JavaPlugin {
    8.  
    9. public static int ItemBlockTimer = 0;
    10. public static int timeInSeconds;
    11. public boolean canStart;
    12.  
    13. public void onDisable() {
    14. super.onDisable();
    15.  
    16. Bukkit.getServer().getScheduler().cancelTask(ItemBlockTimer);
    17. }
    18. public void onEnable() {
    19. super.onEnable();
    20. FileConfiguration config = getConfig();
    21.  
    22. timeInSeconds = config.getInt("ItemBlock.Time");
    23.  
    24. initialiseConfig();
    25. }
    26.  
    27. private void initialiseConfig(){
    28. FileConfiguration config = getConfig();
    29.  
    30. config.addDefault("ItemBlock.Time", "1800");
    31. config.addDefault("ItemBlock.Amount", 2);
    32. config.addDefault("ItemBlock.ID", 1);
    33.  
    34. config.options().copyDefaults(true);
    35. saveConfig();
    36. }
    37. }


    ItemBlockTimer:
    Code:java
    1. package com.bwfcwalshy.lb;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.configuration.file.FileConfiguration;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.inventory.ItemStack;
    7.  
    8. public class ItemBlockTimer implements Runnable {
    9.  
    10. @Override
    11. public void run() {
    12. FileConfiguration config;
    13. if(Main.timeInSeconds == 0) {
    14. ItemStack is = ItemStack(config.getString("ItemBlock.ID"), config.getString("ItemBlock.Amount"));
    15. Player[] players = Bukkit.getServer().getOnlinePlayers();
    16.  
    17. }
    18. }
    19. }
    20.  
     
  2. Offline

    TomYaMee

Thread Status:
Not open for further replies.

Share This Page