essential-actions

Clone or download

Modified Files

M build.sh
+13 −13
--- 'a/build.sh'
+++ b/build.sh
@@ -80,43 +80,43 @@ text_block() {
twitch_chat() {
pushd . || exit
- cd twitch/twitch-chat-connect && ../mvn clean install -Dmaven.test.skip package
+ cd twitch/twitch-chat-connect && mvn clean install -Dmaven.test.skip package
mv target/twitch-chat-connect-*.jar ../../$FOLD/twitch-chat-connect.jar
- cd ../send-channel-msg && ../mvn clean -Dmaven.test.skip package
+ cd ../send-channel-msg && mvn clean -Dmaven.test.skip package
mv target/twitch-send-channel-msg-*.jar ../../$FOLD/twitch-send-channel-msg.jar
- cd ../clear-chat && ../mvn clean -Dmaven.test.skip package
+ cd ../clear-chat && mvn clean -Dmaven.test.skip package
mv target/twitch-clear-chat-*.jar ../../$FOLD/twitch-clear-chat.jar
- cd ../set-color && ../mvn clean -Dmaven.test.skip package
+ cd ../set-color && mvn clean -Dmaven.test.skip package
mv target/twitch-set-color-*.jar ../../$FOLD/twitch-set-color.jar
- cd ../whisper && ../mvn clean -Dmaven.test.skip package
+ cd ../whisper && mvn clean -Dmaven.test.skip package
mv target/twitch-whisper-*.jar ../../$FOLD/twitch-whisper.jar
- cd ../unraid && ../mvn clean -Dmaven.test.skip package
+ cd ../unraid && mvn clean -Dmaven.test.skip package
mv target/twitch-unraid-*.jar ../../$FOLD/twitch-unraid.jar
- cd ../unhost && ../mvn clean -Dmaven.test.skip package
+ cd ../unhost && mvn clean -Dmaven.test.skip package
mv target/twitch-unhost-*.jar ../../$FOLD/twitch-unhost.jar
- cd ../add-stream-marker && ../mvn clean -Dmaven.test.skip package
+ cd ../add-stream-marker && mvn clean -Dmaven.test.skip package
mv target/twitch-add-stream-marker-*.jar ../../$FOLD/twitch-add-stream-marker.jar
- cd ../host-channel && ../mvn clean -Dmaven.test.skip package
+ cd ../host-channel && mvn clean -Dmaven.test.skip package
mv target/twitch-host-channel-*.jar ../../$FOLD/twitch-host-channel.jar
- cd ../raid-channel && ../mvn clean -Dmaven.test.skip package
+ cd ../raid-channel && mvn clean -Dmaven.test.skip package
mv target/twitch-raid-channel-*.jar ../../$FOLD/twitch-raid-channel.jar
- cd ../start-commercial && ../mvn clean -Dmaven.test.skip package
+ cd ../start-commercial && mvn clean -Dmaven.test.skip package
mv target/twitch-start-commercial-*.jar ../../$FOLD/twitch-start-commercial.jar
- cd ../subs-only && ../mvn clean -Dmaven.test.skip package
+ cd ../subs-only && mvn clean -Dmaven.test.skip package
mv target/twitch-subs-only-*.jar ../../$FOLD/twitch-subs-only.jar
- cd ../slow-mode && ../mvn clean -Dmaven.test.skip package
+ cd ../slow-mode && mvn clean -Dmaven.test.skip package
mv target/twitch-slow-mode-*.jar ../../$FOLD/twitch-slow-mode.jar
popd || exit
--- 'a/hotkeyaction/.gitignore'
+++ b/hotkeyaction/.gitignore
@@ -1,5 +1,5 @@
.idea/
-HotkeyAction.iml
+*.iml
target/
--- 'a/hotkeyaction/pom.xml'
+++ b/hotkeyaction/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.stream-pi</groupId>
<artifactId>hotkeyaction</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1</version>
<build>
<plugins>
@@ -39,15 +39,9 @@
<properties>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
-
- <JavaFXVersion>16</JavaFXVersion>
-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
-
- <IkonliVersion>11.5.0</IkonliVersion>
- <IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
</properties>
<dependencies>
@@ -62,17 +56,5 @@
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
</dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-fontawesome5-pack</artifactId>
- <version>${IkonliFA5PackVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-javafx</artifactId>
- <version>${IkonliVersion}</version>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
--- 'a/hotkeyaction/src/main/java/com/stream_pi/hotkeyaction/HotkeyAction.java'
+++ b/hotkeyaction/src/main/java/com/stream_pi/hotkeyaction/HotkeyAction.java
@@ -23,11 +23,12 @@ public class HotkeyAction extends Normal
setAuthor("rnayabed");
setServerButtonGraphic("far-keyboard");
setHelpLink("https://github.com/stream-pi/essentialactions/blob/master/hotkeyaction/README.md");
- setVersion(new Version(2,0,0));
+ setVersion(new Version(2,0,1));
}
@Override
- public void initProperties() throws Exception {
+ public void initProperties()
+ {
Property keyCombination = new Property("key_comb", Type.STRING);
keyCombination.setDisplayName("Key combination (Separate using comma)");
@@ -38,12 +39,13 @@ public class HotkeyAction extends Normal
private Robot robot;
@Override
- public void initAction() throws Exception {
+ public void initAction()
+ {
Platform.runLater(()->robot = new Robot());
}
@Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
Property keyCombination = getClientProperties().getSingleProperty("key_comb");
@@ -52,15 +54,24 @@ public class HotkeyAction extends Normal
throw new MinorException("No key specified");
}
- press(keyCombination.getStringValue()
- .toUpperCase()
- .replace("?","SHIFT,/")
- .replace("|","SHIFT,\\")
- .split(",")
- );
+ try
+ {
+ press(keyCombination.getStringValue()
+ .toUpperCase()
+ .replace("?","SHIFT,/")
+ .replace("|","SHIFT,\\")
+ .split(",")
+ );
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ throw new MinorException("Interrupted while press called. \n"+e.getMessage());
+ }
}
- public void press(String[] characters) throws InterruptedException {
+ public void press(String[] characters) throws InterruptedException
+ {
ArrayList<KeyCode> pressedChars = new ArrayList<>();
@@ -116,7 +127,9 @@ public class HotkeyAction extends Normal
case "X": return X;
case "Y": return Y;
case "Z": return Z;
- case "`": return BACK_QUOTE;
+ case "`":
+ case "~":
+ return BACK_QUOTE;
case "0": return DIGIT0;
case "1": return DIGIT1;
case "2": return DIGIT2;
@@ -128,8 +141,7 @@ public class HotkeyAction extends Normal
case "8": return DIGIT8;
case "9": return DIGIT9;
case "-": return MINUS;
- case "=": return EQUALS;
- case "~": return BACK_QUOTE;
+ case "=": return EQUALS;
case "!": return EXCLAMATION_MARK;
case "@": return AT;
case "#": return NUMBER_SIGN;
@@ -142,10 +154,8 @@ public class HotkeyAction extends Normal
case "_": return UNDERSCORE;
case "+": return PLUS;
case "TAB": return TAB;
- case "[": return OPEN_BRACKET;
- case "]": return CLOSE_BRACKET;
- case "{": return OPEN_BRACKET;
- case "}": return CLOSE_BRACKET;
+ case "[": case "{" : return OPEN_BRACKET;
+ case "]": case "}" : return CLOSE_BRACKET;
case ";": return SEMICOLON;
case ":": return COLON;
case "\\": return BACK_SLASH;
@@ -305,11 +315,5 @@ public class HotkeyAction extends Normal
{
Platform.runLater(()->robot.keyRelease(keyCode));
}
-
- @Override
- public void onShutDown() throws Exception {
- // TODO Auto-generated method stub
-
- }
}
--- 'a/mediakeyaction/.gitignore'
+++ b/mediakeyaction/.gitignore
@@ -1,5 +1,5 @@
.idea/
-MediaKeyAction.iml
+*.iml
target/
--- 'a/mediakeyaction/pom.xml'
+++ b/mediakeyaction/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.stream-pi</groupId>
<artifactId>mediakeyaction</artifactId>
- <version>1.1.0</version>
+ <version>1.1.1</version>
<build>
<plugins>
@@ -45,9 +45,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
-
- <IkonliVersion>11.5.0</IkonliVersion>
- <IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
</properties>
<dependencies>
@@ -68,17 +65,5 @@
<artifactId>javafx-media</artifactId>
<version>${JavaFXVersion}</version>
</dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-fontawesome5-pack</artifactId>
- <version>${IkonliFA5PackVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-javafx</artifactId>
- <version>${IkonliVersion}</version>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
--- 'a/mediakeyaction/src/main/java/com/stream_pi/mediakeyaction/MediaKeyAction.java'
+++ b/mediakeyaction/src/main/java/com/stream_pi/mediakeyaction/MediaKeyAction.java
@@ -3,11 +3,13 @@ package com.stream_pi.mediakeyaction;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.platform.Platform;
import com.stream_pi.util.version.Version;
import java.io.*;
import java.util.List;
+import java.util.Objects;
public class MediaKeyAction extends NormalAction
{
@@ -19,11 +21,12 @@ public class MediaKeyAction extends Norm
setAuthor("rnayabed");
setServerButtonGraphic("fas-volume-up");
setHelpLink("https://github.com/stream-pi/essentialactions/tree/master/mediakeyaction");
- setVersion(new Version(1,1,0));
+ setVersion(new Version(1,1,1));
}
@Override
- public void initProperties() throws Exception {
+ public void initProperties() throws MinorException
+ {
List<String> states = List.of("Play/Pause", "Previous", "Next", "Vol Up", "Vol Down", "Mute", "Stop");
Property mediaKeyTypeProperty = new Property("media_key_type", Type.LIST);
@@ -34,17 +37,27 @@ public class MediaKeyAction extends Norm
}
@Override
- public void initAction() throws Exception {
- if(getServerConnection().getPlatform() == Platform.WINDOWS)
- extractKeyEXEToTmpDirectory();
+ public void initAction() throws MinorException
+ {
+ try
+ {
+ if(getServerConnection().getPlatform() == Platform.WINDOWS)
+ extractKeyEXEToTmpDirectory();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ throw new MinorException("Error","IOException occurred. \n\n"+e.getMessage());
+ }
+
}
private static String absolutePathToExe;
- private void extractKeyEXEToTmpDirectory() throws Exception
+ private void extractKeyEXEToTmpDirectory() throws IOException
{
String tmpDirectory = System.getProperty("java.io.tmpdir");
- InputStream is = getClass().getResource("key.exe").openStream();
+ InputStream is = Objects.requireNonNull(getClass().getResource("key.exe")).openStream();
absolutePathToExe = tmpDirectory+"/key.exe";
File file = new File(absolutePathToExe);
file.deleteOnExit();
@@ -62,7 +75,7 @@ public class MediaKeyAction extends Norm
}
@Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
int state = getClientProperties().getSingleProperty("media_key_type").getSelectedIndex();
@@ -81,12 +94,6 @@ public class MediaKeyAction extends Norm
}
}
- @Override
- public void onShutDown()
- {
-
- }
-
private void runCommand(String command) throws Exception
{
Runtime rt = Runtime.getRuntime();
@@ -94,7 +101,7 @@ public class MediaKeyAction extends Norm
pr.waitFor();
}
- private void linuxHandler(int state) throws Exception
+ private void linuxHandler(int state)
{
try
{
@@ -119,7 +126,8 @@ public class MediaKeyAction extends Norm
}
}
- private void windowsHandler(int state) throws Exception {
+ private void windowsHandler(int state)
+ {
try
{
String exe = "\""+absolutePathToExe+"\"";
--- 'a/playaudioclipaction/.gitignore'
+++ b/playaudioclipaction/.gitignore
@@ -1,6 +1,6 @@
.idea/
target/
-WebsiteAction.iml
+*.iml
.classpath
.factorypath
.project
--- 'a/playaudioclipaction/pom.xml'
+++ b/playaudioclipaction/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.stream-pi</groupId>
<artifactId>playaudioclipaction</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1</version>
<build>
<plugins>
@@ -45,9 +45,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
-
- <IkonliVersion>11.5.0</IkonliVersion>
- <IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
</properties>
<dependencies>
@@ -68,17 +65,5 @@
<artifactId>javafx-media</artifactId>
<version>${JavaFXVersion}</version>
</dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-fontawesome5-pack</artifactId>
- <version>${IkonliFA5PackVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-javafx</artifactId>
- <version>${IkonliVersion}</version>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
--- 'a/playaudioclipaction/src/main/java/com/stream_pi/playaudioclipaction/PlayAudioClipAction.java'
+++ b/playaudioclipaction/src/main/java/com/stream_pi/playaudioclipaction/PlayAudioClipAction.java
@@ -7,6 +7,7 @@ import com.stream_pi.action_api.actionpr
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import javafx.application.Platform;
@@ -14,7 +15,8 @@ import javafx.scene.media.AudioClip;
import java.io.File;
-public class PlayAudioClipAction extends NormalAction {
+public class PlayAudioClipAction extends NormalAction
+{
public PlayAudioClipAction()
{
@@ -23,11 +25,11 @@ public class PlayAudioClipAction extends
setAuthor("rnayabed");
setServerButtonGraphic("fas-volume-up");
setHelpLink("https://github.com/Stream-Pi/EssentialActions");
- setVersion(new Version(2,0,0));
+ setVersion(new Version(2,0,1));
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property audioFileLocationProperty = new Property("audio_location", Type.STRING);
audioFileLocationProperty.setControlType(ControlType.FILE_PATH);
@@ -49,7 +51,7 @@ public class PlayAudioClipAction extends
public String path = null;
@Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
Property audioFileLocationProperty = getClientProperties().getSingleProperty("audio_location");
@@ -101,9 +103,9 @@ public class PlayAudioClipAction extends
if(mediaPlayer != null)
{
if(mediaPlayer.isPlaying())
+ {
Platform.runLater(mediaPlayer::stop);
+ }
}
}
-
-
}
--- 'a/runcommandaction/.gitignore'
+++ b/runcommandaction/.gitignore
@@ -1,6 +1,6 @@
.idea/
target/
-WebsiteAction.iml
+*.iml
.classpath
.factorypath
.project
--- 'a/runcommandaction/pom.xml'
+++ b/runcommandaction/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.stream-pi</groupId>
<artifactId>runcommandaction</artifactId>
- <version>1.1.0</version>
+ <version>1.1.1</version>
<build>
<plugins>
@@ -43,9 +43,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
-
- <IkonliVersion>11.5.0</IkonliVersion>
- <IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
</properties>
<dependencies>
@@ -60,17 +57,5 @@
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
</dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-fontawesome5-pack</artifactId>
- <version>${IkonliFA5PackVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-javafx</artifactId>
- <version>${IkonliVersion}</version>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
--- 'a/runcommandaction/src/main/java/com/stream_pi/runcommandaction/RunCommandAction.java'
+++ b/runcommandaction/src/main/java/com/stream_pi/runcommandaction/RunCommandAction.java
@@ -3,10 +3,13 @@ package com.stream_pi.runcommandaction;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
+import java.io.IOException;
-public class RunCommandAction extends NormalAction {
+public class RunCommandAction extends NormalAction
+{
public RunCommandAction()
{
@@ -19,7 +22,8 @@ public class RunCommandAction extends No
}
@Override
- public void initProperties() throws Exception {
+ public void initProperties()
+ {
Property commandProperty = new Property("command", Type.STRING);
commandProperty.setDisplayName("Command");
@@ -27,24 +31,22 @@ public class RunCommandAction extends No
}
@Override
- public void initAction() throws Exception {
-
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
- runCommand(getClientProperties().getSingleProperty("command").getStringValue());
- }
-
- @Override
- public void onShutDown() throws Exception {
- // TODO Auto-generated method stub
+ String command = getClientProperties().getSingleProperty("command").getStringValue();
+ try
+ {
+ runCommand(command);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ throw new MinorException("Unable to run command \n\n"+command+"\n\n.Reason:\n"+e.getMessage());
+ }
}
- private void runCommand(String command) throws Exception
+ private void runCommand(String command) throws IOException
{
Runtime rt = Runtime.getRuntime();
rt.exec(command);
--- 'a/runcommandaction/src/main/java/module-info.java'
+++ b/runcommandaction/src/main/java/module-info.java
@@ -1,4 +1,3 @@
-
module com.stream_pi.runcommandaction
{
requires com.stream_pi.action_api;
@@ -8,5 +7,4 @@ module com.stream_pi.runcommandaction
requires org.kordamp.ikonli.fontawesome5;
provides com.stream_pi.action_api.externalplugin.ExternalPlugin with com.stream_pi.runcommandaction.RunCommandAction;
-
}
\ No newline at end of file
--- 'a/textblockaction/.gitignore'
+++ b/textblockaction/.gitignore
@@ -1,5 +1,5 @@
.idea/
-HotkeyAction.iml
+*.iml
target/
--- 'a/textblockaction/pom.xml'
+++ b/textblockaction/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.stream-pi</groupId>
<artifactId>textblockaction</artifactId>
- <version>1.0.0</version>
+ <version>1.0.1</version>
<build>
<plugins>
@@ -40,14 +40,9 @@
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
- <JavaFXVersion>16-ea+4</JavaFXVersion>
-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
-
- <IkonliVersion>11.5.0</IkonliVersion>
- <IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
</properties>
<dependencies>
@@ -62,17 +57,5 @@
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
</dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-fontawesome5-pack</artifactId>
- <version>${IkonliFA5PackVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-javafx</artifactId>
- <version>${IkonliVersion}</version>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
--- 'a/textblockaction/src/main/java/com/stream_pi/textblockaction/TextBlockAction.java'
+++ b/textblockaction/src/main/java/com/stream_pi/textblockaction/TextBlockAction.java
@@ -3,13 +3,14 @@ package com.stream_pi.textblockaction;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import static java.awt.event.KeyEvent.*;
import java.awt.*;
-public class TextBlockAction extends NormalAction {
-
+public class TextBlockAction extends NormalAction
+{
public TextBlockAction()
{
setName("Text Block");
@@ -17,11 +18,12 @@ public class TextBlockAction extends Nor
setAuthor("rnayabed");
setServerButtonGraphic("fas-keyboard");
setHelpLink("https://github.com/stream-pi/essentialactions");
- setVersion(new Version(1,0,0));
+ setVersion(new Version(1,0,1));
}
@Override
- public void initProperties() throws Exception {
+ public void initProperties() throws MinorException
+ {
Property textBlockProperty = new Property("text_block", Type.STRING);
textBlockProperty.setDisplayName("Text");
textBlockProperty.setDefaultValueStr("Stream-Pi FTW");
@@ -34,19 +36,28 @@ public class TextBlockAction extends Nor
private Robot robot;
@Override
- public void initAction() throws Exception {
- robot = new Robot();
+ public void initAction() throws MinorException
+ {
+ try
+ {
+ robot = new Robot();
+ }
+ catch (AWTException e)
+ {
+ e.printStackTrace();
+ throw new MinorException("Unable to start AWT Robot");
+ }
}
@Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
Property textBlockProperty = getClientProperties().getSingleProperty("text_block");
type(textBlockProperty.getStringValue());
}
- public void type(String toType) throws Exception
+ public void type(String toType)
{
release(VK_CAPS_LOCK);
release(VK_SHIFT);
@@ -66,7 +77,7 @@ public class TextBlockAction extends Nor
}
private boolean isShiftOn = false;
- public void pressAndReleaseKey(char c) throws Exception
+ public void pressAndReleaseKey(char c)
{
if(Character.isUpperCase(c))
{
@@ -189,11 +200,5 @@ public class TextBlockAction extends Nor
{
robot.keyRelease(keyCode);
}
-
- @Override
- public void onShutDown() throws Exception {
- // TODO Auto-generated method stub
-
- }
}
--- 'a/textblockaction/src/main/java/module-info.java'
+++ b/textblockaction/src/main/java/module-info.java
@@ -1,6 +1,5 @@
-import com.stream_pi.textblockaction.TextBlockAction;
-
-module com.stream_pi.textblockaction {
+module com.stream_pi.textblockaction
+{
requires com.stream_pi.action_api;
requires com.stream_pi.util;
@@ -9,6 +8,5 @@ module com.stream_pi.textblockaction {
requires java.desktop;
- provides com.stream_pi.action_api.externalplugin.ExternalPlugin with TextBlockAction;
-
+ provides com.stream_pi.action_api.externalplugin.ExternalPlugin with com.stream_pi.textblockaction.TextBlockAction;
}
\ No newline at end of file
--- 'a/twitch/add-stream-marker/src/main/java/addstreammarker/AddStreamMarkerAction.java'
+++ b/twitch/add-stream-marker/src/main/java/addstreammarker/AddStreamMarkerAction.java
@@ -5,7 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
-import com.stream_pi.util.exception.StreamPiException;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -28,7 +28,7 @@ public class AddStreamMarkerAction exten
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property channelName = new Property(channelNameKey, Type.STRING);
channelName.setDisplayName("Channel Name");
@@ -42,13 +42,7 @@ public class AddStreamMarkerAction exten
}
@Override
- public void initAction() throws Exception
- {
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -68,21 +62,23 @@ public class AddStreamMarkerAction exten
}
} catch (Exception ex)
{
- throw new StreamPiException(
- "Failed to add marker to stream", "Could not add stream marker, please try again."
+ throw new MinorException(
+ "Failed to add marker to stream\nCould not add stream marker, please try again."
);
}
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null) {
try
{
twirk.disconnect();
- } catch (Exception ex) {
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ }
+ catch (Exception ex)
+ {
+ throw new MinorException("Twitch connection error - Please try again.");
}
}
}
--- 'a/twitch/clear-chat/src/main/java/clearchat/ClearChatAction.java'
+++ b/twitch/clear-chat/src/main/java/clearchat/ClearChatAction.java
@@ -5,6 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.StreamPiException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -17,7 +18,7 @@ public class ClearChatAction extends Nor
private Twirk twirk;
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
setName("Clear Chat");
setCategory("Twitch Chat");
@@ -28,7 +29,7 @@ public class ClearChatAction extends Nor
}
@Override
- public void initAction() throws Exception
+ public void initAction() throws MinorException
{
Property channelName = new Property(channelNameKey, Type.STRING);
channelName.setDisplayName("Channel Name");
@@ -39,7 +40,7 @@ public class ClearChatAction extends Nor
}
@Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -53,15 +54,14 @@ public class ClearChatAction extends Nor
twirk.channelMessage("/clear");
} catch (Exception ex)
{
- throw new StreamPiException(
- "Failed to clear channel chat",
- String.format("Could not clear chat for '%s' channel, please try again.", channel)
+ throw new MinorException(
+ String.format("Could not clear chat for '%s' channel, please try again.", channel)
);
}
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null)
{
@@ -70,7 +70,7 @@ public class ClearChatAction extends Nor
twirk.disconnect();
} catch (Exception ex)
{
- throw new StreamPiException("Twitch Connection error", "Please try again.");
+ throw new MinorException("Twitch Connection error - Please try again.");
}
}
}
--- 'a/twitch/host-channel/src/main/java/hostchannel/HostChannelAction.java'
+++ b/twitch/host-channel/src/main/java/hostchannel/HostChannelAction.java
@@ -5,7 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
-import com.stream_pi.util.exception.StreamPiException;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -28,7 +28,7 @@ public class HostChannelAction extends N
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property channel = new Property(channelKey, Type.STRING);
channel.setDisplayName("Channel");
@@ -44,13 +44,7 @@ public class HostChannelAction extends N
}
@Override
- public void initAction() throws Exception
- {
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -65,21 +59,21 @@ public class HostChannelAction extends N
twirk.channelMessage(String.format("/host %s", channelToHost));
} catch (Exception ex)
{
- throw new StreamPiException(
+ throw new MinorException(
"Failed to host channel",
String.format("Could not host channel '%s', please try again.", channelToHost));
}
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null) {
try
{
twirk.disconnect();
} catch (Exception ex) {
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error - Please try again.");
}
}
}
--- 'a/twitch/raid-channel/src/main/java/raidchannel/RaidChannelAction.java'
+++ b/twitch/raid-channel/src/main/java/raidchannel/RaidChannelAction.java
@@ -5,7 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
-import com.stream_pi.util.exception.StreamPiException;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -28,7 +28,7 @@ public class RaidChannelAction extends N
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property channel = new Property(channelKey, Type.STRING);
channel.setDisplayName("Channel");
@@ -44,13 +44,7 @@ public class RaidChannelAction extends N
}
@Override
- public void initAction() throws Exception
- {
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -65,21 +59,19 @@ public class RaidChannelAction extends N
twirk.channelMessage(String.format("/raid %s", channelToRaid));
} catch (Exception ex)
{
- throw new StreamPiException(
- "Failed to raid channel",
- String.format("Could not raid channel '%s', please try again.", channelToRaid));
+ throw new MinorException(String.format("Could not raid channel '%s', please try again.", channelToRaid));
}
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null) {
try
{
twirk.disconnect();
} catch (Exception ex) {
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error - Please try again.");
}
}
}
--- 'a/twitch/send-channel-msg/src/main/java/sendchannelmsg/SendChannelMessageAction.java'
+++ b/twitch/send-channel-msg/src/main/java/sendchannelmsg/SendChannelMessageAction.java
@@ -5,7 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
-import com.stream_pi.util.exception.StreamPiException;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -28,7 +28,7 @@ public class SendChannelMessageAction ex
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property channelName = new Property(channelNameKey, Type.STRING);
channelName.setDisplayName("Channel Name");
@@ -44,13 +44,7 @@ public class SendChannelMessageAction ex
}
@Override
- public void initAction() throws Exception
- {
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -65,7 +59,7 @@ public class SendChannelMessageAction ex
twirk.channelMessage(message);
} catch (Exception ex)
{
- throw new StreamPiException(
+ throw new MinorException(
"Failed to send channel message",
String.format("Could not send message '%s' to '%s' channel, please try again.",
channel, message)
@@ -74,14 +68,14 @@ public class SendChannelMessageAction ex
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null) {
try
{
twirk.disconnect();
} catch (Exception ex) {
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error", "Please try again.");
}
}
}
--- 'a/twitch/set-color/src/main/java/setcolor/SetColorAction.java'
+++ b/twitch/set-color/src/main/java/setcolor/SetColorAction.java
@@ -5,7 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
-import com.stream_pi.util.exception.StreamPiException;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -18,7 +18,7 @@ public class SetColorAction extends Norm
private Twirk twirk;
@Override
- public void initProperties() throws Exception
+ public void initProperties()
{
setName("Set Color");
setCategory("Twitch Chat");
@@ -29,7 +29,7 @@ public class SetColorAction extends Norm
}
@Override
- public void initAction() throws Exception
+ public void initAction() throws MinorException
{
Property channelName = new Property(channelNameKey, Type.STRING);
channelName.setDisplayName("Channel Name");
@@ -45,7 +45,7 @@ public class SetColorAction extends Norm
}
@Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -60,7 +60,7 @@ public class SetColorAction extends Norm
twirk.channelMessage(String.format("/color %s", color));
} catch (Exception ex)
{
- throw new StreamPiException(
+ throw new MinorException(
"Failed to change username color",
String.format("Could not change username color to '%s' for '%s' channel, please try again.",
color, channel)
@@ -69,14 +69,14 @@ public class SetColorAction extends Norm
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null) {
try
{
twirk.disconnect();
} catch (Exception ex) {
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error", "Please try again.");
}
}
}
--- 'a/twitch/slow-mode/src/main/java/slow_mode/SlowModeAction.java'
+++ b/twitch/slow-mode/src/main/java/slow_mode/SlowModeAction.java
@@ -8,7 +8,6 @@ import com.stream_pi.action_api.actionpr
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.ToggleAction;
import com.stream_pi.util.exception.MinorException;
-import com.stream_pi.util.exception.StreamPiException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -46,7 +45,7 @@ public class SlowModeAction extends Togg
}
@Override
- public void onToggleOn() throws Exception
+ public void onToggleOn() throws MinorException
{
try
{
@@ -56,12 +55,12 @@ public class SlowModeAction extends Togg
} catch (Exception ex)
{
setCurrentStatus(false);
- throw new StreamPiException("Failed to enable slow mode.", "Please try again.");
+ throw new MinorException("Failed to enable slow mode.", "Please try again.");
}
}
@Override
- public void onToggleOff() throws Exception
+ public void onToggleOff() throws MinorException
{
try
{
@@ -70,7 +69,7 @@ public class SlowModeAction extends Togg
} catch (Exception ex)
{
setCurrentStatus(true);
- throw new StreamPiException("Failed to disable slow mode.", "Please try again.");
+ throw new MinorException("Failed to disable slow mode.", "Please try again.");
}
}
@@ -108,13 +107,13 @@ public class SlowModeAction extends Togg
twirk.connect();
} catch (Exception ex)
{
- throw new StreamPiException("Failed to connect to Twitch",
+ throw new MinorException("Failed to connect to Twitch",
String.format("Could not connect to '%s' channel.", channel));
}
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null)
{
@@ -123,7 +122,7 @@ public class SlowModeAction extends Togg
twirk.disconnect();
} catch (Exception ex)
{
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error", "Please try again.");
}
}
}
--- 'a/twitch/start-commercial/src/main/java/startcommercial/StartCommercialAction.java'
+++ b/twitch/start-commercial/src/main/java/startcommercial/StartCommercialAction.java
@@ -5,7 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
-import com.stream_pi.util.exception.StreamPiException;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -30,7 +30,7 @@ public class StartCommercialAction exten
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property channelName = new Property(channelNameKey, Type.STRING);
channelName.setDisplayName("Channel Name");
@@ -51,13 +51,7 @@ public class StartCommercialAction exten
}
@Override
- public void initAction() throws Exception
- {
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -72,20 +66,20 @@ public class StartCommercialAction exten
twirk.channelMessage(String.format("/commercial %s", duration));
} catch (Exception ex)
{
- throw new StreamPiException(
+ throw new MinorException(
"Failed to start commercial", "Could not start commercial, please try again.");
}
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null) {
try
{
twirk.disconnect();
} catch (Exception ex) {
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error", "Please try again.");
}
}
}
--- 'a/twitch/subs-only/src/main/java/subs_only/SubsOnlyAction.java'
+++ b/twitch/subs-only/src/main/java/subs_only/SubsOnlyAction.java
@@ -8,7 +8,6 @@ import com.stream_pi.action_api.actionpr
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.ToggleAction;
import com.stream_pi.util.exception.MinorException;
-import com.stream_pi.util.exception.StreamPiException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -42,7 +41,7 @@ public class SubsOnlyAction extends Togg
}
@Override
- public void onToggleOn() throws Exception
+ public void onToggleOn() throws MinorException
{
try
{
@@ -51,12 +50,12 @@ public class SubsOnlyAction extends Togg
} catch (Exception ex)
{
setCurrentStatus(false);
- throw new StreamPiException("Failed to enable subscribers only mode.", "Please try again.");
+ throw new MinorException("Failed to enable subscribers only mode.", "Please try again.");
}
}
@Override
- public void onToggleOff() throws Exception
+ public void onToggleOff() throws MinorException
{
try
{
@@ -65,7 +64,7 @@ public class SubsOnlyAction extends Togg
} catch (Exception ex)
{
setCurrentStatus(true);
- throw new StreamPiException("Failed to disable subscribers only mode.", "Please try again.");
+ throw new MinorException("Failed to disable subscribers only mode.", "Please try again.");
}
}
@@ -105,13 +104,13 @@ public class SubsOnlyAction extends Togg
twirk.connect();
} catch (Exception ex)
{
- throw new StreamPiException("Failed to connect to Twitch",
+ throw new MinorException("Failed to connect to Twitch",
String.format("Could not connect to '%s' channel.", channel));
}
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null)
{
@@ -120,7 +119,7 @@ public class SubsOnlyAction extends Togg
twirk.disconnect();
} catch (Exception ex)
{
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error", "Please try again.");
}
}
}
--- 'a/twitch/twitch-chat-connect/src/main/java/connect/TwitchChatConnectAction.java'
+++ b/twitch/twitch-chat-connect/src/main/java/connect/TwitchChatConnectAction.java
@@ -34,6 +34,12 @@ public class TwitchChatConnectAction ext
}
@Override
+ public void onActionClicked() throws MinorException
+ {
+
+ }
+
+ @Override
public void initProperties() throws MinorException
{
Property twitchNicknameProp = new Property(NICKNAME_KEY, Type.STRING);
@@ -88,14 +94,4 @@ public class TwitchChatConnectAction ext
}
});
}
-
- @Override
- public void onActionClicked() throws Exception
- {
- }
-
- @Override
- public void onShutDown() throws Exception
- {
- }
}
--- 'a/twitch/twitch-chat-connect/src/main/java/connect/chat/TwitchChatCredentials.java'
+++ b/twitch/twitch-chat-connect/src/main/java/connect/chat/TwitchChatCredentials.java
@@ -1,5 +1,6 @@
package connect.chat;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.StreamPiException;
public final class TwitchChatCredentials
@@ -22,7 +23,8 @@ public final class TwitchChatCredentials
String nickname;
String oauthToken;
- public void ensureCredentialsInitialized() throws Exception {
+ public void ensureCredentialsInitialized() throws MinorException
+ {
final String twitchNickname = nickname;
boolean isNicknameInitialized = twitchNickname != null && !twitchNickname.isEmpty();
@@ -30,8 +32,8 @@ public final class TwitchChatCredentials
boolean isTokenInitialized = twitchChatOauthToken != null && !twitchChatOauthToken.isEmpty();
if (!isNicknameInitialized && !isTokenInitialized) {
- throw new StreamPiException(
- "Twitch Chat config uninitialized.",
+ throw new MinorException(
+ "Twitch Chat config uninitialized\n"+
"Please check that the Twitch Chat plugin configuration is correct.");
}
}
--- 'a/twitch/unhost/src/main/java/unhost/UnhostAction.java'
+++ b/twitch/unhost/src/main/java/unhost/UnhostAction.java
@@ -5,7 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
-import com.stream_pi.util.exception.StreamPiException;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -27,7 +27,7 @@ public class UnhostAction extends Normal
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property channel = new Property(channelNameKey, Type.STRING);
channel.setDisplayName("Channel");
@@ -38,13 +38,7 @@ public class UnhostAction extends Normal
}
@Override
- public void initAction() throws Exception
- {
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -58,21 +52,21 @@ public class UnhostAction extends Normal
twirk.channelMessage("/unhost");
} catch (Exception ex)
{
- throw new StreamPiException(
+ throw new MinorException(
"Failed to cancel channel hosting",
"Could not cancel channel hosting, please try again.");
}
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null) {
try
{
twirk.disconnect();
} catch (Exception ex) {
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error", "Please try again.");
}
}
}
--- 'a/twitch/unraid/src/main/java/unraid/UnraidAction.java'
+++ b/twitch/unraid/src/main/java/unraid/UnraidAction.java
@@ -5,7 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
-import com.stream_pi.util.exception.StreamPiException;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -27,7 +27,7 @@ public class UnraidAction extends Normal
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property channel = new Property(channelNameKey, Type.STRING);
channel.setDisplayName("Channel");
@@ -38,13 +38,7 @@ public class UnraidAction extends Normal
}
@Override
- public void initAction() throws Exception
- {
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -58,21 +52,21 @@ public class UnraidAction extends Normal
twirk.channelMessage("/unraid");
} catch (Exception ex)
{
- throw new StreamPiException(
+ throw new MinorException(
"Failed to cancel channel raid",
"Could not cancel channel raid, please try again.");
}
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null) {
try
{
twirk.disconnect();
} catch (Exception ex) {
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error", "Please try again.");
}
}
}
--- 'a/twitch/whisper/src/main/java/whisper/WhisperAction.java'
+++ b/twitch/whisper/src/main/java/whisper/WhisperAction.java
@@ -5,7 +5,7 @@ import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
-import com.stream_pi.util.exception.StreamPiException;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
@@ -28,7 +28,7 @@ public class WhisperAction extends Norma
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property usernameProp = new Property(usernameKey, Type.STRING);
usernameProp.setDisplayName("Twitch Username");
@@ -44,13 +44,7 @@ public class WhisperAction extends Norma
}
@Override
- public void initAction() throws Exception
- {
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
final TwitchChatCredentials.ChatCredentials credentials = TwitchChatCredentials.getCredentials();
credentials.ensureCredentialsInitialized();
@@ -65,7 +59,7 @@ public class WhisperAction extends Norma
twirk.whisper(username, message);
} catch (Exception ex)
{
- throw new StreamPiException(
+ throw new MinorException(
"Failed to send message to user",
String.format("Could not send message '%s' to user '%s', please try again.",
username, message)
@@ -74,14 +68,14 @@ public class WhisperAction extends Norma
}
@Override
- public void onShutDown() throws Exception
+ public void onShutDown() throws MinorException
{
if (twirk != null) {
try
{
twirk.disconnect();
} catch (Exception ex) {
- throw new StreamPiException("Twitch connection error", "Please try again.");
+ throw new MinorException("Twitch connection error", "Please try again.");
}
}
}
--- 'a/twitteraction/pom.xml'
+++ b/twitteraction/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.stream-pi</groupId>
<artifactId>twitteraction</artifactId>
- <version>1.0.1</version>
+ <version>1.0.2</version>
<build>
<plugins>
@@ -40,27 +40,17 @@
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
- <JavaFXVersion>16-ea+5</JavaFXVersion>
-
+ <Twitter4JVersion>4.0.7</Twitter4JVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
-
- <IkonliVersion>11.5.0</IkonliVersion>
- <IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
</properties>
<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
- <version>4.0.7</version>
- </dependency>
-
- <dependency>
- <groupId>org.openjfx</groupId>
- <artifactId>javafx-controls</artifactId>
- <version>${JavaFXVersion}</version>
+ <version>${Twitter4JVersion}</version>
</dependency>
<dependency>
@@ -74,17 +64,5 @@
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
</dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-fontawesome5-pack</artifactId>
- <version>${IkonliFA5PackVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-javafx</artifactId>
- <version>${IkonliVersion}</version>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
--- 'a/twitteraction/src/main/java/com/stream_pi/twitteraction/TwitterAction.java'
+++ b/twitteraction/src/main/java/com/stream_pi/twitteraction/TwitterAction.java
@@ -7,6 +7,7 @@ import com.stream_pi.action_api.external
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertListener;
import com.stream_pi.util.alert.StreamPiAlertType;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.uihelper.HBoxInputBox;
import com.stream_pi.util.version.Version;
import javafx.application.Platform;
@@ -18,12 +19,15 @@ import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import twitter4j.Twitter;
+import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken;
import twitter4j.auth.RequestToken;
import twitter4j.conf.ConfigurationBuilder;
-public class TwitterAction extends NormalAction {
+
+public class TwitterAction extends NormalAction
+{
Button loginAsNewUserButton, logoutButton;
@@ -34,7 +38,7 @@ public class TwitterAction extends Norma
setAuthor("rnayabed");
setServerButtonGraphic("fab-twitter");
setHelpLink("https://github.com/stream-pi/essentialactions");
- setVersion(new Version(1,0,1));
+ setVersion(new Version(1,0,2));
loginAsNewUserButton = new Button("Login as new user");
@@ -98,7 +102,7 @@ public class TwitterAction extends Norma
}
@Override
- public void initProperties() throws Exception
+ public void initProperties() throws MinorException
{
Property oAuthConsumerKey = new Property("consumer_key", Type.STRING);
oAuthConsumerKey.setDisplayName("API Key");
@@ -234,9 +238,8 @@ public class TwitterAction extends Norma
TwitterFactory tf;
@Override
- public void initAction() throws Exception {
- //System.setProperty("twitter4j.http.useSSL", "true");
-
+ public void initAction() throws MinorException
+ {
setNewTwitterConfig(
getServerProperties().getSingleProperty("consumer_key").getStringValue(),
getServerProperties().getSingleProperty("consumer_key_secret").getStringValue(),
@@ -259,20 +262,25 @@ public class TwitterAction extends Norma
}
@Override
- public void onActionClicked() throws Exception {
+ public void onActionClicked() throws MinorException
+ {
Twitter twitter = tf.getInstance();
- twitter.updateStatus(getClientProperties().getSingleProperty("tweet").getStringValue());
+ try
+ {
+ twitter.updateStatus(
+ getClientProperties().getSingleProperty("tweet").getStringValue()
+ );
+ } catch (TwitterException e)
+ {
+ e.printStackTrace();
+ throw new MinorException("Unable to update Twitter : "+e.getMessage());
+ }
}
- /*public String addRandomBlank(String value)
+ /*
+ TOP SECRET - If you found this then congrats :D (you probably know why)
+ public String getRandomBlanks()
{
- return value+("⠀".repeat(new Random().nextInt(100)));
+ return "⠀".repeat(new Random().nextInt(100));
}*/
-
- @Override
- public void onShutDown() throws Exception {
- // TODO Auto-generated method stub
-
- }
-
}
--- 'a/twitteraction/src/main/java/module-info.java'
+++ b/twitteraction/src/main/java/module-info.java
@@ -1,4 +1,5 @@
-module com.stream_pi.twitteraction {
+module com.stream_pi.twitteraction
+{
requires com.stream_pi.action_api;
requires com.stream_pi.util;
--- 'a/websiteaction/pom.xml'
+++ b/websiteaction/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.stream-pi</groupId>
<artifactId>websiteaction</artifactId>
- <version>1.0.0</version>
+ <version>1.0.1</version>
<build>
<plugins>
@@ -40,14 +40,9 @@
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
- <JavaFXVersion>16-ea+6</JavaFXVersion>
-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
-
- <IkonliVersion>11.5.0</IkonliVersion>
- <IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
</properties>
<dependencies>
@@ -62,17 +57,5 @@
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
</dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-fontawesome5-pack</artifactId>
- <version>${IkonliFA5PackVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-javafx</artifactId>
- <version>${IkonliVersion}</version>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
--- 'a/websiteaction/src/main/java/com/stream_pi/websiteaction/WebsiteAction.java'
+++ b/websiteaction/src/main/java/com/stream_pi/websiteaction/WebsiteAction.java
@@ -11,7 +11,6 @@ import java.net.URI;
public class WebsiteAction extends NormalAction
{
-
public WebsiteAction()
{
setName("Website");
@@ -19,11 +18,12 @@ public class WebsiteAction extends Norma
setAuthor("rnayabed");
setServerButtonGraphic("fas-globe");
setHelpLink("https://github.com/stream-pi/essentialactions");
- setVersion(new Version(1,0,0));
+ setVersion(new Version(1,0,1));
}
@Override
- public void initProperties() throws Exception {
+ public void initProperties() throws MinorException
+ {
Property websiteUrl = new Property("websiteURL", Type.STRING);
websiteUrl.setDisplayName("Website URL");
websiteUrl.setDefaultValueStr("https://stream-pi.com/");
@@ -32,14 +32,9 @@ public class WebsiteAction extends Norma
addClientProperties(websiteUrl);
}
-
- @Override
- public void initAction() throws Exception {
-
- }
-
@Override
- public void onActionClicked() throws Exception {
+ public void onActionClicked() throws MinorException
+ {
Property website = getClientProperties().getSingleProperty("websiteURL");
String urlToOpen = website.getStringValue();
@@ -58,10 +53,4 @@ public class WebsiteAction extends Norma
throw new MinorException("Unable to open URL '"+urlToOpen+"'. Check if its correct.");
}
}
-
- @Override
- public void onShutDown() throws Exception {
- // TODO Auto-generated method stub
-
- }
}
--- 'a/websiteaction/src/main/java/module-info.java'
+++ b/websiteaction/src/main/java/module-info.java
@@ -1,4 +1,5 @@
-module com.stream_pi.websiteaction {
+module com.stream_pi.websiteaction
+{
requires com.stream_pi.action_api;
requires com.stream_pi.util;
@@ -8,5 +9,4 @@ module com.stream_pi.websiteaction {
requires java.desktop;
provides com.stream_pi.action_api.externalplugin.ExternalPlugin with com.stream_pi.websiteaction.WebsiteAction;
-
}
\ No newline at end of file