Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.97 KB | None | 0 0
  1. package com.dbzjp.oneshot;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.entity.Player;
  5. import org.bukkit.plugin.Plugin;
  6. import org.bukkit.potion.PotionEffect;
  7. import org.bukkit.potion.PotionEffectType;
  8.  
  9. public class EndMethod {
  10.    
  11.     private static Plugin plugin = Bukkit.getPluginManager().getPlugin("OneShot");
  12.     static int task;
  13.     static int task2;
  14.    
  15.     public static void End(Player p) {
  16.         Main.IsRebooting = true;
  17.         for(Player all : Bukkit.getOnlinePlayers()) {
  18.             Title title = new Title("§6Fin de la partie", "§aGagnant: §8" + p.getName());
  19.             title.send(all);
  20.             all.sendMessage(Main.prefix + "§cRedémarrage du serveur dans 10 secondes");
  21.         }      
  22.        
  23.         task = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
  24.  
  25.             @Override
  26.             public void run() {
  27.                 for(Player all : Bukkit.getOnlinePlayers()) {
  28.                     all.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 10, 255));
  29.                     all.sendMessage(Main.prefix + "§eMerci d'avoir joué !");
  30.                     all.performCommand("/hub");
  31.                     Bukkit.dispatchCommand(Bukkit.getConsoleSender(), plugin.getConfig().getString("stop-server-command"));
  32.                 }              
  33.             }
  34.            
  35.            
  36.         }, 10*20);
  37.        
  38.        
  39.        
  40.     }
  41.    
  42.     public static void Endbytime() {
  43.         Main.IsRebooting = true;
  44.         for(Player all : Bukkit.getOnlinePlayers()) {
  45.             Title title = new Title("§6Fin de la partie", "§8Match nul");
  46.             title.send(all);
  47.             all.sendMessage(Main.prefix + "§cRedémarrage du serveur dans 10 secondes");
  48.         }      
  49.        
  50.         task = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
  51.  
  52.             @Override
  53.             public void run() {
  54.                 for(Player all : Bukkit.getOnlinePlayers()) {
  55.                     all.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 10, 255));
  56.                     all.sendMessage(Main.prefix + "§eMerci d'avoir joué !");
  57.                     all.performCommand("/hub");
  58.                     Bukkit.dispatchCommand(Bukkit.getConsoleSender(), plugin.getConfig().getString("stop-server-command"));
  59.                 }              
  60.             }
  61.            
  62.            
  63.         }, 10*20);
  64.     }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement