mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-27 02:40:51 +01:00
grtgrtgrg
This commit is contained in:
parent
170f1b4760
commit
50fc4b4107
@ -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);
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
|
@ -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(
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user