Advertisement
Guest User

AutoBroadcast

a guest
Feb 1st, 2011
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. package org.bukkit.pandemic.AutoBroadcast;
  2.  
  3. import org.bukkit.event.player.PlayerListener;
  4. import org.bukkit.event.player.PlayerMoveEvent;
  5.  
  6. public class ABPlayerListener extends PlayerListener {
  7.    
  8.     public AutoBroadcast plugin;
  9.     public int interval = 0;
  10.     public int seconds = 0;
  11.     public int wait = 0;
  12.    
  13.     public ABPlayerListener(AutoBroadcast _plugin) {
  14.         plugin = _plugin;
  15.     }
  16.    
  17.     public void onPlayerMove(PlayerMoveEvent event) {      
  18.         interval++;
  19.         if (interval == 17) {
  20.             seconds++;
  21.             interval = 0;
  22.         }
  23.         if (interval == 0) {
  24.             for (int i = 0; i < plugin.delays.size(); i++) {
  25.                 if (seconds % plugin.delays.get(i) == 0) {
  26.                     plugin.getServer().broadcastMessage(plugin.broadcasts.get(i));
  27.                     break;
  28.                 }
  29.             }
  30.         }
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement