Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.33 KB | None | 0 0
  1. import com.bravemc.BraveSG.Chests.ChestItems;
  2. import com.bravemc.BraveSG.Data.SpawnLocs;
  3. import com.bravemc.BraveSG.Executors.EndGame;
  4. import com.bravemc.BraveSG.Executors.StartGame;
  5. import com.bravemc.BraveSG.Listeners.*;
  6. import me.william_burns.anAPI.Arcade.GameCore;
  7. import me.william_burns.anAPI.Arcade.GameManager;
  8. import me.william_burns.anAPI.Arcade.GameState;
  9. import me.william_burns.anAPI.Arcade.GameType.Game;
  10. import me.william_burns.anAPI.Arcade.Map.GameMap;
  11. import me.william_burns.anAPI.Arcade.Prevention.PreventionSet;
  12. import me.william_burns.anAPI.Arcade.Teams.GameTeam;
  13. import me.william_burns.anAPI.Arcade.Teams.TeamManager;
  14. import me.william_burns.anAPI.Arcade.Utils.JoinAction;
  15. import org.bukkit.Bukkit;
  16. import org.bukkit.World;
  17. import org.bukkit.configuration.file.FileConfiguration;
  18. import org.bukkit.entity.Entity;
  19. import org.bukkit.entity.Player;
  20. import org.bukkit.plugin.Plugin;
  21. import org.bukkit.plugin.java.JavaPlugin;
  22.  
  23. import java.util.ArrayList;
  24. import java.util.Arrays;
  25. import java.util.List;
  26.  
  27. /**
  28.  * Created by william_burns.
  29.  * All the code and any API's associated with it
  30.  * are not to be used anywhere else without written
  31.  * consent of William Burns. 2014.
  32.  * 01/04/2015
  33.  */
  34. public class BraveSG extends JavaPlugin implements GameCore {
  35.  
  36.     private static GameMap map = new GameMap("Countaville", "Brave Block Squad", "sg1");
  37.  
  38.     private static SpawnLocs spawnLocs;
  39.     private static ChestItems chestItems;
  40.  
  41.     private static List<String> livePlayers = new ArrayList<String>();
  42.  
  43.     public static String first;
  44.     public static String second;
  45.     public static String third;
  46.  
  47.     @Override
  48.     public void onEnable() {
  49.         GameManager.getManager().initializeGame(setupGame(), map);
  50.  
  51.         spawnLocs = new SpawnLocs(this);
  52.         getSpawnLocs().findSpawnPoints();
  53.         chestItems = new ChestItems(this);
  54.         getChestItems().fillAllChests();
  55.  
  56.         registerListeners();
  57.  
  58.         //Mobs mobs go away, come again another day.
  59.         for (World w : Bukkit.getWorlds()){
  60.             for (Entity e : w.getLivingEntities()){
  61.                 if (!(e instanceof Player)) e.remove();
  62.             }
  63.         }
  64.     }
  65.  
  66.     @Override
  67.     public Game setupGame() {
  68.         Game game = new Game("Survival Games", "SG", "§6", new PreventionSet(), map);
  69.  
  70.         game.setState(GameState.WAITING);
  71.         game.setTicks(45);
  72.         game.setTeamBased(false);
  73.         game.setDescription(Arrays.asList("Loot chests to find gear.", "Kill other players.", "Be the last player standing."));
  74.         game.setStartGameExecutor(new StartGame());
  75.         game.setEndGameExecutor(new EndGame());
  76.         game.setSubtitle("Classic Solo");
  77.         game.setEnforcePlayableArena(true);
  78.         game.setGameKits(null);
  79.         game.setJoinAction(JoinAction.SEND_TO_LOBBY);
  80.         game.setKitsEnabled(false);
  81.         game.setMaxPlayers(24);
  82.         game.setMinPlayers(2);
  83.         //game.setSet(); ---- Already set above lol.
  84.  
  85.         List<GameTeam> teams = new ArrayList<GameTeam>();
  86.         {
  87.             GameTeam team = new GameTeam("Players", "§e");
  88.             teams.add(team);
  89.             TeamManager.getManager().registerTeam(team);
  90.         }
  91.         {
  92.             GameTeam team = new GameTeam("Spectators", "§7");
  93.             team.setVisible(false);
  94.             teams.add(team);
  95.             TeamManager.getManager().registerTeam(team);
  96.         }
  97.         game.setTeams(teams);
  98.  
  99.         return game;
  100.     }
  101.  
  102.     public static FileConfiguration getConf(){
  103.         return Bukkit.getPluginManager().getPlugin("BraveSG").getConfig();
  104.     }
  105.  
  106.     public static Plugin getPlugin(){
  107.         return Bukkit.getPluginManager().getPlugin("BraveSG");
  108.     }
  109.  
  110.     public static SpawnLocs getSpawnLocs() {
  111.         return spawnLocs;
  112.     }
  113.  
  114.     public static ChestItems getChestItems() {
  115.         return chestItems;
  116.     }
  117.  
  118.     public static List<String> getLivePlayers() {
  119.         return livePlayers;
  120.     }
  121.  
  122.     public void registerListeners(){
  123.         Bukkit.getPluginManager().registerEvents(new Join(), this);
  124.         Bukkit.getPluginManager().registerEvents(new Mobs(), this);
  125.         Bukkit.getPluginManager().registerEvents(new Leave(), this);
  126.         Bukkit.getPluginManager().registerEvents(new Death(), this);
  127.         Bukkit.getPluginManager().registerEvents(new SpecBlock(), this);
  128.     }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement