update deps and add noprompt mode

This commit is contained in:
John Grosh 2021-04-02 14:02:16 -04:00
parent ebf6e43084
commit 699c2a0e6e
3 changed files with 14 additions and 6 deletions

View file

@ -7,6 +7,11 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<repositories> <repositories>
<repository>
<id>dv8tion</id>
<name>m2-dv8tion</name>
<url>https://m2.dv8tion.net/releases</url>
</repository>
<repository> <repository>
<id>central</id> <id>central</id>
<name>bintray</name> <name>bintray</name>
@ -23,12 +28,12 @@
<dependency> <dependency>
<groupId>net.dv8tion</groupId> <groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId> <artifactId>JDA</artifactId>
<version>4.2.0_227</version> <version>4.2.1_253</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sedmelluq</groupId> <groupId>com.sedmelluq</groupId>
<artifactId>lavaplayer</artifactId> <artifactId>lavaplayer</artifactId>
<version>1.3.67</version> <version>1.3.73</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sedmelluq</groupId> <groupId>com.sedmelluq</groupId>

View file

@ -59,8 +59,7 @@ public class JMusicBot
Logger log = LoggerFactory.getLogger("Startup"); Logger log = LoggerFactory.getLogger("Startup");
// create prompt to handle startup // create prompt to handle startup
Prompt prompt = new Prompt("JMusicBot", "Switching to nogui mode. You can manually start in nogui mode by including the -Dnogui=true flag.", Prompt prompt = new Prompt("JMusicBot", "Switching to nogui mode. You can manually start in nogui mode by including the -Dnogui=true flag.");
"true".equalsIgnoreCase(System.getProperty("nogui", "false")));
// get and check latest version // get and check latest version
String version = OtherUtil.checkVersion(prompt); String version = OtherUtil.checkVersion(prompt);

View file

@ -30,6 +30,7 @@ public class Prompt
private final String noguiMessage; private final String noguiMessage;
private boolean nogui; private boolean nogui;
private boolean noprompt;
private Scanner scanner; private Scanner scanner;
public Prompt(String title) public Prompt(String title)
@ -39,14 +40,15 @@ public class Prompt
public Prompt(String title, String noguiMessage) public Prompt(String title, String noguiMessage)
{ {
this(title, noguiMessage, "true".equalsIgnoreCase(System.getProperty("nogui"))); this(title, noguiMessage, "true".equalsIgnoreCase(System.getProperty("nogui")), "true".equalsIgnoreCase(System.getProperty("noprompt")));
} }
public Prompt(String title, String noguiMessage, boolean nogui) public Prompt(String title, String noguiMessage, boolean nogui, boolean noprompt)
{ {
this.title = title; this.title = title;
this.noguiMessage = noguiMessage == null ? "Switching to nogui mode. You can manually start in nogui mode by including the -Dnogui=true flag." : noguiMessage; this.noguiMessage = noguiMessage == null ? "Switching to nogui mode. You can manually start in nogui mode by including the -Dnogui=true flag." : noguiMessage;
this.nogui = nogui; this.nogui = nogui;
this.noprompt = noprompt;
} }
public boolean isNoGUI() public boolean isNoGUI()
@ -108,6 +110,8 @@ public class Prompt
public String prompt(String content) public String prompt(String content)
{ {
if(noprompt)
return null;
if(nogui) if(nogui)
{ {
if(scanner==null) if(scanner==null)