Updated more println to new logger
This commit is contained in:
1 parent
84c8748731
commit
49e7f87d17
9 files changed
+23
-16
No files matched your search
@@ -63,6 +63,7 @@
|
||||
<groupId>org.fusesource.jansi</groupId>
|
||||
<artifactId>jansi</artifactId>
|
||||
<version>1.17</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sedmelluq</groupId>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package netneutrality.db;
|
||||
|
||||
import netneutrality.MusicBot;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public abstract class AbstractController {
|
||||
@@ -19,14 +21,14 @@ public abstract class AbstractController {
|
||||
}
|
||||
|
||||
public AbstractController start() {
|
||||
System.out.println("Starting task.. ["+ getControllerName() + "}");
|
||||
MusicBot.LOGGER.debug("Starting task.. ["+ getControllerName() + "}");
|
||||
DBController.isDoingSomething = true;
|
||||
isDoingSomething = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected AbstractController end() {
|
||||
System.out.println("Ended task! ["+ getControllerName() + "}");
|
||||
MusicBot.LOGGER.debug("Ended task! ["+ getControllerName() + "}");
|
||||
DBController.isDoingSomething = false;
|
||||
isDoingSomething = false;
|
||||
return this;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DBController {
|
||||
public static MysqlDatabase get() {
|
||||
try {
|
||||
if (database.isClosed()) {
|
||||
System.out.println("Reconnecting to database..");
|
||||
MusicBot.LOGGER.info("Reconnecting to database..");
|
||||
database.reconnect();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@@ -93,7 +93,7 @@ public class DBController {
|
||||
* Loads all the controllers which extends {@link AbstractController}
|
||||
*/
|
||||
private static void loadControllers() {
|
||||
System.out.println("Loading databases controllers..");
|
||||
MusicBot.LOGGER.info("Loading databases controllers..");
|
||||
|
||||
Reflections reflections = new Reflections("netneutrality.db.controllers");
|
||||
Set<Class<? extends AbstractController>> classes = reflections.getSubTypesOf(AbstractController.class);
|
||||
@@ -109,7 +109,7 @@ public class DBController {
|
||||
|
||||
if (!controllers.containsKey(c.getControllerName())) {
|
||||
controllers.put(c.getControllerName(), c);
|
||||
System.out.println("Loaded controller: " + c.getControllerName());
|
||||
MusicBot.LOGGER.info("Loaded controller: " + c.getControllerName());
|
||||
}
|
||||
|
||||
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException e) {
|
||||
|
||||
@@ -26,10 +26,10 @@ public class MysqlDatabase {
|
||||
public MysqlDatabase(String dbName) {
|
||||
this.dbName = dbName;
|
||||
try {
|
||||
System.out.println("Connecting to database...");
|
||||
MusicBot.LOGGER.info("Connecting to database...");
|
||||
connection = new MysqlConnector(dbName, "root", "localhost", "").connect().getConnection();
|
||||
} catch (SQLException e) {
|
||||
System.err.println("Error connecting to database. Shutting down..");
|
||||
MusicBot.LOGGER.error("Error connecting to database. Shutting down..");
|
||||
MusicBot.disconnect();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package netneutrality.handler;
|
||||
|
||||
import netneutrality.MusicBot;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -8,7 +10,7 @@ public class ConsoleHandler {
|
||||
|
||||
|
||||
public ConsoleHandler() {
|
||||
System.out.println("Console input ready!");
|
||||
MusicBot.LOGGER.info("Console input ready!");
|
||||
}
|
||||
|
||||
public String init() throws IOException {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class MessageRateLimit {
|
||||
private static OffsetDateTime timestamp;
|
||||
private static int cooldown = 500000000; // 1 seconds = 1000000000 nanoseconds
|
||||
|
||||
public static boolean check(MessageReceivedEvent event) {
|
||||
public synchronized static boolean check(MessageReceivedEvent event) {
|
||||
|
||||
if (event.getChannel() instanceof PrivateChannel)
|
||||
return false;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import net.dv8tion.jda.core.entities.ChannelType;
|
||||
import netneutrality.MusicBot;
|
||||
import netneutrality.command.Visibility;
|
||||
import netneutrality.command.basic.HelpCommand;
|
||||
import org.reflections.Reflections;
|
||||
@@ -101,7 +102,7 @@ public class NewCommandListener extends ListenerAdapter {
|
||||
}
|
||||
|
||||
private void initCommands() {
|
||||
System.out.println("Loading commands..");
|
||||
MusicBot.LOGGER.info("Loading commands..");
|
||||
|
||||
Reflections reflections = new Reflections("netneutrality.command");
|
||||
Set<Class<? extends AbstractCommand>> classes = reflections.getSubTypesOf(AbstractCommand.class);
|
||||
@@ -125,8 +126,8 @@ public class NewCommandListener extends ListenerAdapter {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Loaded " + commands.size() + " commands!");
|
||||
|
||||
MusicBot.LOGGER.info("Loaded " + commands.size() + " commands!");
|
||||
}
|
||||
|
||||
private void initAlias() {
|
||||
|
||||
@@ -7,6 +7,7 @@ package netneutrality.http.server;
|
||||
*/
|
||||
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import netneutrality.MusicBot;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
@@ -17,7 +18,7 @@ public class WebApi {
|
||||
private HttpServer server;
|
||||
|
||||
public WebApi() {
|
||||
System.out.println("Starting web server...");
|
||||
MusicBot.LOGGER.debug("Starting web server...");
|
||||
try {
|
||||
server = HttpServer.create(new InetSocketAddress(port), 0);
|
||||
} catch (IOException e) {
|
||||
@@ -27,7 +28,7 @@ public class WebApi {
|
||||
server.createContext("/guild", new GuildBrowser());
|
||||
server.setExecutor(null);
|
||||
server.start();
|
||||
System.out.println("Web server started at [" + server.getAddress().getAddress().toString() + "]");
|
||||
MusicBot.LOGGER.debug("Web server started at [" + server.getAddress().getAddress().getAddress().toString() + "]");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -50,12 +50,12 @@ public class MusicManager {
|
||||
return vChannel != null && vChannel.equals(MusicBot.getJDA().getGuildById(guildId).getAudioManager().getConnectedChannel());
|
||||
}
|
||||
|
||||
public void connect(VoiceChannel vChannel) {
|
||||
public synchronized void connect(VoiceChannel vChannel) {
|
||||
if (vChannel != null && !isConnectedTo(vChannel)) {
|
||||
Guild guild = MusicBot.getJDA().getGuildById(guildId);
|
||||
guild.getAudioManager().openAudioConnection(vChannel);
|
||||
} else
|
||||
MusicBot.LOGGER.debug("Error connecting!");
|
||||
MusicBot.LOGGER.error("Error connecting!");
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
|
||||
Reference in new issue
Block a user