essential-actions

Clone or download

[OBS] - [Set Replay Buffer] - refactored to work with new API

[Twitch] - [Set Colour, Set Commercial] - Refactored UI

Modified Files

--- 'a/obssuite/setreplaybuffer/src/main/java/setreplaybuffer/SetReplayBuffer.java'
+++ b/obssuite/setreplaybuffer/src/main/java/setreplaybuffer/SetReplayBuffer.java
@@ -1,7 +1,9 @@
package setreplaybuffer;
import java.util.ArrayList;
+import java.util.Arrays;
+import com.stream_pi.action_api.actionproperty.property.ListValue;
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;
@@ -27,12 +29,14 @@ public class SetReplayBuffer extends Nor
setVersion(MotherConnection.VERSION);
states = new ArrayList<>();
- states.add("Start");
- states.add("Stop");
- states.add("Save");
+ states.addAll(Arrays.asList(
+ new ListValue("Start"),
+ new ListValue("Stop"),
+ new ListValue("Save")
+ ));
}
- private final ArrayList<String> states;
+ private final ArrayList<ListValue> states;
@Override
public void initProperties() throws MinorException
@@ -52,7 +56,7 @@ public class SetReplayBuffer extends Nor
@Override
public void onActionClicked() throws MinorException
{
- String state = states.get(getClientProperties().getSingleProperty("replay_status").getSelectedIndex());
+ String state = states.get(getClientProperties().getSingleProperty("replay_status").getSelectedIndex()).getName().toString();
if (MotherConnection.getRemoteController() == null)
{
--- 'a/twitch/set-color/src/main/java/setcolor/SetColorAction.java'
+++ b/twitch/set-color/src/main/java/setcolor/SetColorAction.java
@@ -3,6 +3,7 @@ package setcolor;
import com.gikk.twirk.Twirk;
import com.gikk.twirk.TwirkBuilder;
import com.stream_pi.action_api.actionproperty.property.ListProperty;
+import com.stream_pi.action_api.actionproperty.property.ListValue;
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;
@@ -10,6 +11,10 @@ import com.stream_pi.util.exception.Mino
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
public class SetColorAction extends NormalAction
{
@@ -18,8 +23,7 @@ public class SetColorAction extends Norm
private Twirk twirk;
- @Override
- public void initProperties()
+ public SetColorAction()
{
setName("Set Color");
setCategory("Twitch Chat");
@@ -27,8 +31,31 @@ public class SetColorAction extends Norm
setAuthor("j4ckofalltrades");
setVersion(new Version(1, 0, 0));
setHelpLink("https://github.com/stream-pi/essentialactions#twitch-chat-integration");
+
+ colors = new ArrayList<>();
+ colors.addAll(
+ Arrays.asList(
+ new ListValue("Blue"),
+ new ListValue("Coral"),
+ new ListValue("DodgerBlue", "Dodger Blue"),
+ new ListValue("SpringGreen", "Spring Green"),
+ new ListValue("YellowGreen", "Yellow Green"),
+ new ListValue("Green"),
+ new ListValue("OrangeRed", "Orange Red"),
+ new ListValue("Red"),
+ new ListValue("GoldenRod", "Golden Rod"),
+ new ListValue("HotPink", "Hot Pink"),
+ new ListValue("CadetBlue", "Cadet Blue"),
+ new ListValue("SeaGreen", "Sea Green"),
+ new ListValue("Chocolate"),
+ new ListValue("BlueViolet", "Blue Violet"),
+ new ListValue("Firebrick")
+ )
+ );
}
+ private final ArrayList<ListValue> colors;
+
@Override
public void initAction() throws MinorException
{
@@ -39,7 +66,7 @@ public class SetColorAction extends Norm
ListProperty usernameColor = new ListProperty(usernameColorKey);
usernameColor.setDisplayName("Color");
-
+ usernameColor.setListValue(colors);
addClientProperties(channelName, usernameColor);
}
@@ -51,7 +78,7 @@ public class SetColorAction extends Norm
credentials.ensureCredentialsInitialized();
final String channel = getClientProperties().getSingleProperty(channelNameKey).getStringValue();
- final String color = getClientProperties().getSingleProperty(usernameColorKey).getStringValue();
+ final String color = colors.get(getClientProperties().getSingleProperty(usernameColorKey).getSelectedIndex()).getName().toString();
try
{
--- 'a/twitch/start-commercial/src/main/java/startcommercial/StartCommercialAction.java'
+++ b/twitch/start-commercial/src/main/java/startcommercial/StartCommercialAction.java
@@ -2,6 +2,7 @@ package startcommercial;
import com.gikk.twirk.Twirk;
import com.gikk.twirk.TwirkBuilder;
+import com.stream_pi.action_api.actionproperty.property.ListValue;
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;
@@ -9,6 +10,8 @@ import com.stream_pi.util.exception.Mino
import com.stream_pi.util.version.Version;
import connect.chat.TwitchChatCredentials;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
public class StartCommercialAction extends NormalAction
@@ -27,6 +30,18 @@ public class StartCommercialAction exten
setAuthor("j4ckofalltrades");
setVersion(new Version(1, 0, 0));
setHelpLink("https://github.com/stream-pi/essentialactions#twitch-chat-integration");
+
+
+ durations = new ArrayList<>();
+ durations.addAll(Arrays.asList(
+ new ListValue("30"),
+ new ListValue("60"),
+ new ListValue("90"),
+ new ListValue("120"),
+ new ListValue("150"),
+ new ListValue("180")
+ ));
+
}
@Override
@@ -39,17 +54,13 @@ public class StartCommercialAction exten
Property duration = new Property(durationKey, Type.LIST);
duration.setDisplayName("Duration");
- duration.setListValue(List.of(
- String.valueOf(30),
- String.valueOf(60),
- String.valueOf(90),
- String.valueOf(120),
- String.valueOf(150),
- String.valueOf(180)));
+ duration.setListValue(durations);
addClientProperties(channelName, duration);
}
+ private final ArrayList<ListValue> durations;
+
@Override
public void onActionClicked() throws MinorException
{
@@ -57,7 +68,7 @@ public class StartCommercialAction exten
credentials.ensureCredentialsInitialized();
final String channel = getClientProperties().getSingleProperty(channelNameKey).getStringValue();
- final String duration = getClientProperties().getSingleProperty(durationKey).getStringValue();
+ final String duration = durations.get(getClientProperties().getSingleProperty(durationKey).getSelectedIndex()).getName().toString();
try
{