NullChips

PvPMadness.java

Mar 4th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.40 KB | None | 0 0
  1. package com.pvpmadness.pvpmadness;
  2.  
  3. import com.pvpmadness.pvpmadness.minigames.ffa.ffacommands.FFACommand;
  4. import com.pvpmadness.pvpmadness.minigames.minigameutils.ArenaManagementFile;
  5. import com.pvpmadness.pvpmadness.minigames.minigameutils.MinigameManager;
  6. import com.pvpmadness.pvpmadness.utils.SettingsManager;
  7. import org.bukkit.Bukkit;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.plugin.Plugin;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11.  
  12. import java.util.UUID;
  13.  
  14. /**
  15.  * Copyright (c) NullChips 2017. All rights reserved.
  16.  * All code contained within this document is the
  17.  * sole property of NullChips. Distribution, reproduction,
  18.  * taking snippets or claiming any contents as your own will
  19.  * break the terms of the license, and void any agreements with
  20.  * you, the third party.
  21.  * Thanks.
  22.  */
  23. public class PvPMadness extends JavaPlugin {
  24.  
  25.     private static Plugin instance;
  26.  
  27.     private static ArenaManagementFile arenaManagementFile;
  28.  
  29.     SettingsManager settingsManager = SettingsManager.getInstance();
  30.     MinigameManager mm = MinigameManager.getInstance();
  31.  
  32.     public void onEnable() {
  33.         instance = this;
  34.  
  35.         /*
  36.         if(!getDataFolder().exists()) {
  37.             getDataFolder().mkdirs();
  38.         }
  39.         */
  40.  
  41.         arenaManagementFile = new ArenaManagementFile(this);
  42.  
  43.         mm.registerMinigames();
  44.         settingsManager.registerSettings(this);
  45.  
  46.         getCommand("ffa").setExecutor(new FFACommand());
  47.  
  48.     }
  49.  
  50.     public void onDisable() {
  51.         arenaManagementFile.save();
  52.         instance = null;
  53.     }
  54.  
  55.     public static Plugin getInstance() {
  56.         return instance;
  57.     }
  58.  
  59.     public static Player getPlayerFromUUID(String s) {
  60.  
  61.         Player foundPlayer = null;
  62.  
  63.         for(Player p : Bukkit.getServer().getOnlinePlayers()) {
  64.             if(p.getUniqueId().toString().equals(s)) {
  65.                 foundPlayer = p;
  66.                 break;
  67.             }
  68.         }
  69.         return foundPlayer;
  70.     }
  71.  
  72.     public static Player getPlayerFromUUID(UUID u) {
  73.  
  74.         Player foundPlayer = null;
  75.  
  76.         for(Player p : Bukkit.getServer().getOnlinePlayers()) {
  77.             if(p.getUniqueId().equals(u)) {
  78.                 foundPlayer = p;
  79.                 break;
  80.             }
  81.         }
  82.         return foundPlayer;
  83.     }
  84.  
  85.     public static ArenaManagementFile getArenaManagementFile() {
  86.         return arenaManagementFile;
  87.     }
  88.  
  89. }
Add Comment
Please, Sign In to add comment