Create your first BungeeCord plugin (Proxy) - Historical

Applied By SuchHero: Apr 11, 2016 at 8:21 PM

Create your first BungeeCord plugin (Proxy)
[1] First Create a test project, name can be anything you want, but for our project the name is going to be "TestProject"!

[2] Let's begin!

[3] Make sure you have BungeeCord in your IDE's build path! (Eclipse, IntelliJ, NetBeans, etc)

First you want to start off with the basics!

Code (Text):

/*
* This is going to be your first project, Note: "TestProject" is just a name --- your project name can be * anything
*/
package me.gabe.plugin;

import net.md_5.bungee.api.plugin.Plugin;j j hj hjhj [BungEee

public class TestProject extends Plugin {

}

 
[3] Now we're going to move onto the onEnable!

Code (Text):

package me.gabe.plugin;

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin;

public class TestProject extends Plugin {

    @Override
    public void onEnable() {
        ProxyServer.getInstance().getPluginManager().registerCommand(this, new Hi(this));
        /*
        * Create the class "Hi"
        */

    }
}
 
[4] Working on the class "Hi" now, the command.

Code (Text):

package me.gabe.plugin;

import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;


class Hi extends Command {


    public Hi(TestProject This) {
        super("command", "permission");
    }

    public void execute(CommandSender sender, String[] args) {
        if ((sender instanceof ProxiedPlayer)) {
          ProxiedPlayer p = (ProxiedPlayer)sender;
          if (p.hasPermission("testproject.hi"))


              p.sendMessage(ChatColor.GOLD + "Created your project! :)");
              }
          }
    }
   
[5] You're done!
[6] Congrats! You made your first project! :)