grtgrtgrg

This commit is contained in:
sirjonasxx 2021-04-29 02:38:27 +02:00
parent 170f1b4760
commit 50fc4b4107
7 changed files with 11 additions and 10 deletions

View File

@ -155,6 +155,7 @@ public abstract class Extension extends ExtensionBase {
flagRequestCallback = null;
}
else if (packet.headerId() == NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.INIT) {
// boolean isConnected = packet.readBoolean(); - don't read since not relevant here
initExtension();
writeToConsole("green","Extension \"" + getInfoAnnotations().Title() + "\" successfully initialized", false);
}

View File

@ -118,9 +118,9 @@ public class InternalExtensionBuilder extends GEarthExtension {
}
@Override
public void init() {
public void init(boolean isConnected) {
extension.initExtension();
}
} // not implementing isConnected, only relevant for g-python
@Override
public void close() {

View File

@ -37,10 +37,10 @@ public class HPacket implements StringifyAble {
packetInBytes = packetFromString.packetInBytes;
identifier = packetFromString.identifier;
identifierDirection = packetFromString.identifierDirection;
} catch (InvalidPacketException e) {
packetInBytes = new byte[0];
}
} catch (InvalidPacketException e) {
packetInBytes = new byte[0];
}
}
public HPacket(int header) {
packetInBytes = new byte[]{0,0,0,2,0,0};
replaceShort(4, (short)header);

View File

@ -237,7 +237,7 @@ public class ExtensionHandler {
};
extension.getExtensionObservable().addListener(listener);
extension.init();
extension.init(hConnection.getState() == HState.CONNECTED);
if (hConnection.getState() == HState.CONNECTED) {
extension.connectionStart(

View File

@ -40,7 +40,7 @@ public abstract class GEarthExtension {
public abstract void provideFlags(String[] flags);
public abstract void connectionStart(String host, int port, String hotelVersion, String clientIdentifier, HClient clientType, PacketInfoManager packetInfoManager);
public abstract void connectionEnd();
public abstract void init();
public abstract void init(boolean isConnected);
public abstract void close();
public abstract void packetToStringResponse(String string, String expression);
public abstract void stringToPacketResponse(HPacket packet);

View File

@ -213,9 +213,9 @@ public class NetworkExtension extends GEarthExtension {
}
@Override
public void init() {
public void init(boolean isConnected) {
sendMessage(
new HPacket(NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.INIT)
new HPacket(NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.INIT, isConnected)
);
}

View File

@ -97,7 +97,7 @@ public class ExampleExtension extends GEarthExtension {
}
@Override
public void init() {
public void init(boolean isConnected) {
System.out.println("Example extension is connected to G-Earth");
// the extension is now connected with G-Earth
}