Implement new MineplexLink methods

This commit is contained in:
cnr 2017-04-13 00:00:17 -06:00
parent 490fe56b34
commit 0735b415cf

View File

@ -1,14 +1,18 @@
package mineplex.core.antihack; package mineplex.core.antihack;
import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.MinecraftServer;
import net.minecraft.server.v1_8_R3.MobEffect;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import com.mineplex.anticheat.api.MineplexLink; import com.mineplex.anticheat.api.MineplexLink;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseBase;
@ -47,4 +51,29 @@ public class MineplexLinkImpl implements MineplexLink
{ {
return ((CraftPlayer) player).getHandle().bS(); // See Anticheat javadoc return ((CraftPlayer) player).getHandle().bS(); // See Anticheat javadoc
} }
@Override
public int allocateNewEntityID()
{
return UtilEnt.getNewEntityId();
}
@Override
public boolean isUsingElytra(Player player)
{
return ((CraftPlayer) player).getHandle().isGliding();
}
@Override
public int getLevitationAmplifier(Player player)
{
MobEffect effect = ((CraftPlayer) player).getHandle().effects.get(PotionEffectType.LEVITATION.getId());
return effect == null ? -1 : effect.getAmplifier();
}
@Override
public boolean canDamage(Player attacker, Entity target)
{
return true;
}
} }