Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pillars.EssemCSH.main;
- import java.util.HashMap;
- import java.util.Map.Entry;
- import java.util.UUID;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.block.Block;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.BlockBreakEvent;
- import org.bukkit.event.block.BlockPlaceEvent;
- import org.bukkit.event.entity.PlayerDeathEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.event.player.PlayerQuitEvent;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.scheduler.BukkitRunnable;
- import org.bukkit.scoreboard.DisplaySlot;
- import org.bukkit.scoreboard.Objective;
- import org.bukkit.scoreboard.Scoreboard;
- import org.bukkit.scoreboard.ScoreboardManager;
- import org.bukkit.scoreboard.Team;
- public class Main extends JavaPlugin implements Listener {
- /* THIS IS THE
- onEnable() method */
- @Override
- public void onEnable() {
- getLogger().info("§2Plugin activated properly, enjoy!");
- PluginManager pm = this.getServer().getPluginManager();
- pm.registerEvents(this, this);
- getConfig().options().copyDefaults(true);
- saveConfig();
- queueTeamYellow.put(1, "null");
- queueTeamYellow.put(2, "null");
- queueTeamYellow.put(3, "null");
- queueTeamYellow.put(4, "null");
- queueTeamBlue.put(1, "null");
- queueTeamBlue.put(2, "null");
- queueTeamBlue.put(3, "null");
- queueTeamBlue.put(4, "null");
- queueTeamGreen.put(1, "null");
- queueTeamGreen.put(2, "null");
- queueTeamGreen.put(3, "null");
- queueTeamGreen.put(4, "null");
- queueTeamRed.put(1, "null");
- queueTeamRed.put(2, "null");
- queueTeamRed.put(3, "null");
- queueTeamRed.put(4, "null");
- }
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
- {
- if (sender instanceof Player && args.length == 1)
- {
- Player p = (Player) sender;
- if (cmd.getName().equalsIgnoreCase("game"))
- {
- if (args.length != 1) {
- p.sendMessage("§4Missing arguments!");
- }
- else {
- if (args[0].equalsIgnoreCase("start")) {
- if (p.isOp() || p.hasPermission("pillars.start")) {
- gameStarting = true;
- p.sendMessage("§9§lPillars " + dot + " §7Successfully started the game!");
- World wSpawn = Bukkit.getServer().getWorld(getConfig().getString("spawn.world"));
- double xSpawn = getConfig().getDouble("spawn.x");
- double ySpawn = getConfig().getDouble("spawn.y");
- double zSpawn = getConfig().getDouble("spawn.z");
- for(Player player : Bukkit.getServer().getOnlinePlayers()) {
- player.teleport(new Location(wSpawn, xSpawn, ySpawn, zSpawn));
- SetScoreBoard(player);
- }
- countDowner();
- }
- }
- if (args[0].equalsIgnoreCase("stop")) {
- if (p.isOp() || p.hasPermission("pillars.stop")) {
- gameRunning = false;
- countDown = 16;
- gameStarting = false;
- p.sendMessage("§9§lPillars " + dot + " §7Successfully stopped the game!");
- World wSpawn = Bukkit.getServer().getWorld(getConfig().getString("spawn.world"));
- double xSpawn = getConfig().getDouble("spawn.x");
- double ySpawn = getConfig().getDouble("spawn.y");
- double zSpawn = getConfig().getDouble("spawn.z");
- for(Player player : Bukkit.getServer().getOnlinePlayers()) {
- player.teleport(new Location(wSpawn, xSpawn, ySpawn, zSpawn));
- SetScoreBoard(player);
- }
- }
- }
- if (args[0].equalsIgnoreCase("blockreset")) {
- if (p.isOp() || p.hasPermission("pillars.blockreset")) {
- for(Integer integer : BlockReset.keySet()){
- Block block = BlockReset.get(integer);
- block.setType(Material.AIR);
- }
- }
- }
- }
- }
- if (cmd.getName().equalsIgnoreCase("gameset")) {
- if (p.isOp() || p.hasPermission("pillars.set")) {
- if (args[0].equalsIgnoreCase("spawn")) {
- getConfig().set("spawn.world", w);
- getConfig().set("spawn.x", x);
- getConfig().set("spawn.y", y + 2);
- getConfig().set("spawn.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set spawn!");
- }
- if (args[0].equalsIgnoreCase("yellowspawn")) {
- getConfig().set("yellowspawn.world", w);
- getConfig().set("yellowspawn.x", x);
- getConfig().set("yellowspawn.y", y + 2);
- getConfig().set("yellowspawn.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §eyellow §5spawn!");
- }
- if (args[0].equalsIgnoreCase("yellowbeacon1")) {
- getConfig().set("yellowbeacon1.world", w);
- getConfig().set("yellowbeacon1.x", x - 0.5);
- getConfig().set("yellowbeacon1.y", y);
- getConfig().set("yellowbeacon1.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §eyellow §5beacon1!");
- }
- if (args[0].equalsIgnoreCase("yellowbeacon2")) {
- getConfig().set("yellowbeacon2.world", w);
- getConfig().set("yellowbeacon2.x", x - 0.5);
- getConfig().set("yellowbeacon2.y", y);
- getConfig().set("yellowbeacon2.z", z - 0.5);
- saveConfig();
- p.sendMessage(" §5Successfully set §eyellow §5beacon2!");
- }
- if (args[0].equalsIgnoreCase("yellowbeacon3")) {
- getConfig().set("yellowbeacon3.world", w);
- getConfig().set("yellowbeacon3.x", x - 0.5);
- getConfig().set("yellowbeacon3.y", y);
- getConfig().set("yellowbeacon3.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §eyellow §5beacon3!");
- }
- if (args[0].equalsIgnoreCase("yellowbeacon4")) {
- getConfig().set("yellowbeacon4.world", w);
- getConfig().set("yellowbeacon4.x", x - 0.5);
- getConfig().set("yellowbeacon4.y", y);
- getConfig().set("yellowbeacon4.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §eyellow §5beacon4!");
- }
- if (args[0].equalsIgnoreCase("bluespawn")) {
- getConfig().set("bluespawn.world", w);
- getConfig().set("bluespawn.x", x);
- getConfig().set("bluespawn.y", y + 2);
- getConfig().set("bluespawn.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §bblue §5spawn!");
- }
- if (args[0].equalsIgnoreCase("bluebeacon1")) {
- getConfig().set("bluebeacon1.world", w);
- getConfig().set("bluebeacon1.x", x - 0.5);
- getConfig().set("bluebeacon1.y", y);
- getConfig().set("bluebeacon1.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §bblue §5beacon1!");
- }
- if (args[0].equalsIgnoreCase("bluebeacon2")) {
- getConfig().set("bluebeacon2.world", w);
- getConfig().set("bluebeacon2.x", x - 0.5);
- getConfig().set("bluebeacon2.y", y);
- getConfig().set("bluebeacon2.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §bblue §5beacon2!");
- }
- if (args[0].equalsIgnoreCase("bluebeacon3")) {
- getConfig().set("bluebeacon3.world", w);
- getConfig().set("bluebeacon3.x", x - 0.5);
- getConfig().set("bluebeacon3.y", y);
- getConfig().set("bluebeacon3.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §bblue §5beacon3!");
- }
- if (args[0].equalsIgnoreCase("bluebeacon4")) {
- getConfig().set("bluebeacon4.world", w);
- getConfig().set("bluebeacon4.x", x - 0.5);
- getConfig().set("bluebeacon4.y", y);
- getConfig().set("bluebeacon4.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §bblue §5beacon4!");
- }
- if (args[0].equalsIgnoreCase("greenspawn")) {
- getConfig().set("greenspawn.world", w);
- getConfig().set("greenspawn.x", x);
- getConfig().set("greenspawn.y", y + 2);
- getConfig().set("greenspawn.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §agreen §5spawn!");
- }
- if (args[0].equalsIgnoreCase("greenbeacon1")) {
- getConfig().set("greenbeacon1.world", w);
- getConfig().set("greenbeacon1.x", x - 0.5);
- getConfig().set("greenbeacon1.y", y);
- getConfig().set("greenbeacon1.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §agreen §5beacon1!");
- }
- if (args[0].equalsIgnoreCase("greenbeacon2")) {
- getConfig().set("greenbeacon2.world", w);
- getConfig().set("greenbeacon2.x", x - 0.5);
- getConfig().set("greenbeacon2.y", y);
- getConfig().set("greenbeacon2.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §agreen §5beacon2!");
- }
- if (args[0].equalsIgnoreCase("greenbeacon3")) {
- getConfig().set("greenbeacon3.world", w);
- getConfig().set("greenbeacon3.x", x - 0.5);
- getConfig().set("greenbeacon3.y", y);
- getConfig().set("greenbeacon3.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §agreen §5beacon3!");
- }
- if (args[0].equalsIgnoreCase("greenbeacon4")) {
- getConfig().set("greenbeacon4.world", w);
- getConfig().set("greenbeacon4.x", x - 0.5);
- getConfig().set("greenbeacon4.y", y);
- getConfig().set("greenbeacon4.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §agreen §5beacon4!");
- }
- if (args[0].equalsIgnoreCase("redspawn")) {
- getConfig().set("redspawn.world", w);
- getConfig().set("redspawn.x", x);
- getConfig().set("redspawn.y", y + 2);
- getConfig().set("redspawn.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §cred §5spawn!");
- }
- if (args[0].equalsIgnoreCase("redbeacon1")) {
- getConfig().set("redbeacon1.world", w);
- getConfig().set("redbeacon1.x", x - 0.5);
- getConfig().set("redbeacon1.y", y);
- getConfig().set("redbeacon1.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §cred §5beacon1!");
- }
- if (args[0].equalsIgnoreCase("redbeacon2")) {
- getConfig().set("redbeacon2.world", w);
- getConfig().set("redbeacon2.x", x - 0.5);
- getConfig().set("redbeacon2.y", y);
- getConfig().set("redbeacon2.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §cred §5beacon2!");
- }
- if (args[0].equalsIgnoreCase("redbeacon3")) {
- getConfig().set("redbeacon3.world", w);
- getConfig().set("redbeacon3.x", x - 0.5);
- getConfig().set("redbeacon3.y", y);
- getConfig().set("redbeacon3.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §cred §5beacon3!");
- }
- if (args[0].equalsIgnoreCase("redbeacon4")) {
- getConfig().set("redbeacon4.world", w);
- getConfig().set("redbeacon4.x", x - 0.5);
- getConfig().set("redbeacon4.y", y);
- getConfig().set("redbeacon4.z", z - 0.5);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §cred §5beacon4!");
- }
- if (args[0].equalsIgnoreCase("gold1")) {
- getConfig().set("gold1.world", w);
- getConfig().set("gold1.x", x);
- getConfig().set("gold1.y", y + 1);
- getConfig().set("gold1.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §6gold §5spawner1!");
- }
- if (args[0].equalsIgnoreCase("gold2")) {
- getConfig().set("gold2.world", w);
- getConfig().set("gold2.x", x);
- getConfig().set("gold2.y", y + 1);
- getConfig().set("gold2.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §6gold §5spawner2!");
- }
- if (args[0].equalsIgnoreCase("gold3")) {
- getConfig().set("gold3.world", w);
- getConfig().set("gold3.x", x);
- getConfig().set("gold3.y", y + 1);
- getConfig().set("gold3.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §6gold §5spawner3!");
- }
- if (args[0].equalsIgnoreCase("gold4")) {
- getConfig().set("gold4.world", w);
- getConfig().set("gold4.x", x);
- getConfig().set("gold4.y", y + 1);
- getConfig().set("gold4.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §6gold §5spawner4!");
- }
- if (args[0].equalsIgnoreCase("diamond")) {
- getConfig().set("diamond.world", w);
- getConfig().set("diamond.x", x);
- getConfig().set("diamond.y", y + 1);
- getConfig().set("diamond.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §1diamond §5spawner!");
- }
- if (args[0].equalsIgnoreCase("shopkeeper1")) {
- getConfig().set("shopkeeper1.world", w);
- getConfig().set("shopkeeper1.x", x);
- getConfig().set("shopkeeper1.y", y);
- getConfig().set("shopkeeper1.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §7shopkeeper §5location1!");
- }
- if (args[0].equalsIgnoreCase("shopkeeper2")) {
- getConfig().set("shopkeeper2.world", w);
- getConfig().set("shopkeeper2.x", x);
- getConfig().set("shopkeeper2.y", y);
- getConfig().set("shopkeeper2.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §7shopkeeper §5location2!");
- }
- if (args[0].equalsIgnoreCase("shopkeeper3")) {
- getConfig().set("shopkeeper3.world", w);
- getConfig().set("shopkeeper3.x", x);
- getConfig().set("shopkeeper3.y", y);
- getConfig().set("shopkeeper3.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §7shopkeeper §5location3!");
- }
- if (args[0].equalsIgnoreCase("shopkeeper4")) {
- getConfig().set("shopkeeper4.world", w);
- getConfig().set("shopkeeper4.x", x);
- getConfig().set("shopkeeper4.y", y);
- getConfig().set("shopkeeper4.z", z);
- saveConfig();
- p.sendMessage("§9§lPillars " + dot + " §7Successfully set §7shopkeeper §5location4!");
- }
- }
- }
- }
- return false;
- }
- /* THESE ARE THE
- VARIABLES */
- boolean gameRunning = false;
- boolean gameStarting = false;
- int countDown = 16;
- String w;
- double x;
- double y;
- double z;
- public HashMap<UUID, Scoreboard> boardMap = new HashMap<UUID, Scoreboard>();
- private ScoreboardManager manager = Bukkit.getScoreboardManager();
- public Scoreboard scoreboard = manager.getNewScoreboard();
- public Objective objective;
- public Scoreboard teams = manager.getNewScoreboard();
- Team yellow = teams.registerNewTeam("yellow");
- Team blue = teams.registerNewTeam("blue");
- Team green = teams.registerNewTeam("green");
- Team red = teams.registerNewTeam("red");
- public HashMap<Integer, String> queueTeamYellow = new HashMap<>();
- public HashMap<Integer, String> queueTeamBlue = new HashMap<>();
- public HashMap<Integer, String> queueTeamGreen = new HashMap<>();
- public HashMap<Integer, String> queueTeamRed = new HashMap<>();
- HashMap<UUID, String> score15 = new HashMap<>();
- HashMap<UUID, String> score14 = new HashMap<>();
- HashMap<UUID, String> score13 = new HashMap<>();
- HashMap<UUID, String> score12 = new HashMap<>();
- HashMap<UUID, String> score11 = new HashMap<>();
- HashMap<UUID, String> score10 = new HashMap<>();
- HashMap<UUID, String> score9 = new HashMap<>();
- HashMap<UUID, String> score8 = new HashMap<>();
- HashMap<UUID, String> score7 = new HashMap<>();
- HashMap<UUID, String> score6 = new HashMap<>();
- HashMap<UUID, String> score5 = new HashMap<>();
- HashMap<UUID, String> score4 = new HashMap<>();
- HashMap<UUID, String> score3 = new HashMap<>();
- HashMap<UUID, String> score2 = new HashMap<>();
- HashMap<UUID, String> score1 = new HashMap<>();
- /* THIS IS THE
- onPlayerJoin() method */
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onPlayerJoin(PlayerJoinEvent event) {
- Player p = event.getPlayer();
- World wSpawn = Bukkit.getServer().getWorld(getConfig().getString("spawn.world"));
- double xSpawn = getConfig().getDouble("spawn.x");
- double ySpawn = getConfig().getDouble("spawn.y");
- double zSpawn = getConfig().getDouble("spawn.z");
- p.teleport(new Location(wSpawn, xSpawn, ySpawn, zSpawn));
- if (yellow.getPlayers().size() == 0) {
- yellow.addPlayer(p);
- }
- else if (yellow.getPlayers().size() == 1) {
- if (blue.getPlayers().size() == 0) {
- blue.addPlayer(p);
- }
- else if (blue.getPlayers().size() == 1) {
- if (green.getPlayers().size() == 0) {
- green.addPlayer(p);
- }
- else if (green.getPlayers().size() == 1) {
- if (red.getPlayers().size() == 0) {
- red.addPlayer(p);
- }
- else if (red.getPlayers().size() == 1) {
- if (yellow.getPlayers().size() == 1) {
- yellow.addPlayer(p);
- }
- else if (yellow.getPlayers().size() == 2) {
- if (blue.getPlayers().size() == 1) {
- blue.addPlayer(p);
- }
- else if (blue.getPlayers().size() == 2) {
- if (green.getPlayers().size() == 1) {
- green.addPlayer(p);
- }
- else if (green.getPlayers().size() == 2) {
- if (red.getPlayers().size() == 1) {
- red.addPlayer(p);
- }
- else if (red.getPlayers().size() == 2) {
- if (yellow.getPlayers().size() == 2) {
- yellow.addPlayer(p);
- }
- else if (yellow.getPlayers().size() == 3) {
- if (blue.getPlayers().size() == 2) {
- blue.addPlayer(p);
- }
- else if (blue.getPlayers().size() == 3) {
- if (green.getPlayers().size() == 2) {
- green.addPlayer(p);
- }
- else if (green.getPlayers().size() == 3) {
- if (red.getPlayers().size() == 2) {
- red.addPlayer(p);
- }
- else if (red.getPlayers().size() == 3) {
- if (yellow.getPlayers().size() == 3) {
- yellow.addPlayer(p);
- }
- else if (yellow.getPlayers().size() == 4) {
- if (blue.getPlayers().size() == 3) {
- blue.addPlayer(p);
- }
- else if (blue.getPlayers().size() == 4) {
- if (green.getPlayers().size() == 3) {
- green.addPlayer(p);
- }
- else if (green.getPlayers().size() == 4) {
- if (red.getPlayers().size() == 3) {
- red.addPlayer(p);
- }
- else if (red.getPlayers().size() == 4) {
- p.kickPlayer("§4Server Seems To Be Full...");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- if (player.getDisplayName() != p.getDisplayName()) {
- SetScoreBoard(player);
- }
- }
- new BukkitRunnable() {
- String queueWin = "null";
- @Override
- public void run() {
- if (yellow.getPlayers().size() == 3) {
- queueWin = queueTeamYellow.get(1);
- SetScoreBoard(p);
- if (queueWin == p.getDisplayName()) {
- yellow.addPlayer(p);
- }
- queueTeamYellow.put(1, queueTeamYellow.get(2));
- queueTeamYellow.put(2, queueTeamYellow.get(3));
- queueTeamYellow.put(3, queueTeamYellow.get(4));
- queueTeamYellow.put(4, "null");
- }
- if (blue.getPlayers().size() == 3) {
- queueWin = queueTeamBlue.get(1);
- SetScoreBoard(p);
- if (queueWin == p.getDisplayName()) {
- blue.addPlayer(p);
- }
- queueTeamBlue.put(1, queueTeamBlue.get(2));
- queueTeamBlue.put(2, queueTeamBlue.get(3));
- queueTeamBlue.put(3, queueTeamBlue.get(4));
- queueTeamBlue.put(4, "null");
- }
- if (green.getPlayers().size() == 3) {
- queueWin = queueTeamGreen.get(1);
- SetScoreBoard(p);
- if (queueWin == p.getDisplayName()) {
- green.addPlayer(p);
- }
- queueTeamGreen.put(1, queueTeamGreen.get(2));
- queueTeamGreen.put(2, queueTeamGreen.get(3));
- queueTeamGreen.put(3, queueTeamGreen.get(4));
- queueTeamGreen.put(4, "null");
- }
- if (red.getPlayers().size() == 3) {
- queueWin = queueTeamRed.get(1);
- SetScoreBoard(p);
- if (queueWin == p.getDisplayName()) {
- red.addPlayer(p);
- }
- queueTeamRed.put(1, queueTeamRed.get(2));
- queueTeamRed.put(2, queueTeamRed.get(3));
- queueTeamRed.put(3, queueTeamRed.get(4));
- queueTeamRed.put(4, "null");
- }
- }
- }.runTaskTimer(this, 0, 20);
- SetScoreBoard(p);
- }
- public HashMap<UUID, Integer> kills = new HashMap<>();
- public HashMap<UUID, Integer> beaconsdestroyed = new HashMap<>();
- public HashMap<UUID, Integer> coins = new HashMap<>();
- public String upgradeNext;
- public int upgradeTimer;
- public int yellowbcount = 4;
- public int bluebcount = 4;
- public int greenbcount = 4;
- public int redbcount = 4;
- char dot = 8901;
- char checkmark = 10004;
- char nomark = 10060;
- /* THIS IS THE
- updateScoreBoard() method */
- @SuppressWarnings("deprecation")
- public void updateScoreBoard(Player p) {
- boardMap.put(p.getUniqueId(), scoreboard);
- scoreboard = boardMap.get(p.getUniqueId());
- if (score15.get(p.getUniqueId()) != null) {
- scoreboard.resetScores(score15.get(p.getUniqueId()));
- scoreboard.resetScores(score14.get(p.getUniqueId()));
- scoreboard.resetScores(score13.get(p.getUniqueId()));
- scoreboard.resetScores(score12.get(p.getUniqueId()));
- scoreboard.resetScores(score11.get(p.getUniqueId()));
- scoreboard.resetScores(score10.get(p.getUniqueId()));
- scoreboard.resetScores(score9.get(p.getUniqueId()));
- scoreboard.resetScores(score8.get(p.getUniqueId()));
- scoreboard.resetScores(score7.get(p.getUniqueId()));
- scoreboard.resetScores(score6.get(p.getUniqueId()));
- scoreboard.resetScores(score5.get(p.getUniqueId()));
- scoreboard.resetScores(score4.get(p.getUniqueId()));
- scoreboard.resetScores(score3.get(p.getUniqueId()));
- scoreboard.resetScores(score2.get(p.getUniqueId()));
- scoreboard.resetScores(score1.get(p.getUniqueId()));
- }
- if (gameRunning == false) {
- int yellowSize = yellow.getPlayers().size();
- int blueSize = blue.getPlayers().size();
- int greenSize = green.getPlayers().size();
- int redSize = red.getPlayers().size();
- score15.put(p.getUniqueId(), "§1 ");
- if (gameStarting == true) {
- score14.put(p.getUniqueId(), "§6Starting: §f" + countDown);
- }
- else {
- score14.put(p.getUniqueId(), "§6Starting: §4Not Enough Players" );
- }
- score13.put(p.getUniqueId(), "§2 ");
- score12.put(p.getUniqueId(), "§6Players: §f" + Bukkit.getServer().getOnlinePlayers().size() + "/16");
- score11.put(p.getUniqueId(), "§3 ");
- score10.put(p.getUniqueId(), "§6Teams:");
- score9.put(p.getUniqueId(), "§eYellow: §f" + yellowSize + "/4");
- score8.put(p.getUniqueId(), "§bBlue: §f" + blueSize + "/4");
- score7.put(p.getUniqueId(), "§aGreen: §f" + greenSize + "/4");
- score6.put(p.getUniqueId(), "§cRed: §f" + redSize + "/4");
- score5.put(p.getUniqueId(), "§4 ");
- score4.put(p.getUniqueId(), "§6Map: §fOG");
- score3.put(p.getUniqueId(), "§6Server: §fpillars1");
- score2.put(p.getUniqueId(), "§5 ");
- score1.put(p.getUniqueId(), "§7www.intelyc.com");
- }
- if (gameRunning == true) {
- score15.put(p.getUniqueId(), "§1 ");
- score14.put(p.getUniqueId(), "§6Coins: §f" + coins.get(p.getUniqueId()));
- score13.put(p.getUniqueId(), "§6Upgrade:");
- score12.put(p.getUniqueId(), upgradeNext + upgradeTimer);
- score11.put(p.getUniqueId(), "§3 ");
- score10.put(p.getUniqueId(), "§6Beacons:");
- if (yellowbcount == 4) {
- score9.put(p.getUniqueId(), "§eYellow: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark);
- }
- else {
- if (yellowbcount == 3) {
- score9.put(p.getUniqueId(), "§eYellow: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark + " " + "§4" + nomark);
- }
- else {
- if (yellowbcount == 2) {
- score9.put(p.getUniqueId(), "§eYellow: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- else {
- if (yellowbcount == 1) {
- score9.put(p.getUniqueId(), "§eYellow: §2" + "§2" + checkmark + " " + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- else {
- score9.put(p.getUniqueId(), "§eYellow: §2" + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- }
- }
- }
- if (bluebcount == 4) {
- score8.put(p.getUniqueId(), "§bBlue: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark);
- }
- else {
- if (bluebcount == 3) {
- score8.put(p.getUniqueId(), "§bBlue: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark + " " + "§4" + nomark);
- }
- else {
- if (bluebcount == 2) {
- score8.put(p.getUniqueId(), "§bBlue: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- else {
- if (bluebcount == 1) {
- score8.put(p.getUniqueId(), "§bBlue: §2" + "§2" + checkmark + " " + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- else {
- score8.put(p.getUniqueId(), "§bBlue: §2" + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- }
- }
- }
- if (greenbcount == 4) {
- score7.put(p.getUniqueId(), "§aGreen: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark);
- }
- else {
- if (greenbcount == 3) {
- score7.put(p.getUniqueId(), "§aGreen: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark + " " + "§4" + nomark);
- }
- else {
- if (greenbcount == 2) {
- score7.put(p.getUniqueId(), "§aGreen: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- else {
- if (greenbcount == 1) {
- score7.put(p.getUniqueId(), "§aGreen: §2" + "§2" + checkmark + " " + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- else {
- score7.put(p.getUniqueId(), "§aGreen: §2" + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- }
- }
- }
- if (redbcount == 4) {
- score6.put(p.getUniqueId(), "§cRed: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark);
- }
- else {
- if (redbcount == 3) {
- score6.put(p.getUniqueId(), "§cRed: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§2" + checkmark + " " + "§4" + nomark);
- }
- else {
- if (redbcount == 2) {
- score6.put(p.getUniqueId(), "§cRed: §2" + "§2" + checkmark + " " + "§2" + checkmark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- else {
- if (redbcount == 1) {
- score6.put(p.getUniqueId(), "§cRed: §2" + "§2" + checkmark + " " + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- else {
- score6.put(p.getUniqueId(), "§cRed: §2" + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark + " " + "§4" + nomark);
- }
- }
- }
- }
- score5.put(p.getUniqueId(), "§4 ");
- score4.put(p.getUniqueId(), "§6Kills: §f" + kills.get(p.getUniqueId()));
- score3.put(p.getUniqueId(), "§6Beacons Destroyed: §f" + beaconsdestroyed.get(p.getUniqueId()));
- score2.put(p.getUniqueId(), "§5 ");
- score1.put(p.getUniqueId(), "§7www.intelyc.com");
- }
- if (objective == null) {
- objective = scoreboard.registerNewObjective("pillars", "dummy");
- }
- objective.setDisplaySlot(DisplaySlot.SIDEBAR);
- objective.setDisplayName("§f§lPILLARS");
- objective.getScore(score15.get(p.getUniqueId())).setScore(15);
- objective.getScore(score14.get(p.getUniqueId())).setScore(14);
- objective.getScore(score13.get(p.getUniqueId())).setScore(13);
- objective.getScore(score12.get(p.getUniqueId())).setScore(12);
- objective.getScore(score11.get(p.getUniqueId())).setScore(11);
- objective.getScore(score10.get(p.getUniqueId())).setScore(10);
- objective.getScore(score9.get(p.getUniqueId())).setScore(9);
- objective.getScore(score8.get(p.getUniqueId())).setScore(8);
- objective.getScore(score7.get(p.getUniqueId())).setScore(7);
- objective.getScore(score6.get(p.getUniqueId())).setScore(6);
- objective.getScore(score5.get(p.getUniqueId())).setScore(5);
- objective.getScore(score4.get(p.getUniqueId())).setScore(4);
- objective.getScore(score3.get(p.getUniqueId())).setScore(3);
- objective.getScore(score2.get(p.getUniqueId())).setScore(2);
- objective.getScore(score1.get(p.getUniqueId())).setScore(1);
- boardMap.put(p.getUniqueId(), scoreboard);
- p.setScoreboard(boardMap.get(p.getUniqueId()));
- }
- public void countDowner() {
- if (gameStarting == true) {
- new BukkitRunnable() {
- @SuppressWarnings("deprecation")
- public void run() {
- if (countDown >= 1 && gameStarting == true) {
- for (Player p : Bukkit.getServer().getOnlinePlayers()) {
- scoreboard.resetScores(score14.get(p.getUniqueId()));
- }
- countDown--;
- for (Player p : Bukkit.getServer().getOnlinePlayers()) {
- SetScoreBoard(p);
- }
- }
- else if (countDown == 0 && gameStarting == true) {
- for (Player p : Bukkit.getServer().getOnlinePlayers()) {
- scoreboard.resetScores(score14.get(p.getUniqueId()));
- if (yellow.getPlayers().contains(p)) {
- World wyellowspawn = Bukkit.getServer().getWorld(getConfig().getString("yellowspawn.world"));
- double xyellowspawn = getConfig().getDouble("yellowspawn.x");
- double yyellowspawn = getConfig().getDouble("yellowspawn.y");
- double zyellowspawn = getConfig().getDouble("yellowspawn.z");
- p.teleport(new Location(wyellowspawn, xyellowspawn, yyellowspawn, zyellowspawn));
- }
- if (blue.getPlayers().contains(p)) {
- World wbluespawn = Bukkit.getServer().getWorld(getConfig().getString("bluespawn.world"));
- double xbluespawn = getConfig().getDouble("bluespawn.x");
- double ybluespawn = getConfig().getDouble("bluespawn.y");
- double zbluespawn = getConfig().getDouble("bluespawn.z");
- p.teleport(new Location(wbluespawn, xbluespawn, ybluespawn, zbluespawn));
- }
- if (green.getPlayers().contains(p)) {
- World wgreenspawn = Bukkit.getServer().getWorld(getConfig().getString("greenspawn.world"));
- double xgreenspawn = getConfig().getDouble("greenspawn.x");
- double ygreenspawn = getConfig().getDouble("greenspawn.y");
- double zgreenspawn = getConfig().getDouble("greenspawn.z");
- p.teleport(new Location(wgreenspawn, xgreenspawn, ygreenspawn, zgreenspawn));
- }
- if (red.getPlayers().contains(p)) {
- World wredspawn = Bukkit.getServer().getWorld(getConfig().getString("redspawn.world"));
- double xredspawn = getConfig().getDouble("redspawn.x");
- double yredspawn = getConfig().getDouble("redspawn.y");
- double zredspawn = getConfig().getDouble("redspawn.z");
- p.teleport(new Location(wredspawn, xredspawn, yredspawn, zredspawn));
- }
- }
- gameStarting = false;
- gameRunning = true;
- countDown = 16;
- for (Player p : Bukkit.getServer().getOnlinePlayers()) {
- coins.put(p.getUniqueId(), 10);
- kills.put(p.getUniqueId(), 0);
- beaconsdestroyed.put(p.getUniqueId(), 0);
- SetScoreBoard(p);
- }
- cancel();
- }
- else {
- cancel();
- }
- }
- }.runTaskTimer(this, 0, 20);
- }
- }
- /* THIS THE
- resetScoreBoard(p) method*/
- public void SetScoreBoard(Player p) {
- updateScoreBoard(p);
- }
- // WHEN PLAYER USE ITEM
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onPlayerUse(PlayerInteractEvent event){
- Player p = event.getPlayer();
- if (gameRunning == false) {
- if(p.getItemInHand().getType() == Material.GOLD_INGOT){
- if(yellow.getPlayers().size() <= 3) {
- yellow.addPlayer(p);
- blue.removePlayer(p);
- green.removePlayer(p);
- red.removePlayer(p);
- }
- else {
- if (queueTeamYellow.get(1).equals("null")) {
- queueTeamYellow.put(1, p.getDisplayName());
- p.sendMessage("§e§lYellow §fTeam is currently full! You we're put in queue 1/1.");
- }
- else if (!queueTeamYellow.get(1).equals("null")) {
- if (queueTeamYellow.get(2).equals("null")) {
- queueTeamYellow.put(2, p.getDisplayName());
- p.sendMessage("§e§lYellow §fTeam is currently full! You we're put in queue 2/2.");
- }
- else if (!queueTeamYellow.get(2).equals("null")) {
- if (queueTeamYellow.get(3).equals("null")) {
- queueTeamYellow.put(3, p.getDisplayName());
- p.sendMessage("§e§lYellow §fTeam is currently full! You we're put in queue 3/3.");
- }
- else if (!queueTeamYellow.get(3).equals("null")) {
- if (queueTeamYellow.get(4).equals("null")) {
- queueTeamYellow.put(4, p.getDisplayName());
- p.sendMessage("§e§lYellow §fTeam is currently full! You we're put in queue 4/4.");
- }
- else if (!queueTeamYellow.get(4).equals("null")) {
- p.sendMessage("§e§lYellow §fTeam is currently full! Queue is currently full! ._.");
- }
- }
- }
- }
- }
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- if (player.getDisplayName() != p.getDisplayName()) {
- SetScoreBoard(player);
- }
- }
- SetScoreBoard(p);
- }
- else if(p.getItemInHand().getType() == Material.DIAMOND){
- if(blue.getPlayers().size() <= 3) {
- yellow.removePlayer(p);
- blue.addPlayer(p);
- green.removePlayer(p);
- red.removePlayer(p);
- }
- else {
- if (queueTeamBlue.get(1).equals("null")) {
- queueTeamBlue.put(1, p.getDisplayName());
- p.sendMessage("§b§lBlue §fTeam is currently full! You we're put in queue 1/1.");
- }
- else if (!queueTeamBlue.get(1).equals("null")) {
- if (queueTeamBlue.get(2).equals("null")) {
- queueTeamBlue.put(2, p.getDisplayName());
- p.sendMessage("§b§lBlue §fTeam is currently full! You we're put in queue 2/2.");
- }
- else if (!queueTeamBlue.get(2).equals("null")) {
- if (queueTeamBlue.get(3).equals("null")) {
- queueTeamBlue.put(3, p.getDisplayName());
- p.sendMessage("§b§lBlue §fTeam is currently full! You we're put in queue 3/3.");
- }
- else if (!queueTeamBlue.get(3).equals("null")) {
- if (queueTeamBlue.get(4).equals("null")) {
- queueTeamBlue.put(4, p.getDisplayName());
- p.sendMessage("§b§lBlue §fTeam is currently full! You we're put in queue 4/4.");
- }
- else if (!queueTeamBlue.get(4).equals("null")) {
- p.sendMessage("§b§lBlue §fTeam is currently full! Queue is currently full! ._.");
- }
- }
- }
- }
- }
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- if (player.getDisplayName() != p.getDisplayName()) {
- SetScoreBoard(player);
- }
- }
- SetScoreBoard(p);
- }
- else if(p.getItemInHand().getType() == Material.EMERALD){
- if(green.getPlayers().size() <= 3) {
- yellow.removePlayer(p);
- blue.removePlayer(p);
- green.addPlayer(p);
- red.removePlayer(p);
- }
- else {
- if (queueTeamGreen.get(1).equals("null")) {
- queueTeamGreen.put(1, p.getDisplayName());
- p.sendMessage("§a§lGreen §fTeam is currently full! You we're put in queue 1/1.");
- }
- else if (!queueTeamGreen.get(1).equals("null")) {
- if (queueTeamGreen.get(2).equals("null")) {
- queueTeamGreen.put(2, p.getDisplayName());
- p.sendMessage("§a§lGreen §fTeam is currently full! You we're put in queue 2/2.");
- }
- else if (!queueTeamGreen.get(2).equals("null")) {
- if (queueTeamGreen.get(3).equals("null")) {
- queueTeamGreen.put(3, p.getDisplayName());
- p.sendMessage("§a§lGreen §fTeam is currently full! You we're put in queue 3/3.");
- }
- else if (!queueTeamGreen.get(3).equals("null")) {
- if (queueTeamGreen.get(4).equals("null")) {
- queueTeamGreen.put(4, p.getDisplayName());
- p.sendMessage("§a§lGreen §fTeam is currently full! You we're put in queue 4/4.");
- }
- else if (!queueTeamGreen.get(4).equals("null")) {
- p.sendMessage("§a§lGreen §fTeam is currently full! Queue is currently full! ._.");
- }
- }
- }
- }
- }
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- if (player.getDisplayName() != p.getDisplayName()) {
- SetScoreBoard(player);
- }
- }
- SetScoreBoard(p);
- }
- else if(p.getItemInHand().getType() == Material.REDSTONE){
- if(red.getPlayers().size() <= 3) {
- yellow.removePlayer(p);
- blue.removePlayer(p);
- green.removePlayer(p);
- red.addPlayer(p);
- }
- else {
- if (queueTeamRed.get(1).equals("null")) {
- queueTeamRed.put(1, p.getDisplayName());
- p.sendMessage("§c§lRed §fTeam is currently full! You we're put in queue 1/1.");
- }
- else if (!queueTeamRed.get(1).equals("null")) {
- if (queueTeamRed.get(2).equals("null")) {
- queueTeamRed.put(2, p.getDisplayName());
- p.sendMessage("§c§lRed §fTeam is currently full! You we're put in queue 2/2.");
- }
- else if (!queueTeamRed.get(2).equals("null")) {
- if (queueTeamRed.get(3).equals("null")) {
- queueTeamRed.put(3, p.getDisplayName());
- p.sendMessage("§c§lRed §fTeam is currently full! You we're put in queue 3/3.");
- }
- else if (!queueTeamRed.get(3).equals("null")) {
- if (queueTeamRed.get(4).equals("null")) {
- queueTeamRed.put(4, p.getDisplayName());
- p.sendMessage("§c§lRed §fTeam is currently full! You we're put in queue 4/4.");
- }
- else if (!queueTeamRed.get(4).equals("null")) {
- p.sendMessage("§c§lRed §fTeam is currently full! Queue is currently full! ._.");
- }
- }
- }
- }
- }
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- if (player.getDisplayName() != p.getDisplayName()) {
- SetScoreBoard(player);
- }
- }
- SetScoreBoard(p);
- }
- }
- }
- // WHEN PLAYER DIES
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onPlayerDeath(PlayerDeathEvent event) {
- Player p = event.getEntity().getPlayer();
- Player killer = event.getEntity().getKiller();
- if (killer instanceof Player) {
- if (p instanceof Player) {
- int value = kills.get(killer.getUniqueId());
- kills.put(killer.getUniqueId(), value + 1);
- SetScoreBoard(killer);
- }
- }
- p.spigot().respawn();
- if (yellow.getPlayers().contains(p)) {
- World wyellowspawn = Bukkit.getServer().getWorld(getConfig().getString("yellowspawn.world"));
- double xyellowspawn = getConfig().getDouble("yellowspawn.x");
- double yyellowspawn = getConfig().getDouble("yellowspawn.y");
- double zyellowspawn = getConfig().getDouble("yellowspawn.z");
- p.teleport(new Location(wyellowspawn, xyellowspawn, yyellowspawn, zyellowspawn));
- }
- if (blue.getPlayers().contains(p)) {
- World wbluespawn = Bukkit.getServer().getWorld(getConfig().getString("bluespawn.world"));
- double xbluespawn = getConfig().getDouble("bluespawn.x");
- double ybluespawn = getConfig().getDouble("bluespawn.y");
- double zbluespawn = getConfig().getDouble("bluespawn.z");
- p.teleport(new Location(wbluespawn, xbluespawn, ybluespawn, zbluespawn));
- }
- if (green.getPlayers().contains(p)) {
- World wgreenspawn = Bukkit.getServer().getWorld(getConfig().getString("greenspawn.world"));
- double xgreenspawn = getConfig().getDouble("greenspawn.x");
- double ygreenspawn = getConfig().getDouble("greenspawn.y");
- double zgreenspawn = getConfig().getDouble("greenspawn.z");
- p.teleport(new Location(wgreenspawn, xgreenspawn, ygreenspawn, zgreenspawn));
- }
- if (red.getPlayers().contains(p)) {
- World wredspawn = Bukkit.getServer().getWorld(getConfig().getString("redspawn.world"));
- double xredspawn = getConfig().getDouble("redspawn.x");
- double yredspawn = getConfig().getDouble("redspawn.y");
- double zredspawn = getConfig().getDouble("redspawn.z");
- p.teleport(new Location(wredspawn, xredspawn, yredspawn, zredspawn));
- }
- }
- public HashMap<Integer, Block> beaconStore = new HashMap<>();
- // WHEN PLAYER BREAKS BLOCK
- @EventHandler
- public void onBreak(BlockBreakEvent event){
- Player p = event.getPlayer();
- Block block = event.getBlock();
- if (p.getItemInHand().getType() == Material.WOOD_HOE) {
- event.setCancelled(true);
- w = block.getLocation().getWorld().getName();
- x = block.getLocation().getX() + 0.500;
- y = block.getLocation().getY();
- z = block.getLocation().getZ() + 0.500;
- p.sendMessage("§6Saved coordinates for block. (World:" + w + " x:" + x + "," + " y:" + y + "," + " z:" + z + ")");
- }
- if (gameRunning == true) {
- boolean okBreak = false;
- for(Integer integer : BlockReset.keySet()){
- Block bl = BlockReset.get(integer);
- if (bl.equals(block)) {
- okBreak = true;
- }
- else {
- }
- }
- Location blockLocation = block.getLocation();
- if (block.getType() == Material.BEACON) {
- okBreak = true;
- p.sendMessage(" " + blockLocation);
- World world = block.getWorld();
- double xyellowBeacon1 = getConfig().getDouble("yellowbeacon1.x");
- double yyellowBeacon1 = getConfig().getDouble("yellowbeacon1.y");
- double zyellowBeacon1 = getConfig().getDouble("yellowbeacon1.z");
- Location yellowBeacon1Location = new Location(world, xyellowBeacon1, yyellowBeacon1, zyellowBeacon1);
- double xyellowBeacon2 = getConfig().getDouble("yellowbeacon2.x");
- double yyellowBeacon2 = getConfig().getDouble("yellowbeacon2.y");
- double zyellowBeacon2 = getConfig().getDouble("yellowbeacon2.z");
- Location yellowBeacon2Location = new Location(world, xyellowBeacon2, yyellowBeacon2, zyellowBeacon2);
- double xyellowBeacon3 = getConfig().getDouble("yellowbeacon3.x");
- double yyellowBeacon3 = getConfig().getDouble("yellowbeacon3.y");
- double zyellowBeacon3 = getConfig().getDouble("yellowbeacon3.z");
- Location yellowBeacon3Location = new Location(world, xyellowBeacon3, yyellowBeacon3, zyellowBeacon3);
- double xyellowBeacon4 = getConfig().getDouble("yellowbeacon4.x");
- double yyellowBeacon4 = getConfig().getDouble("yellowbeacon4.y");
- double zyellowBeacon4 = getConfig().getDouble("yellowbeacon4.z");
- Location yellowBeacon4Location = new Location(world, xyellowBeacon4, yyellowBeacon4, zyellowBeacon4);
- if (blockLocation == yellowBeacon1Location) {
- yellowbcount--;
- }
- if (blockLocation == yellowBeacon2Location) {
- yellowbcount--;
- }
- if (blockLocation == yellowBeacon3Location) {
- yellowbcount--;
- }
- if (blockLocation == yellowBeacon4Location) {
- yellowbcount--;
- }
- double xblueBeacon1 = getConfig().getDouble("bluebeacon1.x");
- double yblueBeacon1 = getConfig().getDouble("bluebeacon1.y");
- double zblueBeacon1 = getConfig().getDouble("bluebeacon1.z");
- Location blueBeacon1Location = new Location(world, xblueBeacon1, yblueBeacon1, zblueBeacon1);
- double xblueBeacon2 = getConfig().getDouble("bluebeacon2.x");
- double yblueBeacon2 = getConfig().getDouble("bluebeacon2.y");
- double zblueBeacon2 = getConfig().getDouble("bluebeacon2.z");
- Location blueBeacon2Location = new Location(world, xblueBeacon2, yblueBeacon2, zblueBeacon2);
- double xblueBeacon3 = getConfig().getDouble("bluebeacon3.x");
- double yblueBeacon3 = getConfig().getDouble("bluebeacon3.y");
- double zblueBeacon3 = getConfig().getDouble("bluebeacon3.z");
- Location blueBeacon3Location = new Location(world, xblueBeacon3, yblueBeacon3, zblueBeacon3);
- double xblueBeacon4 = getConfig().getDouble("bluebeacon4.x");
- double yblueBeacon4 = getConfig().getDouble("bluebeacon4.y");
- double zblueBeacon4 = getConfig().getDouble("bluebeacon4.z");
- Location blueBeacon4Location = new Location(world, xblueBeacon4, yblueBeacon4, zblueBeacon4);
- if (blockLocation == blueBeacon1Location) {
- bluebcount--;
- }
- if (blockLocation == blueBeacon2Location) {
- bluebcount--;
- }
- if (blockLocation == blueBeacon3Location) {
- bluebcount--;
- }
- if (blockLocation == blueBeacon4Location) {
- bluebcount--;
- }
- double xgreenBeacon1 = getConfig().getDouble("greenbeacon1.x");
- double ygreenBeacon1 = getConfig().getDouble("greenbeacon1.y");
- double zgreenBeacon1 = getConfig().getDouble("greenbeacon1.z");
- Location greenBeacon1Location = new Location(world, xgreenBeacon1, ygreenBeacon1, zgreenBeacon1);
- double xgreenBeacon2 = getConfig().getDouble("greenbeacon2.x");
- double ygreenBeacon2 = getConfig().getDouble("greenbeacon2.y");
- double zgreenBeacon2 = getConfig().getDouble("greenbeacon2.z");
- Location greenBeacon2Location = new Location(world, xgreenBeacon2, ygreenBeacon2, zgreenBeacon2);
- double xgreenBeacon3 = getConfig().getDouble("greenbeacon3.x");
- double ygreenBeacon3 = getConfig().getDouble("greenbeacon3.y");
- double zgreenBeacon3 = getConfig().getDouble("greenbeacon3.z");
- Location greenBeacon3Location = new Location(world, xgreenBeacon3, ygreenBeacon3, zgreenBeacon3);
- double xgreenBeacon4 = getConfig().getDouble("greenbeacon4.x");
- double ygreenBeacon4 = getConfig().getDouble("greenbeacon4.y");
- double zgreenBeacon4 = getConfig().getDouble("greenbeacon4.z");
- Location greenBeacon4Location = new Location(world, xgreenBeacon4, ygreenBeacon4, zgreenBeacon4);
- if (blockLocation == greenBeacon1Location) {
- greenbcount--;
- }
- if (blockLocation == greenBeacon2Location) {
- greenbcount--;
- }
- if (blockLocation == greenBeacon3Location) {
- greenbcount--;
- }
- if (blockLocation == greenBeacon4Location) {
- greenbcount--;
- }
- double xredBeacon1 = getConfig().getDouble("redbeacon1.x");
- double yredBeacon1 = getConfig().getDouble("redbeacon1.y");
- double zredBeacon1 = getConfig().getDouble("redbeacon1.z");
- Location redBeacon1Location = new Location(world, xredBeacon1, yredBeacon1, zredBeacon1);
- p.sendMessage(" " + redBeacon1Location);
- double xredBeacon2 = getConfig().getDouble("redbeacon2.x");
- double yredBeacon2 = getConfig().getDouble("redbeacon2.y");
- double zredBeacon2 = getConfig().getDouble("redbeacon2.z");
- Location redBeacon2Location = new Location(world, xredBeacon2, yredBeacon2, zredBeacon2);
- double xredBeacon3 = getConfig().getDouble("redbeacon3.x");
- double yredBeacon3 = getConfig().getDouble("redbeacon3.y");
- double zredBeacon3 = getConfig().getDouble("redbeacon3.z");
- Location redBeacon3Location = new Location(world, xredBeacon3, yredBeacon3, zredBeacon3);
- double xredBeacon4 = getConfig().getDouble("redbeacon4.x");
- double yredBeacon4 = getConfig().getDouble("redbeacon4.y");
- double zredBeacon4 = getConfig().getDouble("redbeacon4.z");
- Location redBeacon4Location = new Location(world, xredBeacon4, yredBeacon4, zredBeacon4);
- if (blockLocation == redBeacon1Location) {
- redbcount--;
- p.sendMessage("Okay!");
- }
- if (blockLocation == redBeacon2Location) {
- redbcount--;
- }
- if (blockLocation == redBeacon3Location) {
- redbcount--;
- }
- if (blockLocation == redBeacon4Location) {
- redbcount--;
- }
- }
- if (okBreak == true) {
- event.setCancelled(false);
- }
- else {
- event.setCancelled(true);
- p.sendMessage("§9§lPillars " + dot + " §7You can only break blocks placed by a player!");
- }
- }
- }
- public int BlocksPlaced = 0;
- public HashMap<Integer, Block> BlockReset = new HashMap<>();
- // WHEN PLACED BLOCK
- @EventHandler
- public void onPlace(BlockPlaceEvent event) {
- Block block = event.getBlock();
- BlocksPlaced++;
- if (gameRunning == true) {
- BlockReset.put(BlocksPlaced, block);
- }
- }
- // WHEN GAME IS FINISHED
- public void gameFinished() {
- for(Integer integer : BlockReset.keySet()){
- Block bl = BlockReset.get(integer);
- bl.setType(Material.AIR);
- }
- Bukkit.getServer().reload();
- }
- // WHEN PLAYER LEAVES
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onPlayerLeave(PlayerQuitEvent event) {
- Player p = event.getPlayer();
- yellow.removePlayer(p);
- blue.removePlayer(p);
- green.removePlayer(p);
- red.removePlayer(p);
- if (queueTeamYellow.get(1) == p.getDisplayName()) {
- queueTeamYellow.put(1, queueTeamYellow.get(2));
- queueTeamYellow.put(2, queueTeamYellow.get(3));
- queueTeamYellow.put(3, queueTeamYellow.get(4));
- }
- if (queueTeamYellow.get(2) == p.getDisplayName()) {
- queueTeamYellow.put(2, queueTeamYellow.get(3));
- queueTeamYellow.put(3, queueTeamYellow.get(4));
- }
- if (queueTeamYellow.get(3) == p.getDisplayName()) {
- queueTeamYellow.put(3, queueTeamYellow.get(4));
- }
- if (queueTeamYellow.get(4) == p.getDisplayName()) {
- queueTeamYellow.put(4, "null");
- }
- if (queueTeamBlue.get(1) == p.getDisplayName()) {
- queueTeamBlue.put(1, queueTeamBlue.get(2));
- queueTeamBlue.put(2, queueTeamBlue.get(3));
- queueTeamBlue.put(3, queueTeamBlue.get(4));
- }
- if (queueTeamBlue.get(2) == p.getDisplayName()) {
- queueTeamBlue.put(2, queueTeamBlue.get(3));
- queueTeamBlue.put(3, queueTeamBlue.get(4));
- }
- if (queueTeamBlue.get(3) == p.getDisplayName()) {
- queueTeamBlue.put(3, queueTeamBlue.get(4));
- }
- if (queueTeamBlue.get(4) == p.getDisplayName()) {
- queueTeamBlue.put(4, "null");
- }
- if (queueTeamGreen.get(1) == p.getDisplayName()) {
- queueTeamGreen.put(1, queueTeamGreen.get(2));
- queueTeamGreen.put(2, queueTeamGreen.get(3));
- queueTeamGreen.put(3, queueTeamGreen.get(4));
- }
- if (queueTeamGreen.get(2) == p.getDisplayName()) {
- queueTeamGreen.put(2, queueTeamGreen.get(3));
- queueTeamGreen.put(3, queueTeamGreen.get(4));
- }
- if (queueTeamGreen.get(3) == p.getDisplayName()) {
- queueTeamGreen.put(3, queueTeamGreen.get(4));
- }
- if (queueTeamGreen.get(4) == p.getDisplayName()) {
- queueTeamGreen.put(4, "null");
- }
- if (queueTeamRed.get(1) == p.getDisplayName()) {
- queueTeamRed.put(1, queueTeamRed.get(2));
- queueTeamRed.put(2, queueTeamRed.get(3));
- queueTeamRed.put(3, queueTeamRed.get(4));
- }
- if (queueTeamRed.get(2) == p.getDisplayName()) {
- queueTeamRed.put(2, queueTeamRed.get(3));
- queueTeamRed.put(3, queueTeamRed.get(4));
- }
- if (queueTeamRed.get(3) == p.getDisplayName()) {
- queueTeamRed.put(3, queueTeamRed.get(4));
- }
- if (queueTeamRed.get(4) == p.getDisplayName()) {
- queueTeamRed.put(4, "null");
- }
- for (Player player : Bukkit.getServer().getOnlinePlayers()) {
- SetScoreBoard(player);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement