daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import de.toxicgaming.skypvp.Skypvp;
  2. import org.bukkit.Bukkit;
  3. import org.bukkit.World;
  4. import org.bukkit.entity.*;
  5. import org.bukkit.scheduler.BukkitRunnable;
  6.  
  7. public class ClearlagManager {
  8.     double clearlag = 300;
  9.     public void startClearlag() {
  10.         new BukkitRunnable() {
  11.             @Override
  12.             public void run() {
  13.                 double minuten = clearlag / 60;
  14.                 if(minuten == 4 || minuten == 3 || minuten == 2 || minuten == 1) {
  15.                     sendMessage(Skypvp.getPrefix()+"§eAlle Items werden in §7"+minuten+" Minuten §eentfernt!");
  16.                 }
  17.                 if(clearlag == 45 || clearlag == 30 || clearlag == 10 || clearlag == 5 || clearlag == 3 || clearlag == 2 || clearlag == 1) {
  18.                     sendMessage(clearlag >= 2 ? Skypvp.getPrefix()+"§eAlle Items werden in §7"+clearlag+" Sekunden §e entfernt!" : Skypvp.getPrefix()+"§eAlle Items werden in §7"+clearlag+" Sekunde §eentfernt!");
  19.                 }
  20.                 if(clearlag == 0) {
  21.                     clearlag = 300;
  22.                     int removed = 0;
  23.                     for(World world : Bukkit.getWorlds()) {
  24.                         for(Entity e : world.getEntities()) {
  25.                             if(e instanceof Item || e instanceof Arrow) {
  26.                                 e.remove();
  27.                                 removed++;
  28.                             }
  29.                         }
  30.                     }
  31.                     sendMessage(removed == 1 ? Skypvp.getPrefix()+"§eEs wurde §7"+removed+"§e Item entfernt!" : Skypvp.getPrefix()+"§eEs wurden §7"+removed+" Items §eentfernt!");
  32.                 }
  33.                 clearlag--;
  34.             }
  35.         }.runTaskTimer(Skypvp.getInstance(), 0, 20);
  36.     }
  37.     void sendMessage(String message) {
  38.         for(Player all : Bukkit.getOnlinePlayers()) {
  39.             all.sendMessage(message);
  40.         }
  41.     }
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top