Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

bukkit scheduler self cancelling task

new BukkitRunnable() {
	int timer = 10;

	@Override
	public void run() {
		if (timer == 0) cancel();
        else Bukkit.broadcastMessage("Starting in: " + timer--);
	}

	@Override // this code can be in run(), its here as a possibility
	public synchronized void cancel() throws IllegalStateException {
        Bukkit.broadcastMessage("Action!");
		super.cancel();
	}
}.runTaskTimer(Main.main(), 0L, 20L); // repeat every second
Comment

PREVIOUS NEXT
Code Example
Java :: Java object of the file 
Java :: java map get value 
Java :: spring component 
Java :: java :: operator 
Java :: binary search tree 
Java :: java package 
Java :: java 8 seconds to days 
Java :: java importing 
Java :: java break statement 
Java :: Jlabel icon 
Java :: java join list 
Java :: final class java 
Java :: alert dialog not displayed android 
Java :: Java Filters 
Java :: create thread 
Java :: explain java coding standards for classes 
Java :: how to find a string in a sentence in java 
Java :: multiple root tags android manifest 
Java :: iptc classification java code example 
Java :: Fab to CircularRevealFrameLayout example 
Sql :: count of tables in database mysql 
Sql :: alter user mysql native password 
Sql :: freemysqlhosting keeps deleting tables 
Sql :: oracle get current schema 
Sql :: mariadb select multiple rows into one column 
Sql :: install mysql ubuntu 18.04 
Sql :: mysql add boolean column 
Sql :: oracle list packages 
Sql :: oracle search stored procedures for text 
Sql :: drush sql-dump 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =