mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 06:28:49 +00:00
Fix NPE caused by PluginMessenger not instantiating futures
This commit is contained in:
1 parent
4164f07841
commit
139f2b7ff2
1 file changed
+3
-3
@@ -38,7 +38,7 @@ public class PluginMessenger extends NetworkMessenger implements PluginMessageLi
|
|||||||
* This is needed because it is not possible to have players dispatch plugin messages in certain circumstance,
|
* This is needed because it is not possible to have players dispatch plugin messages in certain circumstance,
|
||||||
* such as on the tick that they join the server.
|
* such as on the tick that they join the server.
|
||||||
*/
|
*/
|
||||||
private static final long PLUGIN_MESSAGE_DELAY_TICKS = 1L;
|
private static final long PLUGIN_MESSAGE_DELAY_TICKS = 3L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(@NotNull HuskHomes implementor) {
|
public void initialize(@NotNull HuskHomes implementor) {
|
||||||
@@ -70,8 +70,8 @@ public class PluginMessenger extends NetworkMessenger implements PluginMessageLi
|
|||||||
@SuppressWarnings("UnstableApiUsage")
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public CompletableFuture<String> getServerName(@NotNull OnlineUser requester) {
|
public CompletableFuture<String> getServerName(@NotNull OnlineUser requester) {
|
||||||
final BukkitHuskHomes plugin = (BukkitHuskHomes) this.plugin;
|
final BukkitHuskHomes plugin = (BukkitHuskHomes) this.plugin;
|
||||||
|
serverNameRequest = new CompletableFuture<>();
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||||
serverNameRequest = new CompletableFuture<>();
|
|
||||||
final ByteArrayDataOutput pluginMessageWriter = ByteStreams.newDataOutput();
|
final ByteArrayDataOutput pluginMessageWriter = ByteStreams.newDataOutput();
|
||||||
pluginMessageWriter.writeUTF("GetServer");
|
pluginMessageWriter.writeUTF("GetServer");
|
||||||
((BukkitPlayer) requester).sendPluginMessage(plugin,
|
((BukkitPlayer) requester).sendPluginMessage(plugin,
|
||||||
@@ -84,8 +84,8 @@ public class PluginMessenger extends NetworkMessenger implements PluginMessageLi
|
|||||||
@SuppressWarnings("UnstableApiUsage")
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public CompletableFuture<String[]> getOnlineServers(@NotNull OnlineUser requester) {
|
public CompletableFuture<String[]> getOnlineServers(@NotNull OnlineUser requester) {
|
||||||
final BukkitHuskHomes plugin = (BukkitHuskHomes) this.plugin;
|
final BukkitHuskHomes plugin = (BukkitHuskHomes) this.plugin;
|
||||||
|
onlineServersRequest = new CompletableFuture<>();
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||||
onlineServersRequest = new CompletableFuture<>();
|
|
||||||
final ByteArrayDataOutput pluginMessageWriter = ByteStreams.newDataOutput();
|
final ByteArrayDataOutput pluginMessageWriter = ByteStreams.newDataOutput();
|
||||||
pluginMessageWriter.writeUTF("GetServers");
|
pluginMessageWriter.writeUTF("GetServers");
|
||||||
((BukkitPlayer) requester).sendPluginMessage(plugin,
|
((BukkitPlayer) requester).sendPluginMessage(plugin,
|
||||||
|
|||||||
Reference in new issue
Block a user