Skip to content
Snippets Groups Projects
Commit 33a28b6b authored by Miniontoby's avatar Miniontoby :writing_hand_tone1:
Browse files

Fixed some stuff...

parent 28268016
No related branches found
No related tags found
No related merge requests found
Showing
with 25 additions and 36 deletions
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -33,27 +33,8 @@ dependencies{
annotationProcessor "com.github.Anuken:jabel:$jabelVersion"
}
task jarAndroid{
dependsOn "jar"
doLast{
if(!sdkRoot || !new File(sdkRoot).exists()) throw new GradleException("No valid Android SDK found. Ensure that ANDROID_HOME is set to your Android SDK directory.");
def platformRoot = new File("$sdkRoot/platforms/").listFiles().sort().reverse().find{ f -> new File(f, "android.jar").exists()}
if(!platformRoot) throw new GradleException("No android.jar found. Ensure that you have an Android platform installed.")
//collect dependencies needed for desugaring
def dependencies = (configurations.compileClasspath.asList() + configurations.runtimeClasspath.asList() + [new File(platformRoot, "android.jar")]).collect{ "--classpath $it.path" }.join(" ")
//dex and desugar files - this requires d8 in your PATH
"d8 $dependencies --min-api 14 --output ${project.archivesBaseName}Android.jar ${project.archivesBaseName}Desktop.jar"
.execute(null, new File("$buildDir/libs")).waitForProcessOutput(System.out, System.err)
}
}
jar{
archiveFileName = "${project.archivesBaseName}Desktop.jar"
archiveFileName = "${project.archivesBaseName}.jar"
from{
configurations.runtimeClasspath.collect{ it.isDirectory() ? it : zipTree(it) }
......@@ -69,16 +50,14 @@ jar{
}
task deploy(type: Jar){
dependsOn jarAndroid
dependsOn jar
archiveFileName = "${project.archivesBaseName}.jar"
archiveFileName = "${project.archivesBaseName}Server.jar"
from{ [zipTree("$buildDir/libs/${project.archivesBaseName}Desktop.jar"), zipTree("$buildDir/libs/${project.archivesBaseName}Android.jar")] }
from{ [zipTree("$buildDir/libs/${project.archivesBaseName}.jar")] }
doLast{
delete{
delete "$buildDir/libs/${project.archivesBaseName}Desktop.jar"
delete "$buildDir/libs/${project.archivesBaseName}Android.jar"
delete "$buildDir/libs/${project.archivesBaseName}.jar"
}
}
}
No preview for this file type
No preview for this file type
File added
File deleted
File added
No preview for this file type
Manifest-Version: 1.0
......@@ -34,7 +34,7 @@ public class IRCBot extends Thread {
output = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream()));
}
private void disconnect() throws Exception {
public void disconnect() throws Exception {
connection.close();
}
......
......@@ -24,6 +24,8 @@ public class MindustrIRC extends Plugin {
static public String version = "1.0.0";
static public String ctcp_version = "MindustrIRC v" + version;
static private boolean started = false;
static public void ConsoleLog(String message){
Log.info("[MindustrIRC] " + message);
}
......@@ -68,21 +70,12 @@ public class MindustrIRC extends Plugin {
public void init(){
if(Vars.headless){
ConsoleLog("Loaded!");
Core.settings.defaults("ircServer", "irc.libera.chat", "ircPort", 6667, "ircNickname", "MindustrIRC", "ircChannel", "#mindustry");
if (Core.settings.has("ircServer") && Core.settings.has("ircPort") && Core.settings.has("ircNickname") && Core.settings.has("ircChannel")) {
server = Core.settings.getString("ircServer");
port = Core.settings.getInt("ircPort");
nickname = Core.settings.getString("ircNickname");
channel = Core.settings.getString("ircChannel");
} else {
Core.settings.put("ircServer", "irc.ircforever.org");
Core.settings.put("ircPort", 6667);
Core.settings.put("ircNickname", "MindustrIRC");
Core.settings.put("ircChannel", "#mindustry");
server = "irc.ircforever.org";
port = 6667;
nickname = "MindustrIRC";
channel = "#mindustry";
}
setupGameListeners();
connectToIRC();
......@@ -97,6 +90,21 @@ public class MindustrIRC extends Plugin {
}
static private void setupGameListeners(){
Events.on(PlayEvent.class, event -> {
if (!started) {
IRCMessage("The server just started hosting a game! Join now!", channel, true);
started = true;
} else if (Seqsize(Vars.net.getConnections()) != 0){
IRCMessage("A new game has started!", channel, true);
}
});
Events.on(DisposeEvent.class, event -> {
try {
bot.disconnect();
} catch (Exception ex) {
}
});
Events.on(GameOverEvent.class, event -> {
if (Seqsize(Vars.net.getConnections()) != 0){
IRCMessage("Game over!", channel, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment