G-Earth/Extensions/G-Translator_1.0.2/decompiled/gearth/protocol/HMessage.java
Administrator 368b92d87a G-Earth 1.5.4 beta 22 - Initial release
Komplettes G-Earth Paket inkl. JRE, Extensions und Tools.

Extensions:
- G-BuildTools, G-Click Ultimate, G-Loader, G-Manipulate
- G-Presets, G-Translator, G-Trigger, G-itemViewer
- Market Utils, Packet Info Explorer, Plants
- RandomRoomVisitor, RoomLogger, Sanbovir Photo Inspector
- SpyFriends, WallAligner, XabboScripter, xabbo
2026-03-16 09:45:04 +01:00

94 lines
2.3 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package gearth.protocol;
import gearth.misc.StringifyAble;
import gearth.protocol.HPacket;
public class HMessage
implements StringifyAble {
private HPacket hPacket;
private Direction direction;
private int index;
private boolean isBlocked;
public HMessage(String fromString) {
this.constructFromString(fromString);
}
public HMessage(HMessage message) {
this.constructFromHMessage(message);
}
public HMessage(HPacket packet, Direction direction, int index) {
this.direction = direction;
this.hPacket = packet;
this.index = index;
this.isBlocked = false;
}
public int getIndex() {
return this.index;
}
public void setBlocked(boolean block) {
this.isBlocked = block;
}
public boolean isBlocked() {
return this.isBlocked;
}
public HPacket getPacket() {
return this.hPacket;
}
public Direction getDestination() {
return this.direction;
}
public boolean isCorrupted() {
return this.hPacket.isCorrupted();
}
@Override
public String stringify() {
String s = (this.isBlocked ? "1" : "0") + "\t" + this.index + "\t" + this.direction.name() + "\t" + this.hPacket.stringify();
return s;
}
@Override
public void constructFromString(String str) {
String[] parts = str.split("\t", 4);
this.isBlocked = parts[0].equals("1");
this.index = Integer.parseInt(parts[1]);
this.direction = parts[2].equals("TOCLIENT") ? Direction.TOCLIENT : Direction.TOSERVER;
HPacket p = new HPacket(new byte[0]);
p.constructFromString(parts[3]);
this.hPacket = p;
}
public void constructFromHMessage(HMessage message) {
this.isBlocked = message.isBlocked();
this.index = message.getIndex();
this.direction = message.getDestination();
this.hPacket = new HPacket(message.getPacket());
}
public boolean equals(Object obj) {
if (!(obj instanceof HMessage)) {
return false;
}
HMessage message = (HMessage)obj;
return message.hPacket.equals(this.hPacket) && this.direction == message.direction && this.index == message.index;
}
public static enum Direction {
TOSERVER,
TOCLIENT;
}
}