how to make spigot plugins code example

Example 1: spigot plugin.yml

main: PATHTOMAINCLASS.MAINCLASS
# Name can not contain spaces!
name: YourPluginName
# plugin version
version: '1.0.0'
description: What your plugin does
# for api version make sure its your minecraft version without patches eg: 1.15, 1.14 etc
api-version: 1.16
author: YOURNAME
prefix: YourPluginName
website: YourPluginWebsite
depend: [PluginsYouDependOn]
softdepend: [PluginsYouUseButDon'tNeed]
loadbefore: [PluginsToLoadBefore]
permissions:
 PLUGINNAME.testpermission:
  description: Everyone gets this permission by default
  default: true
 PLUGINNAME.testpermission2:
  description: No one gets this permission by default
  default: false
 PLUGINNAME.testpermission3:
  description: Operators get this permission by default
  default: op
commands:
 commandname:
  description: Your commands description that is show in /help
  aliases:
  -alternatecommandname
  -alternatecommandname2
  permission: PLUGINNAME.permissionYouMadeEarlier
  usage: /<command> [args]

Example 2: how to make a plugin load after another spigot

//In Plugin.YML

depend: [OnePlugin, AnotherPlugin]

Example 3: how to code a minecraft plugin

public class Main extends JavaPlugin {

	@Override
    public static void onEnable() {
    	getLogger.info("Plugin Enabled");
    }
  
  	@Override
  	public static void onDisable() {
     	getLogger.info("Plugin Disabled");
    }

}

Tags:

Java Example