- Баллы
- 173
Получаю ShaftWars.destinationWorld из класса Messenger:
В консоли получаю
В главном классе ShaftWars следующее:
PS: "моё сообщение" в игре выводится, но с null нужно разобраться
Java:
if (ShaftWars.destinationWorld == null) Bukkit.getLogger().info("ShaftWars.destinationWorld == null");
else Bukkit.getLogger().info("ShaftWars.destinationWorld.getName() == "+ShaftWars.destinationWorld.getName());
if (ShaftWars.destinationWorld.getPlayers() == null) Bukkit.getLogger().info("ShaftWars.destinationWorld.getPlayers() == null");
else Bukkit.getLogger().info("ShaftWars.destinationWorld.getPlayers() != null");
List<Player> var7 = (List<Player>)ShaftWars.destinationWorld.getPlayers();
2015-02-19 21:29:55 [INFO] ShaftWars.destinationWorld == null
2015-02-19 21:29:55 [SEVERE] Could not pass event PlayerInteractEvent to ShaftWars v1.0
org.bukkit.event.EventException
...
Caused by: java.lang.NullPointerException
at ru.onlymc.shaftwars.Messenger.msgNear(Messenger.java:47)
at ru.onlymc.shaftwars.ShaftWars.onPlayerInteract(ShaftWars.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:441)
... 20 more
В главном классе ShaftWars следующее:
Java:
public static World mineWorld;
public static World destinationWorld;
public void onEnable() {
mineWorld = getServer().getWorld(config.mineWorld);
destinationWorld = mineWorld;
if (mineWorld == null) getServer().broadcastMessage("MAIN: [ON START] mineWorld == null"); // Не выводится, значит mineWorld не null
if (destinationWorld == null) getServer().broadcastMessage("MAIN: [ON START] destinationWorld == null"); // Не выводится, значит destinationWorld не null
messenger = new Messenger(this, config, pressurePlateBlock.getLocation());
}
//...
messenger.msgNear("моё сообщение");
PS: "моё сообщение" в игре выводится, но с null нужно разобраться