mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-25 18:07:57 +01:00
Schedule sending the chat.text warning message.
Thread safety not guaranteed by API.
This commit is contained in:
parent
00836ac9d7
commit
821dc34d7a
@ -5,6 +5,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||||
@ -271,7 +272,13 @@ public class Text extends AsyncCheck implements INotifyReload{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cc.chatWarningCheck && time - data.chatWarningTime > cc.chatWarningTimeout && (100f * accumulated / cc.textFreqNormLevel > cc.chatWarningLevel || 100f * shortTermAccumulated / cc.textFreqShortTermLevel > cc.chatWarningLevel)){
|
else if (cc.chatWarningCheck && time - data.chatWarningTime > cc.chatWarningTimeout && (100f * accumulated / cc.textFreqNormLevel > cc.chatWarningLevel || 100f * shortTermAccumulated / cc.textFreqShortTermLevel > cc.chatWarningLevel)){
|
||||||
player.sendMessage(ColorUtil.replaceColors(cc.chatWarningMessage));
|
// TODO: In case this gets used more often, use the player tasks, at least once PlayerData can be used for async calls.
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("NoCheatPlus"), new Runnable(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
player.sendMessage(ColorUtil.replaceColors(cc.chatWarningMessage));
|
||||||
|
};
|
||||||
|
});
|
||||||
data.chatWarningTime = time;
|
data.chatWarningTime = time;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user