Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.loumaster;
- import java.io.ByteArrayOutputStream;
- import java.io.DataOutputStream;
- import java.io.IOException;
- import java.io.PrintStream;
- import java.net.Socket;
- import java.util.ArrayList;
- import java.util.Random;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Color;
- import org.bukkit.FireworkEffect;
- import org.bukkit.FireworkEffect.Type;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.World;
- import org.bukkit.WorldCreator;
- import org.bukkit.block.Block;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Firework;
- 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.EntityDamageByEntityEvent;
- import org.bukkit.event.entity.EntityDamageEvent;
- import org.bukkit.event.entity.PlayerDeathEvent;
- import org.bukkit.event.player.AsyncPlayerChatEvent;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.event.player.PlayerMoveEvent;
- import org.bukkit.event.player.PlayerQuitEvent;
- import org.bukkit.event.weather.WeatherChangeEvent;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.FireworkMeta;
- import org.bukkit.plugin.java.JavaPlugin;
- import com.connorlinfoot.titleapi.TitleAPI;
- public class Main extends JavaPlugin implements Listener{
- int PAOOOOO;
- int EMOREU;
- int MAMAE;
- boolean bhxfvbhfxdbhjf = false;
- public void onEnable(){
- getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
- EMOREU = Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
- new Runnable() {
- public void run() {
- if(bhxfvbhfxdbhjf == true){
- Bukkit.getScheduler().cancelTask(PAOOOOO);
- pao("§9§l[EM JOGO]");
- }
- }
- },
- 0L,
- 17L);
- PAOOOOO = Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
- new Runnable() {
- public void run() {
- pao("§a§l[ENTRAR]");
- }
- },
- 0L,
- 17L);
- World w = Bukkit.getServer().getWorld("world");
- w.setAutoSave(false);
- getServer().getPluginManager().registerEvents(this, this);
- Bukkit.setDefaultGameMode(GameMode.SURVIVAL);
- Block block = Bukkit.getWorld("world").getBlockAt(100, 102, 69);
- block.setType(Material.OBSIDIAN);
- Block blockA = Bukkit.getWorld("world").getBlockAt(100, 101, 101);
- blockA.setType(Material.OBSIDIAN);
- }
- public static void unloadMap(String mapname){
- if(Bukkit.getServer().unloadWorld(Bukkit.getServer().getWorld(mapname), false)){
- }else{
- }
- }
- public static void loadMap(String mapname){
- Bukkit.getServer().createWorld(new WorldCreator(mapname));
- World w = Bukkit.getServer().createWorld(new WorldCreator(mapname));
- w.setAutoSave(false);
- }
- public static void rollback(String mapname){
- unloadMap(mapname);
- loadMap(mapname);
- }
- public void onDisable(){
- rollback("world");
- try{
- Bukkit.getScheduler().cancelTask(EMOREU);
- } catch(Exception e){
- System.out.println("Task Não estava ligada.");
- }
- pao("§4§l[REINICIANDO]");
- }
- public void pao(String MODOO){
- Socket cliente;
- try {
- cliente = new Socket("127.0.0.1", 12345);
- PrintStream saida = new PrintStream(cliente.getOutputStream());
- saida.println("2 "+MODOO);
- saida.close();
- cliente.close();
- } catch (IOException e) {
- System.out.println("Erro ao conctar... Tentando novamente.");
- }
- }
- ArrayList<Player> red = new ArrayList<Player>();
- ArrayList<Player> blue = new ArrayList<Player>();
- int MaxPlayers = 12;
- String MODE = "START";
- int countdownS;
- int countdownB;
- boolean ModoBuild = false;
- boolean countdownIniciado = false;
- int countdown = 60;
- int countdownFinal = 20;
- int countdownBuild = 31;
- Location redSpawn = new Location(Bukkit.getWorld("world"), 98, 100, 100);
- Location blueSpawn = new Location(Bukkit.getWorld("world"), 98, 101, 70);
- public int getRandom(int lower, int upper) {
- Random random = new Random();
- return random.nextInt((upper - lower) + 1) + lower;
- }
- public void DivididorTimes(Player p){
- if(red.size() > blue.size()){
- blue.add(p);
- }else if(red.size() < blue.size()){
- red.add(p);
- }else if(red.size() == blue.size()){
- int r = getRandom(0, 1);
- if(r == 1){
- red.add(p);
- }else if(r == 0){
- blue.add(p);
- }
- }
- }
- @EventHandler
- public void quebrar(BlockBreakEvent e){
- Player p1 = e.getPlayer();
- if(ModoBuild == true){
- if(e.getBlock().getLocation().getBlockZ() == 86){
- e.setCancelled(true);
- }
- if(blue.contains(p1)){
- if(e.getBlock().getLocation().getBlockZ() > 86){
- e.setCancelled(true);
- }
- }else if(red.contains(p1)){
- if(e.getBlock().getLocation().getBlockZ() < 86){
- e.setCancelled(true);
- }
- }
- }
- if(MODE == "INICIADO" && ModoBuild == false){
- if(blue.contains(p1) && e.getBlock().getType() == Material.OBSIDIAN && e.getBlock().getLocation().getBlockZ() > 86){
- MODE = "ACABANDO";
- for(Player p : Bukkit.getOnlinePlayers()){
- p.setGameMode(GameMode.CREATIVE);
- if(blue.contains(p)){
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
- new Runnable() {
- public void run() {
- if(countdownFinal > 0){
- countdownFinal--;
- } else {
- sendToServer(p, "lobby");
- Bukkit.shutdown();
- }
- Bukkit.broadcastMessage("§b[§6MiniGuerra§b]§6 O time §9§lAzul§6 ganhou o MiniGuerra!");
- spawnFirework(p);
- }
- },
- 0L,
- 10L);
- }
- }
- } else if(red.contains(p1) && e.getBlock().getType() == Material.OBSIDIAN && e.getBlock().getLocation().getBlockZ() < 86){
- MODE = "ACABANDO";
- for(Player p : Bukkit.getOnlinePlayers()){
- p.setGameMode(GameMode.CREATIVE);
- if(red.contains(p)){
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
- new Runnable() {
- public void run() {
- if(countdownFinal > 0){
- countdownFinal--;
- } else {
- Bukkit.shutdown();
- }
- if(countdownFinal == 3){
- sendToServer(p, "lobby");
- }
- Bukkit.broadcastMessage("§b[§6MiniGuerra§b]§6 O time §9§lVermelho§6 ganhou o MiniGuerra!");
- spawnFirework(p);
- }
- },
- 0L,
- 10L);
- }
- }
- }else if(!red.contains(p1) && e.getBlock().getType() == Material.OBSIDIAN && e.getBlock().getLocation().getBlockZ() < 86){
- e.setCancelled(true);
- }else if(!blue.contains(p1) && e.getBlock().getType() == Material.OBSIDIAN && e.getBlock().getLocation().getBlockZ() > 86){
- e.setCancelled(true);
- }
- }
- }
- private Color getColor(int i) {
- Color c = null;
- if(i==1){c=Color.AQUA;}
- if(i==2){c=Color.BLACK;}
- if(i==3){c=Color.BLUE;}
- if(i==4){c=Color.FUCHSIA;}
- if(i==5){c=Color.GRAY;}
- if(i==6){c=Color.GREEN;}
- if(i==7){c=Color.LIME;}
- if(i==8){c=Color.MAROON;}
- if(i==9){c=Color.NAVY;}
- if(i==10){c=Color.OLIVE;}
- if(i==11){c=Color.ORANGE;}
- if(i==12){c=Color.PURPLE;}
- if(i==13){c=Color.RED;}
- if(i==14){c=Color.SILVER;}
- if(i==15){c=Color.TEAL;}
- if(i==16){c=Color.WHITE;}
- if(i==17){c=Color.YELLOW;}
- return c;}
- @EventHandler
- public void tempo(WeatherChangeEvent e){
- e.setCancelled(true);
- }
- public void IniciarCountdown() {
- countdownS = Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
- new Runnable() {
- public void run() {
- if(countdownIniciado == false){
- countdownIniciado = true;
- }
- if (countdown > 0) {
- countdown--;
- }else if(countdown <= 0){
- Bukkit.getScheduler().cancelTask(countdownS);
- iniciarJogo();
- ModoBuild = true;
- Bukkit.broadcastMessage("§b[§6MiniGuerra§b]§6 A partida iniciou! Vocês teram 5 minutos para construir a base!");
- }
- if(countdown == 5){
- bhxfvbhfxdbhjf = true;
- }
- if(countdown == 30 || countdown == 15 || countdown == 10 || countdown == 5 || countdown == 3 || countdown == 2 || countdown == 1){
- Bukkit.broadcastMessage("§b[§6MiniGuerra§b]§6 Tempo restante: §3"+countdown+"§6 segundos!");
- }else if(countdown == 59){
- Bukkit.broadcastMessage("§b[§6MiniGuerra§b]§6 Tempo restante: §31§6 minuto!");
- }
- }
- },
- 0L,
- 20L);
- }
- public void IniciarCountdownBuild() {
- countdownB = Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
- new Runnable() {
- @SuppressWarnings("deprecation")
- public void run() {
- if (countdownBuild == 30 || countdownBuild == 15 || countdownBuild == 10 || countdownBuild == 5 || countdownBuild == 4 || countdownBuild == 3 || countdownBuild == 2 || countdownBuild == 1) {
- for(Player p : Bukkit.getOnlinePlayers()){
- TitleAPI.sendTitle(p, 20, 100, 20, "§a§l"+countdownBuild+" segundos Restantes");
- }
- }else if (countdownBuild == 60 ) {
- for(Player p : Bukkit.getOnlinePlayers()){
- TitleAPI.sendTitle(p, 20, 100, 20, "§a§l1 Minuto Restante");
- }
- }else if (countdownBuild == 120 ) {
- for(Player p : Bukkit.getOnlinePlayers()){
- TitleAPI.sendTitle(p, 20, 100, 20, "§a§l2 Minutos Restantes");
- }
- }else if (countdownBuild == 180 ) {
- for(Player p : Bukkit.getOnlinePlayers()){
- TitleAPI.sendTitle(p, 20, 100, 20, "§a§l3 Minutos Restantes");
- }
- } else if (countdownBuild == 240 ) {
- for(Player p : Bukkit.getOnlinePlayers()){
- TitleAPI.sendTitle(p, 20, 100, 20, "§a§l4 Minutos Restantes");
- }
- } else if (countdownBuild == 299 ) {
- for(Player p : Bukkit.getOnlinePlayers()){
- TitleAPI.sendTitle(p, 20, 100, 20, "§a§l5 Minuto Restantes");
- }
- } else if (countdownBuild == 0 ) {
- Bukkit.getScheduler().cancelTask(countdownB);
- iniciarLuta();
- ModoBuild = false;
- for(Player p : Bukkit.getOnlinePlayers()){
- TitleAPI.sendTitle(p, 20, 100, 20, "§a§lDestrua a §3§lOBSIDIAN§a§l inimiga!");
- }
- }
- if(countdownBuild > 0){
- countdownBuild--;
- }
- }
- },
- 0L,
- 20L);
- }
- @EventHandler
- public void dano(EntityDamageEvent e){
- if(MODE == "COUNTDOWN" || MODE == "BUILD" || MODE == "START"){
- e.setCancelled(true);
- }
- }
- @EventHandler
- public void join(PlayerJoinEvent e){
- Player p = e.getPlayer();
- p.setHealth(20);
- p.setHealth(20);
- p.setFireTicks(0);
- p.setFoodLevel(20);
- p.getInventory().clear();
- p.setFoodLevel(20);
- World w = Bukkit.getServer().getWorld(
- getConfig().getString(
- "SpawnWorld"));
- double x = getConfig()
- .getDouble("SpawnX");
- double y = getConfig().getDouble(
- "SpawnY");
- double z = getConfig().getDouble(
- "SpawnZ");
- float yaw = (float) getConfig().getDouble("SpawnYA");
- float pitch = (float) getConfig().getDouble("SpawnP");
- Location loc = new Location(w, x, y, z);
- loc.setPitch(pitch);
- loc.setYaw(yaw);
- p.teleport(loc);
- int playerOnline = Bukkit.getOnlinePlayers().size();
- e.setJoinMessage("§b[§6MiniGuerra§b]§6 §3"+p.getName()+" §6se juntou a partida! §3("+playerOnline+"/"+MaxPlayers+")");
- DivididorTimes(p);
- if(playerOnline > 1 && countdownIniciado == false){
- IniciarCountdown();
- }
- }
- public void spawnFirework(Player p){
- Firework fw = (Firework) p.getWorld().spawnEntity(p.getLocation(), EntityType.FIREWORK);
- FireworkMeta fwm = fw.getFireworkMeta();
- Random r = new Random();
- int rt = r.nextInt(4) + 1;
- Type type = Type.BALL;
- if (rt == 1) type = Type.BALL;
- if (rt == 2) type = Type.BALL_LARGE;
- if (rt == 3) type = Type.BURST;
- if (rt == 4) type = Type.CREEPER;
- if (rt == 5) type = Type.STAR;
- int r1i = r.nextInt(17) + 1;
- int r2i = r.nextInt(17) + 1;
- Color c1 = getColor(r1i);
- Color c2 = getColor(r2i);
- FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c2).with(type).trail(r.nextBoolean()).build();
- fwm.addEffect(effect);
- int rp = r.nextInt(2) + 1;
- fwm.setPower(rp);
- fw.setFireworkMeta(fwm);
- }
- @EventHandler
- public void quit(PlayerQuitEvent e){
- Player p = e.getPlayer();
- if(red.contains(p)){
- red.remove(p);
- }
- if(blue.contains(p)){
- blue.remove(p);
- }
- int playerOnline = Bukkit.getOnlinePlayers().size()-1;
- e.setQuitMessage("§b[§6MiniGuerra§b]§6 §3"+p.getName()+"§6 saiu da partida! §3("+playerOnline+"/"+MaxPlayers+")");
- if(MODE == "COUNTDOWN"){
- if(playerOnline < 1 && MODE == "COUNTDOWN"){
- if(countdownIniciado == true){
- Bukkit.getScheduler().cancelTask(countdownS);
- countdownIniciado = false;
- Bukkit.broadcastMessage("§b[§6MiniGuerra§b]§6 A contagem parou por não ter jogadores suficientes.");
- }
- }
- }
- if(MODE == "INICIADO"){
- new java.util.Timer().schedule(
- new java.util.TimerTask() {
- public void run() {
- testEnd();
- }
- },
- 1000
- );
- }
- }
- public void iniciarJogo(){
- MODE = "INICIADO";
- IniciarCountdownBuild();
- for(Player p1 : Bukkit.getOnlinePlayers()){
- p1.getInventory().clear();
- p1.setGameMode(GameMode.CREATIVE);
- if(blue.contains(p1)){
- World w = Bukkit.getServer().getWorld(
- getConfig().getString(
- "BlueWorld"));
- double x = getConfig()
- .getDouble("BlueX");
- double y = getConfig().getDouble(
- "BlueY");
- double z = getConfig().getDouble(
- "BlueZ");
- float yaw = (float) getConfig().getDouble("BlueYA");
- float pitch = (float) getConfig().getDouble("BlueP");
- Location loc = new Location(w, x, y, z);
- loc.setPitch(pitch);
- loc.setYaw(yaw);
- p1.teleport(loc);
- }
- if(red.contains(p1)){
- World w = Bukkit.getServer().getWorld(
- getConfig().getString(
- "RedWorld"));
- double x = getConfig()
- .getDouble("RedX");
- double y = getConfig().getDouble(
- "RedY");
- double z = getConfig().getDouble(
- "RedZ");
- float yaw = (float) getConfig().getDouble("RedYA");
- float pitch = (float) getConfig().getDouble("RedP");
- Location loc = new Location(w, x, y, z);
- loc.setPitch(pitch);
- loc.setYaw(yaw);
- p1.teleport(loc);
- }
- }
- }
- public void iniciarLuta(){
- for(Player p1 : Bukkit.getOnlinePlayers()){
- p1.setGameMode(GameMode.SURVIVAL);
- p1.getActivePotionEffects().clear();
- p1.getInventory().clear();
- p1.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD));
- p1.getInventory().setItem(1, new ItemStack(Material.BOW));
- p1.getInventory().setItem(2, new ItemStack(Material.WATER_BUCKET));
- p1.getInventory().setItem(3, new ItemStack(Material.LAVA_BUCKET));
- p1.getInventory().setItem(4, new ItemStack(Material.APPLE, 64));
- p1.getInventory().setItem(5, new ItemStack(Material.DIAMOND_PICKAXE));
- p1.getInventory().setItem(6, new ItemStack(Material.FLINT_AND_STEEL));
- p1.getInventory().setItem(7, new ItemStack(Material.COBBLESTONE, 64));
- p1.getInventory().setItem(8, new ItemStack(Material.REDSTONE_TORCH_OFF, 64));
- p1.getInventory().addItem(new ItemStack(Material.TNT, 64));
- p1.getInventory().addItem(new ItemStack(Material.ARROW, 64));
- p1.getInventory().addItem(new ItemStack(Material.TNT, 64));
- p1.getInventory().addItem(new ItemStack(Material.LEVER, 64));
- p1.getInventory().addItem(new ItemStack(Material.REDSTONE, 64));
- p1.playSound(p1.getLocation(), Sound.NOTE_PLING, 1, 7);
- }
- }
- @EventHandler
- public void dano(EntityDamageByEntityEvent e){
- if(e.getDamager() instanceof Player){
- if(MODE == "COUNTDOWN" || MODE == "START"){
- e.setCancelled(true);
- }
- }
- if(e.getEntity().getType().equals(EntityType.PLAYER) && e.getDamager().getType().equals(EntityType.PLAYER)){
- Player p = (Player) e.getEntity();
- Player d = (Player) e.getDamager();
- if(blue.contains(p) && blue.contains(d)){
- e.setCancelled(true);
- }
- if(red.contains(p) && red.contains(d)){
- e.setCancelled(true);
- }
- }
- }
- @EventHandler
- public void MORREU(PlayerDeathEvent e){
- Player p = (Player) e.getEntity().getPlayer();
- p.setHealth(20);
- if(blue.contains(p)){
- World w = Bukkit.getServer().getWorld(
- getConfig().getString(
- "BlueWorld"));
- double x = getConfig()
- .getDouble("BlueX");
- double y = getConfig().getDouble(
- "BlueY");
- double z = getConfig().getDouble(
- "BlueZ");
- float yaw = (float) getConfig().getDouble("BlueYA");
- float pitch = (float) getConfig().getDouble("BlueP");
- Location loc = new Location(w, x, y, z);
- loc.setPitch(pitch);
- loc.setYaw(yaw);
- e.getEntity().getPlayer().teleport(loc);
- if(p.getKiller() != null && p.getKiller() != p){
- e.setDeathMessage("§b[§6MiniGuerra§b] §6O Jogador §c§l"+p.getKiller().getName()+" §6matou o §9§l"+p.getName()+"§6!");
- }
- if(p.getKiller() == null){
- e.setDeathMessage("§b[§6MiniGuerra§b] §6O Jogador §9§l"+p.getName()+" §6morreu!");
- }
- if(p.getKiller() != null && p.getKiller() == p){
- if(p.getKiller() == null){
- e.setDeathMessage("§b[§6MiniGuerra§b] §6O Jogador §9§l"+p.getName()+" §6se matou!");
- }
- }
- }else if(red.contains(p)){
- World w = Bukkit.getServer().getWorld(
- getConfig().getString(
- "RedWorld"));
- double x = getConfig()
- .getDouble("RedX");
- double y = getConfig().getDouble(
- "RedY");
- double z = getConfig().getDouble(
- "RedZ");
- float yaw = (float) getConfig().getDouble("RedYA");
- float pitch = (float) getConfig().getDouble("RedP");
- Location loc = new Location(w, x, y, z);
- loc.setPitch(pitch);
- loc.setYaw(yaw);
- p.teleport(loc);
- if(p.getKiller() != null && p.getKiller() != p){
- e.setDeathMessage("§b[§6MiniGuerra§b] §6O Jogador §9§l"+p.getKiller().getName()+" §6matou o §c§l"+p.getName()+"§6!");
- }
- if(p.getKiller() == null){
- e.setDeathMessage("§b[§6MiniGuerra§b] §6O Jogador §c§l"+p.getName()+" §6morreu!");
- }
- if(p.getKiller() != null && p.getKiller() == p){
- if(p.getKiller() == null){
- e.setDeathMessage("§b[§6MiniGuerra§b] §6O Jogador §c§l"+p.getName()+" §6se matou!");
- }
- }
- }
- }
- @EventHandler
- public void chat(AsyncPlayerChatEvent e){
- Player p = e.getPlayer();
- String m = e.getMessage();
- if(blue.contains(p)){
- e.setFormat("§9"+p.getName()
- + ChatColor.WHITE + " §f» §7" + m.replaceAll("&", "§"));
- }else if(red.contains(p)){
- e.setFormat("§c"+p.getName()
- + ChatColor.WHITE + " §f» §7" + m.replaceAll("&", "§"));
- }
- }
- @EventHandler
- public void colocar(BlockPlaceEvent e){
- Block b = e.getBlock();
- Player p = e.getPlayer();
- if(b.getType() == Material.BEDROCK){
- p.sendMessage("§b[§6MiniGuerra§b]§6 Não é permitido usar §3§lBEDROCK §6desculpe.");
- p.getItemInHand().setType(Material.AIR);
- e.setCancelled(true);
- }else if(b.getType() == Material.OBSIDIAN){
- p.sendMessage("§b[§6MiniGuerra§b]§6 Não é permitido usar §3§lOBSIDIAN §6desculpe.");
- p.getItemInHand().setType(Material.AIR);
- e.setCancelled(true);
- }else if(b.getType() == Material.ENCHANTMENT_TABLE){
- p.sendMessage("§b[§6MiniGuerra§b]§6 Não é permitido usar §3§lMESA DE ENCANTAMENTOS §6desculpe.");
- p.getItemInHand().setType(Material.AIR);
- e.setCancelled(true);
- }else if(b.getType() == Material.CHEST){
- p.sendMessage("§b[§6MiniGuerra§b]§6 Não é permitido usar §3§lBau §6desculpe.");
- p.getItemInHand().setType(Material.AIR);
- e.setCancelled(true);
- }else if(b.getType() == Material.ENDER_CHEST){
- p.sendMessage("§b[§6MiniGuerra§b]§6 Não é permitido usar §3§lENDER CHEST §6desculpe.");
- p.getItemInHand().setType(Material.AIR);
- e.setCancelled(true);
- }
- if(p.getLocation().getBlockY() > 150){
- e.setCancelled(true);
- p.sendMessage("§b[§6MiniGuerra§b]§6 Limite de §3§lALTURA §6foi atingido.");
- }
- }
- @EventHandler
- public void move(PlayerMoveEvent e){
- if(e.getTo().getY() > 150){
- e.getPlayer().sendMessage("§b[§6MiniGuerra§b]§6 Limite de §3§lALTURA §6foi atingido.");
- }
- if(ModoBuild == true){
- if(e.getTo().getZ() > 86 && e.getTo().getZ() < 87){
- e.setCancelled(true);
- }
- }
- if(e.getTo().getY() < 50){
- if(MODE == "BUILD" || MODE == "INICIADO"){
- if(blue.contains(e.getPlayer())){
- World w = Bukkit.getServer().getWorld(
- getConfig().getString(
- "BlueWorld"));
- double x = getConfig()
- .getDouble("BlueX");
- double y = getConfig().getDouble(
- "BlueY");
- double z = getConfig().getDouble(
- "BlueZ");
- float yaw = (float) getConfig().getDouble("BlueYA");
- float pitch = (float) getConfig().getDouble("BlueP");
- Location loc = new Location(w, x, y, z);
- loc.setPitch(pitch);
- loc.setYaw(yaw);
- e.getPlayer().teleport(loc);
- }else if(red.contains(e.getPlayer())){
- World w = Bukkit.getServer().getWorld(
- getConfig().getString(
- "RedWorld"));
- double x = getConfig()
- .getDouble("RedX");
- double y = getConfig().getDouble(
- "RedY");
- double z = getConfig().getDouble(
- "RedZ");
- float yaw = (float) getConfig().getDouble("RedYA");
- float pitch = (float) getConfig().getDouble("RedP");
- Location loc = new Location(w, x, y, z);
- loc.setPitch(pitch);
- loc.setYaw(yaw);
- e.getPlayer().teleport(loc);
- }
- }
- }
- }
- public void testEnd(){
- if(red.size() == 0){
- for(Player p : Bukkit.getOnlinePlayers()){
- if(blue.contains(p)){
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
- new Runnable() {
- public void run() {
- if(countdownFinal > 0){
- countdownFinal--;
- } else {
- Bukkit.shutdown();
- }
- if(countdownFinal == 2){
- sendToServer(p, "lobby");
- }
- if(MODE == "INICIADO"){
- Bukkit.getScheduler().cancelTask(countdownB);
- }
- Bukkit.broadcastMessage("§b[§6MiniGuerra§b]§6 O time §9§lAzul §6ganhou o MiniGuerra!");
- spawnFirework(p);
- }
- },
- 0L,
- 25L);
- }
- }
- }
- if(blue.size() == 0){
- for(Player p : Bukkit.getOnlinePlayers()){
- if(red.contains(p)){
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this,
- new Runnable() {
- public void run() {
- if(countdownFinal > 0){
- countdownFinal--;
- } else {
- Bukkit.shutdown();
- }
- if(countdownFinal == 2){
- sendToServer(p, "lobby");
- }
- if(MODE == "INICIADO"){
- Bukkit.getScheduler().cancelTask(countdownB);
- }
- Bukkit.broadcastMessage("§b[§6MiniGuerra§b]§6 O time §c§lVermelho §6ganhou o MiniGuerra!");
- spawnFirework(p);
- }
- },
- 0L,
- 25L);
- }
- }
- }
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label,
- String[] args) {
- if (cmd.getName().equalsIgnoreCase("setazul")) {
- Player p = (Player) sender;
- this.getConfig().set("BlueWorld",
- p.getLocation().getWorld().getName());
- this.getConfig().set("BlueX",
- Double.valueOf(p.getLocation().getX()));
- this.getConfig().set("BlueY",
- Double.valueOf(p.getLocation().getY()+1));
- this.getConfig().set("BlueZ",
- Double.valueOf(p.getLocation().getZ()));
- this.getConfig().set("BlueP",
- Double.valueOf(p.getLocation().getPitch()));
- this.getConfig().set("BlueYA",
- Double.valueOf(p.getLocation().getYaw()));
- this.saveConfig();
- p.sendMessage("§a§oAZUL setado!");
- return true;
- }else if (cmd.getName().equalsIgnoreCase("setred")) {
- Player p = (Player) sender;
- this.getConfig().set("RedWorld",
- p.getLocation().getWorld().getName());
- this.getConfig().set("RedX",
- Double.valueOf(p.getLocation().getX()));
- this.getConfig().set("RedY",
- Double.valueOf(p.getLocation().getY()+1));
- this.getConfig().set("RedZ",
- Double.valueOf(p.getLocation().getZ()));
- this.getConfig().set("RedP",
- Double.valueOf(p.getLocation().getPitch()));
- this.getConfig().set("RedYA",
- Double.valueOf(p.getLocation().getYaw()));
- this.saveConfig();
- p.sendMessage("§a§oRed setado!");
- return true;
- }else if (cmd.getName().equalsIgnoreCase("setspawn")) {
- Player p = (Player) sender;
- this.getConfig().set("SpawnWorld",
- p.getLocation().getWorld().getName());
- this.getConfig().set("SpawnX",
- Double.valueOf(p.getLocation().getX()));
- this.getConfig().set("SpawnY",
- Double.valueOf(p.getLocation().getY()+1));
- this.getConfig().set("SpawnZ",
- Double.valueOf(p.getLocation().getZ()));
- this.getConfig().set("SpawnP",
- Double.valueOf(p.getLocation().getPitch()));
- this.getConfig().set("SpawnYA",
- Double.valueOf(p.getLocation().getYaw()));
- this.saveConfig();
- p.sendMessage("§a§oSpawn setado!");
- return true;
- }else if(cmd.getName().equalsIgnoreCase("sair") || cmd.getName().equalsIgnoreCase("leave")){
- Player p = (Player) sender;
- sendToServer(p, "lobby");
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement