Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.bravemc.BraveSG.Chests.ChestItems;
- import com.bravemc.BraveSG.Data.SpawnLocs;
- import com.bravemc.BraveSG.Executors.EndGame;
- import com.bravemc.BraveSG.Executors.StartGame;
- import com.bravemc.BraveSG.Listeners.*;
- import me.william_burns.anAPI.Arcade.GameCore;
- import me.william_burns.anAPI.Arcade.GameManager;
- import me.william_burns.anAPI.Arcade.GameState;
- import me.william_burns.anAPI.Arcade.GameType.Game;
- import me.william_burns.anAPI.Arcade.Map.GameMap;
- import me.william_burns.anAPI.Arcade.Prevention.PreventionSet;
- import me.william_burns.anAPI.Arcade.Teams.GameTeam;
- import me.william_burns.anAPI.Arcade.Teams.TeamManager;
- import me.william_burns.anAPI.Arcade.Utils.JoinAction;
- import org.bukkit.Bukkit;
- import org.bukkit.World;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.java.JavaPlugin;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.List;
- /**
- * Created by william_burns.
- * All the code and any API's associated with it
- * are not to be used anywhere else without written
- * consent of William Burns. 2014.
- * 01/04/2015
- */
- public class BraveSG extends JavaPlugin implements GameCore {
- private static GameMap map = new GameMap("Countaville", "Brave Block Squad", "sg1");
- private static SpawnLocs spawnLocs;
- private static ChestItems chestItems;
- private static List<String> livePlayers = new ArrayList<String>();
- public static String first;
- public static String second;
- public static String third;
- @Override
- public void onEnable() {
- GameManager.getManager().initializeGame(setupGame(), map);
- spawnLocs = new SpawnLocs(this);
- getSpawnLocs().findSpawnPoints();
- chestItems = new ChestItems(this);
- getChestItems().fillAllChests();
- registerListeners();
- //Mobs mobs go away, come again another day.
- for (World w : Bukkit.getWorlds()){
- for (Entity e : w.getLivingEntities()){
- if (!(e instanceof Player)) e.remove();
- }
- }
- }
- @Override
- public Game setupGame() {
- Game game = new Game("Survival Games", "SG", "§6", new PreventionSet(), map);
- game.setState(GameState.WAITING);
- game.setTicks(45);
- game.setTeamBased(false);
- game.setDescription(Arrays.asList("Loot chests to find gear.", "Kill other players.", "Be the last player standing."));
- game.setStartGameExecutor(new StartGame());
- game.setEndGameExecutor(new EndGame());
- game.setSubtitle("Classic Solo");
- game.setEnforcePlayableArena(true);
- game.setGameKits(null);
- game.setJoinAction(JoinAction.SEND_TO_LOBBY);
- game.setKitsEnabled(false);
- game.setMaxPlayers(24);
- game.setMinPlayers(2);
- //game.setSet(); ---- Already set above lol.
- List<GameTeam> teams = new ArrayList<GameTeam>();
- {
- GameTeam team = new GameTeam("Players", "§e");
- teams.add(team);
- TeamManager.getManager().registerTeam(team);
- }
- {
- GameTeam team = new GameTeam("Spectators", "§7");
- team.setVisible(false);
- teams.add(team);
- TeamManager.getManager().registerTeam(team);
- }
- game.setTeams(teams);
- return game;
- }
- public static FileConfiguration getConf(){
- return Bukkit.getPluginManager().getPlugin("BraveSG").getConfig();
- }
- public static Plugin getPlugin(){
- return Bukkit.getPluginManager().getPlugin("BraveSG");
- }
- public static SpawnLocs getSpawnLocs() {
- return spawnLocs;
- }
- public static ChestItems getChestItems() {
- return chestItems;
- }
- public static List<String> getLivePlayers() {
- return livePlayers;
- }
- public void registerListeners(){
- Bukkit.getPluginManager().registerEvents(new Join(), this);
- Bukkit.getPluginManager().registerEvents(new Mobs(), this);
- Bukkit.getPluginManager().registerEvents(new Leave(), this);
- Bukkit.getPluginManager().registerEvents(new Death(), this);
- Bukkit.getPluginManager().registerEvents(new SpecBlock(), this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement