Skip to content

Instantly share code, notes, and snippets.

@MrMaurice211
Last active June 29, 2019 08:03
Show Gist options
  • Save MrMaurice211/986f4e333b26622dbafe6452eb4c88c6 to your computer and use it in GitHub Desktop.
Save MrMaurice211/986f4e333b26622dbafe6452eb4c88c6 to your computer and use it in GitHub Desktop.
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