Last active
February 3, 2017 04:29
-
-
Save BlackBeltPanda/e67c6f926d473508a865a7985fd4823c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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