Jump to content

notification duration extended with each new notification

Pending 1.0.8

molokatan
molokatan

Posted

Hi.

when we started using this plugin on ours server, we included f.e. death notes, raidbases and other event messages to be shown as notifiaction.

It helped us a lot to keep chat cleaner but had one huge downside.

1. you receive a notification -> a timer starts

2. you receive another notification -> timer gets refreshed for first notification and it will stay again for full length

As soon as you f.e. start killing a lot of npcs the timer for the notifications shown is refreshed over and over again.

As a result, noritifations will not get removed as long as you receive another new notification within the cooldown.

 

thats the reason why i changed the code for our server:

 

public void AddNotify(NotifyData data)
{
	if (!_config.Types.ContainsKey(data.Type)) return;

	// the start time is set for individual notifications -> they will be removed after cooldown no matter what happens
	data.StartTime = Time.time;

	_notifies.Add(data);

	// the start time only needs to be set for the created notification.
    /**if (_notifies.Count == 1)
    	_notifies[0].StartTime = Time.time;**/

	MainUi();

	if (!string.IsNullOrEmpty(_config.Types[data.Type].Effect))
		SendEffect(_config.Types[data.Type].Effect);
}

 

private void RemoveNotify(int index = 0)
{
	_notifies.RemoveAt(index);

	if (_notifies.Count == 0)
    {
    	Kill();
        return;
     }

	// we dont want to reset the timeout for notifications. They should only stay for the cooldown time and then get removed
	// _notifies[0].StartTime = Time.time;

     MainUi();
}

 

With those changes, the notifications fade away as soon as they pass their own cooldown time.

 

Would like to know what you think about this change.

It keeps our notification stream clean for players and they get enough time to read each of the notifications.

Our cooldown is still 10s.

MeventSupport

Posted

Hi! I really like this idea. I’ll think about it:) 

1.4m

Downloads

Total number of downloads.

6.9k

Customers

Total customers served.

102.3k

Files Sold

Total number of files sold.

2m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.