Added NoCheatPlus hook for double jump fly hack prevention.
This commit is contained in:
parent
fabf385a57
commit
44bab01e33
Binary file not shown.
@ -13,5 +13,6 @@
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -4,6 +4,8 @@ import java.lang.reflect.Field;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.DummyEntity;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -32,8 +34,12 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
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.plugin.java.JavaPlugin;
|
||||
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
|
||||
|
||||
public class CustomTagFix extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
private NautHashMap<String, NautHashMap<Integer, Integer>> _entityMap = new NautHashMap<String, NautHashMap<Integer, Integer>>();
|
||||
@ -42,6 +48,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
|
||||
private HashSet<String> _loggedIn = new HashSet<String>();
|
||||
private HashSet<Integer> _ignoreSkulls = new HashSet<Integer>();
|
||||
|
||||
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
|
||||
|
||||
private Field _destroyId;
|
||||
|
||||
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
|
||||
@ -71,6 +79,45 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
|
||||
_loggedIn.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ncpExempt(final PlayerToggleFlightEvent event)
|
||||
{
|
||||
if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId()))
|
||||
{
|
||||
_exemptTimeMap.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + 1500);
|
||||
return;
|
||||
}
|
||||
|
||||
NCPExemptionManager.exemptPermanently(event.getPlayer());
|
||||
_exemptTimeMap.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + 1500);
|
||||
event.getPlayer().sendMessage(event.getPlayer().getName() + " ignored.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void unexempt(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Iterator<Entry<UUID, Long>> iterator = _exemptTimeMap.entrySet().iterator(); iterator.hasNext();)
|
||||
{
|
||||
Entry<UUID, Long> entry = iterator.next();
|
||||
|
||||
|
||||
if (System.currentTimeMillis() > entry.getValue())
|
||||
{
|
||||
iterator.remove();
|
||||
NCPExemptionManager.unexempt(entry.getKey());
|
||||
Player player = Bukkit.getPlayer(entry.getKey());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.sendMessage(player.getName() + " not ignored.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cleanMap(UpdateEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user