Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. package fr.keke142.getiteminhand.commands;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Location;
  5. import org.bukkit.Material;
  6. import org.bukkit.block.Block;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandExecutor;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.entity.Player;
  11.  
  12. public class groundFromLoc implements CommandExecutor {
  13.  
  14. public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
  15.  
  16. if (alias.equalsIgnoreCase("groundfromloc")) {
  17.  
  18. Player p = (Player) sender;
  19.  
  20. String world = "world";
  21. int x = 10;
  22. int y = 256;
  23. int z = 20;
  24.  
  25. //Ok donc la je créer ma location avec mes 3 coordonnées toi t'as déjà ta loc,
  26. //c'est celle que t'a chopé au hasard, parcontre vieille à ce que le y de ta loc random sois 256
  27. Location loc = new Location(Bukkit.getWorld(world), x, y, z);
  28.  
  29. //La ma boucle elle s'éffectue tant que loc est égale à air
  30. while (loc.getBlock().getType() == Material.AIR) {
  31. //Tant que cette boucle continue, je retire 1 au y de ma loc
  32. loc = loc.subtract(0, -1, 0);
  33.  
  34. if (loc.getBlock().getType() != Material.AIR) {
  35. Bukkit.broadcastMessage("Je viens de touché un bloc qui n'est pas de l'air!");
  36. loc.getBlock().setType(Material.CHEST);
  37. }
  38.  
  39. }
  40.  
  41. }
  42. return false;
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement