Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (label.equalsIgnoreCase("setvotecage")) {
- if (!(sender.isOp())) {
- sender.sendMessage(ChatColor.RED + "No tienes permisos para ejecutar este comando.");
- return true;
- }
- if (!(sender instanceof Player))
- return true;
- Player player = (Player) sender;
- String w = player.getWorld().getName();
- double x = player.getLocation().getBlockX();
- double y = player.getLocation().add(0, 1, 0).getBlockY();
- double z = player.getLocation().getBlockZ();
- getConfig().set("Caja.world", w);
- getConfig().set("Caja.X", x);
- getConfig().set("Caja.Y", y);
- getConfig().set("Caja.Z", z);
- saveConfig();
- player.sendMessage(ChatColor.GREEN + "Caja de votaciones colocada correctamente!");
- spawncajaherecraft();
- }
- return false;
- }
- public void spawncajaherecraft() {
- World w = Bukkit.getWorld(getConfig().getString("Caja.world"));
- double x = getConfig().getDouble("Caja.X");
- double y = getConfig().getDouble("Caja.Y");
- double z = getConfig().getDouble("Caja.Z");
- Location loc1 = new Location(w, x, y , z);
- Block b1 = loc1.getBlock();
- b1.setType(Material.ENDER_PORTAL_FRAME);
- }
- @EventHandler(priority=EventPriority.NORMAL)
- public void onPlayerInteract(PlayerInteractEvent e) {
- if ((e.getAction() != Action.LEFT_CLICK_BLOCK)) {
- if ((e.getClickedBlock().getType() == Material.ENDER_PORTAL_FRAME)) {
- Player player = e.getPlayer();
- Block b = e.getClickedBlock();
- if (getConfig().getConfigurationSection("Caja") == null)
- return;
- World w = Bukkit.getWorld(getConfig().getString("Caja.world"));
- double x = getConfig().getDouble("Caja.X");
- double y = getConfig().getDouble("Caja.Y");
- double z = getConfig().getDouble("Caja.Z");
- if (w == b.getWorld() && x == b.getX() && y == b.getY() && z == b.getZ()) {
- player.openInventory(VoteInv.votemenu);
- }
- }
- }
- }
- }
- #Error
- [22:27:27 ERROR]: Could not pass event PlayerInteractEvent to VoteJson v1.0
- org.bukkit.event.EventException
- at org.bukkit.plugin.EventExecutor$1.execute(EventExecutor.java:46) ~[rpg.jar:git-Paper-1104]
- at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[rpg.jar:git-Paper-1104]
- at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[rpg.jar:git-Paper-1104]
- at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) ~[rpg.jar:git-Paper-1104]
- at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) ~[rpg.jar:git-Paper-1104]
- at org.bukkit.craftbukkit.v1_11_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:235) ~[rpg.jar:git-Paper-1104]
- at org.bukkit.craftbukkit.v1_11_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:202) ~[rpg.jar:git-Paper-1104]
- at net.minecraft.server.v1_11_R1.PlayerInteractManager.a(PlayerInteractManager.java:110) ~[rpg.jar:git-Paper-1104]
- at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:840) ~[rpg.jar:git-Paper-1104]
- at net.minecraft.server.v1_11_R1.PacketPlayInBlockDig.a(SourceFile:40) ~[rpg.jar:git-Paper-1104]
- at net.minecraft.server.v1_11_R1.PacketPlayInBlockDig.a(SourceFile:10) ~[rpg.jar:git-Paper-1104]
- 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