org.bukkit.event.entity.SlimeSplitEvent Java Examples

The following examples show how to use org.bukkit.event.entity.SlimeSplitEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SlimeEvent.java    From StackMob-3 with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onSlimeEvent(SlimeSplitEvent e) {
    if(StackTools.hasSizeMoreThanOne(e.getEntity())){
        int stackSize = StackTools.getSize(e.getEntity()) - 1;
        int randomAmount = ThreadLocalRandom.current().nextInt(2,4);
        e.setCount(e.getCount() + (stackSize * randomAmount));
    }
}
 
Example #2
Source File: EntityEventHandler.java    From GriefDefender with MIT License 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onSlimeSplitEvent(SlimeSplitEvent event) {
    handleEntitySpawn(event, event.getEntity(), event.getEntity());
}
 
Example #3
Source File: OwnedMobTracker.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSlimeSplit(SlimeSplitEvent event) {
  if (event.getCount() > 0 && resolveEntity(event.getEntity()) != null) {
    splitter = new WeakReference<>(event.getEntity());
  }
}
 
Example #4
Source File: OwnedMobTracker.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSlimeSplit(SlimeSplitEvent event) {
    if(event.getCount() > 0 && resolveEntity(event.getEntity()) != null) {
        splitter = new WeakReference<>(event.getEntity());
    }
}