Could someone assist me with a problem?

Discussion in 'Plugin Development' started by RightLegRed, Jan 14, 2011.

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

    Archelaus

    I'm currently trying to get into Mod programming. I understand programming basics, but build paths and external jar files are new to me. Is my file structure right? It's this:

    Code:
    Civilizations
    >src
    >>bukkit.RightLegRed.Civilizations
    >>>Civilizations.java
    >>>CivilizationsBlockListener.java
    >>>CivilizationsPlayerListener.java
    >>plugin.yml
    >JRE system library
    >Referenced Libraries
    >>bukkit-0.0.1-SNAPSHOT.jar
     
  2. Offline

    JMEYER

    You shouldn't need bukkit-0.0.1-SNAPSHOT.jar since you're including the "bukkit" project, itself. Everything else checks out.

    Are you asking this question because you can't get your plugin to compile, or were you concerned about your organization? If it runs as is right now, all power to ya.
     
  3. Offline

    Archelaus

    Compiling. I also get errors such as:

    Code:
    The declared package "" does not match the expected package "bukkit.RightLegRed.Civilizations"    Civilizations.java    /Civilization/src/bukkit/RightLegRed/Civilizations    line 1    Java Problem
    Line 1 =
    Code:
    import java.io.File;
    The problem only seems to exist with the import java.io.File;

    Could someone please help?

    Scratch that. It happens with the first import of every file. Here's two example out of the three

    Code:
    package bukkit.RightLegRed.Civilizations;
    
    
    import org.bukkit.Block;
    import org.bukkit.BlockFace;
    import org.bukkit.Material;
    import org.bukkit.event.block.BlockCanBuildEvent;
    import org.bukkit.event.block.BlockListener;
    import org.bukkit.event.block.BlockPhysicsEvent;
    
    /**
     * Civilizations block listener
     * @author RightLegRed
     */
    public class CivilizationsBlockListener extends BlockListener {
        private final Civilizations plugin;
    
        public CivilizationsBlockListener(final Civilizations plugin) {
            this.plugin = plugin;
        }
    
        //put all Block related code here
    }
    

    -------

    Code:
    package bukkit.RightLegRed.Civilizations;
    
    import org.bukkit.Location;
    import org.bukkit.Player;
    import org.bukkit.event.player.PlayerChatEvent;
    import org.bukkit.event.player.PlayerEvent;
    import org.bukkit.event.player.PlayerListener;
    import org.bukkit.event.player.PlayerMoveEvent;
    
    /**
     * Handle events for all Player related events
     * @author <yourname>
     */
    public class CivilizationsPlayerListener extends PlayerListener {
        private final Civilizations plugin;
    
        public CivilizationsPlayerListener(Civilizations instance) {
            plugin = instance;
        }
    
        //Insert Player related code here
    }
    
    
    --------------------

    The errors I get for each is the same:

    Code:
    
    The declared package "" does not match the expected package "bukkit.RightLegRed.Civilizations"
    
    How do I fix this?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jan 8, 2016
  4. Offline

    MarkusNemesis

    because the package is to be declared as follows "com.yourname.bukkit.yourplugin"
     
Thread Status:
Not open for further replies.

Share This Page