Added NoCheatPlus hooks.

This commit is contained in:
Jonathan Williams 2015-02-09 00:18:51 -08:00
parent fb563c9274
commit c5b7e97623

View File

@ -35,6 +35,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.plugin.java.JavaPlugin;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
@ -88,9 +89,37 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
return;
}
NCPExemptionManager.exemptPermanently(event.getPlayer());
try
{
NCPExemptionManager.exemptPermanently(event.getPlayer());
}
catch (Exception exception)
{
}
_exemptTimeMap.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + 1500);
}
@EventHandler
public void ncpExemptVelocity(final PlayerVelocityEvent event)
{
if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId()))
{
_exemptTimeMap.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + 1500);
return;
}
try
{
NCPExemptionManager.exemptPermanently(event.getPlayer());
}
catch (Exception exception)
{
}
_exemptTimeMap.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + 1500);
event.getPlayer().sendMessage(event.getPlayer().getName() + " ignored.");
}
@EventHandler
@ -107,12 +136,14 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
if (System.currentTimeMillis() > entry.getValue())
{
iterator.remove();
NCPExemptionManager.unexempt(entry.getKey());
Player player = Bukkit.getPlayer(entry.getKey());
if (player != null)
try
{
player.sendMessage(player.getName() + " not ignored.");
NCPExemptionManager.unexempt(entry.getKey());
}
catch (Exception exception)
{
}
}
}