finish extension console

This commit is contained in:
sirjonasxx 2020-04-27 17:58:53 +02:00
parent 23e28ba7a9
commit 6e5bc39489
4 changed files with 63 additions and 18 deletions

View File

@ -37,6 +37,7 @@ public class AdminOnConnect extends Extension {
packet.replaceBoolean(14, true);
done = true;
writeToConsole("Replaced user permissions");
}
}
}

View File

@ -160,7 +160,7 @@ public abstract class Extension implements IExtension {
}
else if (packet.headerId() == NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.INIT) {
initExtension();
writeToConsole("green","Extension \"" + getInfoAnnotations().Title() + "\" succesfully initialized");
writeToConsole("green","Extension \"" + getInfoAnnotations().Title() + "\" succesfully initialized", false);
}
else if (packet.headerId() == NetworkExtensionInfo.OUTGOING_MESSAGES_IDS.ONDOUBLECLICK) {
onClick();
@ -301,26 +301,40 @@ public abstract class Extension implements IExtension {
return true;
}
/**
* Write to the console in G-Earth
* @param s the text to be written
*/
public void writeToConsole(String s) {
HPacket packet = new HPacket(NetworkExtensionInfo.INCOMING_MESSAGES_IDS.EXTENSIONCONSOLELOG);
packet.appendString(s);
try {
writeToStream(packet.toBytes());
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Write to the console in G-Earth
* @param s the text to be written
*/
public void writeToConsole(String s) {
writeToConsole("black", s, true);
}
/**
* Write to the console in G-Earth
* @param s the text to be written
* @param colorClass color of the text to be written
*/
public void writeToConsole(String colorClass, String s) {
writeToConsole("[" + colorClass + "]" + s);
writeToConsole(colorClass, s, true);
}
/**
* Write to the console in G-Earth
* @param s the text to be written
* @param colorClass color of the text to be written
* @param mentionTitle log the extension title as well
*/
private void writeToConsole(String colorClass, String s, boolean mentionTitle) {
String text = "[" + colorClass + "]" + (mentionTitle ? (getInfoAnnotations().Title() + " --> ") : "") + s;
HPacket packet = new HPacket(NetworkExtensionInfo.INCOMING_MESSAGES_IDS.EXTENSIONCONSOLELOG);
packet.appendString(text);
try {
writeToStream(packet.toBytes());
} catch (IOException e) {
e.printStackTrace();
}
}

View File

@ -78,6 +78,12 @@ public class ExtensionLoggerController implements Initializable {
text = s;
}
if (text.contains(" --> ")) {
int index = text.indexOf(" --> ") + 5;
String extensionAnnouncement = text.substring(0, index);
text = text.substring(index);
elements.add(new Element(extensionAnnouncement, "black"));
}
elements.add(new Element(text + "\n", classname.toLowerCase()));
synchronized (appendOnLoad) {

View File

@ -11,8 +11,28 @@
-fx-fill: #ffff00;
}
.orange {
-fx-fill: orange;
}
.white {
-fx-fill: white;
}
.purple {
-fx-fill: purple;
}
.brown {
-fx-fill: brown;
}
.pink {
-fx-fill: pink;
}
.red {
-fx-fill: #b22222;
-fx-fill: red;
}
.black {
@ -20,10 +40,10 @@
}
.blue {
-fx-fill: #0066cc;
-fx-fill: blue;
}
.lightblue {
.cyan {
-fx-fill: cyan;
}
@ -31,6 +51,10 @@
-fx-fill: #73b504;
}
.darkergreen {
-fx-fill: green;
}
.dark {
-fx-background-color: #000000;
}