Minecraft Blogs / Tutorial

Bukkit plugin tutorial part 2

  • 279 views, 1 today
  • 1
  • 0
  • 2
Raymart23's Avatar Raymart23
Level 9 : Apprentice Miner
5
Making a Commands
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("test")) { // If the player typed /test then do the following...
// doSomething like this
sender.sendMessage(ChatColor.GREEN + "Plugin successfully worked");
return true;
} //If this has happened the function will return true.
// If this hasn't happened the value of false will be returned.
return false;
}


return true; == it process is already finish and don't do the codes below because the process is already finished
return false; == if you have a usage: at the config and you need to use the code if (args.length == 0) {
//return false;
then it will sends you the usage at the plugin.yml


Making a Plugin.yml
name:
name of the plugin
author:
the creator
version:
the version must be a decimal like this : 1.0
commands:
give 3 spaces
   test:
//this is the command
       another 3 spaces
      description:
hello this is a description
Tags

Create an account or sign in to comment.

Raymart23
06/22/2015 6:40 am
Level 9 : Apprentice Miner
Raymart23's Avatar
request part 3 just ask me
1
Raymart23
06/22/2015 6:28 am
Level 9 : Apprentice Miner
Raymart23's Avatar
ask me a question if you don't understand
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome