SHARE
TWEET

Untitled

a guest Mar 26th, 2020 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class ShearSheepTaskType<T extends User<T>> extends ATaskType<T> {
  2.  
  3.     @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
  4.     private void onShear(PlayerShearEntityEvent event) {
  5.         T user = getManager().getUserManager().getUser(event.getPlayer());
  6.         if (user == null)
  7.             return;
  8.         List<Task<T>> tasks = user.getActiveTasks(this);
  9.         if (tasks == null || tasks.isEmpty())
  10.             return;
  11.         if (tasks == null || tasks.isEmpty())
  12.             return;
  13.         for (int i = 0; i < tasks.size(); i++) {
  14.             ShearSheepTask task = (ShearSheepTask) tasks.get(i);
  15.             if (task.isWorldAllowed(event.getPlayer().getWorld())
  16.  
  17.                 //HERE
  18.                 && task.entityData.isValidEntity(event.getEntity())) {
  19.  
  20.  
  21.                 if (task.onProgress(user, 1, event.getPlayer(), false) > 0 && task.dropsData.removeItemDrops()
  22.                         && event.getEntity() instanceof Sheep) {
  23.                     ((Sheep) event.getEntity()).setSheared(true);
  24.                     event.setCancelled(true);
  25.                     // TODO break/damage shears
  26.                 }
  27.             }
  28.         }
  29.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top