Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int id = -1;
- Plugin plugin;
- public void theMethodThatMovesSomeone(final Player player, final Location location){
- id = plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- player.teleport(location);
- }
- }, 5*20);
- if(id==-1){
- // error
- }
- }
- public void cancel(){
- if(id!=-1) plugin.getServer().getScheduler().cancelTask(id);
- }
Add Comment
Please, Sign In to add comment