Guest User

Untitled

a guest
May 20th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. public boolean addPotionEffect(PotionEffect effect) {
  2. return addPotionEffect(effect, false);
  3. }
  4.  
  5. public boolean addPotionEffect(PotionEffect effect, boolean force) {
  6. if(hasPotionEffect(effect.getType())) {
  7. if(force) {
  8. removePotionEffect(effect.getType());
  9. } else {
  10. return false;
  11. }
  12. }
  13. getHandle().addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier()));
  14. return true;
  15. }
  16.  
  17. public void removePotionEffect(PotionType type) {
  18. getHandle().effects.remove(type.getId());
  19. }
  20.  
  21. public boolean hasPotionEffect(PotionType type) {
  22. return getHandle().hasEffect(CraftPotionType.handleFromType(type));
  23. }
Add Comment
Please, Sign In to add comment