forked from MagicBane/Server
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
3 years ago
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||
|
// Magicbane Emulator Project © 2013 - 2022
|
||
|
// www.magicbane.com
|
||
|
|
||
|
|
||
|
package engine.session;
|
||
|
|
||
|
import engine.util.ByteUtils;
|
||
|
|
||
|
public class SessionID {
|
||
|
|
||
|
private final byte[] data;
|
||
|
private final String dataAsString;
|
||
|
|
||
|
public SessionID(byte[] data) {
|
||
|
super();
|
||
|
this.data = data;
|
||
|
this.dataAsString = ByteUtils.byteArrayToStringHex(data);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean equals(Object obj) {
|
||
|
boolean out = false;
|
||
|
if(obj instanceof SessionID) {
|
||
|
out = true;
|
||
|
SessionID id = (SessionID) obj;
|
||
|
for (int i = 0; out && i < id.data.length; ++i) {
|
||
|
if (id.data[i] != this.data[i]) {
|
||
|
out = false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return out;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String toString() {
|
||
|
return this.dataAsString;
|
||
|
}
|
||
|
|
||
|
public final byte[] getData() {
|
||
|
return data;
|
||
|
}
|
||
|
|
||
|
}
|