Fix some log stuff

This commit is contained in:
Marc Baloup 2021-07-04 16:05:45 +02:00
parent 611dd00c48
commit 1c7f64595e
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893
2 changed files with 13 additions and 3 deletions

View File

@ -5,6 +5,8 @@ import java.net.ServerSocket;
import java.util.Arrays;
import java.util.HashMap;
import fr.pandacube.lib.core.util.Log;
@Deprecated
public class NetworkAPIListener implements Runnable {
@ -40,7 +42,7 @@ public class NetworkAPIListener implements Runnable {
}
}
System.out.println("NetworkAPI '" + name + "' à l'écoute sur le port " + port);
Log.info("NetworkAPI '" + name + "' à l'écoute sur le port " + port);
try {
// réception des connexion client
@ -57,7 +59,7 @@ public class NetworkAPIListener implements Runnable {
} catch (IOException e) {}
}
System.out.println("NetworkAPI '" + name + "' ferme le port " + port);
Log.info("NetworkAPI '" + name + "' ferme le port " + port);
}

View File

@ -1,9 +1,11 @@
package fr.pandacube.lib.paper.util;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import org.bukkit.Bukkit;
import fr.pandacube.lib.core.util.Log;
import fr.pandacube.lib.paper.PandaLibPaper;
public class ThreadUtil {
@ -19,7 +21,13 @@ public class ThreadUtil {
if (Bukkit.isPrimaryThread())
return task.call();
return Bukkit.getScheduler().callSyncMethod(PandaLibPaper.getPlugin(), task).get();
try {
return Bukkit.getScheduler().callSyncMethod(PandaLibPaper.getPlugin(), task).get();
} catch (ExecutionException e) {
Log.severe("Execution Exception while running code on server Thread. The source exception is:",
e.getCause());
throw e;
}
}
public static void runOnServerThreadAndWait(Runnable task) throws Exception {