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)
public void onPlayerJoinEvent(final PlayerJoinEvent event) {
plugin.logDebug("PlayerJoinEvent: " + event.getPlayer().getDisplayName()
+ ": " + event.getPlayer().getCustomName());
plugin.logDebug("onPlayerJoinEvent [" + plugin.joinDelay + "]: " + event.getPlayer().getName());
if (plugin.kickedPlayers.contains(event.getPlayer().getName())) {
plugin.kickedPlayers.remove(event.getPlayer().getName());
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.updateUuidCache(event.getPlayer());
}
}, 20);
}, plugin.joinDelay);
}
}

View File

@ -44,8 +44,8 @@ public class GamePlayerQuitListener implements Listener {
* @param event
*/
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerQuitEvent(PlayerQuitEvent event) {
plugin.logDebug("QUIT: " + event.getPlayer().getName());
public void onPlayerQuitEvent(final PlayerQuitEvent event) {
plugin.logDebug("onPlayerQuitEvent [" + plugin.quitDelay + "]: " + event.getPlayer().getName());
if (plugin.kickedPlayers.contains(event.getPlayer().getName())) {
plugin.kickedPlayers.remove(event.getPlayer().getName());
plugin.logDebug("Player "
@ -53,12 +53,17 @@ public class GamePlayerQuitListener implements Listener {
+ " was in the recently kicked list. Not sending quit message.");
return;
}
for (PurpleBot ircBot : plugin.ircBots.values()) {
ircBot.gameQuit(event.getPlayer(), event.getQuitMessage());
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()) {
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 Long ircConnCheckInterval;
public Long ircChannelCheckInterval;
public Long joinDelay;
public long quitDelay;
public ChannelWatcher channelWatcher;
public LinkUpdater linkUpdater;
public ColorConverter colorConverter;
@ -698,6 +700,8 @@ public class PurpleIRC extends JavaPlugin {
ircConnCheckInterval = getConfig().getLong("conn-check-interval");
reconnectSuppression = getConfig().getInt("reconnect-fail-message-count", 10);
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");
customTabList = getConfig().getBoolean("custom-tab-list", false);

View File

@ -16,6 +16,10 @@ enable-ident-server: false
channel-check-interval: 100
# Alias /irc smsg to /msg
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
smsg-alias: '/m'
# Alias for /irc smsg <prev player>
@ -182,6 +186,7 @@ message-format:
# 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."
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-complete: '[RTS:Complete] #%TICKETNUMBER% <%NAME%> %MESSAGE%'
rts-claim: '[RTS:Claim] #%TICKETNUMBER% <%NAME%> %MESSAGE%'