mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 00:37:55 +00:00
Merge pull request #150 from Parabot/feature/PushBulletNotifications
[FEATURE] Push Bullet Notifications
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<groupId>org.parabot</groupId>
|
||||
<artifactId>client</artifactId>
|
||||
<version>2.6.4</version>
|
||||
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
@@ -73,7 +73,7 @@
|
||||
<dependency>
|
||||
<groupId>org.parabot</groupId>
|
||||
<artifactId>internal-api</artifactId>
|
||||
<version>1.4.5</version>
|
||||
<version>1.4.5.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.parabot.core.lib.jpushbullet;
|
||||
|
||||
import org.parabot.core.Configuration;
|
||||
import org.parabot.core.Core;
|
||||
import org.parabot.core.Directories;
|
||||
import org.parabot.core.build.BuildPath;
|
||||
import org.parabot.core.lib.Library;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @author EmmaStone
|
||||
*/
|
||||
public class JPushBullet extends Library {
|
||||
private static boolean valid;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
if (!hasJar()) {
|
||||
System.err.println("Failed to load jpushbullet... [jar missing]");
|
||||
return;
|
||||
}
|
||||
Core.verbose("Adding jpushbullet jar file to build path: "
|
||||
+ getJarFileURL().getPath());
|
||||
BuildPath.add(getJarFileURL());
|
||||
|
||||
try {
|
||||
Class.forName("com.shakethat.jpushbullet.net.PushbulletClient");
|
||||
valid = true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.err
|
||||
.println("Failed to add jpushbullet to build path, or incorrupt download");
|
||||
}
|
||||
|
||||
Core.verbose("JPushBullet initialized.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAdded() {
|
||||
return valid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getJarFile() {
|
||||
return new File(Directories.getCachePath(), "jpushbullet.jar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDownloadLink() {
|
||||
try {
|
||||
return new URL(Configuration.LIBRARIES_DOWNLOAD + "/JPushBullet");
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresJar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLibraryName() {
|
||||
return "JPushBullet";
|
||||
}
|
||||
|
||||
public static boolean isValid() {
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user