Ich habe eine Animation erstellt in der mann hochgeschleudert wird.
Aber es kommt der Fehler:
Java:
Location strike = p.getLocation();
strike.setY(p.getLocation().getY());
p.closeInventory();
p.playEffect(p.getLocation(), Effect.EXPLOSION, 1);
Vector v = p.getLocation().getDirection().multiply(3D).setX(0).setZ(0).setY(2);
p.setVelocity(v);
float f = 0; // Not used; The mob apperance is always in front of the player
float data = 0;// This is also not used for this effect :P
float count = 1; //Don't think that this is used either :P
//PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(EnumParticle.MOB_APPEARANCE, false, f, f, f, f, f, f, data, (int) count);
//((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
p.playSound(p.getLocation(), Sound.WITHER_IDLE, 1, 3);
for (Player player : Bukkit.getOnlinePlayers()) {
if (player != p) {
player.hidePlayer(p);
}
}
p.getLocation().getWorld().strikeLightningEffect(strike);
TitleSystem.sendTitle(p, 1, 40, 1, "§8▪ §3PrivateServer §8▪", MessageHandler.getTitleTp(p));
p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 60, 2, true));
Bukkit.getScheduler().scheduleSyncDelayedTask(PrivateServerSpigot.getPlugin(PrivateServerSpigot.class), new Runnable() {
@Override
public void run() {
Location to = p.getLocation();
to.setY(200);
p.teleport(to);
p.playSound(p.getLocation(), Sound.WITHER_HURT, 1, 6);
for (Player player : Bukkit.getOnlinePlayers()) {
if (player != p) {
player.showPlayer(p);
}
}
aniconnect.remove(p.getName());
Bukkit.getScheduler().scheduleSyncDelayedTask(privateServerSpigot, new Runnable() {
@Override
public void run() {
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF(server);
} catch (IOException e) {
}
p.sendPluginMessage(privateServerSpigot, "BungeeCord", b.toByteArray());
}
}, 10);
}
}, 30);
Aber es kommt der Fehler:
Code:
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? [13:40:02 WARN]: org.apache.commons.lang.UnhandledException: Plugin PrivateServer v1.0.0 generated an exception while executing task 24
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at java.lang.Thread.run(Thread.java:748)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? Caused by: java.lang.IllegalStateException: Asynchronous effect add!
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:14)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at net.minecraft.server.v1_8_R3.EntityLiving.addEffect(EntityLiving.java:582)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity.addPotionEffect(CraftLivingEntity.java:293)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at net.rafadev.mainskript.privateserver.spigot.api.manager.AnimationsManager$1.run(AnimationsManager.java:84)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
[17.03.2020 13:29:49] INFO ? [Lobby-1] ? ... 3 more