Last active
February 2, 2023 18:20
-
-
Save LOOHP/eb1dc37739bf9c2a14c8da67698ac158 to your computer and use it in GitHub Desktop.
InteractiveChatHexnicksBridge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.loohp.interactivechathexnicksbridge; | |
import com.loohp.interactivechat.api.InteractiveChatAPI; | |
import dev.majek.hexnicks.HexNicks; | |
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; | |
import org.bukkit.ChatColor; | |
import org.bukkit.event.Listener; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.ExecutionException; | |
public class InteractiveChatHexnicksBridge extends JavaPlugin implements Listener { | |
public static InteractiveChatHexnicksBridge plugin; | |
@Override | |
public void onEnable() { | |
plugin = this; | |
getServer().getPluginManager().registerEvents(this, this); | |
InteractiveChatAPI.registerNicknameProvider(this, uuid -> { | |
List<String> nicknames = new ArrayList<>(); | |
try { | |
String nickname = PlainTextComponentSerializer.plainText().serialize(HexNicks.api().getStoredNick(uuid).get()); | |
nicknames.add(nickname); | |
} catch (InterruptedException | ExecutionException e) { | |
e.printStackTrace(); | |
} | |
return nicknames; | |
}); | |
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "[InteractiveChatHexnicksBridge] Registered Hexnicks nicknames into InteractiveChat!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment