hey ich fasse mich kurz ich bekomme folgenden Error:
[18:55:20 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'baum
' in plugin MiniGame v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spi
got_server.jar:git-Spigot-fdc1440-53fac9f]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:14
1) ~[spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServe
r.java:641) ~[spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerCon
nection.java:1162) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java
:997) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java
:45) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java
:1) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:1
3) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [
?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_60]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot_ser
ver.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:7
14) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:3
74) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:6
53) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java
:556) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
Caused by: java.lang.NullPointerException
at API.SQLStats.playerExist(SQLStats.java:16) ~[?:?]
at API.SQLStats.getDeahts(SQLStats.java:35) ~[?:?]
at de.Timeox2k.Commands.Stats.onCommand(Stats.java:42) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spi
got_server.jar:git-Spigot-fdc1440-53fac9f]
... 15 more
>
#------------------------------------ und der code ist :
package API;
import java.sql.ResultSet;
import java.sql.SQLException;
import de.Timeox2k.Main.Main;
public class SQLStats {
public static boolean playerExist(String uuid) {
try {
ResultSet rs = Main.mysql.query("SELECT * FROM Stats WHERE UUID=*" + uuid + "'");
if(rs.next()) {
return rs.getString("UUID") != null;
}
return false;
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
public static void createPlayer(String uuid) {
if(!(playerExist(uuid))) {
Main.mysql.update("INSERT INTO Stats(UUID, KILLS, DEATHS) VALUES ('" + uuid + "', '0', '0');");
}
}
public static Integer getDeahts(String uuid) {
Integer i = 0;
if(playerExist(uuid)) {
try {
ResultSet rs = Main.mysql.query("SELECT * FROM Stats WHERE UUID=*" + uuid + "'");
if((!rs.next()) || (Integer.valueOf(rs.getInt("KILLS")) == null));
i = rs.getInt("KILLS");
} catch (SQLException e) {
e.printStackTrace();
}
}else {
createPlayer(uuid);
getKills(uuid);
}
return i;
}
public static Integer getKills(String uuid) {
Integer i = 0;
if(playerExist(uuid)) {
try {
ResultSet rs = Main.mysql.query("SELECT * FROM Stats WHERE UUID=*" + uuid + "'");
if((!rs.next()) || (Integer.valueOf(rs.getInt("DEATHS")) == null));
i = rs.getInt("DEATHS");
} catch (SQLException e) {
e.printStackTrace();
}
}else {
createPlayer(uuid);
getDeahts(uuid);
}
return i;
}
public static void setKills(String uuid, Integer kills) {
if(playerExist(uuid)) {
Main.mysql.update("UPDATE Stats SET KILLS= '" + kills + "' WHERE UUID = '" + uuid + "';");
} else {
createPlayer(uuid);
setKills(uuid, kills);
}
}
public static void setDeaths(String uuid, Integer deaths) {
if(playerExist(uuid)) {
Main.mysql.update("UPDATE Stats SET DEATHS= '" + deaths + "' WHERE UUID = '" + uuid + "';");
} else {
createPlayer(uuid);
setDeaths(uuid, deaths);
}
}
public static void addKills(String uuid, Integer kills) {
if(playerExist(uuid)) {
setKills(uuid, Integer.valueOf(getKills(uuid).intValue() + kills.intValue()));
}else {
createPlayer(uuid);
addKills(uuid, kills);
}
}
public static void addDeaths(String uuid, Integer deaths) {
if(playerExist(uuid)) {
setDeaths(uuid, Integer.valueOf(getDeahts(uuid).intValue() + deaths.intValue()));
}else {
createPlayer(uuid);
addDeaths(uuid, deaths);
}
}
//-------------------------------------------------------------------------------------------
public static void removeKills(String uuid, Integer kills) {
if(playerExist(uuid)) {
setKills(uuid, Integer.valueOf(getKills(uuid).intValue() - kills.intValue()));
}else {
createPlayer(uuid);
removeKills(uuid, kills);
}
}
public static void removeDeaths(String uuid, Integer deaths) {
if(playerExist(uuid)) {
setDeaths(uuid, Integer.valueOf(getDeahts(uuid).intValue() - deaths.intValue()));
}else {
createPlayer(uuid);
removeDeaths(uuid, deaths);
}
}
}
hätte da jemand eine idee?
[18:55:20 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'baum
' in plugin MiniGame v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spi
got_server.jar:git-Spigot-fdc1440-53fac9f]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:14
1) ~[spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServe
r.java:641) ~[spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerCon
nection.java:1162) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java
:997) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java
:45) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java
:1) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:1
3) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [
?:1.8.0_60]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_60]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot_ser
ver.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:7
14) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:3
74) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:6
53) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java
:556) [spigot_server.jar:git-Spigot-fdc1440-53fac9f]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_60]
Caused by: java.lang.NullPointerException
at API.SQLStats.playerExist(SQLStats.java:16) ~[?:?]
at API.SQLStats.getDeahts(SQLStats.java:35) ~[?:?]
at de.Timeox2k.Commands.Stats.onCommand(Stats.java:42) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spi
got_server.jar:git-Spigot-fdc1440-53fac9f]
... 15 more
>
#------------------------------------ und der code ist :
package API;
import java.sql.ResultSet;
import java.sql.SQLException;
import de.Timeox2k.Main.Main;
public class SQLStats {
public static boolean playerExist(String uuid) {
try {
ResultSet rs = Main.mysql.query("SELECT * FROM Stats WHERE UUID=*" + uuid + "'");
if(rs.next()) {
return rs.getString("UUID") != null;
}
return false;
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
public static void createPlayer(String uuid) {
if(!(playerExist(uuid))) {
Main.mysql.update("INSERT INTO Stats(UUID, KILLS, DEATHS) VALUES ('" + uuid + "', '0', '0');");
}
}
public static Integer getDeahts(String uuid) {
Integer i = 0;
if(playerExist(uuid)) {
try {
ResultSet rs = Main.mysql.query("SELECT * FROM Stats WHERE UUID=*" + uuid + "'");
if((!rs.next()) || (Integer.valueOf(rs.getInt("KILLS")) == null));
i = rs.getInt("KILLS");
} catch (SQLException e) {
e.printStackTrace();
}
}else {
createPlayer(uuid);
getKills(uuid);
}
return i;
}
public static Integer getKills(String uuid) {
Integer i = 0;
if(playerExist(uuid)) {
try {
ResultSet rs = Main.mysql.query("SELECT * FROM Stats WHERE UUID=*" + uuid + "'");
if((!rs.next()) || (Integer.valueOf(rs.getInt("DEATHS")) == null));
i = rs.getInt("DEATHS");
} catch (SQLException e) {
e.printStackTrace();
}
}else {
createPlayer(uuid);
getDeahts(uuid);
}
return i;
}
public static void setKills(String uuid, Integer kills) {
if(playerExist(uuid)) {
Main.mysql.update("UPDATE Stats SET KILLS= '" + kills + "' WHERE UUID = '" + uuid + "';");
} else {
createPlayer(uuid);
setKills(uuid, kills);
}
}
public static void setDeaths(String uuid, Integer deaths) {
if(playerExist(uuid)) {
Main.mysql.update("UPDATE Stats SET DEATHS= '" + deaths + "' WHERE UUID = '" + uuid + "';");
} else {
createPlayer(uuid);
setDeaths(uuid, deaths);
}
}
public static void addKills(String uuid, Integer kills) {
if(playerExist(uuid)) {
setKills(uuid, Integer.valueOf(getKills(uuid).intValue() + kills.intValue()));
}else {
createPlayer(uuid);
addKills(uuid, kills);
}
}
public static void addDeaths(String uuid, Integer deaths) {
if(playerExist(uuid)) {
setDeaths(uuid, Integer.valueOf(getDeahts(uuid).intValue() + deaths.intValue()));
}else {
createPlayer(uuid);
addDeaths(uuid, deaths);
}
}
//-------------------------------------------------------------------------------------------
public static void removeKills(String uuid, Integer kills) {
if(playerExist(uuid)) {
setKills(uuid, Integer.valueOf(getKills(uuid).intValue() - kills.intValue()));
}else {
createPlayer(uuid);
removeKills(uuid, kills);
}
}
public static void removeDeaths(String uuid, Integer deaths) {
if(playerExist(uuid)) {
setDeaths(uuid, Integer.valueOf(getDeahts(uuid).intValue() - deaths.intValue()));
}else {
createPlayer(uuid);
removeDeaths(uuid, deaths);
}
}
}
hätte da jemand eine idee?