mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-27 02:40:51 +01:00
finish extension console
This commit is contained in:
parent
23e28ba7a9
commit
6e5bc39489
@ -37,6 +37,7 @@ public class AdminOnConnect extends Extension {
|
||||
packet.replaceBoolean(14, true);
|
||||
|
||||
done = true;
|
||||
writeToConsole("Replaced user permissions");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user