com.bukkit.... Question

Discussion in 'Plugin Development' started by ElConquistador, Feb 8, 2011.

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

    ElConquistador

    OUTDATED - NEW QUESTION SEE LAST POST!!!

    Hello,

    I'm making a plugin. I got a part, but that's still for Hey0, so I want to make it for Bukkit.
    And I don't really get the hole com.bukkit.... part.
    Is this needed? And if it is needed, how it works?
    Is it just com.bukkit."name"."plugin name"?

    And I want to know if a debugees list is needed, and can somebody tell me what it is.

    Please tell me how it works,
    ElConquistador
     
  2. Offline

    retsrif

    This should be the name of your package. If you were making a plugin called "Keyboard" for example, it would go like so:
    com.bukkit.elconquistador.Keyboard
     
  3. Offline

    Dinnerbone Bukkit Team Member

    Package names are how you keep code separated. They can be whatever you like, but the general convention is something like:

    com.yourname.pluginname
     
  4. Offline

    Byteflux

  5. Offline

    feverdream

    In a week any plugin using com.bukkit will no longer load, so use a different namespace.
     
  6. Offline

    ElConquistador

    I got an other question now:

    I made some events: onPlayerJoin(PlayerEvent e), onPlayerQuit(PlayerEvent e) and onPlayerCommand(PlayerChatEvent e), but if I log in on my test server with the plugin then it says: (Plugin name: MConomy)
    "Could not pass event PLAYER_JOIN to MConomy"

    Here is a screenshot:
    [​IMG]
     
  7. Offline

    Plague

    You have a bug somewhere in the code, hence the NullPointerException, this is not connected to naming scheme.
     
  8. Offline

    ElConquistador

    Here is my code:

    Click here.

    Hopefully somebody finds a bug.
     
  9. Offline

    Plague

    I'm not really a java expert, but you try to access an array member that is not there. You'd have to allocate the array in C, but I think this is the same in java.

    Anyway you can add try {} catch {} block in the onPlayerJoin() and the exception has a text field telling you what is wrong.
     
  10. Offline

    ElConquistador

    I tried what you said but it isn't working yet.
    Can somebody maybe give the code or place it in my code?

    ElConquistador
     
  11. Offline

    Edward Hand

    Code:
        public void onPlayerJoin (PlayerEvent event) {
            plugin.players[event.getPlayer().getEntityId()] = event.getPlayer();
            plugin.persons[event.getPlayer().getEntityId()] = plugin.loader.loadPerson(event.getPlayer().getDisplayName());
        }
    
    This is your problem. You're trying to add data to an array that, as far as I can tell, isn't even initialized. Besides which, entity ID's are not a great thing to use for array indexes. Player entity ID's are usually large and are wide apart so would need a huge array most of which would be empty.

    You will need to rewrite a lot of your code. You need to change the arrays 'players' and 'persons' either to ArrayLists or to HashMaps. Array lists are slightly easier to work with if you've not familiar with these things. If you need help with them you're welcome to message me.
     
Thread Status:
Not open for further replies.

Share This Page