I use 1.7.2 version.
launching eclipse and make new JavaProject
make pakage and class
add your bukkit-craftbukkit.jar to buildpath
write extends JavaPlugin next your class name.
last make 2 methods name onEnable and onDisable
like this
and then make boolean type method named onCommand
public boolean onCommand(CommandSender sender, Command command , String Label, String[] args)
{
if(Label.equalsIgnoreCase("a")) {
Player player = (Player) sender;
player.sendMessage("I am genius");
}
return true;
}
full code :
package hy.main;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class main extends JavaPlugin{
public void onEnable() {
}
public void onDisable() {
}
public boolean onCommand(CommandSender sender, Command command , String Label, String[] args)
{
if(Label.equalsIgnoreCase("a")) {
Player player = (Player) sender;
player.sendMessage("I am genius");
}
return true;
}
}
left side your project name - new - file
file name = plugin.yml
write
name : your project name
main : pakage name.class name
version : 1.0
commands :
a:
save and Export to jar file
and put it to your bukkit-plugins forder and launching server
if you use command "/a" then server send Message to you "I am genius"
댓글 없음:
댓글 쓰기