Skip to content

Instantly share code, notes, and snippets.

@BlackBeltPanda
Last active February 3, 2017 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BlackBeltPanda/e67c6f926d473508a865a7985fd4823c to your computer and use it in GitHub Desktop.
Save BlackBeltPanda/e67c6f926d473508a865a7985fd4823c to your computer and use it in GitHub Desktop.
public class Main extends JavaPlugin {
private static Main instance;
public void onEnable(){
instance = this;
}
public void onDisable(){
Manager.miners = null;
}
public static Main getInstance() {
return instance;
}
}
public class Manager {
public static HashMap<Location, String> miners = new HashMap<Location, String>();
public static void registerTool(Block b){
miners.put(b.getLocation(), WorldGuard.getRegionName(b.getLocation()));
}
}
public class Miner {
public Miner() {
new BukkitRunnable() {
public void run() {
Manager.miners.values().removeIf(s -> Collections.frequency(Manager.miners.values(), s) > 10);
Manager.miners.keySet().stream().collect(Collectors.toList()).forEach(l -> run(l));
}
}.runTaskTimer(Main.getInstance(), 60L, 60L);
}
public void run(Location loc) {
//Do stuff
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment