39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
package ru.bitheaven.donpayintegplug;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
import org.bukkit.scheduler.BukkitScheduler;
|
|
import ru.bitheaven.donpayintegplug.config.ConfigHandler;
|
|
|
|
import java.util.List;
|
|
import java.util.ArrayList;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
public final class DonPayIntegPlug extends JavaPlugin {
|
|
public static List<String> commands = new ArrayList<>();
|
|
|
|
@Override
|
|
public void onEnable() {
|
|
ConfigHandler.register(this.getLogger(), this.getDataFolder().toString());
|
|
|
|
BukkitScheduler scheduler = this.getServer().getScheduler();
|
|
|
|
AtomicReference<DonateThread> thread = new AtomicReference<>();
|
|
scheduler.runTaskTimer(this, () -> {
|
|
thread.set(new DonateThread(this.getLogger()));
|
|
thread.get().start();
|
|
}, 1, 20 * ConfigHandler.load().getReqCooldown());
|
|
scheduler.runTaskTimer(this, () -> {
|
|
if (!commands.isEmpty()) {
|
|
this.getServer().dispatchCommand(Bukkit.getConsoleSender(), commands.getFirst());
|
|
commands.removeFirst();
|
|
}
|
|
}, 1, 20 * 2);
|
|
}
|
|
|
|
@Override
|
|
public void onDisable() {
|
|
// Plugin shutdown logic
|
|
}
|
|
}
|