_Den56_
Активный участник
- Баллы
- 61
- Имя в Minecraft
- _Den56_
Здравствуйте форумчани!У меня такая проблема ивент не хочет работать с шулдером, не пойму почему помогите.Мне нужно чтоб зомби спавнился через 5 секунд после ломания блока травы.
Вот код:
Вот ошибка:
Вот код:
Код:
package org.denys.main;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.denys.events.Events;
public class MainClass extends JavaPlugin implements Listener {
public void onEnable() {
getServer().getPluginManager().registerEvents(new Events(), this);
}
public void onDisable() {
}
}
Код:
package org.denys.events;
import org.bukkit.Color;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
public class Events implements Listener {
[USER=74023]@EventHandler[/USER]
public void onBreak(BlockBreakEvent e) {
Player p = e.getPlayer();
Block b = e.getBlock();
if(b.getType() == Material.GRASS) {
Bukkit.getServer().getScheduler().runTaskLater((Plugin) this, new Runnable() {
public void run() {
Zombie z = p.getWorld().spawn(b.getLocation().subtract(-0.5, 0, -0.5), Zombie.class);
z.setCustomName("Zombie");
z.setCustomNameVisible(true);
p.sendMessage(ChatColor.GOLD + "Zombie was spawned!");
}
}, 20*5);
e.setCancelled(false);
return;
}
}
}
Код:
[21:02:50 ERROR]: Could not pass event BlockBreakEvent to DifferentPlugin v0.0.6
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[Spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[Spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerInteractManager.breakBlock(PlayerInteractManager.java:286) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerInteractManager.a(PlayerInteractManager.java:121) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:623) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PacketPlayInBlockDig.a(SourceFile:40) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PacketPlayInBlockDig.a(SourceFile:10) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_112]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_112]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [Spigot.jar:git-Spigot-db6de12-18fbb24]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_112]
Caused by: java.lang.ClassCastException: org.denys.events.Events cannot be cast to org.bukkit.plugin.Plugin
at org.denys.events.Events.onBreak(Events.java:46) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_112]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_112]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[Spigot.jar:git-Spigot-db6de12-18fbb24]
... 17 more
Последнее редактирование: