Discussion in 'Plugin Development' started by Fosmothegreat, Aug 19, 2011.

Thread Status:
Not open for further replies.
  1. Offline


    I'm new with developing of Bukkit-Plugins!
    And now i want to start with a Stuck-Plugin.

    Stuck-plugin: Let's say you are stuck underground, you can't get up, then you just take the command /stuck, and it will bring you to the top

    The problem is that i don't know how to make a such plugin.
    If u need more info just leave a comment, and please help me!

    Thank you for reading this!

  2. Offline


    The plugin "WorldEdit" is open source, pretty huge, but contains a command named "/ascend" which teleports you one layer above. Maybe you could take a look a the source to get the idea. :)
  3. Offline


    Thank you! :D
    efstajas likes this.
  4. Offline


    Hey @Fosmothegreat

    At first, i hope, you know something about java and you are using Eclipse (i would recommend that rather than checking the bukkit-api for every single method you call :D )
    Second thing: download the newest bukkit-build (not craftbukkit, use bukkit) here:
    if you want your plugin to work with craftbukkit 1060, then you download this one:
    The next thing is setting up your workspace:
    create a new project in eclipse and asign the bukkit-0.0.1-SNAPSHOT.jar as an external jar to the project, now you can use the bukkit-api.
    Your new project needs a file called plugin.yml to help the server loading it:
    this should look like mine here:
    name: BedHeal
    main: me.kostronor.BedHeal.BedHeal
    version: 1.1
    author: Kostronor
    the name is the name of your plugin, in your case "Stuck"
    main is the package you use, i use the package:
    me."myusername"."pluginname"."name of main-class"
    version is your version of the plugin, just start with 1
    author is your username in the bukkit-forums

    there are more things to do with this later, but that is not needed yet

    Here is some code from my Ranks-plugin to show you how your main-class should look like:

    package Me.Kostronor.Ranks;
    public class Ranks extends JavaPlugin{
        Logger log = Logger.getLogger("Minecraft");
        public void onEnable(){
  "<-----Ranks starting----->");
  "<-----Ranks enabled----->");
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
     //This is called when a player uses a command
            return false;
        public void onDisable(){
  "<-----Ranks disabled----->");
    You can now check if the command is for your plugin
    the String commandLabel should equal your command, so if commandLabel.EqualsIgnoreCase("Stuck"); then someone typed "/stuck"
    now you get the player with Player player = (Player)CommandSender
    and you can try altering the players y-coordinate to a point where there is a space of two blocks to get the player unstuck.
    efstajas likes this.
  5. Offline


    Great! Thank you!
  6. Offline


    i can probably help you, (in Norwegian) if you want :p
  7. Offline


    Its says that i have to log in. Help please!
  8. Offline


    location loc = sender.getLocation();
    sender.sendMessage("You are now unstuck.");
Thread Status:
Not open for further replies.

Share This Page