mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
Removed NoSwing & KillAura check, noswing is broken since 1.10 and i'm
rewriting killaura
This commit is contained in:
1 parent
f8a58fa888
commit
cf36228285
7 files changed
+14
-230
No files matched your search
@@ -1,49 +0,0 @@
|
||||
package net.gravitydevelopment.anticheat.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class CheckerNPCS {
|
||||
|
||||
private List<NPC> NPCS = new ArrayList<NPC>();
|
||||
|
||||
public CheckerNPCS(Player p) {
|
||||
NPC npcOne = new NPC(NameUtil.getRandomName(), p.getWorld(), p);
|
||||
NPCS.add(npcOne);
|
||||
}
|
||||
|
||||
public void doMove(PlayerMoveEvent e) {
|
||||
NPC one = NPCS.get(0);
|
||||
Location eyeLocation = e.getPlayer().getEyeLocation();
|
||||
Vector vec = e.getFrom().getDirection();
|
||||
Vector newVec = new Vector(vec.getX() * -2, vec.getY() * -2, vec.getZ() * -2);
|
||||
Location backLocation = eyeLocation.add(newVec);
|
||||
if (e.getPlayer().getLocation().getPitch() <= -45) {// TODO better fix for this
|
||||
Vector direction = e.getFrom().getDirection();
|
||||
Vector addVector = direction.setX(direction.getX() * -2).setY(direction.getY() * -2).setZ(direction.getZ() * -2);
|
||||
backLocation.add(addVector);
|
||||
}
|
||||
one.move(backLocation, e.getPlayer());
|
||||
}
|
||||
|
||||
public boolean onHit(int entityId) {
|
||||
for (NPC npc : NPCS)
|
||||
if (npc.getEntityId() == entityId)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clean(Player p) {
|
||||
if (!p.isOnline())
|
||||
return;
|
||||
for (NPC npc : NPCS)
|
||||
npc.destroy(p);
|
||||
NPCS.clear();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package net.gravitydevelopment.anticheat.util;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.server.v1_9_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_9_R1.PlayerInteractManager;
|
||||
|
||||
public class NPC {
|
||||
|
||||
private final EntityPlayer npc;
|
||||
|
||||
public NPC(String name, World w, Player owner) {
|
||||
this.npc = new EntityPlayer(((CraftServer) Bukkit.getServer()).getServer(), ((CraftWorld) w).getHandle(), new GameProfile(UUID.randomUUID(), name), new PlayerInteractManager(((CraftWorld) w).getHandle()));
|
||||
((CraftPlayer)owner).getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{this.npc}));
|
||||
this.npc.setInvisible(true);
|
||||
Location eyeLocation = owner.getEyeLocation();
|
||||
Vector vec = owner.getLocation().getDirection();
|
||||
Vector newVec = new Vector(vec.getX() * -2, vec.getY() * -2, vec.getZ() * -2);
|
||||
Location backLocation = eyeLocation.add(newVec);
|
||||
if (owner.getLocation().getPitch() < -50 && owner.getLocation().getPitch() > -75)
|
||||
this.npc.setLocation(backLocation.getX(), backLocation.getY() + 1, backLocation.getZ(), 0, 0);
|
||||
else if (owner.getLocation().getPitch() >= -50)
|
||||
this.npc.setLocation(backLocation.getX(), backLocation.getY() - 0.25, backLocation.getZ(), 0, 0);
|
||||
else
|
||||
this.npc.setLocation(backLocation.getX(), backLocation.getY() + 1.75, backLocation.getZ(), 0, 0);
|
||||
((CraftPlayer)owner).getHandle().playerConnection.sendPacket(new PacketPlayOutNamedEntitySpawn(this.npc));
|
||||
}
|
||||
|
||||
public int getEntityId() {
|
||||
return npc.getId();
|
||||
}
|
||||
|
||||
public void move(Location loc, Player owner) {
|
||||
this.npc.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
|
||||
((CraftPlayer)owner).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(this.npc));
|
||||
}
|
||||
|
||||
public void destroy(Player p) {
|
||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[] { this.npc }));
|
||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[] { this.npc.getId() }));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user