/src/me/desmin88/mobdisguise/disguises/GhastHandler.java

https://gitlab.com/N3X15/MobDisguise · Java · 37 lines · 30 code · 7 blank · 0 comment · 3 complexity · ca4c8af0137d33896aee13df16abab91 MD5 · raw file

  1. package me.desmin88.mobdisguise.disguises;
  2. import java.util.logging.Logger;
  3. import me.desmin88.mobdisguise.MobDisguise;
  4. import me.desmin88.mobdisguise.utils.MobIdEnum;
  5. import org.bukkit.entity.Fireball;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.util.Vector;
  8. public class GhastHandler extends DisguiseHandler {
  9. public GhastHandler(final Player pl, final MobDisguise p) {
  10. super(pl, p, MobIdEnum.GHAST.id);
  11. Logger.getLogger("Minecraft").info(pl.getName() + " has been disguised as a ghast.");
  12. }
  13. @Override
  14. public boolean handleEffectCommand(final String cmd, final String[] arg) {
  15. if (cmd.equalsIgnoreCase("fireball")) {
  16. if (datawatcher == null) {
  17. player.sendMessage("Sorry, it appears that the datawatcher we need is null.");
  18. return true;
  19. }
  20. greatBallsOfFire();
  21. return true;
  22. }
  23. player.sendMessage(MobDisguise.pref + "/md e fireball");
  24. return false;
  25. }
  26. private void greatBallsOfFire() {
  27. final Vector direction = player.getEyeLocation().getDirection().multiply(2);
  28. player.getWorld().spawn(getPlayer().getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), Fireball.class);
  29. }
  30. }