MonsterLib 1.0

LivingEntity wrapper for event driven instances.

  1. ikygoose
    MonsterLib was made to hold and maintain instances of wrapper classes for changing the behavior of default living entities.

    each sub class of MonsterLib's MonsterWrapper, is serialized on server reload and chunk unload, then de-serialized into the corresponding sub class.

    sub classes of MonsterWrapper have access to numerous entity related event methods to override. There's also an overridable update method run every second.

    Creating event driven behavior of mobs is essentially just passing a living entity to some subclass MonsterWrapper on entity's spawn.

    Code (Text):
    public static MonsterLib monsterLib = getMonsterLib();

    private static MonsterLib getMonsterLib() {
        Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("MonsterLib");
        if(plugin != null && plugin instanceof MonsterLib) {
            return (MonsterLib) plugin;
        }
        return null;
    }
     
    Code (Text):
    import org.bukkit.entity.LivingEntity;
    import org.bukkit.event.player.PlayerInteractEntityEvent;

    public class ExampleMonster extends MonsterWrapper {
        private static final long serialVersionUID = 2695211705804867688L;
        public ExampleMonster(LivingEntity livingEntity) {
            super(livingEntity);
        }
        @Override
        public void onPlayerInteract(PlayerInteractEntityEvent event) {
            event.getPlayer().sendMessage("Event fired.");
        }
    }
     

Recent Reviews

  1. SIndybad
    SIndybad
    5/5,
    Version: 1.0
    Cool!