Dev AddOn: Difference between revisions

From MBedwars
Jump to navigation Jump to search
(Created page with "Creating yourself a MBedwars Add-On isn't that hard as you thing.<br /> But first of all make sure that your plugin.yml is depending MBedwars: depend: [MBedwars] Simply exten...")
 
No edit summary
Line 1: Line 1:
Creating yourself a MBedwars Add-On isn't that hard as you thing.<br />
Creating yourself a MBedwars Add-On isn't that hard as you thing.<br />
But first of all make sure that your plugin.yml is depending MBedwars:
But first of all make sure that your plugin.yml is depending MBedwars.<br />
Example:
name: MyFirstMBedwarsAddon
version: 1.0
main: com.me.MyFirstMBedwarsAddon.Main
  depend: [MBedwars]
  depend: [MBedwars]
Simply extend de.marcely.bedwars.api in your main class.<br />
After that is done create a new de.marcely.bedwars.api.BedwarsAddon object.<br />
Example of a Main class:
package com.me.MyFirstMBedwarsAddon.Main;
import org.bukkit.plugin.java.JavaPlugin;
import de.marcely.bedwars.api.BedwarsAddon;
public class Main extends JavaPlugin {
    public BedwarsAddon bedwarsAddon = new BedwarsAddon(this);
}
You can skip the creating of this object if you don't want to create commands.<br />
Here is an example of creating a command:
bedwarsAddon.registerCommand(new BedwarsAddonCommand("testcommand", "<arg1> [arg2] [arg3]"){
    public void onWrite(String[] args){
      // do something
    }
});
That's it!

Revision as of 17:00, 8 November 2016

Creating yourself a MBedwars Add-On isn't that hard as you thing.
But first of all make sure that your plugin.yml is depending MBedwars.
Example:

name: MyFirstMBedwarsAddon
version: 1.0
main: com.me.MyFirstMBedwarsAddon.Main
depend: [MBedwars]

After that is done create a new de.marcely.bedwars.api.BedwarsAddon object.
Example of a Main class:

package com.me.MyFirstMBedwarsAddon.Main;

import org.bukkit.plugin.java.JavaPlugin;
import de.marcely.bedwars.api.BedwarsAddon;

public class Main extends JavaPlugin {
   public BedwarsAddon bedwarsAddon = new BedwarsAddon(this);
}

You can skip the creating of this object if you don't want to create commands.
Here is an example of creating a command:

bedwarsAddon.registerCommand(new BedwarsAddonCommand("testcommand", "<arg1> [arg2] [arg3]"){
   public void onWrite(String[] args){
      // do something
   }
});

That's it!