Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
fix: #658 System.out.printlnをMain.getMyMaidLogger().infoに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
book000 committed Jan 24, 2022
1 parent 49911f2 commit ebe0a83
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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") ||
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
*
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
}

Expand Down Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand All @@ -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());
Expand Down Expand Up @@ -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) {
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/jaoafa/mymaid4/event/Event_Vote.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/jaoafa/mymaid4/lib/MySQLDBManager.java
Original file line number Diff line number Diff line change
@@ -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
*
Expand All @@ -11,6 +11,8 @@

package com.jaoafa.mymaid4.lib;

import com.jaoafa.mymaid4.Main;

import java.sql.*;

public class MySQLDBManager {
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}
Expand Down

0 comments on commit ebe0a83

Please sign in to comment.