Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
Add 20 tick delay to join message. Should allow enough time for other…
Browse files Browse the repository at this point in the history
… plugins to change displayName.
  • Loading branch information
cnaude committed May 10, 2014
1 parent 58355ea commit 1e470aa
Showing 1 changed file with 20 additions and 10 deletions.
Expand Up @@ -6,10 +6,12 @@

import com.cnaude.purpleirc.PurpleBot;
import com.cnaude.purpleirc.PurpleIRC;
import java.io.IOException;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.pircbotx.exception.IrcException;

/**
*
Expand All @@ -25,27 +27,35 @@ public class GamePlayerJoinListener implements Listener {
*/
public GamePlayerJoinListener(PurpleIRC plugin) {
this.plugin = plugin;
}
}

/**
*
* @param event
*/
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoinEvent(PlayerJoinEvent event) {
public void onPlayerJoinEvent(final PlayerJoinEvent event) {
plugin.logDebug("PlayerJoinEvent: " + event.getPlayer().getDisplayName()
+ ": " + event.getPlayer().getCustomName());
if (plugin.kickedPlayers.contains(event.getPlayer().getName())) {
plugin.kickedPlayers.remove(event.getPlayer().getName());
plugin.logDebug("Removing player "
plugin.logDebug("Removing player "
+ event.getPlayer().getName()
+ " from the recently kicked list.");
+ " from the recently kicked list.");
}
for (PurpleBot ircBot : plugin.ircBots.values()) {
if (ircBot.isConnected()) {
ircBot.gameJoin(event.getPlayer(), event.getJoinMessage());
if (plugin.netPackets != null) {
plugin.netPackets.updateTabList(event.getPlayer());
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
@Override
public void run() {
for (PurpleBot ircBot : plugin.ircBots.values()) {
if (ircBot.isConnected()) {
ircBot.gameJoin(event.getPlayer(), event.getJoinMessage());
if (plugin.netPackets != null) {
plugin.netPackets.updateTabList(event.getPlayer());
}
}
}
}
}
}, 20);

}
}

0 comments on commit 1e470aa

Please sign in to comment.