/surface Plugin Help

Here is a Plugin i made some years back on Bukkit:

<code=java>
package me.TheShermanTanker.SurfaceCommand;

import java.util.Random

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;

public class SurfaceCommand extends JavaPlugin{

public void onEnable(){

getLogger().info(ChatColor.GREEN + “Spigot 1.7 Surface Command Plugin is the first Plugin by TheShermanTanker”);

}

public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){

 }

if (cmd.getName().equalsIgnoreCase(“surface”) && sender instanceof Player)

 Player player = (Player) sender
 Location

original.Location = player.getLocation();

Random random = new Random();

 Location

teleportLocation = null;

       boolean isOnLand = false;

       while (isOnLand == false) {

            teleportLocation = new Location(world.getHighestBlockAt());

            if (teleportLocation.getBlock().getType()!=Material.AIR){

                isOnLand = true;

            } else y--;



       }



       player.teleport(teleportLocation);

       player.sendMessage(ChatColor.GREEN + "Teleported to the surface!");


       return true;

   }
User types /surface and is teleported to the surface. How do i convert this into sponge code?

Well, the docs tell basically everything there is to know about writing a sponge plugins, so I’d suggest you start there. You’ll have to make a plugin class and register a command.

I agree Phoenix, By the looks of it you are extremely new to any sort of software development, I’d read through the sponge creating a plugin docs he linked.

https://docs.spongepowered.org/master/en/plugin/commands/creating.html

You will need the command builder to put together the command, but before that you’ll need to setup your sponge/sponge forge work space. That link above shows the steps and shows the pretty well, if not check out sibmots’ videos which may or may not be in the process of re-recording.

Also take a look at the example plugins. They give you a good idea :smiley:

https://github.com/sibomots/DerpyDerp