Solved Seperate Class's........Methods and Timers

Discussion in 'Plugin Development' started by ASHninja1997, Oct 15, 2013.

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

    ASHninja1997

    I have been trying to figure this out but i can't get it work....
    It keeps bringing a "File can not be null error" on this onEnable().
    Code:java
    1. @Override
    2. public void onEnable() {
    3. Bukkit.getConsoleSender().sendMessage(
    4. ChatColor.GREEN + "[SnipeCraft] SnipeCraft has been Enabled!");
    5. getServer().getPluginManager().registerEvents(new Counters(), this);
    6. Counters.Fire();
    7. InventoryGUI();
    8. getServer().getPluginManager().registerEvents(this, this);
    9. }

    Specifically on this line
    Code:
    Counters.Fire();
    Ask questions if you need more answers.
    Thanks in Advance :D.
     
  2. Offline

    The_Doctor_123

    Can we see your Counters class?
     
  3. Offline

    ASHninja1997

    The_Doctor_123
    Very sorry for the long reply
    Code:java
    1. package com.ASHninja1997.snipecraft;
    2.  
    3. import java.io.File;
    4. import java.io.IOException;
    5. import java.util.ArrayList;
    6. import java.util.List;
    7. import java.util.Random;
    8.  
    9. import org.bukkit.Bukkit;
    10. import org.bukkit.ChatColor;
    11. import org.bukkit.Location;
    12. import org.bukkit.Material;
    13. import org.bukkit.Sound;
    14. import org.bukkit.configuration.file.FileConfiguration;
    15. import org.bukkit.configuration.file.YamlConfiguration;
    16. import org.bukkit.enchantments.Enchantment;
    17. import org.bukkit.entity.Player;
    18. import org.bukkit.event.Listener;
    19. import org.bukkit.inventory.ItemStack;
    20. import org.bukkit.inventory.meta.ItemMeta;
    21. import org.bukkit.potion.PotionEffect;
    22. import org.bukkit.potion.PotionEffectType;
    23. import org.bukkit.scheduler.BukkitRunnable;
    24.  
    25. public class Counters extends snipecraft implements Listener {
    26.  
    27. static String text = ChatColor.AQUA + "Seconds till" + ChatColor.GOLD + " Battle" + ChatColor.AQUA + "!";
    28. static String text2 = ChatColor.AQUA + "minute's left";
    29. static String text3 = ChatColor.AQUA + "Seconds till" + ChatColor.GOLD + " Sniper" + ChatColor.AQUA + "!";
    30. static String text4 = ChatColor.AQUA + "Seconds till" + ChatColor.GOLD + " Archer" + ChatColor.AQUA + "!";
    31. static String text5 = ChatColor.AQUA + "Seconds till" + ChatColor.GOLD + " Castle Defence" + ChatColor.AQUA + "!";
    32.  
    33. static int ctPreGameB;
    34. static int NumPreGameB;
    35. static int ctBattle;
    36. static int numBattle;
    37.  
    38. static int ctTime;
    39. static int numCheck;
    40. static int ctCheck;
    41. static int ctFire;
    42.  
    43. static int ctPreGameS;
    44. static int NumPreGameS;
    45.  
    46. static int ctPreGameC;
    47. static int NumPreGameC;
    48.  
    49. static int cdSniper;
    50. static int numCdSniper;
    51.  
    52. static int ctPreGameA;
    53. static int NumPreGameA;
    54.  
    55. static public Counters plugin;
    56.  
    57. public FileConfiguration config;
    58.  
    59. @SuppressWarnings("deprecation")
    60. public static Listener Fire(){
    61. ctFire = Bukkit.getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable(){
    62. public void run() {
    63. Bukkit.getWorld("world").setTime(6000);
    64. }
    65. }, 0L, 40L);
    66. return plugin;
    67. }
    68.  
    69. private static ItemStack cname(ItemStack is, String name, List<String> lore) {
    70. ItemMeta im = is.getItemMeta();
    71. if (name != null)
    72. im.setDisplayName(name);
    73. if (lore != null)
    74. im.setLore(lore);
    75. is.setItemMeta(im);
    76. return is;
    77. }


    That is the beginning with the first two methods I would put more, but the class is 775 lines long.

    bump.......er Cars

    nvm Solved it xD :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
Thread Status:
Not open for further replies.

Share This Page