my Plugin isnt working

Discussion in 'Plugin Development' started by Coffox, Apr 7, 2011.

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

    Coffox

    Hey

    i'm working on my first plugin for bukkit. it will just let leaves drop cocobeans, like saplings.

    but when i start the server, an exception occurs, so i decided to reduce the code, so the plugin does absolutely nothing.

    heres the code:
    Code:
    package com.bukkit.coffox.cocoBeans;
    
    // I missed out all the imports
    
    public class cocoBeans extends JavaPlugin {
    
        public cocoBeans(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader)  {
    
        }
    
     
        public void onEnable() {
            System.out.println( "cocoBeans enabled !" );
        }
    
        public void onDisable() {
            System.out.println("cocoBeans disabled !");
        }
    
    }
    My craftBukkit version is #612 and I'm using this Bukkit version.

    another question: how do I get the material for coco beans? Material.INK_SACK just returns my the material for ink sacks

    hope you could understand me ^^

    thanks for help
     
  2. Offline

    ssell

    @Coffox

    First off, don't use a constructor. Not positive, but that may be causing the crash. Not positive because I never used one and so don't have first-hand experience with the problem using a constructor makes. I just know that you should not use one.

    Second, you are on the right path for the Cocoa Beans. All dyes originate from the same object (INK_SACK), you just have to set their data values.

    http://www.minecraftwiki.net/wiki/Data_values#Dyes

    For example, to get Cocoa Beans:

    Code:
    yourInkSack.setData( 0x3 );
    
    edit: Also, I suggest to always use the latest RB for the CraftBukkit (as of now, it is 617).
     
  3. Offline

    Coffox

    still doesnt work
     
  4. Offline

    ssell

  5. Offline

    Coffox

    ah I think I got it.

    I had the <plugin>.class file in the wrong directory

    now the plugin is working but there is a bug:
    ink sacks are dropping instead of cocos beans and these ink sacks seem to stack but without a number next to the icon.

    Code:
        public void onLeavesDecay(LeavesDecayEvent event) {
            MaterialData bean = new MaterialData( Material.INK_SACK , (byte) 0x3 ) ;
    
            event.getBlock().getChunk().getWorld().dropItem( event.getBlock().getLocation() , bean.toItemStack() ) ;
        }
    I tried this to get cocoa beans
     
Thread Status:
Not open for further replies.

Share This Page