Join and quit delay should probably be the same and configurable.

This commit is contained in:
cnaude 2015-12-25 12:27:58 -07:00
parent 33cad8d3fb
commit 99bf740ff6
4 changed files with 24 additions and 11 deletions

View File

@ -45,8 +45,7 @@ public class GamePlayerJoinListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoinEvent(final PlayerJoinEvent event) { public void onPlayerJoinEvent(final PlayerJoinEvent event) {
plugin.logDebug("PlayerJoinEvent: " + event.getPlayer().getDisplayName() plugin.logDebug("onPlayerJoinEvent [" + plugin.joinDelay + "]: " + event.getPlayer().getName());
+ ": " + event.getPlayer().getCustomName());
if (plugin.kickedPlayers.contains(event.getPlayer().getName())) { if (plugin.kickedPlayers.contains(event.getPlayer().getName())) {
plugin.kickedPlayers.remove(event.getPlayer().getName()); plugin.kickedPlayers.remove(event.getPlayer().getName());
plugin.logDebug("Removing player " + event.getPlayer().getName() + " from the recently kicked list."); plugin.logDebug("Removing player " + event.getPlayer().getName() + " from the recently kicked list.");
@ -65,6 +64,6 @@ public class GamePlayerJoinListener implements Listener {
plugin.updateDisplayNameCache(event.getPlayer()); plugin.updateDisplayNameCache(event.getPlayer());
plugin.updateUuidCache(event.getPlayer()); plugin.updateUuidCache(event.getPlayer());
} }
}, 20); }, plugin.joinDelay);
} }
} }

View File

@ -44,8 +44,8 @@ public class GamePlayerQuitListener implements Listener {
* @param event * @param event
*/ */
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerQuitEvent(PlayerQuitEvent event) { public void onPlayerQuitEvent(final PlayerQuitEvent event) {
plugin.logDebug("QUIT: " + event.getPlayer().getName()); plugin.logDebug("onPlayerQuitEvent [" + plugin.quitDelay + "]: " + event.getPlayer().getName());
if (plugin.kickedPlayers.contains(event.getPlayer().getName())) { if (plugin.kickedPlayers.contains(event.getPlayer().getName())) {
plugin.kickedPlayers.remove(event.getPlayer().getName()); plugin.kickedPlayers.remove(event.getPlayer().getName());
plugin.logDebug("Player " plugin.logDebug("Player "
@ -53,12 +53,17 @@ public class GamePlayerQuitListener implements Listener {
+ " was in the recently kicked list. Not sending quit message."); + " was in the recently kicked list. Not sending quit message.");
return; return;
} }
for (PurpleBot ircBot : plugin.ircBots.values()) { plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
ircBot.gameQuit(event.getPlayer(), event.getQuitMessage()); @Override
if (plugin.netPackets != null) { public void run() {
plugin.netPackets.updateTabList(event.getPlayer()); for (PurpleBot ircBot : plugin.ircBots.values()) {
ircBot.gameQuit(event.getPlayer(), event.getQuitMessage());
if (plugin.netPackets != null) {
plugin.netPackets.updateTabList(event.getPlayer());
}
ircBot.sendRemotePlayerInfo();
}
} }
ircBot.sendRemotePlayerInfo(); }, plugin.quitDelay);
}
} }
} }

View File

@ -178,6 +178,8 @@ public class PurpleIRC extends JavaPlugin {
public boolean mineverseChatEnabled; public boolean mineverseChatEnabled;
public Long ircConnCheckInterval; public Long ircConnCheckInterval;
public Long ircChannelCheckInterval; public Long ircChannelCheckInterval;
public Long joinDelay;
public long quitDelay;
public ChannelWatcher channelWatcher; public ChannelWatcher channelWatcher;
public LinkUpdater linkUpdater; public LinkUpdater linkUpdater;
public ColorConverter colorConverter; public ColorConverter colorConverter;
@ -698,6 +700,8 @@ public class PurpleIRC extends JavaPlugin {
ircConnCheckInterval = getConfig().getLong("conn-check-interval"); ircConnCheckInterval = getConfig().getLong("conn-check-interval");
reconnectSuppression = getConfig().getInt("reconnect-fail-message-count", 10); reconnectSuppression = getConfig().getInt("reconnect-fail-message-count", 10);
ircChannelCheckInterval = getConfig().getLong("channel-check-interval"); ircChannelCheckInterval = getConfig().getLong("channel-check-interval");
joinDelay = getConfig().getLong("join-delay", 20);
quitDelay = getConfig().getLong("quit-delay", 20);
customTabGamemode = getConfig().getString("custom-tab-gamemode", "SPECTATOR"); customTabGamemode = getConfig().getString("custom-tab-gamemode", "SPECTATOR");
customTabList = getConfig().getBoolean("custom-tab-list", false); customTabList = getConfig().getBoolean("custom-tab-list", false);

View File

@ -16,6 +16,10 @@ enable-ident-server: false
channel-check-interval: 100 channel-check-interval: 100
# Alias /irc smsg to /msg # Alias /irc smsg to /msg
override-msg-cmd: false override-msg-cmd: false
# Number of ticks after join event fires to process and send to IRC
join-delay: 20
# Number of ticks after quit event fires to process and send to IRC
quit-delay: 20
# Alias for /irc smsg # Alias for /irc smsg
smsg-alias: '/m' smsg-alias: '/m'
# Alias for /irc smsg <prev player> # Alias for /irc smsg <prev player>
@ -182,6 +186,7 @@ message-format:
# Invalid IRC command message # Invalid IRC command message
invalid-irc-command: "I'm sorry '%NICK%' I can't do that. Type '%CMDPREFIX%help' for a list of commands I might respond to." invalid-irc-command: "I'm sorry '%NICK%' I can't do that. Type '%CMDPREFIX%help' for a list of commands I might respond to."
no-perm-for-irc-command: "I'm sorry '%NICK%' you are not authorized to do that. Type '%CMDPREFIX%help' for a list of commands I might respond to." no-perm-for-irc-command: "I'm sorry '%NICK%' you are not authorized to do that. Type '%CMDPREFIX%help' for a list of commands I might respond to."
# ReportRTS tempates
rts-notify: '[RTS:New] #%TICKETNUMBER% <%NAME%> %MESSAGE%' rts-notify: '[RTS:New] #%TICKETNUMBER% <%NAME%> %MESSAGE%'
rts-complete: '[RTS:Complete] #%TICKETNUMBER% <%NAME%> %MESSAGE%' rts-complete: '[RTS:Complete] #%TICKETNUMBER% <%NAME%> %MESSAGE%'
rts-claim: '[RTS:Claim] #%TICKETNUMBER% <%NAME%> %MESSAGE%' rts-claim: '[RTS:Claim] #%TICKETNUMBER% <%NAME%> %MESSAGE%'