This commit is contained in:
parent
16a167e83d
commit
31edef0735
2 changed files with 32 additions and 8 deletions
|
@ -49,6 +49,7 @@ public class Setup {
|
||||||
new ChatCrypt(),
|
new ChatCrypt(),
|
||||||
new ChatExtras(),
|
new ChatExtras(),
|
||||||
new ChatFilter(),
|
new ChatFilter(),
|
||||||
|
new ChatInfo(),
|
||||||
new ClickGUI(),
|
new ClickGUI(),
|
||||||
new Connect(),
|
new Connect(),
|
||||||
new Disconnect(),
|
new Disconnect(),
|
||||||
|
@ -68,7 +69,6 @@ public class Setup {
|
||||||
new NoRender(),
|
new NoRender(),
|
||||||
new NoSlowDown(),
|
new NoSlowDown(),
|
||||||
new Ping(),
|
new Ping(),
|
||||||
new PvpInfo(),
|
|
||||||
new RenderFun(),
|
new RenderFun(),
|
||||||
new Say(),
|
new Say(),
|
||||||
new SeedOverlay(),
|
new SeedOverlay(),
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
package de.com.baseband.client.feature.modules.chat;
|
package de.com.baseband.client.feature.modules.chat;
|
||||||
|
|
||||||
import de.com.baseband.client.BaseBand;
|
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.event.events.TotemPopEvent;
|
||||||
import de.com.baseband.client.feature.Feature;
|
import de.com.baseband.client.feature.Feature;
|
||||||
import de.com.baseband.client.registry.annotation.Config;
|
import de.com.baseband.client.registry.annotation.Config;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.network.play.server.SPacketEntityTeleport;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@de.com.baseband.client.feature.category.Chat
|
@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> names = new ArrayList<>();
|
||||||
private final ArrayList<String> newnames = new ArrayList<>();
|
private final ArrayList<String> newnames = new ArrayList<>();
|
||||||
|
@ -23,9 +25,12 @@ public class PvpInfo extends Feature {
|
||||||
@Config("Visual Range")
|
@Config("Visual Range")
|
||||||
public boolean visualRange;
|
public boolean visualRange;
|
||||||
|
|
||||||
|
@Config("Trace Teleport")
|
||||||
|
public boolean traceTeleport;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PvpInfo";
|
return "ChatInfo";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,8 +40,8 @@ public class PvpInfo extends Feature {
|
||||||
try {
|
try {
|
||||||
for (final Entity entity : mc.world.loadedEntityList) if (entity instanceof EntityPlayer && !entity.getName().equalsIgnoreCase(mc.player.getName())) newnames.add(entity.getName());
|
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)) {
|
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 : newnames) if (!names.contains(name)) BaseBand.notify("[ChatInfo] "+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 : names) if (!newnames.contains(name)) BaseBand.notify("[ChatInfo] "+name+" has left Visual Range.");
|
||||||
names.clear();
|
names.clear();
|
||||||
names.addAll(newnames);
|
names.addAll(newnames);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +52,7 @@ public class PvpInfo extends Feature {
|
||||||
for (EntityPlayer player : mc.world.playerEntities) {
|
for (EntityPlayer player : mc.world.playerEntities) {
|
||||||
if (player.getHealth() <= 0) {
|
if (player.getHealth() <= 0) {
|
||||||
if (popList.containsKey(player.getName())) {
|
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()));
|
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) {
|
public void totemPop(TotemPopEvent event) {
|
||||||
if(popList.get(event.getEntity().getName()) == null) {
|
if(popList.get(event.getEntity().getName()) == null) {
|
||||||
popList.put(event.getEntity().getName(), 1);
|
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) {
|
} else if(popList.get(event.getEntity().getName()) != null) {
|
||||||
int popCounter = popList.get(event.getEntity().getName());
|
int popCounter = popList.get(event.getEntity().getName());
|
||||||
int newPopCounter = popCounter + 1;
|
int newPopCounter = popCounter + 1;
|
||||||
popList.put(event.getEntity().getName(), newPopCounter);
|
popList.put(event.getEntity().getName(), newPopCounter);
|
||||||
BaseBand.notify("[PvpInfo] " + event.getEntity().getName() + " popped " + newPopCounter + " totems.");
|
BaseBand.notify("[ChatInfo] " + event.getEntity().getName() + " popped " + newPopCounter + " totems.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue