Solved Problem with a plugin that uses the Massivecore Factions api

Discussion in 'Spigot Plugin Development' started by writkas, Jun 1, 2017.

  1. I am trying to make a plugin for factions and I have the following error:

    Code (Text):
    [01:08:40 WARN]: [[FactionFly]] Task #33 for FactionFly v1.0-SNAPSHOT generated an exception
    java.lang.NoClassDefFoundError: com/massivecraft/factions/entity/MPlayer
            at org.nightmarenetwork.factionfly.PlayerTerritory.isInOwnTerritory( ~[?:?]
            at ~[?:?]
            at ~[spigot-1.11.2.jar:git-Spigot-3fb9445-6e3cec8]
            at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftScheduler.mainThreadHeartbeat( [spigot-1.11.2.jar:git-Spigot-3fb9445-6e3cec8]
            at net.minecraft.server.v1_11_R1.MinecraftServer.D( [spigot-1.11.2.jar:git-Spigot-3fb9445-6e3cec8]
            at net.minecraft.server.v1_11_R1.DedicatedServer.D( [spigot-1.11.2.jar:git-Spigot-3fb9445-6e3cec8]
            at net.minecraft.server.v1_11_R1.MinecraftServer.C( [spigot-1.11.2.jar:git-Spigot-3fb9445-6e3cec8]
            at [spigot-1.11.2.jar:git-Spigot-3fb9445-6e3cec8]
            at [?:1.8.0_131]
    Caused by: java.lang.ClassNotFoundException: com.massivecraft.factions.entity.MPlayer
            at ~[?:1.8.0_131]
            at ~[spigot-1.11.2.jar:git-Spigot-3fb9445-6e3cec8]
            at ~[spigot-1.11.2.jar:git-Spigot-3fb9445-6e3cec8]
            at java.lang.ClassLoader.loadClass( ~[?:1.8.0_131]
            at java.lang.ClassLoader.loadClass( ~[?:1.8.0_131]
            ... 9 more
    Player territory class:

    Code (Text):
    package org.nightmarenetwork.factionfly;

    import com.massivecraft.factions.entity.BoardColl;
    import com.massivecraft.factions.entity.Faction;
    import com.massivecraft.factions.entity.MPlayer;
    import com.massivecraft.massivecore.util.IdUtil;
    import org.bukkit.Location;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.Plugin;

    import java.util.ArrayList;
    import java.util.List;

    * Created by matias on 31-05-17.
    public class PlayerTerritory {
        private Player player;
        private Plugin plugin;

        private List<String> worlds;

        public PlayerTerritory (Plugin plugin, Player player) {
            this.player = player;
            this.plugin = plugin;

            this.worlds = new ArrayList<>();
            worlds = this.plugin.getConfig().getStringList("worlds");

        public boolean isInOwnTerritory() {
            boolean isAPermittedWold = checkWold();

            if (isAPermittedWold) {
                MPlayer mplayer = MPlayer.get(player);
                Faction faction;

                Location location = player.getLocation();
                faction = BoardColl.get().getFactionAt(PS.valueOf(location));

                if (faction.getName().equals(mplayer.getFactionName())) {
                    return true;

            return false;

        public boolean checkWold() {
            String playerWorld = player.getWorld().getName();

            for (String world : worlds) {
                if (playerWorld.equalsIgnoreCase(world)) return true;

            return false;
    The error is in:
    MPlayer mplayer = MPlayer.get(player);

    I do not know what I'm doing wrong.

  2. Are you using the correct version of massive core on the server? Server is saying MPlayer class doesn't exist. Might have been removed, renamed, move to another package, or your jar is too old.
  3. I guess MPlayer isn't found, try to do a null check.
  4. Also to add on to that, make sure it's depending on Massive core in the plugin.yml
  5. This is my plugin.yml

    Code (Text):
    name: FactionFly
    version: ${project.version}
    main: org.nightmarenetwork.factionfly.FactionFly
    prefix: [FactionFly]
    depend: [Factions, MassiveCore]
    authors: [MatiasME]
    description: Faction Fly Plugin
    and i am using this jar:

    that is bad?

    i need download from github?
  6. Update your jar and make sure maven filters the src/main/resources folder

  7. This is my pom.xml


    is bad?

    how i can add the massivecore and factions ?

    sorry i am new in plugins :(
  8. OK you need to look for a massivecore maven library/repo. Add them. Make sure <scope> is provided
  9. Thanks.

    But I read that they did not provide a maven repository ... They only provide the jar.
  10. Is fixed :D

    I am using gradle and add the dependency this way:

    Code (Text):
    dependencies {
        testCompile group: 'junit', name: 'junit', version: '4.12'
        compile 'org.spigotmc:spigot-api:1.11.2-R0.1-SNAPSHOT'
        compile files ('libs/MassiveCore.jar')
        compile files ('libs/Factions.jar')
    Also add local libraries in the proyect.