Advertisement
Guest User

CobbleWall plugin

a guest
Jan 4th, 2016
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. package net.itsprime;
  2.  
  3. import org.bukkit.Location;
  4. import org.bukkit.Material;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10.  
  11. /**
  12. * Created by Prime on 1/4/2015.
  13. */
  14. public class Main extends JavaPlugin implements Listener {
  15.  
  16. public void onEnable(){
  17. getConfig().options().copyDefaults(true);
  18. saveConfig();
  19. }
  20.  
  21. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] a) {
  22. if (!(sender instanceof Player)) {
  23. return false;
  24. }
  25. Player player = (Player) sender;
  26.  
  27. if (cmd.getName().equalsIgnoreCase("cobblewall")) {
  28. Location loc = player.getLocation();
  29. for (int y = loc.getBlockY(); y > player.getWorld().getMaxHeight(); y++) {
  30. if (loc.getBlock().equals(Material.AIR)) {
  31. loc.add(0,y,0);
  32. loc.getBlock().setType(Material.COBBLESTONE);
  33. }
  34. }
  35. player.teleport(loc);
  36. return true;
  37. }
  38. return false;
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement