Adds NoFriendHurt, adds new option to NoPacket "RemoveEntity"

This commit is contained in:
noil 2020-12-15 22:41:26 -05:00
parent 005692bf47
commit d4330ec1e7
4 changed files with 48 additions and 0 deletions

View File

@ -23,6 +23,7 @@ public final class FriendCommand extends Command {
super("Friend", new String[]{"F"}, "Allows you to add or remove friends", "Friend Add <Username>\n" +
"Friend Add <Username> <Alias>\n" +
"Friend Remove <Username>\n" +
"Friend List\n" +
"Friend Clear");
}

View File

@ -162,6 +162,7 @@ public final class ModuleManager {
add(new SearchModule());
add(new AutoGappleModule());
add(new AutoEatModule());
add(new NoFriendHurtModule());
// p2w experience
if (Seppuku.INSTANCE.getCapeManager().hasCape())

View File

@ -0,0 +1,36 @@
package me.rigamortis.seppuku.impl.module.combat;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.EventStageable;
import me.rigamortis.seppuku.api.event.network.EventSendPacket;
import me.rigamortis.seppuku.api.friend.Friend;
import me.rigamortis.seppuku.api.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.network.play.client.CPacketUseEntity;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
/**
* @author noil
*/
public final class NoFriendHurtModule extends Module {
public NoFriendHurtModule() {
super("NoFriendHurt", new String[]{"NoFriendDMG", "FriendProtect"}, "Cancels any packets that try to hurt your friends.", "NONE", -1, ModuleType.COMBAT);
}
@Listener
public void onSendPacket(EventSendPacket event) {
if (event.getStage().equals(EventStageable.EventStage.PRE)) {
if (event.getPacket() instanceof CPacketUseEntity) {
final CPacketUseEntity packetUseEntity = (CPacketUseEntity) event.getPacket();
if (Minecraft.getMinecraft().player == null || Minecraft.getMinecraft().objectMouseOver == null)
return;
final Friend friend = Seppuku.INSTANCE.getFriendManager().isFriend(Minecraft.getMinecraft().objectMouseOver.entityHit);
if (packetUseEntity.getAction() == CPacketUseEntity.Action.ATTACK && friend != null) {
event.setCanceled(true);
}
}
}
}
}

View File

@ -1,9 +1,11 @@
package me.rigamortis.seppuku.impl.module.player;
import me.rigamortis.seppuku.api.event.network.EventReceivePacket;
import me.rigamortis.seppuku.api.event.network.EventSendPacket;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.network.play.client.*;
import net.minecraft.network.play.server.SPacketDestroyEntities;
import team.stiff.pomelo.impl.annotated.handler.annotation.Listener;
/**
@ -19,6 +21,7 @@ public final class NoPacketModule extends Module {
public final Value<Boolean> vehicleMove = new Value<Boolean>("VehicleMove", new String[]{"vehicle", "vehicle-move", "vm", "move"}, "Cancel vehicle movement packets.", false);
public final Value<Boolean> input = new Value<Boolean>("Input", new String[]{"in", "i"}, "Cancel player input packets.", false);
public final Value<Boolean> abilities = new Value<Boolean>("Abilities", new String[]{"abilities", "player", "ability", "pa"}, "Cancel \"player-ability\" packets.", false);
public final Value<Boolean> removeEntity = new Value<Boolean>("RemoveEntity", new String[]{"DestroyEntities", "RemoveEntities", "remove", "destroy", "re", "de"}, "Cancel receiving all \"remove/destroy entity\" packets.", false);
public NoPacketModule() {
super("NoPacket", new String[]{"NoPacket", "NoPac", "AntiPacket", "PacketDisable", "PacketCancel"}, "Disables various packets from being sent to the server, or back to the client.", "NONE", -1, ModuleType.PLAYER);
@ -58,4 +61,11 @@ public final class NoPacketModule extends Module {
if (event.getPacket() instanceof CPacketInput)
event.setCanceled(true);
}
@Listener
public void onReceivePacket(EventReceivePacket event) {
if (this.removeEntity.getValue())
if (event.getPacket() instanceof SPacketDestroyEntities)
event.setCanceled(true);
}
}