My plugin won't load in on server

Discussion in 'Plugin Development' started by Northical, Jan 23, 2022.

Thread Status:
Not open for further replies.
  1. Offline

    Northical

    I'm very very new at this, so I apologize for any dumb mistakes I probably have made :)

    I want to set the attribute follow range of spawned entity to 100, and i have created this code so far, it doesn't show any errors, but when I put the plugin in the server plugin folder, it still doesn't load :(

    This is my main class:

    Code:
    package me.Northical.creatureFollowRange;
    
    import org.bukkit.Bukkit;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin{
    
    
        public void onEnable()
        {
            Bukkit.getPluginManager().registerEvents(new SpawnEvent(), this);
            this.getServer().getConsoleSender().sendMessage("[CREATURESPAWN] NORTHCIAL HAS ENABLED THIS!");
        }
    
        public void onDisable()
        {
      
        }
    
    
    }
    
    
    and this is my SpawnEvent class:

    Code:
    package me.Northical.creatureFollowRange;
    
    import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
    import org.bukkit.entity.LivingEntity;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.EventPriority;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.CreatureSpawnEvent;
    
    import net.minecraft.server.v1_8_R3.AttributeInstance;
    import net.minecraft.server.v1_8_R3.EntityInsentient;
    import net.minecraft.server.v1_8_R3.EntityLiving;
    import net.minecraft.server.v1_8_R3.GenericAttributes;
    
    public class SpawnEvent implements Listener{
    
        @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
        public void onCreatureSpawn(CreatureSpawnEvent event) {
      
            LivingEntity entity = event.getEntity();
            AttributeInstance attributes = ((EntityInsentient)((CraftLivingEntity)entity).getHandle()).getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
            attributes.setValue(100);
        }
    }
    
    And this is my plugin.yml file:

    Code:
    main: me.Northical.creatureFollowRange.main
    name: CreatureFollowRange
    version: 1.0
    
    Additional info:
    Plugin.yml is where it's supposed to be.
    Again i'm new, be gentle please :)
    [​IMG]
     
    Last edited: Jan 23, 2022
  2. Offline

    timtower Administrator Administrator Moderator

    @Northical That image isn't working, need to put it on imgur or something first.
     
  3. Offline

    pixelrider2000

    You spelled "Main" with a lower case 'm' in you plugin.yml.
     
  4. Offline

    Northical

    I still can't get it to work, I think I gotta go back to Youtube videos :/
    But thanks for your time :)
     
  5. Offline

    Strahan

    Hopefully you are watching good ones. Many promote bad practices. If the vids don't help: did you fix the plugin.yml per pixelrider's suggestion? If so and it still doesn't work, any errors in console?
     
Thread Status:
Not open for further replies.

Share This Page