Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.mittelego.lernen.commands;
- import org.bukkit.Bukkit;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import de.mittelego.lernen.main.Main;
- public class CountdownCommand implements CommandExecutor{
- private int taskID;
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if(sender instanceof Player) {
- taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getPlugin(null), new Runnable() {
- int cd = 10;
- @Override
- public void run() {
- if(cd <= 0) {
- Bukkit.broadcastMessage("§c§lDER KRIEG HAT BEGONNEN!");
- Bukkit.getScheduler().cancelTask(taskID);
- return;
- }
- Bukkit.broadcastMessage("§c§oDer Krieg bricht in §6" + cd + " Sekunden§c§o.");
- cd--;
- }
- }, 20, 20);
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment