Happy Ghast Protection icon

Happy Ghast Protection -----

Happy Ghasts no longer take damage.



This plugin is really simple. I saw how cute happy ghasts were, so I made a basic plugin that just cancels the entity damage event for happy ghasts.

In this spoiler is the source code for the happy ghast plugin. I tried looking on spigot for a plugin for my smp that would just protect happy ghasts and couldn't find anything, which is why I am uploading this resource.
Code (Java):
public class HappyGhastPlugin extends JavaPlugin implements Listener {
    @Override
    public void onEnable ( ) {
        getLogger ( ). info ( "Enabled happy ghast plugin. Happy ghasts will no longer take damage." ) ;
        getServer ( ). getPluginManager ( ). registerEvents ( this, this ) ;
    }

    @Override
    public void onDisable ( ) {

    }

    @EventHandler
    public void onGhastDamage (EntityDamageEvent event ) {
        Entity entity = event. getEntity ( ) ;
        if (entity instanceof HappyGhast ) {
            ( (HappyGhast ) entity ). setHealth ( 20 ) ;
            event. setCancelled ( true ) ;
        }

    }

    @EventHandler
    public void onGhastDeath (EntityDeathEvent event ) {
        Entity entity = event. getEntity ( ) ;
        if (entity instanceof HappyGhast ) {
            event. setDroppedExp ( 0 ) ;
            entity. setFireTicks ( 0 ) ;
            event. getEntity ( ). setHealth ( 20 ) ;
        }
    }
}
Resource Information
Author:
----------
Total Downloads: 4
First Release: Nov 23, 2025
Last Update: Nov 23, 2025
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings