Guest User

Untitled

a guest
Jul 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. int id = -1;
  2. Plugin plugin;
  3.  
  4. public void theMethodThatMovesSomeone(final Player player, final Location location){
  5. id = plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
  6. public void run(){
  7. player.teleport(location);
  8. }
  9. }, 5*20);
  10. if(id==-1){
  11. // error
  12. }
  13. }
  14.  
  15. public void cancel(){
  16. if(id!=-1) plugin.getServer().getScheduler().cancelTask(id);
  17. }
Add Comment
Please, Sign In to add comment