mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-23 08:50:52 +01:00
extension settings
This commit is contained in:
parent
982b3c3fe6
commit
3a2178337a
@ -211,4 +211,9 @@ public class BlockAndReplacePackets extends ExtensionForm {
|
||||
|
||||
clearInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDelete() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ public abstract class Extension {
|
||||
void act(String[] args);
|
||||
}
|
||||
|
||||
protected static final boolean CANLEAVE = true; // can you disconnect the ext
|
||||
protected static final boolean CANDELETE = true; // can you delete the ext (will be false for some built-in extensions)
|
||||
protected boolean canLeave; // can you disconnect the ext
|
||||
protected boolean canDelete; // can you delete the ext (will be false for some built-in extensions)
|
||||
|
||||
private String[] args;
|
||||
private boolean isCorrupted = false;
|
||||
@ -53,6 +53,9 @@ public abstract class Extension {
|
||||
* @param args arguments
|
||||
*/
|
||||
public Extension(String[] args) {
|
||||
canLeave = canLeave();
|
||||
canDelete = canDelete();
|
||||
|
||||
//obtain port
|
||||
this.args = args;
|
||||
|
||||
@ -126,8 +129,8 @@ public abstract class Extension {
|
||||
.appendBoolean(file != null)
|
||||
.appendString(file == null ? "": file)
|
||||
.appendString(cookie == null ? "" : cookie)
|
||||
.appendBoolean(CANLEAVE)
|
||||
.appendBoolean(CANDELETE);
|
||||
.appendBoolean(canLeave)
|
||||
.appendBoolean(canDelete);
|
||||
writeToStream(response.toBytes());
|
||||
}
|
||||
else if (packet.headerId() == Extensions.OUTGOING_MESSAGES_IDS.CONNECTIONSTART) {
|
||||
@ -348,6 +351,14 @@ public abstract class Extension {
|
||||
*/
|
||||
protected void onEndConnection(){}
|
||||
|
||||
protected boolean canLeave() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean canDelete() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
ExtensionInfo getInfoAnnotations() {
|
||||
return getClass().getAnnotation(ExtensionInfo.class);
|
||||
|
@ -74,4 +74,12 @@ public abstract class ExtensionForm {
|
||||
* A connection with Habbo has ended
|
||||
*/
|
||||
protected void onEndConnection(){}
|
||||
|
||||
protected boolean canLeave() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean canDelete() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,16 @@ public class ExtensionFormLauncher extends Application{
|
||||
ExtensionInfo getInfoAnnotations() {
|
||||
return extInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canLeave() {
|
||||
return extensionForm.canLeave();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDelete() {
|
||||
return extensionForm.canDelete();
|
||||
}
|
||||
};
|
||||
extensionForm.primaryStage = primaryStage;
|
||||
Thread t = new Thread(() -> {
|
||||
|
Loading…
Reference in New Issue
Block a user