Updated sigIRCv2 to use new Twitch API features. Follower and twitch
stats data updates once again.
This commit is contained in:
parent
64cc36cd32
commit
427c4804a2
@ -1,4 +1,13 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
@ -6,6 +15,97 @@ org.eclipse.jdt.core.compiler.compliance=1.8
|
|||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.APILeak=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
BIN
sigIRCv2.jar
BIN
sigIRCv2.jar
Binary file not shown.
@ -103,6 +103,13 @@ public class Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadModule() {
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void unloadModule() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void dragWindow() {
|
private void dragWindow() {
|
||||||
if (sigIRC.showWindowControls) {
|
if (sigIRC.showWindowControls) {
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
|
10
src/sig/ModuleLinker.java
Normal file
10
src/sig/ModuleLinker.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package sig;
|
||||||
|
|
||||||
|
public class ModuleLinker {
|
||||||
|
public String name = "";
|
||||||
|
public Module mod;
|
||||||
|
public ModuleLinker(String name,Module mod) {
|
||||||
|
this.name = name;
|
||||||
|
this.mod = mod;
|
||||||
|
}
|
||||||
|
}
|
208
src/sig/ModuleSelector.java
Normal file
208
src/sig/ModuleSelector.java
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
package sig;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.awt.event.WindowListener;
|
||||||
|
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JColorChooser;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
import sig.modules.BandoriModule;
|
||||||
|
import sig.modules.ChatLogModule;
|
||||||
|
import sig.modules.ControllerModule;
|
||||||
|
import sig.modules.DDRStepModule;
|
||||||
|
import sig.modules.RabiRaceModule;
|
||||||
|
import sig.modules.RabiRibiModule;
|
||||||
|
import sig.modules.TouhouMotherModule;
|
||||||
|
import sig.modules.TwitchModule;
|
||||||
|
|
||||||
|
public class ModuleSelector extends JFrame implements WindowListener{
|
||||||
|
public static JCheckBox bandoriBox = new JCheckBox("Bandori",sigIRC.bandorimodule_enabled);
|
||||||
|
public static JCheckBox ddrstepBox = new JCheckBox("DDR Step",sigIRC.ddrstepmodule_enabled);
|
||||||
|
public static JCheckBox rabiraceBox = new JCheckBox("Rabi Race",sigIRC.rabiracemodule_enabled);
|
||||||
|
public static JCheckBox rabiribiBox = new JCheckBox("Rabi Ribi (Broken)",sigIRC.rabiribimodule_enabled);
|
||||||
|
public static JCheckBox controllerBox = new JCheckBox("Controller",sigIRC.controllermodule_enabled);
|
||||||
|
public static JCheckBox chatlogBox = new JCheckBox("Chat Log",sigIRC.chatlogmodule_enabled);
|
||||||
|
public static JCheckBox twitchBox = new JCheckBox("Twitch",sigIRC.twitchmodule_enabled);
|
||||||
|
public static JCheckBox touhoumotherBox = new JCheckBox("Touhou Mother",sigIRC.touhoumothermodule_enabled);
|
||||||
|
public ModuleSelector() {
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
bandoriBox.setActionCommand("bandori");
|
||||||
|
bandoriBox.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
if (ev.getActionCommand().equalsIgnoreCase("bandori")) {
|
||||||
|
if (ModuleSelector.bandoriBox.isSelected()) {
|
||||||
|
BandoriModule.loadModule();
|
||||||
|
} else {
|
||||||
|
BandoriModule.unloadModule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
bandoriBox.setVisible(true);
|
||||||
|
ddrstepBox.setActionCommand("ddrstep");
|
||||||
|
ddrstepBox.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
if (ev.getActionCommand().equalsIgnoreCase("ddrstep")) {
|
||||||
|
if (ModuleSelector.ddrstepBox.isSelected()) {
|
||||||
|
DDRStepModule.loadModule();
|
||||||
|
} else {
|
||||||
|
DDRStepModule.unloadModule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ddrstepBox.setVisible(true);
|
||||||
|
rabiraceBox.setActionCommand("rabirace");
|
||||||
|
rabiraceBox.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
if (ev.getActionCommand().equalsIgnoreCase("rabirace")) {
|
||||||
|
if (ModuleSelector.rabiraceBox.isSelected()) {
|
||||||
|
RabiRaceModule.loadModule();
|
||||||
|
} else {
|
||||||
|
RabiRaceModule.unloadModule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rabiraceBox.setVisible(true);
|
||||||
|
rabiribiBox.setActionCommand("rabiribi");
|
||||||
|
rabiribiBox.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
if (ev.getActionCommand().equalsIgnoreCase("rabiribi")) {
|
||||||
|
if (ModuleSelector.rabiribiBox.isSelected()) {
|
||||||
|
RabiRibiModule.loadModule();
|
||||||
|
} else {
|
||||||
|
RabiRibiModule.unloadModule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
rabiribiBox.setVisible(true);
|
||||||
|
controllerBox.setActionCommand("controller");
|
||||||
|
controllerBox.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
if (ev.getActionCommand().equalsIgnoreCase("controller")) {
|
||||||
|
if (ModuleSelector.controllerBox.isSelected()) {
|
||||||
|
ControllerModule.loadModule();
|
||||||
|
} else {
|
||||||
|
ControllerModule.unloadModule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
controllerBox.setVisible(true);
|
||||||
|
chatlogBox.setActionCommand("chatlog");
|
||||||
|
chatlogBox.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
if (ev.getActionCommand().equalsIgnoreCase("chatlog")) {
|
||||||
|
if (ModuleSelector.chatlogBox.isSelected()) {
|
||||||
|
ChatLogModule.loadModule();
|
||||||
|
} else {
|
||||||
|
ChatLogModule.unloadModule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
chatlogBox.setVisible(true);
|
||||||
|
twitchBox.setActionCommand("twitch");
|
||||||
|
twitchBox.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
if (ev.getActionCommand().equalsIgnoreCase("twitch")) {
|
||||||
|
if (ModuleSelector.twitchBox.isSelected()) {
|
||||||
|
TwitchModule.loadModule();
|
||||||
|
} else {
|
||||||
|
TwitchModule.unloadModule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
twitchBox.setVisible(true);
|
||||||
|
touhoumotherBox.setActionCommand("touhoumother");
|
||||||
|
touhoumotherBox.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
if (ev.getActionCommand().equalsIgnoreCase("touhoumother")) {
|
||||||
|
if (ModuleSelector.touhoumotherBox.isSelected()) {
|
||||||
|
TouhouMotherModule.loadModule();
|
||||||
|
} else {
|
||||||
|
TouhouMotherModule.unloadModule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
touhoumotherBox.setVisible(true);
|
||||||
|
|
||||||
|
panel.setVisible(true);
|
||||||
|
panel.add(twitchBox);
|
||||||
|
panel.add(chatlogBox);
|
||||||
|
panel.add(controllerBox);
|
||||||
|
panel.add(rabiraceBox);
|
||||||
|
panel.add(bandoriBox);
|
||||||
|
panel.add(touhoumotherBox);
|
||||||
|
panel.add(ddrstepBox);
|
||||||
|
panel.add(rabiribiBox);
|
||||||
|
|
||||||
|
panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS));
|
||||||
|
|
||||||
|
this.add(panel);
|
||||||
|
this.pack();
|
||||||
|
this.setVisible(true);
|
||||||
|
this.repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowOpened(WindowEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowClosed(WindowEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowIconified(WindowEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowDeiconified(WindowEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowActivated(WindowEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowDeactivated(WindowEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
50
src/sig/ModuleSelectorButton.java
Normal file
50
src/sig/ModuleSelectorButton.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
package sig;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseWheelEvent;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import sig.sigIRC;
|
||||||
|
import sig.modules.TouhouMotherModule;
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
|
import sig.utils.FileUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
|
public class ModuleSelectorButton {
|
||||||
|
BufferedImage buttonimg;
|
||||||
|
int x=0;
|
||||||
|
int y=0;
|
||||||
|
boolean buttonEnabled = true;
|
||||||
|
|
||||||
|
public ModuleSelectorButton(File filename, int x, int y) {
|
||||||
|
this.x=x;
|
||||||
|
this.y=y;
|
||||||
|
try {
|
||||||
|
buttonimg = ImageIO.read(filename);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(Graphics g) {
|
||||||
|
if (buttonEnabled) {
|
||||||
|
g.drawImage(buttonimg, x, y, sigIRC.panel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClickEvent(MouseEvent ev) {
|
||||||
|
if (buttonEnabled && !sigIRC.overlayMode) {
|
||||||
|
if (ev.getX()>=x && ev.getX()<=x+buttonimg.getWidth() &&
|
||||||
|
ev.getY()>=y && ev.getY()<=y+buttonimg.getHeight()) {
|
||||||
|
sigIRC.moduleSelectorWindow.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -34,7 +34,9 @@ import javax.swing.JPopupMenu;
|
|||||||
import sig.modules.BandoriModule;
|
import sig.modules.BandoriModule;
|
||||||
import sig.modules.ChatLogModule;
|
import sig.modules.ChatLogModule;
|
||||||
import sig.modules.ChatLog.ChatLogMessage;
|
import sig.modules.ChatLog.ChatLogMessage;
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
import sig.utils.FileUtils;
|
import sig.utils.FileUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class MyPanel extends JPanel implements MouseListener, ActionListener, MouseWheelListener, KeyListener, ComponentListener, WindowListener{
|
public class MyPanel extends JPanel implements MouseListener, ActionListener, MouseWheelListener, KeyListener, ComponentListener, WindowListener{
|
||||||
//List<String> messages = new ArrayList<String>();
|
//List<String> messages = new ArrayList<String>();
|
||||||
@ -95,6 +97,11 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
|||||||
sigIRC.chatlogtwitchemoticons.get(i).draw(g);
|
sigIRC.chatlogtwitchemoticons.get(i).draw(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (sigIRC.newUpdateIsAvailable) {
|
||||||
|
DrawUtils.drawOutlineText(g, MyPanel.programFont, sigIRC.panel.getWidth()
|
||||||
|
- TextUtils.calculateStringBoundsFont("NEW UPDATE AVAILABLE!!",MyPanel.programFont).getWidth(), sigIRC.panel.getHeight()
|
||||||
|
- TextUtils.calculateStringBoundsFont("NEW UPDATE AVAILABLE!!",MyPanel.programFont).getHeight(), 2, Color.RED, Color.WHITE, "NEW UPDATE AVAILABLE!!");
|
||||||
|
}
|
||||||
for (int i=0;i<sigIRC.textobj.size();i++) {
|
for (int i=0;i<sigIRC.textobj.size();i++) {
|
||||||
if (sigIRC.textobj.get(i).isActive()) {
|
if (sigIRC.textobj.get(i).isActive()) {
|
||||||
if (sigIRC.overlayMode) {
|
if (sigIRC.overlayMode) {
|
||||||
@ -120,6 +127,7 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
|||||||
}
|
}
|
||||||
if (!sigIRC.overlayMode) {
|
if (!sigIRC.overlayMode) {
|
||||||
sigIRC.button.draw(g);
|
sigIRC.button.draw(g);
|
||||||
|
sigIRC.modulebutton.draw(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,6 +156,7 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
|||||||
m.mouseModuleMousePress(ev);
|
m.mouseModuleMousePress(ev);
|
||||||
}
|
}
|
||||||
sigIRC.button.onClickEvent(ev);
|
sigIRC.button.onClickEvent(ev);
|
||||||
|
sigIRC.modulebutton.onClickEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -213,8 +222,10 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
|||||||
sigIRC.config.setInteger("windowY", sigIRC.windowY);
|
sigIRC.config.setInteger("windowY", sigIRC.windowY);
|
||||||
sigIRC.config.setInteger("windowWidth", sigIRC.windowWidth);
|
sigIRC.config.setInteger("windowWidth", sigIRC.windowWidth);
|
||||||
sigIRC.config.setInteger("windowHeight", sigIRC.windowHeight);
|
sigIRC.config.setInteger("windowHeight", sigIRC.windowHeight);
|
||||||
sigIRC.button.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-96;
|
sigIRC.button.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-192;
|
||||||
sigIRC.button.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
|
sigIRC.button.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
|
||||||
|
sigIRC.modulebutton.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-96;
|
||||||
|
sigIRC.modulebutton.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
|
||||||
//com.repaint();
|
//com.repaint();
|
||||||
//sigIRC.panel.repaint();
|
//sigIRC.panel.repaint();
|
||||||
sigIRC.config.saveProperties();
|
sigIRC.config.saveProperties();
|
||||||
|
@ -2,6 +2,7 @@ package sig.modules;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
@ -231,6 +232,22 @@ public class BandoriModule extends Module{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadModule() {
|
||||||
|
sigIRC.modules.add(new BandoriModule(
|
||||||
|
new Rectangle(sigIRC.bandorimodule_X,sigIRC.bandorimodule_Y,sigIRC.bandorimodule_width,sigIRC.bandorimodule_height),
|
||||||
|
"Bandori"
|
||||||
|
));
|
||||||
|
sigIRC.bandorimodule_enabled=true;
|
||||||
|
}
|
||||||
|
public static void unloadModule() {
|
||||||
|
for (int i=0;i<sigIRC.modules.size();i++) {
|
||||||
|
if (sigIRC.modules.get(i) instanceof BandoriModule) {
|
||||||
|
sigIRC.modules.remove(sigIRC.modules.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sigIRC.bandorimodule_enabled=false;
|
||||||
|
}
|
||||||
|
|
||||||
public BufferedImage crop(BufferedImage img, int x, int y, int targetWidth, int targetHeight) throws IOException {
|
public BufferedImage crop(BufferedImage img, int x, int y, int targetWidth, int targetHeight) throws IOException {
|
||||||
int height = img.getHeight();
|
int height = img.getHeight();
|
||||||
int width = img.getWidth();
|
int width = img.getWidth();
|
||||||
|
@ -2,6 +2,7 @@ package sig.modules;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseWheelEvent;
|
import java.awt.event.MouseWheelEvent;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
@ -51,6 +52,22 @@ public class ChatLogModule extends Module{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadModule() {
|
||||||
|
sigIRC.modules.add(new ChatLogModule(
|
||||||
|
new Rectangle(sigIRC.chatlogmodule_X,sigIRC.chatlogmodule_Y,sigIRC.chatlogmodule_width,sigIRC.chatlogmodule_height),
|
||||||
|
"Chat Log"
|
||||||
|
));
|
||||||
|
sigIRC.chatlogmodule_enabled=true;
|
||||||
|
}
|
||||||
|
public static void unloadModule() {
|
||||||
|
for (int i=0;i<sigIRC.modules.size();i++) {
|
||||||
|
if (sigIRC.modules.get(i) instanceof ChatLogModule) {
|
||||||
|
sigIRC.modules.remove(sigIRC.modules.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sigIRC.chatlogmodule_enabled=false;
|
||||||
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
if (delay>0 && sigIRC.subEmotesCompleted) {
|
if (delay>0 && sigIRC.subEmotesCompleted) {
|
||||||
|
@ -110,6 +110,22 @@ public class ControllerModule extends Module{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadModule() {
|
||||||
|
sigIRC.modules.add(new ControllerModule(
|
||||||
|
new Rectangle(sigIRC.controllermodule_X,sigIRC.controllermodule_Y,sigIRC.controllermodule_width,sigIRC.controllermodule_height),
|
||||||
|
"Controller"
|
||||||
|
));
|
||||||
|
sigIRC.controllermodule_enabled=true;
|
||||||
|
}
|
||||||
|
public static void unloadModule() {
|
||||||
|
for (int i=0;i<sigIRC.modules.size();i++) {
|
||||||
|
if (sigIRC.modules.get(i) instanceof ControllerModule) {
|
||||||
|
sigIRC.modules.remove(sigIRC.modules.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sigIRC.controllermodule_enabled=false;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Controller> getControllers() {
|
public List<Controller> getControllers() {
|
||||||
return controllers;
|
return controllers;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.awt.Color;
|
|||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -82,6 +83,22 @@ public class DDRStepModule extends Module{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadModule() {
|
||||||
|
sigIRC.modules.add(new DDRStepModule(
|
||||||
|
new Rectangle(sigIRC.ddrstepmodule_X,sigIRC.ddrstepmodule_Y,sigIRC.ddrstepmodule_width,sigIRC.ddrstepmodule_height),
|
||||||
|
"DDR Step"
|
||||||
|
));
|
||||||
|
sigIRC.ddrstepmodule_enabled=true;
|
||||||
|
}
|
||||||
|
public static void unloadModule() {
|
||||||
|
for (int i=0;i<sigIRC.modules.size();i++) {
|
||||||
|
if (sigIRC.modules.get(i) instanceof DDRStepModule) {
|
||||||
|
sigIRC.modules.remove(sigIRC.modules.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sigIRC.ddrstepmodule_enabled=false;
|
||||||
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
super.run();
|
super.run();
|
||||||
|
|
||||||
|
@ -190,6 +190,22 @@ public class RabiRaceModule extends Module{
|
|||||||
markmap_button = new MarkMapButton(new Rectangle(2,(int)(position.getHeight()-42),120,18),"Mark Map",this);
|
markmap_button = new MarkMapButton(new Rectangle(2,(int)(position.getHeight()-42),120,18),"Mark Map",this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadModule() {
|
||||||
|
sigIRC.modules.add(new RabiRaceModule(
|
||||||
|
new Rectangle(sigIRC.rabiracemodule_X,sigIRC.rabiracemodule_Y,sigIRC.rabiracemodule_width,sigIRC.rabiracemodule_height),
|
||||||
|
"Rabi Race"
|
||||||
|
));
|
||||||
|
sigIRC.rabiracemodule_enabled=true;
|
||||||
|
}
|
||||||
|
public static void unloadModule() {
|
||||||
|
for (int i=0;i<sigIRC.modules.size();i++) {
|
||||||
|
if (sigIRC.modules.get(i) instanceof RabiRaceModule) {
|
||||||
|
sigIRC.modules.remove(sigIRC.modules.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sigIRC.rabiracemodule_enabled=false;
|
||||||
|
}
|
||||||
|
|
||||||
private void RunRabiRaceUpdater() {
|
private void RunRabiRaceUpdater() {
|
||||||
if (foundRabiRibi) {
|
if (foundRabiRibi) {
|
||||||
UpdateMyProfile();
|
UpdateMyProfile();
|
||||||
|
@ -3,6 +3,7 @@ package sig.modules;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
@ -129,6 +130,22 @@ public class RabiRibiModule extends Module{
|
|||||||
}, 1000, 1000, TimeUnit.MILLISECONDS);
|
}, 1000, 1000, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadModule() {
|
||||||
|
sigIRC.modules.add(new RabiRibiModule(
|
||||||
|
new Rectangle(sigIRC.rabiribimodule_X,sigIRC.rabiribimodule_Y,sigIRC.rabiribimodule_width,sigIRC.rabiribimodule_height),
|
||||||
|
"Rabi Ribi"
|
||||||
|
));
|
||||||
|
sigIRC.rabiribimodule_enabled=true;
|
||||||
|
}
|
||||||
|
public static void unloadModule() {
|
||||||
|
for (int i=0;i<sigIRC.modules.size();i++) {
|
||||||
|
if (sigIRC.modules.get(i) instanceof RabiRibiModule) {
|
||||||
|
sigIRC.modules.remove(sigIRC.modules.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sigIRC.rabiribimodule_enabled=false;
|
||||||
|
}
|
||||||
|
|
||||||
public void ApplyConfigWindowProperties() {
|
public void ApplyConfigWindowProperties() {
|
||||||
sigIRC.rabiribimodule_X=(int)position.getX();
|
sigIRC.rabiribimodule_X=(int)position.getX();
|
||||||
sigIRC.rabiribimodule_Y=(int)position.getY();
|
sigIRC.rabiribimodule_Y=(int)position.getY();
|
||||||
|
@ -114,6 +114,22 @@ public class TouhouMotherModule extends Module implements ActionListener{
|
|||||||
}, 5000, 5000, TimeUnit.MILLISECONDS);
|
}, 5000, 5000, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void loadModule() {
|
||||||
|
sigIRC.modules.add(new TouhouMotherModule(
|
||||||
|
new Rectangle(sigIRC.touhoumothermodule_X,sigIRC.touhoumothermodule_Y,sigIRC.touhoumothermodule_width,sigIRC.touhoumothermodule_height),
|
||||||
|
"Touhou Mother"
|
||||||
|
));
|
||||||
|
sigIRC.touhoumothermodule_enabled=true;
|
||||||
|
}
|
||||||
|
public static void unloadModule() {
|
||||||
|
for (int i=0;i<sigIRC.modules.size();i++) {
|
||||||
|
if (sigIRC.modules.get(i) instanceof TouhouMotherModule) {
|
||||||
|
sigIRC.modules.remove(sigIRC.modules.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sigIRC.touhoumothermodule_enabled=false;
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckTouhouMotherClient() {
|
private void CheckTouhouMotherClient() {
|
||||||
List<Integer> pids;
|
List<Integer> pids;
|
||||||
try {
|
try {
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package sig.modules.Twitch;
|
package sig.modules.Twitch;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.DateFormat;
|
|
||||||
|
|
||||||
import com.mb3364.twitch.api.models.User;
|
|
||||||
|
|
||||||
import sig.modules.TwitchModule;
|
import sig.modules.TwitchModule;
|
||||||
import sig.utils.FileUtils;
|
import sig.utils.FileUtils;
|
||||||
@ -18,13 +15,13 @@ public class Announcement {
|
|||||||
int i=0;
|
int i=0;
|
||||||
String[] contents = FileUtils.readFromFile(userFilePath);
|
String[] contents = FileUtils.readFromFile(userFilePath);
|
||||||
userData = new Follower(twitchID,
|
userData = new Follower(twitchID,
|
||||||
contents[i++],
|
contents[1],
|
||||||
"",
|
contents[0],
|
||||||
contents[i++],
|
contents[2],
|
||||||
contents[i++],
|
contents[3],
|
||||||
contents[i++],
|
contents[4],
|
||||||
contents[i++],
|
contents[5],
|
||||||
"");
|
contents[6]);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("WARNING! Could not find user with ID "+twitchID+"!");
|
System.out.println("WARNING! Could not find user with ID "+twitchID+"!");
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package sig.modules.Twitch;
|
package sig.modules.Twitch;
|
||||||
|
|
||||||
public class Follower {
|
public class Follower {
|
||||||
long id;
|
public long id;
|
||||||
String bio;
|
public String bio;
|
||||||
String created_at;
|
public String created_at;
|
||||||
String display_name;
|
public String display_name;
|
||||||
String logo_url;
|
public String logo_url;
|
||||||
String name;
|
public String name;
|
||||||
String type;
|
public String type;
|
||||||
String updated_at;
|
public String updated_at;
|
||||||
Follower(Long id,
|
Follower(Long id,
|
||||||
String bio,
|
String bio,
|
||||||
String created_at,
|
String created_at,
|
||||||
@ -26,7 +26,7 @@ public class Follower {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
this.updated_at = updated_at;
|
this.updated_at = updated_at;
|
||||||
}
|
}
|
||||||
Follower(String id,
|
public Follower(String id,
|
||||||
String bio,
|
String bio,
|
||||||
String created_at,
|
String created_at,
|
||||||
String display_name,
|
String display_name,
|
||||||
|
@ -12,6 +12,8 @@ import java.io.IOException;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -29,6 +31,7 @@ import sig.Module;
|
|||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.Twitch.Announcement;
|
import sig.modules.Twitch.Announcement;
|
||||||
import sig.modules.Twitch.FancyNumber;
|
import sig.modules.Twitch.FancyNumber;
|
||||||
|
import sig.modules.Twitch.Follower;
|
||||||
import sig.utils.DrawUtils;
|
import sig.utils.DrawUtils;
|
||||||
import sig.utils.FileUtils;
|
import sig.utils.FileUtils;
|
||||||
import sig.utils.SoundUtils;
|
import sig.utils.SoundUtils;
|
||||||
@ -53,7 +56,7 @@ public class TwitchModule extends Module{
|
|||||||
FancyNumber viewers_numb;
|
FancyNumber viewers_numb;
|
||||||
FancyNumber followers_numb;
|
FancyNumber followers_numb;
|
||||||
FancyNumber views_numb;
|
FancyNumber views_numb;
|
||||||
Date uptime = Calendar.getInstance().getTime();
|
ZonedDateTime uptime;
|
||||||
String currentlyPlaying=" ";
|
String currentlyPlaying=" ";
|
||||||
final public static int ARROWTIMER = 3000;
|
final public static int ARROWTIMER = 3000;
|
||||||
public static BufferedImage UPARROWIMAGE;
|
public static BufferedImage UPARROWIMAGE;
|
||||||
@ -79,8 +82,10 @@ public class TwitchModule extends Module{
|
|||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
CreateFollowerQueueLog();
|
CreateFollowerQueueLog();
|
||||||
}
|
}
|
||||||
|
ClearFollowerAnnouncerQueue();
|
||||||
|
|
||||||
myTwitchChannelID = getMyChannelID();
|
|
||||||
|
//myTwitchChannelID = getMyChannelID();
|
||||||
|
|
||||||
/*manager.streams().get("theduckishot", new StreamResponseHandler() {
|
/*manager.streams().get("theduckishot", new StreamResponseHandler() {
|
||||||
|
|
||||||
@ -129,17 +134,20 @@ public class TwitchModule extends Module{
|
|||||||
});*/
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMyChannelID() {
|
public static void loadModule() {
|
||||||
Long id = -1l;
|
sigIRC.modules.add(new TwitchModule(
|
||||||
try {
|
new Rectangle(sigIRC.twitchmodule_X,sigIRC.twitchmodule_Y,sigIRC.twitchmodule_width,sigIRC.twitchmodule_height),
|
||||||
FileUtils.downloadFileFromUrl("https://api.twitch.tv/kraken/users?login="+sigIRC.nickname, "temp_connect");
|
"Twitch"
|
||||||
JSONObject j = FileUtils.readJsonFromFile("temp_connect");
|
));
|
||||||
JSONArray a = j.getJSONArray("users");
|
sigIRC.twitchmodule_enabled=true;
|
||||||
id = Long.parseLong(a.getJSONObject(0).getString("_id"));
|
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
return id;
|
public static void unloadModule() {
|
||||||
|
for (int i=0;i<sigIRC.modules.size();i++) {
|
||||||
|
if (sigIRC.modules.get(i) instanceof TwitchModule) {
|
||||||
|
sigIRC.modules.remove(sigIRC.modules.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sigIRC.twitchmodule_enabled=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeFollowerSounds() {
|
private void InitializeFollowerSounds() {
|
||||||
@ -171,10 +179,24 @@ public class TwitchModule extends Module{
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (lastFollowerCheck--<=0) {
|
if (lastFollowerCheck--<=0) {
|
||||||
lastFollowerCheck = FOLLOWERCHECKTIMER;
|
lastFollowerCheck = FOLLOWERCHECKTIMER;
|
||||||
getFollowers(false);
|
//getFollowers(false);
|
||||||
|
try {
|
||||||
|
GetFollowerAndStreamData();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
popFollowerFromQueue();
|
popFollowerFromQueue();
|
||||||
|
try {
|
||||||
|
//System.out.println("Checking Followers...");
|
||||||
|
JSONObject FollowerData = GetFollowerAndStreamData();
|
||||||
|
followers_numb.updateValue(FollowerData.getInt("total"));
|
||||||
|
//views_numb.updateValue(FollowerData.get);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
// isStreamOnline(true);
|
// isStreamOnline(true);
|
||||||
///TODO Rewrite.
|
|
||||||
}
|
}
|
||||||
if (lastFollowerAnnouncement>0) {
|
if (lastFollowerAnnouncement>0) {
|
||||||
lastFollowerAnnouncement--;
|
lastFollowerAnnouncement--;
|
||||||
@ -182,6 +204,30 @@ public class TwitchModule extends Module{
|
|||||||
//System.out.println(lastFollowerCheck);
|
//System.out.println(lastFollowerCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public JSONObject GetFollowerAndStreamData() throws IOException {
|
||||||
|
FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/streams?user_id="+sigIRC.channel_id, "stream_info",true);
|
||||||
|
JSONObject streamInfo = FileUtils.readJsonFromFile("stream_info");
|
||||||
|
JSONArray streamData = streamInfo.getJSONArray("data");
|
||||||
|
JSONObject stream = streamData.getJSONObject(0);
|
||||||
|
streamOnline = streamData.length()!=0;
|
||||||
|
DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter
|
||||||
|
.ofPattern("uuuu-MM-dd'T'HH:mm:ssz");
|
||||||
|
uptime = ZonedDateTime.parse(stream.getString("started_at"),DATE_TIME_FORMATTER);
|
||||||
|
viewers_numb.updateValue(stream.getInt("viewer_count"));
|
||||||
|
FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/users/follows?to_id="+sigIRC.channel_id, "temp_followers",true);
|
||||||
|
JSONObject FollowerData = FileUtils.readJsonFromFile("temp_followers");
|
||||||
|
JSONArray data = FollowerData.getJSONArray("data");
|
||||||
|
FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/users?id="+sigIRC.channel_id, "channel_info",true);
|
||||||
|
JSONObject channelData = FileUtils.readJsonFromFile("channel_info").getJSONArray("data").getJSONObject(0);
|
||||||
|
views_numb.updateValue(channelData.getInt("view_count"));
|
||||||
|
for (int i=0;i<data.length();i++) {
|
||||||
|
JSONObject user = data.getJSONObject(i);
|
||||||
|
addFollower(user.getString("from_name"),user.getLong("from_id"),streamOnline,false);
|
||||||
|
}
|
||||||
|
return FollowerData;
|
||||||
|
}
|
||||||
|
|
||||||
public void ApplyConfigWindowProperties() {
|
public void ApplyConfigWindowProperties() {
|
||||||
sigIRC.twitchmodule_X=(int)position.getX();
|
sigIRC.twitchmodule_X=(int)position.getX();
|
||||||
sigIRC.twitchmodule_Y=(int)position.getY();
|
sigIRC.twitchmodule_Y=(int)position.getY();
|
||||||
@ -190,31 +236,31 @@ public class TwitchModule extends Module{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void popFollowerFromQueue() {
|
private void popFollowerFromQueue() {
|
||||||
//TODO REWRITE.
|
|
||||||
if (sigIRC.testMode) {
|
if (sigIRC.testMode) {
|
||||||
/*User user = new User();
|
Follower user = new Follower("0","I am an awesome test subject.",
|
||||||
user.setDisplayName("Test User"+((int)Math.random()*100000));
|
new Date().toString(),
|
||||||
user.setBio("I am an awesome test subject.");
|
"Test User"+((int)Math.random()*100000),
|
||||||
user.setName(user.getDisplayName());
|
"http://45.33.13.215/sigIRCv2/sigIRC/sigIRCicon.png",
|
||||||
user.setLogo("http://45.33.13.215/sigIRCv2/sigIRC/sigIRCicon.png");
|
"Test User",
|
||||||
DisplayFollowerAnnouncement(user,true);*/
|
"",
|
||||||
|
new Date().toString());
|
||||||
|
DisplayFollowerAnnouncement(user,true);
|
||||||
} else
|
} else
|
||||||
if (follower_queue.size()>0) {
|
if (follower_queue.size()>0) {
|
||||||
///TODO Rewrite.
|
if (streamOnline) {
|
||||||
// if (isStreamOnline()) {
|
//We have a follower to announce!
|
||||||
// //We have a follower to announce!
|
Announcement a = follower_queue.remove(0);
|
||||||
// /*Announcement a = follower_queue.remove(0);
|
Follower user = a.getUser();
|
||||||
// User user = a.getUser();
|
if (user.display_name.length()>0 &&
|
||||||
// if (user.getDisplayName().length()>0 &&
|
!user.display_name.contains("?")) {
|
||||||
// !user.getDisplayName().contains("?")) {
|
DisplayFollowerAnnouncement(user,true);
|
||||||
// DisplayFollowerAnnouncement(user,true);
|
} else {
|
||||||
// } else {
|
DisplayFollowerAnnouncement(user,false);
|
||||||
// DisplayFollowerAnnouncement(user,false);
|
}
|
||||||
// }*/
|
} else {
|
||||||
// } else {
|
//Store away all remaining followers in the queue....We can't announce them right now.
|
||||||
// //Store away all remaining followers in the queue....We can't announce them right now.
|
StoreRemainingFollowers();
|
||||||
// StoreRemainingFollowers();
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,25 +270,25 @@ public class TwitchModule extends Module{
|
|||||||
|
|
||||||
private void StoreRemainingFollowers() {
|
private void StoreRemainingFollowers() {
|
||||||
for (Announcement a : follower_queue) {
|
for (Announcement a : follower_queue) {
|
||||||
//FileUtils.logToFile(Long.toString(a.getUser().getId()), FOLLOWERQUEUEFILE);
|
FileUtils.logToFile(Long.toString(a.getUser().id), FOLLOWERQUEUEFILE);
|
||||||
//TODO REWRITE
|
|
||||||
}
|
}
|
||||||
follower_queue.clear();
|
follower_queue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO REWRITE
|
public static Follower announcedFollowerUser;
|
||||||
/*private void DisplayFollowerAnnouncement(User user, boolean useNickname) {
|
|
||||||
|
private void DisplayFollowerAnnouncement(Follower user, boolean useNickname) {
|
||||||
lastFollowerAnnouncement = FOLLOWERANNOUNCEMENTTIME;
|
lastFollowerAnnouncement = FOLLOWERANNOUNCEMENTTIME;
|
||||||
if (!useNickname) {
|
if (!useNickname) {
|
||||||
user.setDisplayName(user.getName());
|
user.display_name=user.name;
|
||||||
}
|
}
|
||||||
announcedFollowerUser = user;
|
announcedFollowerUser = user;
|
||||||
String followerAnnouncement = user.getDisplayName()+" is now following the stream!";
|
String followerAnnouncement = user.display_name+" is now following the stream!";
|
||||||
String userlogo = USERDIR+user.getId()+"_logo";
|
String userlogo = USERDIR+user.id+"_logo";
|
||||||
if (user.getLogo()!=null && !user.getLogo().equalsIgnoreCase("null")) {
|
if (user.logo_url!=null && !user.logo_url.equalsIgnoreCase("null")) {
|
||||||
try {
|
try {
|
||||||
org.apache.commons.io.FileUtils.copyURLToFile(new URL(user.getLogo()),new File(userlogo));
|
org.apache.commons.io.FileUtils.copyURLToFile(new URL(user.logo_url),new File(userlogo));
|
||||||
File logo = new File(userlogo);
|
File logo = new File(userlogo);
|
||||||
if (logo.exists()) {
|
if (logo.exists()) {
|
||||||
followerUserLogo = ImageIO.read(logo);
|
followerUserLogo = ImageIO.read(logo);
|
||||||
@ -260,7 +306,7 @@ public class TwitchModule extends Module{
|
|||||||
LogMessageToFile(followerAnnouncement);
|
LogMessageToFile(followerAnnouncement);
|
||||||
System.out.println(followerAnnouncement);
|
System.out.println(followerAnnouncement);
|
||||||
SoundUtils.playSound(SOUNDSDIR+followersounds[(int)(Math.random()*followersounds.length)]);
|
SoundUtils.playSound(SOUNDSDIR+followersounds[(int)(Math.random()*followersounds.length)]);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
private void InitializeImages() {
|
private void InitializeImages() {
|
||||||
try {
|
try {
|
||||||
@ -287,43 +333,6 @@ public class TwitchModule extends Module{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getFollowers(boolean firstTime) {
|
|
||||||
try {
|
|
||||||
FileUtils.downloadFileFromUrl("https://api.twitch.tv/kraken/channels/"+myTwitchChannelID+"/follows", "follows");
|
|
||||||
JSONObject o = FileUtils.readJsonFromFile("follows");
|
|
||||||
JSONArray data = o.getJSONArray("follows");
|
|
||||||
for (int i=0;i<data.length();i++) {
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
///TODO Rewrite.
|
|
||||||
/*sigIRC.manager.channels().getFollows(TextUtils.getActualChannelName(), new ChannelFollowsResponseHandler() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(int total, java.util.List<ChannelFollow> follows) {
|
|
||||||
//System.out.println("Successfully found followers for channel "+sigIRC.channel+". Total: "+total);
|
|
||||||
//console = "Last Follower: "+follows.get(0).getUser().getDisplayName();
|
|
||||||
for (ChannelFollow f : follows) {
|
|
||||||
addFollower(f,isStreamOnline(),firstTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable arg0) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(int arg0, String arg1, String arg2) {
|
|
||||||
System.out.println(arg0+","+arg1+","+arg2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (isStreamOnline()) {ClearFollowerAnnouncerQueue();}*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClearFollowerAnnouncerQueue() {
|
private void ClearFollowerAnnouncerQueue() {
|
||||||
String[] contents = FileUtils.readFromFile(FOLLOWERQUEUEFILE);
|
String[] contents = FileUtils.readFromFile(FOLLOWERQUEUEFILE);
|
||||||
//System.out.println("Contents: "+Arrays.toString(contents));
|
//System.out.println("Contents: "+Arrays.toString(contents));
|
||||||
@ -335,101 +344,50 @@ public class TwitchModule extends Module{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// private boolean isStreamOnline() {
|
|
||||||
///TODO Rewrite.
|
|
||||||
// return isStreamOnline(false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
protected void addFollower(String username, long id, boolean streamOnline, boolean silent) {
|
||||||
///TODO Rewrite.
|
String filename = USERDIR + Long.toString(id);
|
||||||
/*private boolean isStreamOnline(boolean update) {
|
File userProfile = new File(filename);
|
||||||
if (update) {
|
if (!userProfile.exists()) {
|
||||||
sigIRC.manager.streams().get(TextUtils.getActualChannelName(), new StreamResponseHandler() {
|
CreateUserProfile(username, id, filename, userProfile);
|
||||||
|
if (!silent) { //If we got in here, this isn't the initial follower setup, so we are good to go with announcing these followers.
|
||||||
@Override
|
if (!streamOnline) {
|
||||||
public void onFailure(Throwable arg0) {
|
//Save their ID to a queue.
|
||||||
TwitchModule.streamOnline=false;
|
FileUtils.logToFile(Long.toString(id), FOLLOWERQUEUEFILE);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(int arg0, String arg1, String arg2) {
|
|
||||||
System.out.println(arg0+","+arg1+","+arg2);
|
|
||||||
TwitchModule.streamOnline=false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Stream arg0) {
|
|
||||||
//System.out.println("Stream data is available! "+arg0);
|
|
||||||
if (arg0==null) {
|
|
||||||
TwitchModule.streamOnline=false;
|
|
||||||
} else {
|
} else {
|
||||||
TwitchModule.streamOnline=true;
|
//Announce it now.
|
||||||
UpdateAllStreamStatistics(arg0);
|
//System.out.println("Stream is online...");
|
||||||
|
AnnounceFollower(username,id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAllStreamStatistics(Stream data) {
|
private void CreateUserProfile(String username, long id, String filename, File userProfile) {
|
||||||
if (data!=null) {
|
try {
|
||||||
if (data.getGame()!=null && data.getGame().length()>0) {
|
FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/users?id="+id, "user_info",true);
|
||||||
currentlyPlaying = data.getGame();
|
System.out.println("File data: "+Arrays.toString(FileUtils.readFromFile("user_info")));
|
||||||
}
|
JSONObject userdata = FileUtils.readJsonFromFile("user_info").getJSONArray("data").getJSONObject(0);
|
||||||
if (data.getCreatedAt()!=null) {
|
userProfile.createNewFile();
|
||||||
uptime = data.getCreatedAt();
|
System.out.println("Profile Image URL: "+userdata.getString("profile_image_url"));
|
||||||
}
|
FileUtils.logToFile(new Date().toString(), filename);
|
||||||
viewers_numb.updateValue(data.getViewers());
|
FileUtils.logToFile(userdata.getString("description"), filename);
|
||||||
views_numb.updateValue((int)data.getChannel().getViews());
|
FileUtils.logToFile(username, filename);
|
||||||
followers_numb.updateValue(data.getChannel().getFollowers());
|
FileUtils.logToFile(userdata.getString("profile_image_url"), filename);
|
||||||
|
FileUtils.logToFile(userdata.getString("login"), filename);
|
||||||
|
FileUtils.logToFile(userdata.getString("type"), filename);
|
||||||
|
FileUtils.logToFile(new Date().toString(), filename);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
private void AnnounceFollower(String name,long id) {
|
||||||
return TwitchModule.streamOnline;
|
System.out.println("Thanks for following "+name+"!");
|
||||||
} else {
|
AddFollowerToQueue(id);
|
||||||
return TwitchModule.streamOnline;
|
|
||||||
}
|
}
|
||||||
//TwitchModule.streamOnline=true;
|
|
||||||
//return true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// protected void addFollower(ChannelFollow f, boolean streamOnline, boolean silent) {
|
private void AddFollowerToQueue(long id) {
|
||||||
// String filename = USERDIR+f.getUser().getId();
|
|
||||||
// File userProfile = new File(filename);
|
|
||||||
// if (!userProfile.exists()) {
|
|
||||||
// if (!silent) { //If we got in here, this isn't the initial follower setup, so we are good to go with announcing these followers.
|
|
||||||
// if (!streamOnline) {
|
|
||||||
// //Save their ID to a queue.
|
|
||||||
// FileUtils.logToFile(Long.toString(f.getUser().getId()), FOLLOWERQUEUEFILE);
|
|
||||||
// } else {
|
|
||||||
// //Announce it now.
|
|
||||||
// //System.out.println("Stream is online...");
|
|
||||||
// AnnounceFollower(f);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// CreateUserProfile(f, filename, userProfile);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void CreateUserProfile(ChannelFollow f, String filename, File userProfile) {
|
|
||||||
// try {
|
|
||||||
// userProfile.createNewFile();
|
|
||||||
// FileUtils.logToFile(DateFormat.getDateInstance().format(f.getCreatedAt()), filename);
|
|
||||||
// FileUtils.logToFile(f.getUser().getBio(), filename);
|
|
||||||
// FileUtils.logToFile(f.getUser().getDisplayName(), filename);
|
|
||||||
// FileUtils.logToFile(f.getUser().getLogo(), filename);
|
|
||||||
// FileUtils.logToFile(f.getUser().getName(), filename);
|
|
||||||
// FileUtils.logToFile(f.getUser().getType(), filename);
|
|
||||||
// FileUtils.logToFile(DateFormat.getDateInstance().format(f.getUser().getUpdatedAt()), filename);
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void AnnounceFollower(ChannelFollow f) {
|
|
||||||
// //System.out.println("Thanks for following "+f.getUser().getDisplayName()+"!");
|
|
||||||
// AddFollowerToQueue(f.getUser());
|
|
||||||
// }
|
|
||||||
|
|
||||||
private void AddFollowerToQueue(int id) {
|
|
||||||
follower_queue.add(new Announcement(id));
|
follower_queue.add(new Announcement(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +440,7 @@ public class TwitchModule extends Module{
|
|||||||
int xoffset = 0;
|
int xoffset = 0;
|
||||||
int yoffset = 0;
|
int yoffset = 0;
|
||||||
g.drawImage(UPTIMEIMAGE, x+xoffset, y+yoffset-2, sigIRC.panel);xoffset+=UPTIMEIMAGE.getWidth()+4;
|
g.drawImage(UPTIMEIMAGE, x+xoffset, y+yoffset-2, sigIRC.panel);xoffset+=UPTIMEIMAGE.getWidth()+4;
|
||||||
String timediff = TimeUtils.GetTimeDifferenceFromCurrentDate(uptime);
|
String timediff = TimeUtils.GetTimeDifferenceFromCurrentDate(Date.from(uptime.toInstant()));
|
||||||
if (timediff.length()>0) {
|
if (timediff.length()>0) {
|
||||||
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, x+xoffset, y+yoffset+TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getHeight()/2+3,new Color(184,181,192),timediff);xoffset+=TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getWidth()+12;
|
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, x+xoffset, y+yoffset+TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getHeight()/2+3,new Color(184,181,192),timediff);xoffset+=TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getWidth()+12;
|
||||||
}
|
}
|
||||||
@ -514,25 +472,25 @@ public class TwitchModule extends Module{
|
|||||||
//g.drawImage(follower_img, (int)bounds.getX(), (int)bounds.getY(), , , sigIRC.panel)
|
//g.drawImage(follower_img, (int)bounds.getX(), (int)bounds.getY(), , , sigIRC.panel)
|
||||||
g.drawImage(follower_img, (int)position.getX(), (int)position.getY()+canvasYOffset, (int)position.getX()+follower_img.getWidth()+canvasXOffset, (int)position.getY()+follower_img.getHeight(),
|
g.drawImage(follower_img, (int)position.getX(), (int)position.getY()+canvasYOffset, (int)position.getX()+follower_img.getWidth()+canvasXOffset, (int)position.getY()+follower_img.getHeight(),
|
||||||
-xAlteration, 0, follower_img.getWidth(), follower_img.getHeight()-yAlteration, sigIRC.panel);
|
-xAlteration, 0, follower_img.getWidth(), follower_img.getHeight()-yAlteration, sigIRC.panel);
|
||||||
// Rectangle2D usernameTextsize = TextUtils.calculateStringBoundsFont(announcedFollowerUser.getDisplayName(), sigIRC.panel.programFont);
|
Rectangle2D usernameTextsize = TextUtils.calculateStringBoundsFont(announcedFollowerUser.display_name, sigIRC.panel.programFont);
|
||||||
// int textY = (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration;
|
int textY = (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration;
|
||||||
// int textX = (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration;
|
int textX = (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration;
|
||||||
// if (textY<position.getY()+position.getHeight() && textX+usernameTextsize.getWidth()>position.getX()) {
|
if (textY<position.getY()+position.getHeight() && textX+usernameTextsize.getWidth()>position.getX()) {
|
||||||
// DrawUtils.drawCenteredText(g, sigIRC.panel.programFont, (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration, (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration, Color.BLACK, announcedFollowerUser.getDisplayName());
|
DrawUtils.drawCenteredText(g, sigIRC.panel.programFont, (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration, (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration, Color.BLACK, announcedFollowerUser.display_name);
|
||||||
// }
|
}
|
||||||
// if (announcedFollowerUser.getBio()!=null && !announcedFollowerUser.getBio().equalsIgnoreCase("null")) {
|
if (announcedFollowerUser.bio!=null && !announcedFollowerUser.bio.equalsIgnoreCase("null")) {
|
||||||
// if (followerUserLogo!=null) {
|
if (followerUserLogo!=null) {
|
||||||
// final int image_size = sigIRC.twitchmodule_newfollowerImgLogoSize;
|
final int image_size = sigIRC.twitchmodule_newfollowerImgLogoSize;
|
||||||
// int img_startx = (int)(position.getX()+position.getWidth()-ticksPassed*3-(image_size+4));
|
int img_startx = (int)(position.getX()+position.getWidth()-ticksPassed*3-(image_size+4));
|
||||||
// int img_starty = (int)(position.getY()+follower_img.getHeight()+2-image_size/2);
|
int img_starty = (int)(position.getY()+follower_img.getHeight()+2-image_size/2);
|
||||||
// //g.setColor(Color.BLACK);
|
g.setColor(Color.BLACK);
|
||||||
// //g.drawRect(img_startx, img_starty, image_size, image_size);
|
g.drawRect(img_startx, img_starty, image_size, image_size);
|
||||||
// g.drawImage(followerUserLogo, img_startx, img_starty, img_startx+image_size, img_starty+image_size, 0, 0, followerUserLogo.getWidth(), followerUserLogo.getHeight(), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerImgBackgroundColor), sigIRC.panel);
|
g.drawImage(followerUserLogo, img_startx, img_starty, img_startx+image_size, img_starty+image_size, 0, 0, followerUserLogo.getWidth(), followerUserLogo.getHeight(), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerImgBackgroundColor), sigIRC.panel);
|
||||||
// }
|
}
|
||||||
// if (announcedFollowerUser.getBio()!=null && announcedFollowerUser.getBio().length()>0) {
|
if (announcedFollowerUser.bio!=null && announcedFollowerUser.bio.length()>0) {
|
||||||
// DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, position.getX()+position.getWidth()-ticksPassed*3, position.getY()+follower_img.getHeight()+2+8, 2, TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerTextColor), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerShadowTextColor), announcedFollowerUser.getBio());
|
DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, position.getX()+position.getWidth()-ticksPassed*3, position.getY()+follower_img.getHeight()+2+8, 2, TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerTextColor), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerShadowTextColor), announcedFollowerUser.bio);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import sig.modules.TouhouMotherModule;
|
|||||||
import sig.modules.TwitchModule;
|
import sig.modules.TwitchModule;
|
||||||
import sig.modules.ChatLog.ChatLogMessage;
|
import sig.modules.ChatLog.ChatLogMessage;
|
||||||
import sig.modules.ChatLog.ChatLogTwitchEmote;
|
import sig.modules.ChatLog.ChatLogTwitchEmote;
|
||||||
|
import sig.modules.Controller.ControlConfigurationWindow;
|
||||||
import sig.modules.utils.MyKernel32;
|
import sig.modules.utils.MyKernel32;
|
||||||
import sig.modules.utils.PsapiTools;
|
import sig.modules.utils.PsapiTools;
|
||||||
import sig.utils.FileUtils;
|
import sig.utils.FileUtils;
|
||||||
@ -52,12 +53,14 @@ import java.io.OutputStreamWriter;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.net.SocketException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
@ -92,6 +95,7 @@ public class sigIRC{
|
|||||||
static int dingThreshold;
|
static int dingThreshold;
|
||||||
static Color backgroundcol;
|
static Color backgroundcol;
|
||||||
public static BackgroundColorButton button;
|
public static BackgroundColorButton button;
|
||||||
|
public static ModuleSelectorButton modulebutton;
|
||||||
public static JFrame window;
|
public static JFrame window;
|
||||||
static boolean overlayMode=false;
|
static boolean overlayMode=false;
|
||||||
public static boolean showWindowControls=false;
|
public static boolean showWindowControls=false;
|
||||||
@ -108,8 +112,8 @@ public class sigIRC{
|
|||||||
static Integer messageFontSize = 24;
|
static Integer messageFontSize = 24;
|
||||||
static Integer usernameFontSize = 16;
|
static Integer usernameFontSize = 16;
|
||||||
static Integer touhoumotherConsoleFontSize = 12;
|
static Integer touhoumotherConsoleFontSize = 12;
|
||||||
static boolean touhoumothermodule_enabled=false;
|
public static boolean touhoumothermodule_enabled=false;
|
||||||
static boolean twitchmodule_enabled=true;
|
public static boolean twitchmodule_enabled=true;
|
||||||
public static boolean chatlogmodule_enabled=true;
|
public static boolean chatlogmodule_enabled=true;
|
||||||
static boolean downloadsComplete=false;
|
static boolean downloadsComplete=false;
|
||||||
static boolean hardwareAcceleration=true;
|
static boolean hardwareAcceleration=true;
|
||||||
@ -168,9 +172,12 @@ public class sigIRC{
|
|||||||
public static int lastSubEmoteUpdate = -1;
|
public static int lastSubEmoteUpdate = -1;
|
||||||
public static boolean autoUpdateProgram = true;
|
public static boolean autoUpdateProgram = true;
|
||||||
public static Image programIcon;
|
public static Image programIcon;
|
||||||
final public static int MAX_CONNECTION_RETRIES = 100;
|
//final public static int MAX_CONNECTION_RETRIES = 100;
|
||||||
public final static String CLIENTID = "b5d94i1pu4pq6egyc43xil4p3ujh8t";
|
public static String CLIENTID = "";
|
||||||
public static int retryCounter = 0;
|
public static int retryCounter = 0;
|
||||||
|
public static boolean newUpdateIsAvailable = false;
|
||||||
|
public static long lastRetryTime = 0l;
|
||||||
|
public static List<ModuleLinker> moduleList;
|
||||||
|
|
||||||
public static int subchannelCount = 0;
|
public static int subchannelCount = 0;
|
||||||
public static HashMap<Long,String> subchannelIds = new HashMap<Long,String>();
|
public static HashMap<Long,String> subchannelIds = new HashMap<Long,String>();
|
||||||
@ -182,13 +189,40 @@ public class sigIRC{
|
|||||||
static int lastWindowX = 0;
|
static int lastWindowX = 0;
|
||||||
static int lastWindowY = 0;
|
static int lastWindowY = 0;
|
||||||
public static String longString = "10988989d";
|
public static String longString = "10988989d";
|
||||||
|
public static ModuleSelector moduleSelectorWindow;
|
||||||
|
public static String oauth;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
String[] filedata = FileUtils.readFromFile(BASEDIR+"sigIRC/oauthToken.txt");
|
||||||
|
|
||||||
|
oauth = filedata[0];
|
||||||
|
//filedata = FileUtils.readFromFile("user_data");
|
||||||
|
|
||||||
|
JSONObject data;
|
||||||
|
try {
|
||||||
|
FileUtils.downloadFileFromUrl("https://id.twitch.tv/oauth2/validate", "user_data");
|
||||||
|
data = FileUtils.readJsonFromFile("user_data");
|
||||||
|
sigIRC.CLIENTID = data.getString("client_id");
|
||||||
|
} catch (JSONException | IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
config = InitializeConfigurationFile();
|
config = InitializeConfigurationFile();
|
||||||
|
|
||||||
server = config.getProperty("server");
|
server = config.getProperty("server");
|
||||||
nickname = config.getProperty("nickname");
|
nickname = config.getProperty("nickname");
|
||||||
channel = config.getProperty("channel");
|
channel = config.getProperty("channel");
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
channel_id = sigIRC.GetChannelID(channel.replace("#", ""));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
overlayMode = config.getBoolean("overlayMode", false);
|
overlayMode = config.getBoolean("overlayMode", false);
|
||||||
showWindowControls = config.getBoolean("showWindowControls", true);
|
showWindowControls = config.getBoolean("showWindowControls", true);
|
||||||
windowX = config.getInteger("windowX", 0);
|
windowX = config.getInteger("windowX", 0);
|
||||||
@ -271,10 +305,6 @@ public class sigIRC{
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
String[] filedata = FileUtils.readFromFile(BASEDIR+"sigIRC/oauthToken.txt");
|
|
||||||
|
|
||||||
final String oauth = filedata[0];
|
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
|
|
||||||
WriteBreakToLogFile();
|
WriteBreakToLogFile();
|
||||||
@ -355,6 +385,7 @@ public class sigIRC{
|
|||||||
manager = new FileManager("swap.png"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("swap.png"); manager.verifyAndFetchFileFromServer();
|
||||||
manager = new FileManager("update.png"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("update.png"); manager.verifyAndFetchFileFromServer();
|
||||||
manager = new FileManager("backcolor.png"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("backcolor.png"); manager.verifyAndFetchFileFromServer();
|
||||||
|
manager = new FileManager("modules.png"); manager.verifyAndFetchFileFromServer();
|
||||||
manager = new FileManager("drag_bar.png"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("drag_bar.png"); manager.verifyAndFetchFileFromServer();
|
||||||
manager = new FileManager("map_icons.png"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("map_icons.png"); manager.verifyAndFetchFileFromServer();
|
||||||
manager = new FileManager("sigIRC/stamps1.png"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("sigIRC/stamps1.png"); manager.verifyAndFetchFileFromServer();
|
||||||
@ -386,10 +417,10 @@ public class sigIRC{
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
newUpdateIsAvailable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InitializeModules() {
|
private static void InitializeModules() {
|
||||||
try {
|
try {
|
||||||
Module.IMG_DRAGBAR = ImageIO.read(new File(sigIRC.BASEDIR+"drag_bar.png"));
|
Module.IMG_DRAGBAR = ImageIO.read(new File(sigIRC.BASEDIR+"drag_bar.png"));
|
||||||
@ -434,10 +465,7 @@ public class sigIRC{
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (bandorimodule_enabled) {
|
if (bandorimodule_enabled) {
|
||||||
modules.add(new BandoriModule(
|
BandoriModule.loadModule();
|
||||||
new Rectangle(bandorimodule_X,bandorimodule_Y,bandorimodule_width,bandorimodule_height),
|
|
||||||
"Bandori"
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
if (ddrstepmodule_enabled) {
|
if (ddrstepmodule_enabled) {
|
||||||
modules.add(new DDRStepModule(
|
modules.add(new DDRStepModule(
|
||||||
@ -445,6 +473,7 @@ public class sigIRC{
|
|||||||
"DDR Step"
|
"DDR Step"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
moduleSelectorWindow = new ModuleSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InitializeCustomSounds() {
|
private static void InitializeCustomSounds() {
|
||||||
@ -473,17 +502,18 @@ public class sigIRC{
|
|||||||
writer.flush();
|
writer.flush();
|
||||||
runIRCLoop(channel, writer, reader);
|
runIRCLoop(channel, writer, reader);
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException | SocketException e) {
|
||||||
e.printStackTrace();
|
//e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (retryCounter<MAX_CONNECTION_RETRIES) {
|
new java.util.Timer().schedule(new TimerTask() {
|
||||||
|
public void run() {
|
||||||
InitializeIRCConnection(server,nickname,channel,oauth);
|
InitializeIRCConnection(server,nickname,channel,oauth);
|
||||||
} else {
|
sigIRC.panel.addMessage("SYSTEM: Lost connection. Trying to reconnect...");
|
||||||
sigIRC.panel.addMessage("Connection timed out. Please restart and try again.");
|
System.out.println("SYSTEM: Lost connection. Trying to reconnect...");
|
||||||
System.out.println("Connection timed out. Please restart and try again.");
|
|
||||||
}
|
}
|
||||||
|
},10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteBreakToLogFile() {
|
public static void WriteBreakToLogFile() {
|
||||||
@ -497,10 +527,7 @@ public class sigIRC{
|
|||||||
|
|
||||||
private static void getSubChannels(String s) {
|
private static void getSubChannels(String s) {
|
||||||
try {
|
try {
|
||||||
FileUtils.downloadFileFromUrl("https://api.twitch.tv/kraken/users?login="+s, "temp_connect");
|
Long id = GetChannelID(s);
|
||||||
JSONObject j = FileUtils.readJsonFromFile("temp_connect");
|
|
||||||
JSONArray a = j.getJSONArray("users");
|
|
||||||
Long id = Long.parseLong(a.getJSONObject(0).getString("_id"));
|
|
||||||
subchannelIds.put(id, s);
|
subchannelIds.put(id, s);
|
||||||
//System.out.println("Got ID "+id+" for channel "+s);
|
//System.out.println("Got ID "+id+" for channel "+s);
|
||||||
} catch (JSONException | IOException e) {
|
} catch (JSONException | IOException e) {
|
||||||
@ -509,6 +536,14 @@ public class sigIRC{
|
|||||||
//TwitchModule.streamOnline=true;
|
//TwitchModule.streamOnline=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Long GetChannelID(String username) throws IOException {
|
||||||
|
FileUtils.downloadFileFromUrl("https://api.twitch.tv/kraken/users?login="+username, "temp_connect");
|
||||||
|
JSONObject j = FileUtils.readJsonFromFile("temp_connect");
|
||||||
|
JSONArray a = j.getJSONArray("users");
|
||||||
|
Long id = Long.parseLong(a.getJSONObject(0).getString("_id"));
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
/*private static void getSubChannels(String channelName) {
|
/*private static void getSubChannels(String channelName) {
|
||||||
manager.channels().get(channelName, new ChannelResponseHandler() {
|
manager.channels().get(channelName, new ChannelResponseHandler() {
|
||||||
@Override
|
@Override
|
||||||
@ -710,6 +745,7 @@ public class sigIRC{
|
|||||||
f.setIconImage(programIcon);
|
f.setIconImage(programIcon);
|
||||||
|
|
||||||
button = new BackgroundColorButton(new File(sigIRC.BASEDIR+"backcolor.png"),panel.getX()+panel.getWidth()-96,64+rowobj.size()*rowSpacing);
|
button = new BackgroundColorButton(new File(sigIRC.BASEDIR+"backcolor.png"),panel.getX()+panel.getWidth()-96,64+rowobj.size()*rowSpacing);
|
||||||
|
modulebutton = new ModuleSelectorButton(new File(sigIRC.BASEDIR+"modules.png"),panel.getX()+panel.getWidth()-96,64+rowobj.size()*rowSpacing);
|
||||||
if (sigIRC.overlayMode) {
|
if (sigIRC.overlayMode) {
|
||||||
f.setBackground(new Color(0,0,0,0));
|
f.setBackground(new Color(0,0,0,0));
|
||||||
f.setAlwaysOnTop(true);
|
f.setAlwaysOnTop(true);
|
||||||
|
@ -242,9 +242,10 @@ public class FileUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void logToFile(String message, String filename) {
|
public static void logToFile(String message, String filename) {
|
||||||
if (filename.equalsIgnoreCase("debug.log") && RabiRaceModule.DEBUGMODE==1
|
if ((!filename.equalsIgnoreCase("debug.log") &&
|
||||||
|
!filename.equalsIgnoreCase("debug2.log")) || (filename.equalsIgnoreCase("debug.log") && RabiRaceModule.DEBUGMODE==1)
|
||||||
||
|
||
|
||||||
filename.equalsIgnoreCase("debug2.log") && RabiRaceModule.DEBUGMODE==2
|
(filename.equalsIgnoreCase("debug2.log") && RabiRaceModule.DEBUGMODE==2)
|
||||||
) {
|
) {
|
||||||
logToFile(message,filename,false);
|
logToFile(message,filename,false);
|
||||||
}
|
}
|
||||||
@ -314,8 +315,7 @@ public class FileUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void downloadFileFromUrl(String url, String file,boolean bearer) throws IOException, JSONException {
|
||||||
public static void downloadFileFromUrl(String url, String file) throws IOException, JSONException {
|
|
||||||
File filer = new File(file);
|
File filer = new File(file);
|
||||||
filer.createNewFile();
|
filer.createNewFile();
|
||||||
|
|
||||||
@ -327,7 +327,11 @@ public class FileUtils {
|
|||||||
connection.setRequestMethod("GET");
|
connection.setRequestMethod("GET");
|
||||||
//connection.setRequestProperty("Content-Type", "application/json");
|
//connection.setRequestProperty("Content-Type", "application/json");
|
||||||
connection.setRequestProperty("Accept", "application/vnd.twitchtv.v5+json");
|
connection.setRequestProperty("Accept", "application/vnd.twitchtv.v5+json");
|
||||||
|
connection.setRequestProperty("Authorization", ((bearer)?"Bearer":"OAuth") + " "+sigIRC.oauth.replace("oauth:", ""));
|
||||||
|
if (sigIRC.CLIENTID.length()!=0) {
|
||||||
connection.setRequestProperty("Client-ID", sigIRC.CLIENTID);
|
connection.setRequestProperty("Client-ID", sigIRC.CLIENTID);
|
||||||
|
//System.out.println("Using "+ sigIRC.oauth+"/"+sigIRC.CLIENTID);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
ReadableByteChannel rbc = Channels.newChannel(connection.getInputStream());
|
ReadableByteChannel rbc = Channels.newChannel(connection.getInputStream());
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
FileOutputStream fos = new FileOutputStream(file);
|
||||||
@ -337,4 +341,8 @@ public class FileUtils {
|
|||||||
System.out.println("Failed to connect, moving on...");
|
System.out.println("Failed to connect, moving on...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void downloadFileFromUrl(String url, String file) throws IOException, JSONException {
|
||||||
|
downloadFileFromUrl(url,file,false); //Uses OAUTH instead of Bearer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user