Skip to content

Commit d27ca0a

Browse files
committed
Version 1.0
1 parent d369f1b commit d27ca0a

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@
1111

1212
#Gradle
1313
/.gradle
14-
15-
#Config
16-
*.txt
14+
/build

.travis.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
language: java
22
jdk:
33
- oraclejdk8
4-
script: gradle test
5-
after_success:
6-
- bash <(curl -s https://codecov.io/bash)
4+
script: gradle test

build.gradle

+11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ sourceSets {
2121
}
2222
}
2323

24+
task fatJar(type: Jar) {
25+
manifest {
26+
attributes 'Implementation-Title': 'PhaseBot',
27+
'Implementation-Version': '1.0',
28+
'Main-Class': 'xyz.jadonfowler.phasebot.PhaseBot'
29+
}
30+
baseName = project.name + '-all'
31+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
32+
with jar
33+
}
34+
2435
repositories {
2536
mavenCentral()
2637
}

src/xyz/jadonfowler/phasebot/PhaseBot.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public class PhaseBot {
4747

4848
public static void main(String... args) {
4949
manager = new CommandManager();
50+
console = new ConsoleGui();
5051
loadConfig();
51-
createConsole();
5252
registerCommands();
5353
loadScripts();
5454
bot = new Bot(USERNAME, PASSWORD, HOST, PORT, PROXY);
@@ -119,10 +119,6 @@ else if (line.startsWith("Proxy")) { // Proxy:123.456.789:860
119119
}
120120
}
121121

122-
private static void createConsole() {
123-
console = new ConsoleGui();
124-
}
125-
126122
public static void registerCommands() {
127123
Reflections reflections = new Reflections("xyz.jadonfowler.phasebot.cmd");
128124
Set<Class<? extends Command>> subTypes = reflections.getSubTypesOf(Command.class);
@@ -143,9 +139,8 @@ public static void reloadScripts() {
143139

144140
public static ArrayList<File> getFiles(String directoryName) {
145141
File directory = new File(directoryName);
146-
147142
ArrayList<File> files = new ArrayList<File>();
148-
if(!directory.isDirectory()){
143+
if (!directory.isDirectory()) {
149144
console.println("No files found in " + directoryName);
150145
return files;
151146
}

src/xyz/jadonfowler/phasebot/gui/ConsoleGui.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ public void print(String s, boolean trace) {
109109
}
110110

111111
public void print(String s, boolean trace, Color c) {
112-
Style style = console.addStyle("Style", null);
113-
StyleConstants.setForeground(style, c);
114-
if (trace) {
115-
Throwable t = new Throwable();
116-
StackTraceElement[] elements = t.getStackTrace();
117-
String caller = elements[0].getClassName();
118-
s = caller + " > " + s;
119-
}
120112
try {
113+
Style style = console.addStyle("Style", null);
114+
StyleConstants.setForeground(style, c);
115+
if (trace) {
116+
Throwable t = new Throwable();
117+
StackTraceElement[] elements = t.getStackTrace();
118+
String caller = elements[0].getClassName();
119+
s = caller + " > " + s;
120+
}
121121
document.insertString(document.getLength(), s, style);
122122
}
123123
catch (Exception e) {}

0 commit comments

Comments
 (0)