Ir para conteúdo
  • 0

Dúvida BungeeCord


iVictor777z

Pergunta

10 respostass a esta questão

Posts Recomendados

Tu que não tá usando direito. Mostra como tá o código.

@EventHandler
	void onCommand(PlayerCommandPreprocessEvent e) {
		if (e.getMessage().toLowerCase().equals("/teste")) {
			e.getPlayer().sendMessage("§6" + BungeeChannelApi.of(plugin).getPlayerCount("p4free"));
		}
	}
		plugin = this;
		Bukkit.getPluginManager().registerEvents(this, this);
		if (!new File(getDataFolder(), "config.yml").exists()) {
			saveDefaultConfig();
		}
		Bukkit.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
		Bukkit.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord",
				(PluginMessageListener) this);
Link para o comentário
Compartilhar em outros sites

@EventHandler
	void onCommand(PlayerCommandPreprocessEvent e) {
		if (e.getMessage().toLowerCase().equals("/teste")) {
			e.getPlayer().sendMessage("§6" + BungeeChannelApi.of(plugin).getPlayerCount("p4free"));
		}
	}
		plugin = this;
		Bukkit.getPluginManager().registerEvents(this, this);
		if (!new File(getDataFolder(), "config.yml").exists()) {
			saveDefaultConfig();
		}
		Bukkit.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
		Bukkit.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord",
				(PluginMessageListener) this);

 

Não é assim que se usa... Todos os métodos que retornam algum dado retornam um CompletableFuture...

 

O correto seria assim:

BungeeChannelApi.of(plugin).getPlayerCount("p4free")
  .whenComplete((result, error) -> {
    e.getPlayer().sendMessage("§aJogadores online: " + result);
  });

https://github.com/leonardosnt/BungeeChannelApi/

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem está navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...