From ebe0a83516d76d0b27f52c2a520b857c8b8e838b Mon Sep 17 00:00:00 2001 From: "Tomachi [ICHIGO]" Date: Mon, 24 Jan 2022 19:49:56 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20#658=20System.out.println=E3=82=92Main.g?= =?UTF-8?q?etMyMaidLogger().info=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mymaid4/discordEvent/DiscordEvent_Ready.java | 2 +- .../mymaid4/event/Event_AntiProblemCommand.java | 5 +++-- .../jaoafa/mymaid4/event/Event_Antijaoium.java | 2 +- .../mymaid4/event/Event_MCBansLoginCheck.java | 16 ++++++++-------- .../mymaid4/event/Event_NewPlayerAutoBlMap.java | 12 ++++++------ .../mymaid4/event/Event_PacketLimiterKick.java | 3 ++- .../com/jaoafa/mymaid4/event/Event_Vote.java | 2 +- .../com/jaoafa/mymaid4/lib/MySQLDBManager.java | 8 +++++--- 8 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/jaoafa/mymaid4/discordEvent/DiscordEvent_Ready.java b/src/main/java/com/jaoafa/mymaid4/discordEvent/DiscordEvent_Ready.java index 88344f25e..c196131dc 100644 --- a/src/main/java/com/jaoafa/mymaid4/discordEvent/DiscordEvent_Ready.java +++ b/src/main/java/com/jaoafa/mymaid4/discordEvent/DiscordEvent_Ready.java @@ -20,7 +20,7 @@ public class DiscordEvent_Ready extends ListenerAdapter { @SubscribeEvent public void onReady(ReadyEvent event) { - System.out.println("Ready: " + event.getJDA().getSelfUser().getName()); + Main.getMyMaidLogger().info("Ready: " + event.getJDA().getSelfUser().getName()); MyMaidData.setReportChannel(event.getJDA().getTextChannelById(Main.getMyMaidConfig().getReportChannelId())); MyMaidData.setJaotanChannel(event.getJDA().getTextChannelById(Main.getMyMaidConfig().getJaotanChannelId())); diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_AntiProblemCommand.java b/src/main/java/com/jaoafa/mymaid4/event/Event_AntiProblemCommand.java index f7ad88427..dd4c76396 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_AntiProblemCommand.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_AntiProblemCommand.java @@ -11,6 +11,7 @@ package com.jaoafa.mymaid4.event; +import com.jaoafa.mymaid4.Main; import com.jaoafa.mymaid4.lib.*; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; @@ -301,7 +302,7 @@ public void execute(PlayerCommandPreprocessEvent event, Player player, String[] static class AntiCmd_KickCmd implements AntiCommand { @Override public void execute(PlayerCommandPreprocessEvent event, Player player, String[] args) { - System.out.println("args.length: " + args.length); + Main.getMyMaidLogger().info("args.length: " + args.length); if (args.length >= 2 && (args[1].equalsIgnoreCase(player.getName()) || args[1].equalsIgnoreCase("me") || @@ -386,7 +387,7 @@ public void execute(PlayerCommandPreprocessEvent event, Player player, String[] if (MyMaidData.getJaotanChannel() != null) { MyMaidData.getJaotanChannel().sendMessage(String.format("プレイヤー「%s」がコマンド「%s」を実行したため、キックしました。", player.getName(), command)).queue(); } else { - System.out.println("MyMaidData.getJaotanChannel is null"); + Main.getMyMaidLogger().info("MyMaidData.getJaotanChannel is null"); } event.setCancelled(true); diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_Antijaoium.java b/src/main/java/com/jaoafa/mymaid4/event/Event_Antijaoium.java index e943d68f5..4ebbb4a1e 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_Antijaoium.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_Antijaoium.java @@ -98,7 +98,7 @@ void saveItem(Player player, ItemStack is) { File saveDir = new File(Main.getJavaPlugin().getDataFolder(), "jaoium"); if (!saveDir.exists()) { boolean bool = saveDir.mkdirs(); - System.out.println("Create jaoium data directory: " + bool); + Main.getMyMaidLogger().info("Create jaoium data directory: " + bool); if (!bool) return; } diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_MCBansLoginCheck.java b/src/main/java/com/jaoafa/mymaid4/event/Event_MCBansLoginCheck.java index 71052c7bf..46b115e8e 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_MCBansLoginCheck.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_MCBansLoginCheck.java @@ -1,7 +1,7 @@ /* * jaoLicense * - * Copyright (c) 2021 jao Minecraft Server + * Copyright (c) 2022 jao Minecraft Server * * The following license applies to this project: jaoLicense * @@ -151,7 +151,7 @@ public void run() { try { String url = String.format("https://api.jaoafa.com/users/mcbans/%s", uuid); - System.out.println(MessageFormat.format("OnLoginAfterCheck: APIサーバへの接続を開始: {0} -> {1}", player.getName(), url)); + Main.getMyMaidLogger().info(MessageFormat.format("OnLoginAfterCheck: APIサーバへの接続を開始: {0} -> {1}", player.getName(), url)); OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder().url(url).get().build(); JSONObject json; @@ -163,7 +163,7 @@ public void run() { } try (ResponseBody body = response.body()) { if (body == null) { - System.out.println(MessageFormat.format("OnLoginAfterCheck: APIサーバへの接続に失敗: {0} -> response.body() is null.", url)); + Main.getMyMaidLogger().info(MessageFormat.format("OnLoginAfterCheck: APIサーバへの接続に失敗: {0} -> response.body() is null.", url)); response.close(); return; } @@ -173,15 +173,15 @@ public void run() { } if (!json.has("status")) { - System.out.println("OnLoginAfterCheck: レスポンスの解析に失敗: status not found."); + Main.getMyMaidLogger().info("OnLoginAfterCheck: レスポンスの解析に失敗: status not found."); return; } if (!json.getBoolean("status")) { - System.out.println("OnLoginAfterCheck: レスポンスの解析に失敗: status not boolean."); + Main.getMyMaidLogger().info("OnLoginAfterCheck: レスポンスの解析に失敗: status not boolean."); return; } if (!json.has("data")) { - System.out.println("OnLoginAfterCheck: レスポンスの解析に失敗: data not found."); + Main.getMyMaidLogger().info("OnLoginAfterCheck: レスポンスの解析に失敗: data not found."); return; } @@ -211,9 +211,9 @@ public void run() { }.runTask(Main.getJavaPlugin()); } } catch (SocketTimeoutException e) { - System.out.println("OnLoginAfterCheck: Timeout"); + Main.getMyMaidLogger().info("OnLoginAfterCheck: Timeout"); } catch (IOException e) { - System.out.println("OnLoginAfterCheck: IOException Error..."); + Main.getMyMaidLogger().info("OnLoginAfterCheck: IOException Error..."); MyMaidLibrary.reportError(getClass(), e); } } diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_NewPlayerAutoBlMap.java b/src/main/java/com/jaoafa/mymaid4/event/Event_NewPlayerAutoBlMap.java index c2932f985..6ee63bf11 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_NewPlayerAutoBlMap.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_NewPlayerAutoBlMap.java @@ -49,7 +49,7 @@ public void OnEvent_FirstLogin(PlayerJoinEvent event) { firstLoginer.remove(player.getUniqueId()); return; } - System.out.println("NewPlayerAutoBlMap: 初ログインユーザーがログイン"); + Main.getMyMaidLogger().info("NewPlayerAutoBlMap: 初ログインユーザーがログイン"); firstLoginer.add(player.getUniqueId()); } @@ -59,7 +59,7 @@ public void OnEvent_Quit(PlayerQuitEvent event) { if (!firstLoginer.contains(player.getUniqueId())) { return; } - System.out.println("NewPlayerAutoBlMap: 初ログインユーザーがログアウト"); + Main.getMyMaidLogger().info("NewPlayerAutoBlMap: 初ログインユーザーがログアウト"); new BukkitRunnable() { public void run() { firstLoginer.remove(player.getUniqueId()); @@ -87,7 +87,7 @@ public void run() { response.close(); return; } - System.out.println("NewPlayerAutoBlMap: ブロック編集マップ取得完了"); + Main.getMyMaidLogger().info("NewPlayerAutoBlMap: ブロック編集マップ取得完了"); ResponseBody body = response.body(); if (body == null) { @@ -97,15 +97,15 @@ public void run() { channel.sendFile(body.byteStream(), player.getUniqueId() + ".png") .append(String.format("新規プレイヤー「%s」のブロック編集マップ\nhttps://jaoafa.com/cp/?uuid=%s", player.getName(), player.getUniqueId())).queue(msg -> { - System.out.println("NewPlayerAutoBlMap: メッセージ送信完了 (" + msg.getJumpUrl() + ")"); + Main.getMyMaidLogger().info("NewPlayerAutoBlMap: メッセージ送信完了 (" + msg.getJumpUrl() + ")"); response.close(); }, failure -> { - System.out.println("NewPlayerAutoBlMap: メッセージ送信失敗 (" + failure.getMessage() + ")"); + Main.getMyMaidLogger().info("NewPlayerAutoBlMap: メッセージ送信失敗 (" + failure.getMessage() + ")"); failure.printStackTrace(); response.close(); }); } catch (IOException ex) { - System.out.println("NewPlayerAutoBlMap: APIサーバへの接続に失敗: " + ex.getMessage()); + Main.getMyMaidLogger().info("NewPlayerAutoBlMap: APIサーバへの接続に失敗: " + ex.getMessage()); } } }.runTaskAsynchronously(Main.getJavaPlugin()); diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_PacketLimiterKick.java b/src/main/java/com/jaoafa/mymaid4/event/Event_PacketLimiterKick.java index 4d21c57c8..d22954cba 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_PacketLimiterKick.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_PacketLimiterKick.java @@ -11,6 +11,7 @@ package com.jaoafa.mymaid4.event; +import com.jaoafa.mymaid4.Main; import com.jaoafa.mymaid4.lib.EBan; import com.jaoafa.mymaid4.lib.EventPremise; import com.jaoafa.mymaid4.lib.MyMaidData; @@ -85,7 +86,7 @@ public void onKick(PlayerKickEvent event) { Location teleportLoc = new Location(Bukkit.getWorld("Jao_Afa"), x, 70, z); event.getPlayer().teleport(teleportLoc); - System.out.println("[PacketLimiter_AutoTP] teleport to Jao_Afa " + x + " 70 " + z); + Main.getMyMaidLogger().info("[PacketLimiter_AutoTP] teleport to Jao_Afa " + x + " 70 " + z); if (MyMaidData.getJaotanChannel() == null) { return; diff --git a/src/main/java/com/jaoafa/mymaid4/event/Event_Vote.java b/src/main/java/com/jaoafa/mymaid4/event/Event_Vote.java index 39d8910e9..8d151a110 100644 --- a/src/main/java/com/jaoafa/mymaid4/event/Event_Vote.java +++ b/src/main/java/com/jaoafa/mymaid4/event/Event_Vote.java @@ -137,7 +137,7 @@ public void onVotifierEvent(VotifierEvent event) { Vote vote = event.getVote(); String name = vote.getUsername(); String service = vote.getServiceName(); - System.out.println("onVotifierEvent[MyMaid4]: " + vote.getUsername() + " " + vote.getAddress() + " " + Main.getMyMaidLogger().info("onVotifierEvent[MyMaid4]: " + vote.getUsername() + " " + vote.getAddress() + " " + vote.getServiceName() + " " + vote.getTimeStamp()); new BukkitRunnable() { public void run() { diff --git a/src/main/java/com/jaoafa/mymaid4/lib/MySQLDBManager.java b/src/main/java/com/jaoafa/mymaid4/lib/MySQLDBManager.java index 54dc413f9..baf388f06 100644 --- a/src/main/java/com/jaoafa/mymaid4/lib/MySQLDBManager.java +++ b/src/main/java/com/jaoafa/mymaid4/lib/MySQLDBManager.java @@ -1,7 +1,7 @@ /* * jaoLicense * - * Copyright (c) 2021 jao Minecraft Server + * Copyright (c) 2022 jao Minecraft Server * * The following license applies to this project: jaoLicense * @@ -11,6 +11,8 @@ package com.jaoafa.mymaid4.lib; +import com.jaoafa.mymaid4.Main; + import java.sql.*; public class MySQLDBManager { @@ -40,7 +42,7 @@ public Connection getConnection() throws SQLException { if (diff < WAIT_TIMEOUT) { return conn; } else { - System.out.println("MySQL TIMEOUT! WAIT_TIMEOUT: " + WAIT_TIMEOUT + " / DIFF: " + diff); + Main.getMyMaidLogger().info("MySQL TIMEOUT! WAIT_TIMEOUT: " + WAIT_TIMEOUT + " / DIFF: " + diff); } } LAST_PACKET = System.currentTimeMillis(); @@ -63,7 +65,7 @@ long getWaitTimeout() { ResultSet res = statement.executeQuery(); if (res.next()) { WAIT_TIMEOUT = res.getInt("Value"); - System.out.println("MySQL WAIT_TIMEOUT: " + WAIT_TIMEOUT); + Main.getMyMaidLogger().info("MySQL WAIT_TIMEOUT: " + WAIT_TIMEOUT); } else { WAIT_TIMEOUT = -1; }