@@ -10,6 +10,7 @@ import net.md_5.bungee.api.ChatColor
1010import net.md_5.bungee.api.chat.ClickEvent
1111import net.md_5.bungee.api.chat.ComponentBuilder
1212import net.md_5.bungee.api.chat.TextComponent
13+ import org.bukkit.Bukkit
1314import org.bukkit.command.CommandSender
1415
1516class AddCommand : ChatEmotesCommand {
@@ -25,20 +26,25 @@ class AddCommand : ChatEmotesCommand {
2526 throw InvalidEmoteNameException ()
2627 }
2728
28- ChatEmotes .getInstance().getEmoteProvider().addEmote(name, url)
29- sender.spigot().sendMessage(
30- * ComponentBuilder (" Emote successfully added. " )
31- .color(ChatColor .GREEN )
32- .append(
33- TextComponent (" Click here" ).apply {
34- isUnderlined = true
35- clickEvent = ClickEvent (ClickEvent .Action .RUN_COMMAND , " /emote refresh" )
36- }
29+ Bukkit .getScheduler().runTaskAsynchronously(ChatEmotes .getInstance(), Runnable {
30+ ChatEmotes .getInstance().getEmoteProvider().addEmote(name, url)
31+
32+ Bukkit .getScheduler().runTask(ChatEmotes .getInstance(), Runnable {
33+ sender.spigot().sendMessage(
34+ * ComponentBuilder (" Emote successfully added. " )
35+ .color(ChatColor .GREEN )
36+ .append(
37+ TextComponent (" Click here" ).apply {
38+ isUnderlined = true
39+ clickEvent = ClickEvent (ClickEvent .Action .RUN_COMMAND , " /emote refresh" )
40+ }
41+ )
42+ .append(" to announce the resource pack" , ComponentBuilder .FormatRetention .NONE )
43+ .color(ChatColor .GREEN )
44+ .create()
3745 )
38- .append(" to announce the resource pack" , ComponentBuilder .FormatRetention .NONE )
39- .color(ChatColor .GREEN )
40- .create()
41- )
46+ })
47+ })
4248 }
4349
4450 override fun onTabComplete (sender : CommandSender , args : List <String >): List <String > {
0 commit comments