Skip to content
Snippets Groups Projects
Commit bb17a163 authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

Reformattage du code.

parent b94be4d3
No related branches found
No related tags found
1 merge request!6Donner le joueur habitué aux joueurs.
Pipeline #50 passed
Showing with 175 additions and 168 deletions
......@@ -271,6 +271,7 @@ ConsoleLog.danger("Impossible de d'encoder les données. Func AsyncChatEvent(Pla
ex.printStackTrace();
}
}
public void sendMessageToDiscord(String message) {
sendMessageToDiscord(message, "SL-Craft");
}
......
......@@ -24,10 +24,10 @@ public class Wild implements CommandExecutor {
// Variables
private final Main plugin;
private List<UUID> wildUsersIndexes;
private List<LocalDateTime> wildUsersLastAsked;
private List<Integer> wildUsersAskNum;
private List<Location> wildUsersStartLocation;
private final List<UUID> wildUsersIndexes;
private final List<LocalDateTime> wildUsersLastAsked;
private final List<Integer> wildUsersAskNum;
private final List<Location> wildUsersStartLocation;
private final int usageCooldown;
private final int usagePerDay;
......@@ -127,7 +127,8 @@ public class Wild implements CommandExecutor {
if (Bukkit.getWorld(plugin.getConfig().getString("wild.world")).getBiome(x, y, z).equals(Biome.valueOf(excludedBiome.toUpperCase()))) {
flag = true;
}
}catch(Exception ignored){}
} catch (Exception ignored) {
}
}
}
......
package com.slprojects.slcraftplugin.parallelTasks;
import com.slprojects.slcraftplugin.Main;
import com.slprojects.slcraftplugin.utils.ConsoleLog;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.json.simple.JSONObject;
......@@ -113,7 +114,7 @@ public class InternalWebServer {
client.close(); // Close the socket itself
}
} catch (IOException e) {
plugin.getServer().getConsoleSender().sendMessage(ChatColor.RED + "["+ plugin.getName() +"] Erreur lors de l'écoute du port " + ChatColor.GOLD + serverPort);
ConsoleLog.danger("Erreur lors de l'écoute du port " + ChatColor.GOLD + serverPort);
e.printStackTrace();
// On va logger le message sur discord
......@@ -125,7 +126,7 @@ public class InternalWebServer {
urlString = plugin.getConfig().getString("discordBot-api-url") + "mc/error/" + URLEncoder.encode(json.toJSONString(), "UTF-8").replace("+", "%20");
relaunchListener(plugin);
} catch (UnsupportedEncodingException ex) {
plugin.getServer().getConsoleSender().sendMessage(ChatColor.RED + "["+ plugin.getName() +"] Erreur lors de l'encodage du message. Func waitForDiscordMsg::startServer(Main plugin)");
ConsoleLog.danger("Erreur lors de l'encodage du message. Func waitForDiscordMsg::startServer(Main plugin)");
ex.printStackTrace();
}
plugin.getHttp(urlString);
......
......@@ -16,7 +16,8 @@ public class PeriodicEvent {
}
public void startPeriodicEvent() {
if(doesTheEventIsCurrentlyRunning) throw new RuntimeException("L'exécution de l'évènement périodique est déjà enclanchée.");
if (doesTheEventIsCurrentlyRunning)
throw new RuntimeException("L'exécution de l'évènement périodique est déjà enclanchée.");
doesTheEventIsCurrentlyRunning = true;
......
......@@ -9,12 +9,15 @@ public class ConsoleLog {
public static void info(String message) {
getServer().getConsoleSender().sendMessage("[" + Main.pluginName + "] " + message);
}
public static void warning(String message) {
getServer().getConsoleSender().sendMessage(ChatColor.GOLD + Main.pluginName + "] " + message);
}
public static void danger(String message) {
getServer().getConsoleSender().sendMessage(ChatColor.RED + Main.pluginName + "] " + message);
}
public static void success(String message) {
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + Main.pluginName + "] " + message);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment