New to plugin development, need some help

Discussion in 'Plugin Development' started by paully104, Jun 7, 2013.

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

    paully104

    So i just started my college level java course and things are pretty simple but i'm wanting to use my knowledge towards some plugin development. I have some pretty nooby questions but if someone can help me out when i get stuck i would highly appreciate it.

    So today in class we did this
    Code:
    /*
    First Program
    */
     
    //prompts the user to enter 2 int values
    // then performs different arithmetic operations on these
    // numbers and show the result
    import javax.swing.*;
    import java.text.*;
     
    public class ArithOper
    {
        //Public static void main is how the program initiates
        //Static means that the entire blueprint has that modifier, static can be used by the name of the class
        //Void is a return type, it means it is not returning anything
        //main is the name of the method as it implies it is the main method
     
        public static void main( String[] args )
        {
            /*System.out.println("Welcome to Java Programming!");
            System.out.printf("Hello World\n");
            System.out.print("Hello World Again");
            */
            int val1, val2;
            int sum, diff, product,mod;
            double quotient;
            String val1Str,val2Str;
            DecimalFormat myFormat = new  DecimalFormat ("0.00"); //made a format so the quotient isn't a huge decimal [1]
         
            //prompt the user for the int values
            val1Str = JOptionPane.showInputDialog("Please enter an integer value" );
            val2Str = JOptionPane.showInputDialog("Please enter an integer value" );
            //converts the string values into int types
            val1 = Integer.parseInt( val1Str );
            val2 = Integer.parseInt( val2Str );
         
            //perform the different arithmetic operations
            sum = val1 + val2;
            diff = val1 - val2;
            product = val1 * val2;
            quotient = (double)val1 / val2; //typecasting for this operation val1 is a double in this equation
            mod = val1 % val2;
            String message = " ";
         
            message = message + "val1 =" + val1 + " val2 = " + val2;
            message = message + "\n" + "sum =" + sum;
            message = message + "\n" + "diff = " + diff;
            message = message + "\n" + "product = " + product;
            message = message + "\n" + "quotient = " + myFormat.format(quotient); //[1]
            message = message + "\n" + "mod =" + mod;
         
            JOptionPane.showMessageDialog( null, message );
         
         
     
     
     
         
         
         
            JOptionPane.showMessageDialog( null, "Welcome to Java Programming!");
         
         
         
            System.exit( 0 ); //exits the program
     
        } //end of main
    }//end of class Welcome
        
    So i thought to myself lets do something simple lets make a plugin that simple makes boats able to drive on land. So here is what i got and i'll point out the issue im currently stuck on
    Code:
    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */
    package boatcar;
     
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.entity.*;
    import org.bukkit.plugin.PluginManager;
    /**
    *
    * @author Paul
    */
    public class BoatCar extends JavaPlugin
    {
        public void onEnable()
        {
          org.bukkit.entity.Vehicle.Boat?
        }
     
        public void onDisable()
        {
         
        }
     
     
    }
     
     
    
    See where i did the .org.bukkit.vehicle.boat? , i guess i haven't learned how to call upon a sub class yet. Is this even a good way to approach it? Im attempting to try .org.bukkit.vehicle.boat because in that first program we use the java docs api and it was just a simple JOptionPane.showMessageDialog , however this seems a little bit more complicated ^^!

    Webpage api for the boat is here: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/entity/Boat.html
     
  2. Offline

    ZeusAllMighty11

    I think that as your classes go on, you will understand that it doesn't really make sense what you're doing for the plugin.


    In some cases, there may be more than one import or reference to a Boat class, which causes one of them to be forced to take the path name 'org.bukkit.entity.Vehicle.Boat'. Both references have to have different names.
     
Thread Status:
Not open for further replies.

Share This Page