Last active
June 29, 2019 08:03
-
-
Save MrMaurice211/986f4e333b26622dbafe6452eb4c88c6 to your computer and use it in GitHub Desktop.
This file contains 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 ShowTask extends BukkitRunnable { | |
private ConfigurationSection config; | |
private String lastTick; | |
private int tick = 0; | |
public ShowTask(String path, int startingTick) { | |
tick = startingTick; | |
config = SoarinCore.getMain().getConfigModule().getConfig(path).getData(); | |
Set<String> keys = config.getKeys(false); | |
lastTick = Lists.newArrayList(keys).get(keys.size() - 1); | |
} | |
public void run() { | |
String path = "" + tick; | |
if (config.contains(path)) { | |
config.getStringList(path).forEach(s -> Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), s)); | |
if (path.equals(lastTick)) { | |
this.cancel(); | |
return; | |
} | |
} | |
tick = tick + 1; | |
} | |
public void modifyTick(int amount) { | |
this.tick += amount; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment