Advertisement
Guest User

UtilBlock

a guest
Nov 29th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. public class UtilBlock {
  2.  
  3.     private Block block;
  4.  
  5.     private long timeInSecs;
  6.     public UtilBlock(Block block, long timeInSecs) {
  7.         this.block = block;
  8.         this.timeInSecs = timeInSecs;
  9.     }
  10.  
  11.     @SuppressWarnings("deprecation")
  12.     public void saveBlockToRestore() {
  13.         final int BeforeId = block.getTypeId();
  14.         final byte BeforeData = block.getData();
  15.    
  16.         Bukkit.getScheduler().runTaskLater(MushroomRegen.scheduler, new Runnable(){
  17.  
  18.             @Override
  19.             public void run() {
  20.  
  21.                 block.setTypeId(BeforeId);
  22.                 block.setData(BeforeData);
  23.  
  24.             }
  25.  
  26.         }, timeInSecs*20);
  27.  
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement