Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.86 KB | None | 0 0
  1. package lilian.xteam;
  2.  
  3. import lilian.xteam.commands.FreezeCommand;
  4. import lilian.xteam.commands.IpCommand;
  5. import lilian.xteam.commands.KillStreakCommand;
  6. import lilian.xteam.commands.PingCommand;
  7. import lilian.xteam.listener.EnderPearlListener;
  8. import lilian.xteam.listener.FreezeListener;
  9. import lilian.xteam.listener.GoldenAppleListener;
  10. import lilian.xteam.listener.HeadListener;
  11. import lilian.xteam.listener.KillStreakListener;
  12. import lilian.xteam.listener.PickaxeListener;
  13. import lilian.xteam.listener.PlayerKillDeathListener;
  14. import org.bukkit.Bukkit;
  15. import org.bukkit.ChatColor;
  16. import org.bukkit.event.Listener;
  17. import org.bukkit.plugin.Plugin;
  18. import org.bukkit.plugin.java.JavaPlugin;
  19. import org.bukkit.scoreboard.DisplaySlot;
  20. import org.bukkit.scoreboard.Objective;
  21. import org.bukkit.scoreboard.Scoreboard;
  22.  
  23. public class Main extends JavaPlugin{
  24.        
  25.     public static Main plugin;
  26.    
  27.    
  28.     public Objective o; //Creates a objective called o
  29.     public Scoreboard timerBoard = null; //Creates a scoreboard called timerBoard(You will see what thats used for later)
  30.     public Objective timerObj = null; // Same as above but it creates a objective called timerObj
  31.      
  32.  
  33.     public Main() {
  34.     }
  35.    
  36.     public void onEnable() {
  37.         plugin = this;
  38.         registerEvents(this, new HeadListener(), new FreezeListener(), new GoldenAppleListener(), new PickaxeListener(), new KillStreakListener(), new PlayerKillDeathListener(), new EnderPearlListener(null));
  39.         getCommand("freeze").setExecutor(new FreezeCommand());
  40.         getCommand("ks").setExecutor(new KillStreakCommand());
  41.         getCommand("ping").setExecutor(new PingCommand());
  42.         getCommand("ip").setExecutor(new IpCommand());
  43.         getConfig().options().copyDefaults(true);
  44.         saveConfig();
  45.        
  46.         Scoreboard board = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
  47.          
  48.         o = board.registerNewObjective("timer", "dummy"); //Registering the objective needed for the timer
  49.         o.setDisplayName(ChatColor.BOLD + "" + ChatColor.GOLD + "xTeam Faction Soupe"); // Setting the title for the scoreboard. This would look like: TCGN | Walls
  50.         o.setDisplaySlot(DisplaySlot.SIDEBAR); //Telling the scoreboard where to display when we tell it to display
  51.          
  52.         this.timerBoard = board; //Setting timerBoard equal to board.
  53.         this.timerObj = o; //Setting timerObj equal to o. This makes it so we can access it by typing plugin.timerObj
  54.        
  55.        
  56.        
  57.     }
  58.    
  59.  
  60.    
  61.     public void onDisable() {
  62.         plugin = null;
  63.        
  64.     }
  65.    
  66.    
  67.     public static void registerEvents(org.bukkit.plugin.Plugin plugin, Listener... listeners) {
  68.         for (Listener listener : listeners) {
  69.             Bukkit.getServer().getPluginManager().registerEvents(listener, plugin);
  70.         }
  71.     }
  72.    
  73.     public static Plugin getPlugin() {
  74.         return plugin;
  75.     }
  76.    
  77.  
  78.    
  79.    
  80.    
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement