PvpInfo -> ChatInfo
Some checks failed
/ Build BaseBand DSM & Broadway (push) Failing after 51s

This commit is contained in:
Jess H 2024-06-17 10:39:28 +01:00
parent 16a167e83d
commit 31edef0735
Signed by: UnixSystemV
GPG key ID: 9B21C50B68D67F19
2 changed files with 32 additions and 8 deletions

View file

@ -49,6 +49,7 @@ public class Setup {
new ChatCrypt(),
new ChatExtras(),
new ChatFilter(),
new ChatInfo(),
new ClickGUI(),
new Connect(),
new Disconnect(),
@ -68,7 +69,6 @@ public class Setup {
new NoRender(),
new NoSlowDown(),
new Ping(),
new PvpInfo(),
new RenderFun(),
new Say(),
new SeedOverlay(),

View file

@ -1,17 +1,19 @@
package de.com.baseband.client.feature.modules.chat;
import de.com.baseband.client.BaseBand;
import de.com.baseband.client.event.events.PacketEvent;
import de.com.baseband.client.event.events.TotemPopEvent;
import de.com.baseband.client.feature.Feature;
import de.com.baseband.client.registry.annotation.Config;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.play.server.SPacketEntityTeleport;
import java.util.ArrayList;
import java.util.HashMap;
@de.com.baseband.client.feature.category.Chat
public class PvpInfo extends Feature {
public class ChatInfo extends Feature {
private final ArrayList<String> names = new ArrayList<>();
private final ArrayList<String> newnames = new ArrayList<>();
@ -23,9 +25,12 @@ public class PvpInfo extends Feature {
@Config("Visual Range")
public boolean visualRange;
@Config("Trace Teleport")
public boolean traceTeleport;
@Override
public String toString() {
return "PvpInfo";
return "ChatInfo";
}
@Override
@ -35,8 +40,8 @@ public class PvpInfo extends Feature {
try {
for (final Entity entity : mc.world.loadedEntityList) if (entity instanceof EntityPlayer && !entity.getName().equalsIgnoreCase(mc.player.getName())) newnames.add(entity.getName());
if (!names.equals(newnames)) {
for (final String name : newnames) if (!names.contains(name)) BaseBand.notify("[PvpInfo] "+name+" has entered Visual Range.");
for (final String name : names) if (!newnames.contains(name)) BaseBand.notify("[PvpInfo] "+name+" has left Visual Range.");
for (final String name : newnames) if (!names.contains(name)) BaseBand.notify("[ChatInfo] "+name+" has entered Visual Range.");
for (final String name : names) if (!newnames.contains(name)) BaseBand.notify("[ChatInfo] "+name+" has left Visual Range.");
names.clear();
names.addAll(newnames);
}
@ -47,7 +52,7 @@ public class PvpInfo extends Feature {
for (EntityPlayer player : mc.world.playerEntities) {
if (player.getHealth() <= 0) {
if (popList.containsKey(player.getName())) {
BaseBand.notify("[PvpInfo] " + player.getName() + " died after popping " + popList.get(player.getName()) + " totem(s).");
BaseBand.notify("[ChatInfo] " + player.getName() + " died after popping " + popList.get(player.getName()) + " totem(s).");
popList.remove(player.getName(), popList.get(player.getName()));
}
}
@ -55,16 +60,35 @@ public class PvpInfo extends Feature {
}
}
public void packetEvent(PacketEvent.Receive event) {
if(event.getPacket() instanceof SPacketEntityTeleport) {
SPacketEntityTeleport packet2 = (SPacketEntityTeleport) event.getPacket();
if (! (mc.world.getEntityByID(packet2.getEntityId()) instanceof EntityPlayer)) return false;
if (Math.abs(mc.player.posX - packet2.getX()) > 50d || Math.abs(mc.player.posZ - packet2.getZ()) > 50d) {
String name = "Unknown";
Entity entity = mc.world.getEntityByID(packet2.getEntityId());
if (entity != null) name = entity.getClass().getSimpleName();
double distance = Math.sqrt(Math.pow(mc.player.posX - packet2.getX(), 2d) + Math.pow(mc.player.posZ - packet2.getZ(), 2d));
String warn = String.format("Entity [%s] teleported to [%.2f, %.2f, %.2f], %.2f blocks away", name, packet2.getX(), packet2.getY(), packet2.getZ(), distance);
BaseBand.notify("[ChatInfo] " + warn);
}
}
}
public void totemPop(TotemPopEvent event) {
if(popList.get(event.getEntity().getName()) == null) {
popList.put(event.getEntity().getName(), 1);
BaseBand.notify("[PvpInfo] " + event.getEntity().getName() + " popped " + 1 + " totem.");
BaseBand.notify("[ChatInfo] " + event.getEntity().getName() + " popped " + 1 + " totem.");
} else if(popList.get(event.getEntity().getName()) != null) {
int popCounter = popList.get(event.getEntity().getName());
int newPopCounter = popCounter + 1;
popList.put(event.getEntity().getName(), newPopCounter);
BaseBand.notify("[PvpInfo] " + event.getEntity().getName() + " popped " + newPopCounter + " totems.");
BaseBand.notify("[ChatInfo] " + event.getEntity().getName() + " popped " + newPopCounter + " totems.");
}
}