API issue with placeholders
StormyIceLeopard opened this issue ยท 2 comments
I have been at this for weeks and cannot figure out why it returns null.
ERROR:
[19:47:40 ERROR]: Error occurred while enabling HoloLeaderBoard v1.0 (Is it up to date?)
java.lang.NullPointerException: null
at net.blizzardcraft.HoloLeaderBoard.HoloLeaderBoard.onEnable(HoloLeaderBoard.java:35) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:403) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:381) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:330) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:422) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:383) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:338) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:272) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) [spigot-1.12.2.jar:git-Spigot-fc7ad59-d7bebef]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_201]
Code:
String name = "N/A", win = "N/A", loss = "N/A";
public void registerVariables() {
HologramsAPI.registerPlaceholder(holoLB, "{1player}", 300.0, new PlaceholderReplacer() {
@Override
public String update() {
(Supposded to be bolded)**name = getInfo(1, "name");
return name;** (Supposded to be bolded)
}
});
The code is repeated for 10 of these.
I have determined if the bolded line is not a method but a string itself then it works. I do not understand why.
Can someone please help me as I am still stuck on this.
I have determined that I can not put a method call inside update() and I do not know why.