Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  2. if (label.equalsIgnoreCase("setvotecage")) {
  3. if (!(sender.isOp())) {
  4. sender.sendMessage(ChatColor.RED + "No tienes permisos para ejecutar este comando.");
  5. return true;
  6. }
  7. if (!(sender instanceof Player))
  8. return true;
  9. Player player = (Player) sender;
  10. String w = player.getWorld().getName();
  11. double x = player.getLocation().getBlockX();
  12. double y = player.getLocation().add(0, 1, 0).getBlockY();
  13. double z = player.getLocation().getBlockZ();
  14. getConfig().set("Caja.world", w);
  15. getConfig().set("Caja.X", x);
  16. getConfig().set("Caja.Y", y);
  17. getConfig().set("Caja.Z", z);
  18. saveConfig();
  19. player.sendMessage(ChatColor.GREEN + "Caja de votaciones colocada correctamente!");
  20. spawncajaherecraft();
  21. }
  22. return false;
  23. }
  24.  
  25. public void spawncajaherecraft() {
  26. World w = Bukkit.getWorld(getConfig().getString("Caja.world"));
  27. double x = getConfig().getDouble("Caja.X");
  28. double y = getConfig().getDouble("Caja.Y");
  29. double z = getConfig().getDouble("Caja.Z");
  30. Location loc1 = new Location(w, x, y , z);
  31. Block b1 = loc1.getBlock();
  32. b1.setType(Material.ENDER_PORTAL_FRAME);
  33. }
  34.  
  35. @EventHandler(priority=EventPriority.NORMAL)
  36. public void onPlayerInteract(PlayerInteractEvent e) {
  37. if ((e.getAction() != Action.LEFT_CLICK_BLOCK)) {
  38. if ((e.getClickedBlock().getType() == Material.ENDER_PORTAL_FRAME)) {
  39. Player player = e.getPlayer();
  40. Block b = e.getClickedBlock();
  41. if (getConfig().getConfigurationSection("Caja") == null)
  42. return;
  43. World w = Bukkit.getWorld(getConfig().getString("Caja.world"));
  44. double x = getConfig().getDouble("Caja.X");
  45. double y = getConfig().getDouble("Caja.Y");
  46. double z = getConfig().getDouble("Caja.Z");
  47. if (w == b.getWorld() && x == b.getX() && y == b.getY() && z == b.getZ()) {
  48. player.openInventory(VoteInv.votemenu);
  49.  
  50.  
  51. }
  52. }
  53. }
  54. }
  55. }
  56.  
  57.  
  58.  
  59. #Error
  60. [22:27:27 ERROR]: Could not pass event PlayerInteractEvent to VoteJson v1.0
  61. org.bukkit.event.EventException
  62. at org.bukkit.plugin.EventExecutor$1.execute(EventExecutor.java:46) ~[rpg.jar:git-Paper-1104]
  63. at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[rpg.jar:git-Paper-1104]
  64. at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[rpg.jar:git-Paper-1104]
  65. at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) ~[rpg.jar:git-Paper-1104]
  66. at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) ~[rpg.jar:git-Paper-1104]
  67. at org.bukkit.craftbukkit.v1_11_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:235) ~[rpg.jar:git-Paper-1104]
  68. at org.bukkit.craftbukkit.v1_11_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:202) ~[rpg.jar:git-Paper-1104]
  69. at net.minecraft.server.v1_11_R1.PlayerInteractManager.a(PlayerInteractManager.java:110) ~[rpg.jar:git-Paper-1104]
  70. at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:840) ~[rpg.jar:git-Paper-1104]
  71. at net.minecraft.server.v1_11_R1.PacketPlayInBlockDig.a(SourceFile:40) ~[rpg.jar:git-Paper-1104]
  72. at net.minecraft.server.v1_11_R1.PacketPlayInBlockDig.a(SourceFile:10) ~[rpg.jar:git-Paper-1104]
  73. at net.minecraft.server.v1_11_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14) ~[rpg.jar:git-Paper-1104]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement