use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project meteor-rejects by AntiCope.
the class KickCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(literal("disconnect").executes(ctx -> {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("Disconnected via .kick command")));
return SINGLE_SUCCESS;
}));
builder.then(literal("pos").executes(ctx -> {
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, !mc.player.isOnGround()));
return SINGLE_SUCCESS;
}));
builder.then(literal("hurt").executes(ctx -> {
mc.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.attack(mc.player, mc.player.isSneaking()));
return SINGLE_SUCCESS;
}));
builder.then(literal("chat").executes(ctx -> {
mc.player.sendChatMessage("§0§1§");
return SINGLE_SUCCESS;
}));
builder.then(literal("shutdown").executes(ctx -> {
try {
shutdown();
} catch (Exception exception) {
error("Couldn't disconnect. IOException");
}
return SINGLE_SUCCESS;
}));
builder.then(literal("crash").executes(ctx -> {
GlfwUtil.makeJvmCrash();
return SINGLE_SUCCESS;
}));
}
use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project BleachHack by BleachDrinker420.
the class Ambience method readPacket.
@BleachSubscribe
public void readPacket(EventPacket.Read event) {
if (event.getPacket() instanceof GameStateChangeS2CPacket && getSetting(0).asToggle().getState()) {
GameStateChangeS2CPacket packet = (GameStateChangeS2CPacket) event.getPacket();
if (packet.getReason() == GameStateChangeS2CPacket.RAIN_STARTED) {
weatherManager.setRain(1f);
} else if (packet.getReason() == GameStateChangeS2CPacket.RAIN_STOPPED) {
weatherManager.setRain(0f);
} else if (packet.getReason() == GameStateChangeS2CPacket.RAIN_GRADIENT_CHANGED) {
weatherManager.setRain(packet.getValue());
} else if (packet.getReason() == GameStateChangeS2CPacket.THUNDER_GRADIENT_CHANGED) {
weatherManager.setThunder(packet.getValue());
} else {
return;
}
event.setCancelled(true);
} else if (event.getPacket() instanceof DisconnectS2CPacket && getSetting(0).asToggle().getState()) {
weatherManager.reset();
} else if (event.getPacket() instanceof WorldTimeUpdateS2CPacket && getSetting(1).asToggle().getState()) {
event.setCancelled(true);
}
}
use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project meteor-client by MeteorDevelopment.
the class AutoLog method onTick.
@EventHandler
private void onTick(TickEvent.Post event) {
if (mc.player.getHealth() <= 0) {
this.toggle();
return;
}
if (mc.player.getHealth() <= health.get()) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Health was lower than " + health.get() + ".")));
if (smartToggle.get()) {
this.toggle();
enableHealthListener();
}
}
if (smart.get() && mc.player.getHealth() + mc.player.getAbsorptionAmount() - PlayerUtils.possibleHealthReductions() < health.get()) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Health was going to be lower than " + health.get() + ".")));
if (toggleOff.get())
this.toggle();
}
for (Entity entity : mc.world.getEntities()) {
if (entity instanceof PlayerEntity && entity.getUuid() != mc.player.getUuid()) {
if (onlyTrusted.get() && entity != mc.player && !Friends.get().isFriend((PlayerEntity) entity)) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] A non-trusted player appeared in your render distance.")));
if (toggleOff.get())
this.toggle();
break;
}
if (mc.player.distanceTo(entity) < 8 && instantDeath.get() && DamageUtils.getSwordDamage((PlayerEntity) entity, true) > mc.player.getHealth() + mc.player.getAbsorptionAmount()) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Anti-32k measures.")));
if (toggleOff.get())
this.toggle();
break;
}
}
if (entity instanceof EndCrystalEntity && mc.player.distanceTo(entity) < range.get() && crystalLog.get()) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] End Crystal appeared within specified range.")));
if (toggleOff.get())
this.toggle();
}
}
}
use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project meteor-client by MeteorDevelopment.
the class InfinityMiner method logOut.
private void logOut() {
toggle();
mc.player.networkHandler.sendPacket(new DisconnectS2CPacket(new LiteralText("[Infinity Miner] Inventory is full.")));
}
use of net.minecraft.network.packet.s2c.play.DisconnectS2CPacket in project Client by MatHax.
the class AutoLog method onTick.
@EventHandler
private void onTick(TickEvent.Post event) {
if (mc.player.getHealth() <= 0) {
toggle();
return;
}
if (totems.get() && InvUtils.find(Items.TOTEM_OF_UNDYING).count() <= totemCount.get()) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Totems was lower than " + totemCount.get() + ".")));
toggle();
}
if (mc.player.getHealth() <= health.get()) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Health was lower than " + health.get() + ".")));
if (smartToggle.get()) {
toggle();
enableHealthListener();
}
}
if (smart.get() && mc.player.getHealth() + mc.player.getAbsorptionAmount() - PlayerUtils.possibleHealthReductions() < health.get()) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Health was going to be lower than " + health.get() + ".")));
if (toggleOff.get())
toggle();
}
for (Entity entity : mc.world.getEntities()) {
if (entity instanceof PlayerEntity && entity.getUuid() != mc.player.getUuid()) {
if (onlyTrusted.get() && entity != mc.player && !Friends.get().isFriend((PlayerEntity) entity)) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] A non-trusted player appeared in your render distance.")));
if (toggleOff.get())
toggle();
break;
}
if (mc.player.distanceTo(entity) < 8 && instantDeath.get() && DamageUtils.getSwordDamage((PlayerEntity) entity, true) > mc.player.getHealth() + mc.player.getAbsorptionAmount()) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] Anti-32k measures.")));
if (toggleOff.get())
toggle();
break;
}
}
if (entity instanceof EndCrystalEntity && mc.player.distanceTo(entity) < range.get() && crystalLog.get()) {
mc.player.networkHandler.onDisconnect(new DisconnectS2CPacket(new LiteralText("[AutoLog] End Crystal appeared within specified range.")));
if (toggleOff.get())
toggle();
}
}
}
Aggregations