[16:49:27] [Server thread/ERROR]: Could not pass event PlayerJoinEvent to pc-PlayerProtection-1.8.8 v1.8.8
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[mc.jar:git-PaperSpigot-"4c7641d"]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[mc.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[mc.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [mc.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerList.onPlayerJoin(PlayerList.java:314) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerList.a(PlayerList.java:173) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.LoginListener.b(LoginListener.java:144) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.LoginListener.c(LoginListener.java:54) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:231) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.ServerConnection.c(ServerConnection.java:148) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:875) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [mc.jar:git-PaperSpigot-"4c7641d"]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
Caused by: java.lang.NullPointerException
at pietregcode.pietreg.protectionplayers.listeners.PlayerJoinListnener.onJoin(PlayerJoinListnener.java:32) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[mc.jar:git-PaperSpigot-"4c7641d"]
... 15 more
Code:
Spoiler
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
User u = UserManager.getUser(p);
if (p.getName().equals("Killeerek01")) {
p.sendMessage(ChatUtil.fixColor("&6Ten serwer uzywa twojego pluginu! &4<3"));
}
if (u == null) {
UserManager.createrUser(p);
if (!Config.PROTECTION_TIME_FRISTJOIN_STATUS) {
return;
}
u.setTimeProtect(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(4));
String mm = Config.PROTECTION_NAMETAG;
TagApi.setTag((User) p, mm);
String m = Config.PROTECTION_TIME_FRISTJOIN_START;
m = m.replace("{TIME}", Integer.toString(Config.PROTECTION_TIME_FRISTJOIN));
ChatUtil.sendMsg(p, m);
}
}
Pytanie
Killeerek01 0
Witam mam o taki error:
[16:49:27] [Server thread/ERROR]: Could not pass event PlayerJoinEvent to pc-PlayerProtection-1.8.8 v1.8.8
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[mc.jar:git-PaperSpigot-"4c7641d"]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[mc.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[mc.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517) [mc.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerList.onPlayerJoin(PlayerList.java:314) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerList.a(PlayerList.java:173) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.LoginListener.b(LoginListener.java:144) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.LoginListener.c(LoginListener.java:54) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:231) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.ServerConnection.c(ServerConnection.java:148) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:875) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [mc.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [mc.jar:git-PaperSpigot-"4c7641d"]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
Caused by: java.lang.NullPointerException
at pietregcode.pietreg.protectionplayers.listeners.PlayerJoinListnener.onJoin(PlayerJoinListnener.java:32) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:300) ~[mc.jar:git-PaperSpigot-"4c7641d"]
... 15 more
Code:
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
User u = UserManager.getUser(p);
if (p.getName().equals("Killeerek01")) {
p.sendMessage(ChatUtil.fixColor("&6Ten serwer uzywa twojego pluginu! &4<3"));
}
if (u == null) {
UserManager.createrUser(p);
if (!Config.PROTECTION_TIME_FRISTJOIN_STATUS) {
return;
}
u.setTimeProtect(System.currentTimeMillis() + TimeUtil.MINUTE.getTime(4));
String mm = Config.PROTECTION_NAMETAG;
TagApi.setTag((User) p, mm);
String m = Config.PROTECTION_TIME_FRISTJOIN_START;
m = m.replace("{TIME}", Integer.toString(Config.PROTECTION_TIME_FRISTJOIN));
ChatUtil.sendMsg(p, m);
}
}
}
User:
import java.sql.ResultSet;
import java.sql.SQLException;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import pietregcode.pietreg.protectionplayers.ProtectionPlugin;
public class User
{
private String name;
private long ochronatime;
private long ochronadedtime;
public User(final Player p) {
this.name = p.getName();
this.ochronatime = 0L;
this.ochronadedtime = 0L;
this.insert();
}
public User(final ResultSet rs) throws SQLException{
this.name = rs.getString("name");
this.ochronatime = rs.getLong("protection");
this.ochronadedtime = rs.getLong("protectionded");
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public long getTimeProtect() {
return ochronatime;
}
public void setTimeProtect(long ochrona) {
this.ochronatime = ochrona;
ProtectionPlugin.getStore().update(false, "UPDATE `{P}users` SET `protection`='" + this.getTimeProtect() + "' WHERE `name`='" + this.getName() + "'");
}
public long getTimeProtectDead() {
return ochronadedtime;
}
public void setTimeProtectDead(long ochrona) {
this.ochronadedtime = ochrona;
ProtectionPlugin.getStore().update(false, "UPDATE `{P}users` SET `protectionded` ='" + this.getTimeProtectDead() + "' WHERE `name` ='" + this.getName() + "'");
}
public Player getPlayer() {
return Bukkit.getPlayer(this.getName());
}
public boolean isOnline() {
return this.getPlayer() != null;
}
private void insert() {
ProtectionPlugin.getStore().update(false, "INSERT INTO `{P}users`(`id`, `name`, `protection`, `protectionded`) VALUES (NULL, '" + this.getName() + "','" + this.getTimeProtect() + "','" + this.getTimeProtectDead() + "')");
}
public void save() {
ProtectionPlugin.getStore().update(false, "UPDATE `{P}users` SET `protection` = '" + this.getTimeProtect() + "', `protectionded` = '" + this.getTimeProtectDead() + "' WHERE `name` ='" + this.getName() + "';");
}
public boolean isProtect() {
return this.getTimeProtect() >= System.currentTimeMillis();
}
public boolean isProtectDead() {
return this.getTimeProtectDead() >= System.currentTimeMillis();
}
}
Pomoże ktoś? Z góry dziękuje.
Odnośnik do komentarza
https://skript.pl/temat/26031-problem-error/Udostępnij na innych stronach
5 odpowiedzi na to pytanie
Rekomendowane odpowiedzi