color signs

This commit is contained in:
Cloudburst
2021-06-03 11:26:45 +02:00
parent 0c55eb0851
commit 32c1a07eca
2 changed files with 45 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ public class MeteorRejectsAddon extends MeteorAddon {
modules.add(new AutoHighway());
modules.add(new AutoPot());
modules.add(new AutoTNT());
modules.add(new ColorSigns());
modules.add(new Confuse());
modules.add(new InteractionMenu());
modules.add(new Glide());

View File

@@ -0,0 +1,44 @@
package cloudburst.rejects.modules;
import minegame159.meteorclient.events.game.GameJoinedEvent;
import net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket;
import cloudburst.rejects.MeteorRejectsAddon;
import meteordevelopment.orbit.EventHandler;
import minegame159.meteorclient.events.packets.PacketEvent;
import minegame159.meteorclient.systems.modules.Module;
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
public class ColorSigns extends Module {
public ColorSigns() {
super(MeteorRejectsAddon.CATEGORY, "color-signs", "Allows you to use colors on signs on NON-PAPER servers (use \"&\" for color symbols)");
}
@EventHandler
private void onPacketSend(PacketEvent.Send event) {
if (event.packet instanceof GameJoinS2CPacket) {
checkWarning();
return;
}
if (!(event.packet instanceof UpdateSignC2SPacket)) return;
UpdateSignC2SPacket p = (UpdateSignC2SPacket)event.packet;
for (int l = 0; l < p.getText().length; l++) {
String newText = p.getText()[l].replaceAll("(?i)\u00a7|&([0-9A-FK-OR])", "\u00a7\u00a7$1$1");
p.getText()[l] = newText;
}
event.packet = p;
}
@Override
public void onActivate() {
super.onActivate();
checkWarning();
}
private void checkWarning() {
String brand = mc.player.getServerBrand();
if (brand == null) return;
if (brand.contains("Paper")) warning("You are on a paper server. Color signs won't work here");
}
}