Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.18 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. // Méthode invoquée lorsque un joueur atteint les 25, qui néccésite de récupérer le joueur avec les 25 tués.
  16.     public static void End(Player p) {
  17.         Main.IsRebooting = true;
  18.         for(Player all : Bukkit.getOnlinePlayers()) {
  19.             Title title = new Title("§6Fin de la partie", "§aGagnant: §8" + p.getName());
  20.             title.send(all);
  21.             all.sendMessage(Main.prefix + "§cRedémarrage du serveur dans 10 secondes");
  22.         }      
  23.        
  24.         task = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
  25.  
  26.             @Override
  27.             public void run() {
  28.                 for(Player all : Bukkit.getOnlinePlayers()) {
  29.                     all.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 10, 255));
  30.                     all.sendMessage(Main.prefix + "§eMerci d'avoir joué !");
  31.                     all.performCommand("/hub");
  32.                     Bukkit.dispatchCommand(Bukkit.getConsoleSender(), plugin.getConfig().getString("stop-server-command"));
  33.                 }              
  34.             }
  35.            
  36.            
  37.         }, 10*20);
  38.        
  39.        
  40.        
  41.     }
  42.     // Méthode lorsque il n'y a plus de temps, qui ne nécessite donc pas de joueur. ( Fonctionelle )
  43.     public static void Endbytime() {
  44.         Main.IsRebooting = true;
  45.         for(Player all : Bukkit.getOnlinePlayers()) {
  46.             Title title = new Title("§6Fin de la partie", "§8Match nul");
  47.             title.send(all);
  48.             all.sendMessage(Main.prefix + "§cRedémarrage du serveur dans 10 secondes");
  49.         }      
  50.        
  51.         task = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
  52.  
  53.             @Override
  54.             public void run() {
  55.                 for(Player all : Bukkit.getOnlinePlayers()) {
  56.                     all.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 10, 255));
  57.                     all.sendMessage(Main.prefix + "§eMerci d'avoir joué !");
  58.                     all.performCommand("/hub");
  59.                     Bukkit.dispatchCommand(Bukkit.getConsoleSender(), plugin.getConfig().getString("stop-server-command"));
  60.                 }              
  61.             }
  62.            
  63.            
  64.         }, 10*20);
  65.     }
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement