diff --git a/src/main/java/com/github/ucchyocean/lc3/LunaChatLogger.java b/src/main/java/com/github/ucchyocean/lc3/LunaChatLogger.java index 429fefa..88c22ac 100644 --- a/src/main/java/com/github/ucchyocean/lc3/LunaChatLogger.java +++ b/src/main/java/com/github/ucchyocean/lc3/LunaChatLogger.java @@ -7,10 +7,11 @@ package com.github.ucchyocean.lc3; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -65,23 +66,14 @@ public class LunaChatLogger { String msg = Utility.stripColorCode(message); if ( msg == null ) msg = ""; msg = msg.replace(",", ","); - FileWriter writer = null; - try { - writer = new FileWriter(file, true); - String str = lformat.format(new Date()) + - "," + msg + "," + player; + + try ( OutputStreamWriter writer = new OutputStreamWriter( + new FileOutputStream(file, true), "UTF-8"); ) { + + String str = lformat.format(new Date()) + "," + msg + "," + player; writer.write(str + "\r\n"); - writer.flush(); - } catch (Exception e) { + } catch (IOException e) { e.printStackTrace(); - } finally { - if ( writer != null ) { - try { - writer.close(); - } catch (Exception e) { - // do nothing. - } - } } } }).start(); @@ -147,11 +139,11 @@ public class LunaChatLogger { private ArrayList readAllLines(File file) { ArrayList data = new ArrayList(); + if ( !file.exists() ) return data; - BufferedReader reader = null; + try ( BufferedReader reader = new BufferedReader( + new InputStreamReader(new FileInputStream(file), "UTF-8")) ) { - try { - reader = new BufferedReader(new FileReader(file)); String line; while ( (line = reader.readLine()) != null ) { line = line.trim(); @@ -159,18 +151,8 @@ public class LunaChatLogger { data.add(line); } } - } catch (FileNotFoundException e) { - e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); - } finally { - if ( reader != null ) { - try { - reader.close(); - } catch (IOException e) { - // do nothing. - } - } } return data; diff --git a/src/main/java/com/github/ucchyocean/lc3/Messages.java b/src/main/java/com/github/ucchyocean/lc3/Messages.java index 32aee1e..245a71e 100644 --- a/src/main/java/com/github/ucchyocean/lc3/Messages.java +++ b/src/main/java/com/github/ucchyocean/lc3/Messages.java @@ -538,7 +538,7 @@ public class Messages { String msg = resources.getString("cmdmsgJoin"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -548,7 +548,7 @@ public class Messages { String msg = resources.getString("cmdmsgSet"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -558,7 +558,7 @@ public class Messages { String msg = resources.getString("cmdmsgSetTopic"); if ( msg == null ) return ""; msg = msg.replace("%topic%", topic.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -567,7 +567,7 @@ public class Messages { public static String cmdmsgSetHide() { String msg = resources.getString("cmdmsgSetHide"); if ( msg == null ) return ""; - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -577,7 +577,7 @@ public class Messages { String msg = resources.getString("cmdmsgLeave"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -588,7 +588,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -599,7 +599,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -608,7 +608,7 @@ public class Messages { public static String cmdmsgInvited2() { String msg = resources.getString("cmdmsgInvited2"); if ( msg == null ) return ""; - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -617,7 +617,7 @@ public class Messages { public static String cmdmsgDeny() { String msg = resources.getString("cmdmsgDeny"); if ( msg == null ) return ""; - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -626,7 +626,7 @@ public class Messages { public static String cmdmsgDenyed() { String msg = resources.getString("cmdmsgDenyed"); if ( msg == null ) return ""; - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -637,7 +637,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -647,7 +647,7 @@ public class Messages { String msg = resources.getString("cmdmsgKicked"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -658,7 +658,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -670,7 +670,7 @@ public class Messages { msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); msg = msg.replace("%minutes%", minutes.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -680,7 +680,7 @@ public class Messages { String msg = resources.getString("cmdmsgBanned"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -691,7 +691,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -701,7 +701,7 @@ public class Messages { String msg = resources.getString("cmdmsgPardoned"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -712,7 +712,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -724,7 +724,7 @@ public class Messages { msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); msg = msg.replace("%minutes%", minutes.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -734,7 +734,7 @@ public class Messages { String msg = resources.getString("cmdmsgMuted"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -745,7 +745,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -755,7 +755,7 @@ public class Messages { String msg = resources.getString("cmdmsgUnmuted"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -765,7 +765,7 @@ public class Messages { String msg = resources.getString("cmdmsgHided"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -775,7 +775,7 @@ public class Messages { String msg = resources.getString("cmdmsgHidedPlayer"); if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -785,7 +785,7 @@ public class Messages { String msg = resources.getString("cmdmsgUnhided"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -795,7 +795,7 @@ public class Messages { String msg = resources.getString("cmdmsgUnhidedPlayer"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -804,7 +804,7 @@ public class Messages { public static String cmdmsgReload() { String msg = resources.getString("cmdmsgReload"); if ( msg == null ) return ""; - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -814,7 +814,7 @@ public class Messages { String msg = resources.getString("cmdmsgCreate"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -824,7 +824,7 @@ public class Messages { String msg = resources.getString("cmdmsgRemove"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -834,7 +834,7 @@ public class Messages { String msg = resources.getString("cmdmsgFormat"); if ( msg == null ) return ""; msg = msg.replace("%format%", format.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -845,7 +845,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -856,7 +856,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -867,7 +867,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%key%", key.toString()); msg = msg.replace("%value%", value.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -877,7 +877,7 @@ public class Messages { String msg = resources.getString("cmdmsgDictionaryRemove"); if ( msg == null ) return ""; msg = msg.replace("%key%", key.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -888,7 +888,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%key%", key.toString()); msg = msg.replace("%value%", value.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -899,7 +899,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%index%", index.toString()); msg = msg.replace("%value%", value.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -909,7 +909,7 @@ public class Messages { String msg = resources.getString("cmdmsgTemplateRemove"); if ( msg == null ) return ""; msg = msg.replace("%index%", index.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -920,7 +920,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -930,7 +930,7 @@ public class Messages { String msg = resources.getString("cmdmsgPlayerJapanize"); if ( msg == null ) return ""; msg = msg.replace("%value%", value.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -941,7 +941,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); msg = msg.replace("%value%", value.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -952,7 +952,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%inviter%", inviter.toString()); msg = msg.replace("%invited%", invited.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -962,7 +962,7 @@ public class Messages { String msg = resources.getString("cmdmsgReplyInviterNone"); if ( msg == null ) return ""; msg = msg.replace("%inviter%", inviter.toString()); - return resources.getString("infoPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("infoPrefix", "") + msg); } /** @@ -971,7 +971,7 @@ public class Messages { public static String errmsgIngame() { String msg = resources.getString("errmsgIngame"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -980,7 +980,7 @@ public class Messages { public static String errmsgCommand() { String msg = resources.getString("errmsgCommand"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -989,7 +989,7 @@ public class Messages { public static String errmsgNotExist() { String msg = resources.getString("errmsgNotExist"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -998,7 +998,7 @@ public class Messages { public static String errmsgNotExistChannelAndPlayer() { String msg = resources.getString("errmsgNotExistChannelAndPlayer"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1007,7 +1007,7 @@ public class Messages { public static String errmsgNotExistOrNotSpecified() { String msg = resources.getString("errmsgNotExistOrNotSpecified"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1016,7 +1016,7 @@ public class Messages { public static String errmsgExist() { String msg = resources.getString("errmsgExist"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1025,7 +1025,7 @@ public class Messages { public static String errmsgNomember() { String msg = resources.getString("errmsgNomember"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1034,7 +1034,7 @@ public class Messages { public static String errmsgNomemberOther() { String msg = resources.getString("errmsgNomemberOther"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1044,7 +1044,7 @@ public class Messages { String msg = resources.getString("errmsgNotfoundPlayer"); if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1053,7 +1053,7 @@ public class Messages { public static String errmsgNotInvited() { String msg = resources.getString("errmsgNotInvited"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1062,7 +1062,7 @@ public class Messages { public static String errmsgNotfoundChannel() { String msg = resources.getString("errmsgNotfoundChannel"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1072,7 +1072,7 @@ public class Messages { String msg = resources.getString("errmsgInvitedAlreadyExist"); if ( msg == null ) return ""; msg = msg.replace("%player%", player.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1081,7 +1081,7 @@ public class Messages { public static String errmsgInvitedAlreadyJoin() { String msg = resources.getString("errmsgInvitedAlreadyJoin"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1090,7 +1090,7 @@ public class Messages { public static String errmsgNoJoin() { String msg = resources.getString("errmsgNoJoin"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1099,7 +1099,7 @@ public class Messages { public static String errmsgBanned() { String msg = resources.getString("errmsgBanned"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1108,7 +1108,7 @@ public class Messages { public static String errmsgMuted() { String msg = resources.getString("errmsgMuted"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1117,7 +1117,7 @@ public class Messages { public static String errmsgAlreadyBanned() { String msg = resources.getString("errmsgAlreadyBanned"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1126,7 +1126,7 @@ public class Messages { public static String errmsgAlreadyMuted() { String msg = resources.getString("errmsgAlreadyMuted"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1135,7 +1135,7 @@ public class Messages { public static String errmsgAlreadyHided() { String msg = resources.getString("errmsgAlreadyHided"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1144,7 +1144,7 @@ public class Messages { public static String errmsgAlreadyHidedPlayer() { String msg = resources.getString("errmsgAlreadyHidedPlayer"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1153,7 +1153,7 @@ public class Messages { public static String errmsgAlreadyUnhided() { String msg = resources.getString("errmsgAlreadyUnhided"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1162,7 +1162,7 @@ public class Messages { public static String errmsgAlreadyUnhidedPlayer() { String msg = resources.getString("errmsgAlreadyUnhidedPlayer"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1171,7 +1171,7 @@ public class Messages { public static String errmsgCannotJoinPersonal() { String msg = resources.getString("errmsgCannotJoinPersonal"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1180,7 +1180,7 @@ public class Messages { public static String errmsgNotModerator() { String msg = resources.getString("errmsgNotModerator"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1189,7 +1189,7 @@ public class Messages { public static String errmsgNotBanned() { String msg = resources.getString("errmsgNotBanned"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1198,7 +1198,7 @@ public class Messages { public static String errmsgNotMuted() { String msg = resources.getString("errmsgNotMuted"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1207,7 +1207,7 @@ public class Messages { public static String errmsgInvalidOptions() { String msg = resources.getString("errmsgInvalidOptions"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1216,7 +1216,7 @@ public class Messages { public static String errmsgPassword1() { String msg = resources.getString("errmsgPassword1"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1225,7 +1225,7 @@ public class Messages { public static String errmsgPassword2() { String msg = resources.getString("errmsgPassword2"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1234,7 +1234,7 @@ public class Messages { public static String errmsgPassword3() { String msg = resources.getString("errmsgPassword3"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1243,7 +1243,7 @@ public class Messages { public static String errmsgPasswordNotmatch() { String msg = resources.getString("errmsgPasswordNotmatch"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1253,7 +1253,7 @@ public class Messages { String msg = resources.getString("errmsgPermission"); if ( msg == null ) return ""; msg = msg.replace("%permission%", permission.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1263,7 +1263,7 @@ public class Messages { String msg = resources.getString("errmsgCannotLeaveGlobal"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1273,7 +1273,7 @@ public class Messages { String msg = resources.getString("errmsgCannotKickGlobal"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1283,7 +1283,7 @@ public class Messages { String msg = resources.getString("errmsgCannotBANGlobal"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1293,7 +1293,7 @@ public class Messages { String msg = resources.getString("errmsgCannotRemoveGlobal"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1303,7 +1303,7 @@ public class Messages { String msg = resources.getString("errmsgCannotModeratorGlobal"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1313,7 +1313,7 @@ public class Messages { String msg = resources.getString("errmsgCannotLeaveForceJoin"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1322,7 +1322,7 @@ public class Messages { public static String errmsgNotfoundPM() { String msg = resources.getString("errmsgNotfoundPM"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1331,7 +1331,7 @@ public class Messages { public static String errmsgCannotSendPMSelf() { String msg = resources.getString("errmsgCannotSendPMSelf"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1341,7 +1341,7 @@ public class Messages { String msg = resources.getString("errmsgCannotUseForChannel"); if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1352,7 +1352,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); msg = msg.replace("%min%", min.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1363,7 +1363,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%channel%", channel.toString()); msg = msg.replace("%max%", max.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1373,7 +1373,7 @@ public class Messages { String msg = resources.getString("errmsgCannotUseForGlobal"); if ( msg == null ) return ""; msg = msg.replace("%word%", word.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1383,7 +1383,7 @@ public class Messages { String msg = resources.getString("errmsgInvalidColorCode"); if ( msg == null ) return ""; msg = msg.replace("%value%", value.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1392,7 +1392,7 @@ public class Messages { public static String errmsgInvalidTemplateNumber() { String msg = resources.getString("errmsgInvalidTemplateNumber"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1402,7 +1402,7 @@ public class Messages { String msg = resources.getString("errmsgToolongDescription"); if ( msg == null ) return ""; msg = msg.replace("%max%", max.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1412,7 +1412,7 @@ public class Messages { String msg = resources.getString("errmsgToolongAlias"); if ( msg == null ) return ""; msg = msg.replace("%max%", max.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1422,7 +1422,7 @@ public class Messages { String msg = resources.getString("errmsgToolongPassword"); if ( msg == null ) return ""; msg = msg.replace("%max%", max.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1432,7 +1432,7 @@ public class Messages { String msg = resources.getString("errmsgInvalidBooleanOption"); if ( msg == null ) return ""; msg = msg.replace("%key%", key.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1441,7 +1441,7 @@ public class Messages { public static String errmsgInvalidRangeOption() { String msg = resources.getString("errmsgInvalidRangeOption"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1452,7 +1452,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%key%", key.toString()); msg = msg.replace("%value%", value.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1461,7 +1461,7 @@ public class Messages { public static String errmsgCannotOffGlobalBroadcast() { String msg = resources.getString("errmsgCannotOffGlobalBroadcast"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1471,7 +1471,7 @@ public class Messages { String msg = resources.getString("errmsgFormatConstraint"); if ( msg == null ) return ""; msg = msg.replace("%key%", key.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1480,7 +1480,7 @@ public class Messages { public static String errmsgInvalidBanExpireParameter() { String msg = resources.getString("errmsgInvalidBanExpireParameter"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1489,7 +1489,7 @@ public class Messages { public static String errmsgInvalidMuteExpireParameter() { String msg = resources.getString("errmsgInvalidMuteExpireParameter"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1498,7 +1498,7 @@ public class Messages { public static String errmsgCannotHideSelf() { String msg = resources.getString("errmsgCannotHideSelf"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1509,7 +1509,7 @@ public class Messages { if ( msg == null ) return ""; msg = msg.replace("%aliase%", aliase.toString()); msg = msg.replace("%channel%", channel.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1519,7 +1519,7 @@ public class Messages { String msg = resources.getString("errmsgNotPermission"); if ( msg == null ) return ""; msg = msg.replace("%permission%", permission.toString()); - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** @@ -1528,7 +1528,7 @@ public class Messages { public static String errmsgChannelChatDisabled() { String msg = resources.getString("errmsgChannelChatDisabled"); if ( msg == null ) return ""; - return resources.getString("errorPrefix", "") + msg; + return Utility.replaceColorCode(resources.getString("errorPrefix", "") + msg); } /** diff --git a/src/main/java/com/github/ucchyocean/lc3/Utility.java b/src/main/java/com/github/ucchyocean/lc3/Utility.java index ce9946c..7560e91 100644 --- a/src/main/java/com/github/ucchyocean/lc3/Utility.java +++ b/src/main/java/com/github/ucchyocean/lc3/Utility.java @@ -89,7 +89,7 @@ public class Utility { */ public static String stripColorCode(String source) { if (source == null) return null; - return stripAltColorCode(source).replaceAll("\u00A7([0-9a-fk-or])", ""); + return stripAltColorCode(source).replaceAll("\u00A7([0-9a-fk-or])", "").replaceAll("&([0-9a-fk-or])", ""); } /** diff --git a/src/main/java/com/github/ucchyocean/lc3/bukkit/BukkitEventListener.java b/src/main/java/com/github/ucchyocean/lc3/bukkit/BukkitEventListener.java index 443c57f..7dcf80d 100644 --- a/src/main/java/com/github/ucchyocean/lc3/bukkit/BukkitEventListener.java +++ b/src/main/java/com/github/ucchyocean/lc3/bukkit/BukkitEventListener.java @@ -334,7 +334,7 @@ public class BukkitEventListener implements Listener { message = message.substring(marker.length()); } - // 2byteコードを含むなら、Japanize変換は行わない + // 2byteコードを含む、または、半角カタカナのみなら、Japanize変換は行わない String kanaTemp = Utility.stripColorCode(message); if ( !skipJapanize && ( kanaTemp.getBytes().length > kanaTemp.length() || diff --git a/src/main/java/com/github/ucchyocean/lc3/bungee/BungeeEventListener.java b/src/main/java/com/github/ucchyocean/lc3/bungee/BungeeEventListener.java index 169c364..6cb43bb 100644 --- a/src/main/java/com/github/ucchyocean/lc3/bungee/BungeeEventListener.java +++ b/src/main/java/com/github/ucchyocean/lc3/bungee/BungeeEventListener.java @@ -5,11 +5,11 @@ */ package com.github.ucchyocean.lc3.bungee; +import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -274,14 +274,27 @@ public class BungeeEventListener implements Listener { // NGワードのマスク message = maskNGWord(message, config.getNgwordCompiled()); - // Japanizeの付加 + // Japanizeをスキップするかどうかフラグ + boolean skipJapanize = !LunaChat.getAPI().isPlayerJapanize(sender.getName()); + + // 一時的なJapanizeスキップが指定されているか確認する if ( message.startsWith(config.getNoneJapanizeMarker()) ) { - message = message.substring(config.getNoneJapanizeMarker().length()); + skipJapanize = true; + } - } else { + // 2byteコードを含む、または、半角カタカナのみなら、Japanize変換は行わない + String kanaTemp = Utility.stripColorCode(message); + if ( !skipJapanize && + ( kanaTemp.getBytes(StandardCharsets.UTF_8).length > kanaTemp.length() || + kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) ) { + skipJapanize = true; + } - String japanize = Japanizer.japanize(message, config.getJapanizeType(), + // Japanizeの付加 + if ( !skipJapanize ) { + + String japanize = Japanizer.japanize(Utility.stripColorCode(message), config.getJapanizeType(), LunaChat.getAPI().getAllDictionary()); if ( japanize.length() > 0 ) { @@ -311,48 +324,59 @@ public class BungeeEventListener implements Listener { result = result.replace("%msg", message); result = Utility.replaceColorCode(result); - // 発言したプレイヤーがいるサーバー"以外"のサーバーに、 + // TODO イベントパススルーモードを追加する + // イベントをキャンセルする + event.setCancelled(true); + + // //発言したプレイヤーがいるサーバー"以外"のサーバーに、 + // hideされているプレイヤーを除くすべてのプレイヤーに、 // 発言内容を送信する。 + List hidelist = api.getHidelist(ChannelMember.getChannelMember(sender)); for ( String server : parent.getProxy().getServers().keySet() ) { - if ( server.equals(senderServer) ) { - continue; - } +// if ( server.equals(senderServer) ) { +// continue; +// } ServerInfo info = parent.getProxy().getServerInfo(server); for ( ProxiedPlayer player : info.getPlayers() ) { - sendMessage(player, result); + if ( !containsHideList(player, hidelist) ) { + sendMessage(player, result); + } } } // ローカルも置き換える処理なら、置換えを行う - if ( config.isBroadcastChatLocalJapanize() ) { - - // NOTE: 改行がサポートされないので、改行を含む場合は、 - // \nで分割して前半をセットし、後半は150ミリ秒後に送信する。 - if ( !message.contains("\n") ) { - event.setMessage(Utility.stripColorCode(message)); - } else { - int index = message.indexOf("\n"); - String pre = message.substring(0, index); - final String post = Utility.replaceColorCode( - message.substring(index + "\n".length())); - event.setMessage(Utility.stripColorCode(pre)); - parent.getProxy().getScheduler().schedule(parent, new Runnable() { - @Override - public void run() { - for ( ProxiedPlayer p : sender.getServer().getInfo().getPlayers() ) { - sendMessage(p, post); - } - } - }, 150, TimeUnit.MILLISECONDS); - } - } +// if ( config.isBroadcastChatLocalJapanize() ) { +// +// // NOTE: 改行がサポートされないので、改行を含む場合は、 +// // \nで分割して前半をセットし、後半は150ミリ秒後に送信する。 +// if ( !message.contains("\n") ) { +// event.setMessage(Utility.stripColorCode(message)); +// } else { +// int index = message.indexOf("\n"); +// String pre = message.substring(0, index); +// final String post = Utility.replaceColorCode( +// message.substring(index + "\n".length())); +// event.setMessage(Utility.stripColorCode(pre)); +// parent.getProxy().getScheduler().schedule(parent, new Runnable() { +// @Override +// public void run() { +// for ( ProxiedPlayer p : sender.getServer().getInfo().getPlayers() ) { +// sendMessage(p, post); +// } +// } +// }, 150, TimeUnit.MILLISECONDS); +// } +// } // コンソールに表示設定なら、コンソールに表示する if ( config.isDisplayChatOnConsole() ) { parent.getLogger().info(result); } + + // ログに記録する + LunaChat.getNormalChatLogger().log(Utility.stripColorCode(result), sender.getName()); } /** @@ -534,4 +558,17 @@ public class BungeeEventListener implements Listener { if ( priority == EventPriority.HIGHEST ) return "HIGHEST".equals(c); return false; } + + /** + * 指定されたプレイヤーが指定されたHideListに含まれるかどうかを判定する + * @param p プレイヤー + * @param list リスト + * @return 含まれるかどうか + */ + private boolean containsHideList(ProxiedPlayer p, List list) { + for ( ChannelMember m : list ) { + if (m.getName().equals(p.getName())) return true; + } + return false; + } } \ No newline at end of file diff --git a/src/main/java/com/github/ucchyocean/lc3/channel/BukkitChannel.java b/src/main/java/com/github/ucchyocean/lc3/channel/BukkitChannel.java index 4eaef62..01ccc48 100644 --- a/src/main/java/com/github/ucchyocean/lc3/channel/BukkitChannel.java +++ b/src/main/java/com/github/ucchyocean/lc3/channel/BukkitChannel.java @@ -479,7 +479,12 @@ public class BukkitChannel extends Channel { msg = msg.replace("%ch", getName()); //msg = msg.replace("%msg", message); msg = msg.replace("%color", getColorCode()); - msg = msg.replace("%to", getPrivateMessageTo()); + if ( getPrivateMessageTo() != null ) { + msg = msg.replace("%to", getPrivateMessageTo().getDisplayName()); + } else { + msg = msg.replace("%to", ""); + } + msg = msg.replace("%recieverserver", ""); if ( msg.contains("%date") ) { msg = msg.replace("%date", dateFormat.format(new Date())); diff --git a/src/main/java/com/github/ucchyocean/lc3/channel/BungeeChannel.java b/src/main/java/com/github/ucchyocean/lc3/channel/BungeeChannel.java index c3a4591..3c8a760 100644 --- a/src/main/java/com/github/ucchyocean/lc3/channel/BungeeChannel.java +++ b/src/main/java/com/github/ucchyocean/lc3/channel/BungeeChannel.java @@ -17,7 +17,6 @@ import java.util.regex.Pattern; import com.github.ucchyocean.lc3.LunaChat; import com.github.ucchyocean.lc3.LunaChatAPI; import com.github.ucchyocean.lc3.LunaChatConfig; -import com.github.ucchyocean.lc3.LunaChatLogger; import com.github.ucchyocean.lc3.Messages; import com.github.ucchyocean.lc3.NGWordAction; import com.github.ucchyocean.lc3.Utility; @@ -40,9 +39,6 @@ public class BungeeChannel extends Channel { private SimpleDateFormat dateFormat; private SimpleDateFormat timeFormat; - /** ロガー */ - private LunaChatLogger logger; - /** * コンストラクタ * @param name チャンネル名 @@ -51,7 +47,6 @@ public class BungeeChannel extends Channel { super(name); - logger = new LunaChatLogger(name.replace(">", "-")); dateFormat = new SimpleDateFormat("yyyy/MM/dd"); timeFormat = new SimpleDateFormat("HH:mm:ss"); } @@ -124,6 +119,7 @@ public class BungeeChannel extends Channel { // 2byteコードを含むか、半角カタカナのみなら、Japanize変換は行わない String kanaTemp = Utility.stripColorCode(maskedMessage); + if ( !skipJapanize && ( kanaTemp.getBytes().length > kanaTemp.length() || kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) ) { @@ -417,7 +413,18 @@ public class BungeeChannel extends Channel { msg = msg.replace("%ch", getName()); //msg = msg.replace("%msg", message); msg = msg.replace("%color", getColorCode()); - msg = msg.replace("%to", getPrivateMessageTo()); + if ( getPrivateMessageTo() != null ) { + msg = msg.replace("%to", getPrivateMessageTo().getDisplayName()); + if ( getPrivateMessageTo() instanceof ChannelMemberProxiedPlayer ) { + ChannelMemberProxiedPlayer cm = (ChannelMemberProxiedPlayer)getPrivateMessageTo(); + msg = msg.replace("%recieverserver", cm.getServer().getInfo().getName()); + } else { + msg = msg.replace("%recieverserver", ""); + } + } else { + msg = msg.replace("%to", ""); + msg = msg.replace("%recieverserver", ""); + } if ( msg.contains("%date") ) { msg = msg.replace("%date", dateFormat.format(new Date())); diff --git a/src/main/java/com/github/ucchyocean/lc3/channel/Channel.java b/src/main/java/com/github/ucchyocean/lc3/channel/Channel.java index 3d90810..f78ab5d 100644 --- a/src/main/java/com/github/ucchyocean/lc3/channel/Channel.java +++ b/src/main/java/com/github/ucchyocean/lc3/channel/Channel.java @@ -111,8 +111,8 @@ public abstract class Channel { /** 期限付きMuteの期限(key=プレイヤー名、value=期日(ミリ秒)) */ private Map muteExpires; - /** 1:1チャットの相手名 */ - private String privateMessageTo; + /** 1:1チャットの相手 */ + private ChannelMember privateMessageTo; /** カラーコードの使用可否 */ private boolean allowcc; @@ -145,7 +145,7 @@ public abstract class Channel { this.chatRange = 0; this.banExpires = new HashMap(); this.muteExpires = new HashMap(); - this.privateMessageTo = ""; + this.privateMessageTo = null; this.allowcc = true; LunaChatConfig config = LunaChat.getConfig(); @@ -156,7 +156,7 @@ public abstract class Channel { } this.japanizeType = config.getJapanizeType(); - logger = new LunaChatLogger(name.replace(">", "-")); + logger = new LunaChatLogger(name.replace(">", "-").replace("*", "_")); } /** @@ -853,9 +853,9 @@ public abstract class Channel { /** * 1:1チャットのときに、会話の相手先を取得する - * @return 会話の相手のプレイヤー名 + * @return 会話の相手のプレイヤー */ - public String getPrivateMessageTo() { + public ChannelMember getPrivateMessageTo() { return privateMessageTo; } @@ -863,8 +863,8 @@ public abstract class Channel { * 1:1チャットのときに、会話の相手先を設定する * @param name 会話の相手のプレイヤー名 */ - public void setPrivateMessageTo(String name) { - this.privateMessageTo = name; + public void setPrivateMessageTo(ChannelMember to) { + this.privateMessageTo = to; } /** diff --git a/src/main/java/com/github/ucchyocean/lc3/command/LogCommand.java b/src/main/java/com/github/ucchyocean/lc3/command/LogCommand.java index 479cad0..7f22696 100644 --- a/src/main/java/com/github/ucchyocean/lc3/command/LogCommand.java +++ b/src/main/java/com/github/ucchyocean/lc3/command/LogCommand.java @@ -7,9 +7,9 @@ package com.github.ucchyocean.lc3.command; import java.util.ArrayList; +import com.github.ucchyocean.lc3.LunaChat; import com.github.ucchyocean.lc3.LunaChatLogger; import com.github.ucchyocean.lc3.Messages; -import com.github.ucchyocean.lc3.bukkit.LunaChatBukkit; import com.github.ucchyocean.lc3.channel.Channel; import com.github.ucchyocean.lc3.member.ChannelMember; @@ -123,10 +123,10 @@ public class LogCommand extends LunaChatSubCommand { // グローバルチャンネル設定が無くて、指定チャンネルがマーカーの場合、 // 通常チャットのログを取得する - LunaChatLogger logger = LunaChatBukkit.getInstance().getNormalChatLogger(); + LunaChatLogger logger = LunaChat.getNormalChatLogger(); logs = logger.getLog(argsPlayer, argsFilter, argsDate, reverse); - cname = "グローバルチャット"; + cname = "GlobalChat"; } else { diff --git a/src/main/java/com/github/ucchyocean/lc3/command/LunaChatJapanizeCommand.java b/src/main/java/com/github/ucchyocean/lc3/command/LunaChatJapanizeCommand.java index 4cee058..ab6ba3b 100644 --- a/src/main/java/com/github/ucchyocean/lc3/command/LunaChatJapanizeCommand.java +++ b/src/main/java/com/github/ucchyocean/lc3/command/LunaChatJapanizeCommand.java @@ -5,9 +5,9 @@ */ package com.github.ucchyocean.lc3.command; +import com.github.ucchyocean.lc3.LunaChat; import com.github.ucchyocean.lc3.LunaChatAPI; import com.github.ucchyocean.lc3.Messages; -import com.github.ucchyocean.lc3.bukkit.LunaChatBukkit; import com.github.ucchyocean.lc3.member.ChannelMember; /** @@ -40,7 +40,7 @@ public class LunaChatJapanizeCommand { // Japanize設定をon/offにする boolean value = args[0].equalsIgnoreCase("on"); - LunaChatAPI api = LunaChatBukkit.getInstance().getLunaChatAPI(); + LunaChatAPI api = LunaChat.getAPI(); api.setPlayersJapanize(sender.getName(), value); sender.sendMessage(Messages.cmdmsgPlayerJapanize(args[0])); @@ -65,7 +65,7 @@ public class LunaChatJapanizeCommand { // Japanize設定をon/offにする boolean value = args[1].equalsIgnoreCase("on"); - LunaChatAPI api = LunaChatBukkit.getInstance().getLunaChatAPI(); + LunaChatAPI api = LunaChat.getAPI(); api.setPlayersJapanize(target.getName(), value); target.sendMessage(Messages.cmdmsgPlayerJapanize(args[1])); diff --git a/src/main/java/com/github/ucchyocean/lc3/command/LunaChatMessageCommand.java b/src/main/java/com/github/ucchyocean/lc3/command/LunaChatMessageCommand.java index e11b737..c90447c 100644 --- a/src/main/java/com/github/ucchyocean/lc3/command/LunaChatMessageCommand.java +++ b/src/main/java/com/github/ucchyocean/lc3/command/LunaChatMessageCommand.java @@ -5,9 +5,9 @@ */ package com.github.ucchyocean.lc3.command; +import com.github.ucchyocean.lc3.LunaChat; import com.github.ucchyocean.lc3.LunaChatAPI; import com.github.ucchyocean.lc3.Messages; -import com.github.ucchyocean.lc3.bukkit.LunaChatBukkit; import com.github.ucchyocean.lc3.channel.Channel; import com.github.ucchyocean.lc3.member.ChannelMember; @@ -78,7 +78,7 @@ public class LunaChatMessageCommand { } // チャンネルが存在するかどうかをチェックする - LunaChatAPI api = LunaChatBukkit.getInstance().getLunaChatAPI(); + LunaChatAPI api = LunaChat.getAPI(); String cname = inviter.getName() + ">" + invited.getName(); Channel channel = api.getChannel(cname); if ( channel == null ) { @@ -87,7 +87,7 @@ public class LunaChatMessageCommand { channel.setVisible(false); channel.addMember(inviter); channel.addMember(invited); - channel.setPrivateMessageTo(invited.getName()); + channel.setPrivateMessageTo(invited); } // メッセージがあるなら送信する diff --git a/src/main/java/com/github/ucchyocean/lc3/member/ChannelMember.java b/src/main/java/com/github/ucchyocean/lc3/member/ChannelMember.java index 9429713..cca9b1b 100644 --- a/src/main/java/com/github/ucchyocean/lc3/member/ChannelMember.java +++ b/src/main/java/com/github/ucchyocean/lc3/member/ChannelMember.java @@ -122,6 +122,9 @@ public abstract class ChannelMember implements Comparable { * @return ChannelMember */ public static ChannelMember getChannelMember(Object obj) { + + if ( obj != null && obj instanceof ChannelMember ) return (ChannelMember)obj; + if ( LunaChat.getMode() == LunaChatMode.BUKKIT ) { return ChannelMemberBukkit.getChannelMemberBukkit(obj); } else if ( LunaChat.getMode() == LunaChatMode.BUNGEE ) { diff --git a/src/main/java/com/github/ucchyocean/lc3/tool/MessageParser.java b/src/main/java/com/github/ucchyocean/lc3/tool/MessageParser.java index f7e3a19..d4564b6 100644 --- a/src/main/java/com/github/ucchyocean/lc3/tool/MessageParser.java +++ b/src/main/java/com/github/ucchyocean/lc3/tool/MessageParser.java @@ -58,9 +58,9 @@ public class MessageParser { " msg = msg.replace(\"%%%s%%\", %s.toString());", keyword, keyword)); } if ( key.startsWith("errmsg") ) { - System.out.println(" return resources.getString(\"errorPrefix\", \"\") + msg;"); + System.out.println(" return Utility.replaceColorCode(resources.getString(\"errorPrefix\", \"\") + msg);"); } else if ( key.startsWith("cmdmsg") ) { - System.out.println(" return resources.getString(\"infoPrefix\", \"\") + msg;"); + System.out.println(" return Utility.replaceColorCode(resources.getString(\"infoPrefix\", \"\") + msg);"); } else { System.out.println(" return Utility.replaceColorCode(msg);"); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 801cbc4..649ea2b 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -110,11 +110,11 @@ noneJapanizeMarker: '#' # -------------------- BungeeCord Settings -------------------- -defaultFormatForPrivateMessage: '&7[%sender@%senderserver > %reciever@%recieverserver] %msg' +defaultFormatForPrivateMessage: '&7[%username@%server > %to@%recieverserver] %msg' broadcastChat: true -broadcastChatFormat: '%date %time &d<%sender@%senderserver> &f%msg' +broadcastChatFormat: '%date %time &d<%username@%senderserver> &f%msg' broadcastChatLocalJapanize: true diff --git a/src/main/resources/config_ja.yml b/src/main/resources/config_ja.yml index 370365e..46ec65c 100644 --- a/src/main/resources/config_ja.yml +++ b/src/main/resources/config_ja.yml @@ -221,12 +221,13 @@ noneJapanizeMarker: '#' # /tell や /msg や /r コマンドでプライベートメッセージを送信するときに、 # 適用されるフォーマット設定。 # フォーマット設定には、下記のキーワードが使用できます。 -# %sender : 発言者表示名 +# %username : 発言者表示名 +# %player : 発言者ID # %senderserver : 発言者の接続サーバー名 # %reciever : 受信者表示名 # %recieverserver : 受信者の接続サーバー名 # %msg : 発言内容(Japanize変換された場合は、Japanize結果を含みます。) -defaultFormatForPrivateMessage: '&7[%sender@%senderserver > %reciever@%recieverserver] %msg' +defaultFormatForPrivateMessage: '&7[%username@%server > %to@%recieverserver] %msg' # -------------------- 広域チャット設定 -------------------- @@ -239,12 +240,13 @@ broadcastChat: true # broadcastChat が true のときに、 # 他のサーバーで表示されるチャットフォーマットの設定。 # フォーマット設定には、下記のキーワードが使用できます。 -# %sender : 発言者表示名 +# %username : 発言者表示名 +# %player : 発言者ID # %senderserver : 発言者の接続サーバー名 # %date : 発言した日付(BungeeCordのProxyサーバーのシステム時刻が使用されます) # %time : 発言した時刻(BungeeCordのProxyサーバーのシステム時刻が使用されます) # %msg : 発言内容(Japanize変換された場合は、Japanize結果を含みます。) -broadcastChatFormat: '%date %time &d<%sender@%senderserver> &f%msg' +broadcastChatFormat: '%date %time &d<%username@%senderserver> &f%msg' # broadcastChat が true のときに、 # 発言者のサーバーについても、Japanize変換を行うかどうか。 diff --git a/src/main/resources/messages_en.yml b/src/main/resources/messages_en.yml index d156de0..58eb603 100644 --- a/src/main/resources/messages_en.yml +++ b/src/main/resources/messages_en.yml @@ -3,31 +3,31 @@ # @license LGPLv3 # @copyright Copyright ucchy 2020 -joinMessage: '&f[%color%ch&f]&7%player has joined the channel.' -quitMessage: '&f[%color%ch&f]&7%player has left the channel.' -breakupMessage: '&f[%color%ch&f]&7The channel has been deleted.' -banMessage: '&f[%color%ch&f]&7%player was banned from the channel.' -kickMessage: '&f[%color%ch&f]&7%player was kicked from the channel.' -muteMessage: '&f[%color%ch&f]&7%player was muted at this channel.' -banNGWordMessage: '&f[%color%ch&f]&7%player was banned from the channel, caused by saying NG word.' -kickNGWordMessage: '&f[%color%ch&f]&7%player was kicked from the channel, caused by saying NG word.' -muteNGWordMessage: '&f[%color%ch&f]&7player was muted at this channel, caused by saying NG word.' -banWithExpireMessage: '&f[%color%ch&f]&7%player was kicked from the channel, with an expiration of %d minutes.' -muteWithExpireMessage: '&f[%color%ch&f]&7%player was muted at this channel, with an expiration of %d minutes.' -pardonMessage: '&f[%color%ch&f]&7%player''s ban has been exired.' -unmuteMessage: '&f[%color%ch&f]&7%player''s mute has been exired.' -expiredBanMessage: '&f[%color%ch&f]&7%player''s ban has been exired.' -expiredMuteMessage: '&f[%color%ch&f]&7%player''s mute has been exired.' +joinMessage: '&f[%color%%channel%&f]&7%player% has joined the channel' +quitMessage: '&f[%color%%channel%&f]&7%player% has left the channel' +breakupMessage: '&f[%color%%channel%&f]&7The channel has been deleted.' +banMessage: '&f[%color%%channel%&f]&7%player% was banned from the channel.' +kickMessage: '&f[%color%%channel%&f]&7%player% was kicked from the channel.' +muteMessage: '&f[%color%%channel%&f]&7%player% has been deprived the voice of this channel.' +banNGWordMessage: '&f[%color%%channel%&f]&7%player% was banned from the channel, caused by saying NG word.' +kickNGWordMessage: '&f[%color%%channel%&f]&7%player% was kicked from the channel, caused by saying NG word' +muteNGWordMessage: '&f[%color%%channel%&f]&7%player% has been deprived the voice of this channel, caused by saying NG word.' +banWithExpireMessage: '&f[%color%%channel%&f]&7%player% was banned from the channel, with an expiration of %minutes% minutes.' +muteWithExpireMessage: '&f[%color%%channel%&f]&7%player% was kicked from the channel, with an expiration of %minutes% minutes.' +pardonMessage: '&f[%color%%channel%&f]&7%player%''s ban has been removed.' +unmuteMessage: '&f[%color%%channel%&f]&7%player% has regained the voice of this channel.' +expiredBanMessage: '&f[%color%%channel%&f]&7%player%''s ban has been exired.' +expiredMuteMessage: '&f[%color%%channel%&f]&7%player% has regained the voice of this channel.' -addModeratorMessage: '&f[%color%ch&f]&7%player became the channel moderator.' -removeModeratorMessage: '&f[%color%ch&f]&7%player is no longer the channel moderator.' +addModeratorMessage: '&f[%color%%channel%&f]&7%player% became the channel moderator.' +removeModeratorMessage: '&f[%color%%channel%&f]&7%player% is no longer the channel moderator.' -noRecipientMessage: '&f[%color%ch&f]&7Your chat did not reach anyone.' +noRecipientMessage: '&f[%color%%channel%&f]&7Your chat did not reach anyone.' listFirstLine: '&7---------- &bChannel List &7----------' -listFirstLinePaging: '&7---------- &bChannel List&7(&c%d&7/&c%d&7) ----------' +listFirstLinePaging: '&7---------- &bChannel List&7(&c%page%&7/&c%max%&7) ----------' listEndLine: '&7----------------------------------' -listFormat: '&7| &f%s&7(&c%d&7/&c%d&7) &a%s' +listFormat: '&7| &f%channel%&7(&c%online%&7/&c%total%&7) &a%topic%' listPlainPrefix: '&7| ' channelInfoFirstLine: '&7---------- &bChannel Info &7----------' @@ -38,7 +38,7 @@ channelInfoBroadcast: '&7| &cBroadcast Channel' channelInfoSecret: '&7| &cSecret Channel' channelInfoPassword: '&7| &cWith Password' channelInfoWorldChat: '&7| &cWorld Chat' -channelInfoRangeChat: '&7| &cRange Chat:%d Block distance' +channelInfoRangeChat: '&7| &cRange Chat:%block% Block distance' channelInfoFormat: '&7| &cFormat:' channelInfoBanned: '&7| &cBAN List:' channelInfoMuted: '&7| &cMute List:' @@ -49,59 +49,56 @@ hidePlayerFirstLine: '&7----- &bYour Hided Players &7-----' logDisplayFirstLine: '&7----- &b%s Chat Log &7-----' logDisplayEndLine: '&7----------------------------------' -logDisplayFormat: '&7| &c%s&7, &f%s&7: &f%s' +logDisplayFormat: '&7| &c%date%&7, &f%player%&7: &f%message%' -infoPrefix: '&f[&aChat&f]' -errorPrefix: '&f[&cChat&f]' +infoPrefix: '&f[&aLC&f]' +errorPrefix: '&f[&cLC&f]' -cmdmsgJoin: 'You joined channel %s.' -cmdmsgSet: 'You set %s as the default channel.' -cmdmsgSetTopic: 'Topic: &a%s' -cmdmsgSetHide: ' You set this channel hided.' -cmdmsgLeave: 'You left channel %s.' -cmdmsgInvite: 'You invited %s to channel %s.' -cmdmsgInvited1: '%s invited you at channel %s.' +cmdmsgJoin: 'You joined channel %channel%.' +cmdmsgSet: 'You set %channel% as the default channel.' +cmdmsgSetTopic: 'Topic; &a%topic%' +cmdmsgSetHide: ' You set this channel muted.' +cmdmsgLeave: 'You left channel %channel%.' +cmdmsgInvite: 'You invited %player% to channel %channel%.' +cmdmsgInvited1: '%player% invited you to channel %channel%.' cmdmsgInvited2: 'If you want to join channel, do "/ch accept". If you want to deny the invitation, do "/ch deny".' cmdmsgDeny: 'You denied the invitation.' cmdmsgDenyed: 'The invitation was denied.' -cmdmsgKick: '%s さんを、チャンネル %s からキックしました。' -cmdmsgKicked: 'チャンネル %s からキックされました。' -cmdmsgBan: '%s さんを、チャンネル %s からBANしました。' -cmdmsgBanWithExpire: '%s さんを、チャンネル %s から期限 %d 分でBANしました。' -cmdmsgBanned: 'チャンネル %s からBANされました。' -cmdmsgPardon: '%s さんの、チャンネル %s のBANを解除しました。' -cmdmsgPardoned: 'チャンネル %s のBANが解除されました。' -cmdmsgMute: '%s さんを、チャンネル %s でMuteしました。' -cmdmsgMuteWithExpire: '%s さんを、チャンネル %s から期限 %d 分でMuteしました。' -cmdmsgMuted: 'チャンネル %s からMuteされました。' -cmdmsgUnmute: '%s さんの、チャンネル %s のMuteを解除しました。' -cmdmsgUnmuted: 'チャンネル %s のMuteが解除されました。' -cmdmsgHided: 'チャンネル %s を非表示に設定しました。' -cmdmsgHidedPlayer: 'プレイヤー %s を非表示に設定しました。' -cmdmsgUnhided: 'チャンネル %s を表示に設定しました。' -cmdmsgUnhidedPlayer: 'プレイヤー %s を表示に設定しました。' +cmdmsgKick: '%player% was kicked from channel %channel%.' +cmdmsgKicked: 'You were kicked from channel %channel%.' +cmdmsgBan: '%player% was banned from channel %channel%.' +cmdmsgBanWithExpire: '%player% was banned from channel %channel% with an expiration of %minutes% minutes.' +cmdmsgBanned: 'You were banned from channel %channel%.' +cmdmsgPardon: '%player%''s ban of channel %channel% has been removed.' +cmdmsgPardoned: 'Your ban of channel %channel% has been removed.' +cmdmsgMute: 'You deprived the %player%''s voice of channel %channel%.' +cmdmsgMuteWithExpire: 'You deprived the %player%''s voice of channel %channel% with an expiration of %minutes% minutes.' +cmdmsgMuted: 'You were banned from channel %channel%.' +cmdmsgUnmute: '%player% has regained the voice of channel %channel%.' +cmdmsgUnmuted: 'チャンネル %channel% のMuteが解除されました。' +cmdmsgHided: 'チャンネル %channel% を非表示に設定しました。' +cmdmsgHidedPlayer: 'プレイヤー %player% を非表示に設定しました。' +cmdmsgUnhided: 'チャンネル %channel% を表示に設定しました。' +cmdmsgUnhidedPlayer: 'プレイヤー %channel% を表示に設定しました。' cmdmsgReload: 'LunaChatの設定を再読み込みしました。' -cmdmsgCreate: 'チャンネル %s を新規作成しました。' -cmdmsgRemove: 'チャンネル %s を削除しました。' -cmdmsgFormat: 'メッセージフォーマットを %s に設定しました。' -cmdmsgModerator: '%s さんをチャンネル %s のモデレーターに設定しました。' -cmdmsgModeratorMinus: '%s さんをチャンネル %s のモデレーターから外しました。' -cmdmsgDictionaryAdd: '%s を %s と覚えました。' -cmdmsgDictionaryRemove: '%s を忘れました。' -cmdmsgOption: '%s を %s に設定しました。' -cmdmsgTemplate: 'テンプレート %s番を、%s に設定しました。' -cmdmsgTemplateRemove: 'テンプレート %s番を削除しました。' -cmdmsgCheck: '削除対象のチャンネルは %d 個です。' -cmdmsgCheckConfirm: '全て削除する場合は、/%s check remove を実行してください。' -cmdmsgCheckRemove: '%d 個のチャンネルを削除しました。' -cmdmsgSetDefault: '%s さんの発言先を %s に設定しました。' +cmdmsgCreate: 'チャンネル %channel% を新規作成しました。' +cmdmsgRemove: 'チャンネル %channel% を削除しました。' +cmdmsgFormat: 'メッセージフォーマットを %format% に設定しました。' +cmdmsgModerator: '%player% さんをチャンネル %channel% のモデレーターに設定しました。' +cmdmsgModeratorMinus: '%player% さんをチャンネル %channel% のモデレーターから外しました。' +cmdmsgDictionaryAdd: '%key% を %value% と覚えました。' +cmdmsgDictionaryRemove: '%key% を忘れました。' +cmdmsgOption: '%key% を %value% に設定しました。' +cmdmsgTemplate: 'テンプレート %index% を、%value% に設定しました。' +cmdmsgTemplateRemove: 'テンプレート %index% を削除しました。' +cmdmsgSetDefault: '%player% さんの発言先を %channel% に設定しました。' -cmdmsgPlayerJapanize: 'Your chat''s Japanize conversion was turned %s.' -cmdmsgPlayerJapanizeOther: '%s さんのJapanize変換を %s にしました。' +cmdmsgPlayerJapanize: 'Your chat''s Japanize conversion was turned %value%.' +cmdmsgPlayerJapanizeOther: '%player% さんのJapanize変換を %value% にしました。' -cmdmsgReplyInviter: '%sの現在の会話相手 : %s' -cmdmsgReplyInviterNone: '%sの現在の会話相手 : 相手がいません。' +cmdmsgReplyInviter: '%inviter%の現在の会話相手 : %invited%' +cmdmsgReplyInviterNone: '%inviter%の現在の会話相手 : 相手がいません。' errmsgIngame: 'このコマンドはゲーム内からしか実行できません。' errmsgCommand: 'コマンドの指定が正しくありません。' @@ -111,10 +108,10 @@ errmsgNotExistOrNotSpecified: '指定されたチャンネルが存在しない errmsgExist: '指定されたチャンネル名が既に存在します。' errmsgNomember: '指定されたチャンネルに参加していません。' errmsgNomemberOther: '指定されたプレイヤーはチャンネルに参加していません。' -errmsgNotfoundPlayer: '指定されたプレイヤー %s が見つかりません。' +errmsgNotfoundPlayer: '指定されたプレイヤー %player% が見つかりません。' errmsgNotInvited: '招待を受けたプレイヤーではありません。' errmsgNotfoundChannel: 'チャンネルが無くなってしまったため、参加できませんでした。' -errmsgInvitedAlreadyExist: '招待された %s さんは、既にチャンネルに参加しています。' +errmsgInvitedAlreadyExist: '招待された %player% さんは、既にチャンネルに参加しています。' errmsgInvitedAlreadyJoin: '既にチャンネルに参加しています。' errmsgNoJoin: '現在チャンネルに参加していません。' errmsgBanned: 'あなたはこのチャンネルからBANされています。' @@ -134,79 +131,78 @@ errmsgPassword1: 'このチャンネルはパスワードが設定されてい errmsgPassword2: 'パスワードを指定して、チャンネルに入ってください。' errmsgPassword3: '/ch (channel) (password)' errmsgPasswordNotmatch: 'パスワードが正しくないため、チャンネルに入れません。' -errmsgPermission: '権限 "%s" が無いため、実行できません。' -errmsgCannotLeaveGlobal: 'チャンネル %s はグローバルチャンネルなので、退出できません。' -errmsgCannotKickGlobal: 'チャンネル %s はグローバルチャンネルなので、キックできません。' -errmsgCannotBANGlobal: 'チャンネル %s はグローバルチャンネルなので、BANできません。' -errmsgCannotRemoveGlobal: 'チャンネル %s はグローバルチャンネルなので、削除できません。' -errmsgCannotModeratorGlobal: 'チャンネル %s はグローバルチャンネルなので、モデレーターを設定できません。' -errmsgCannotLeaveForceJoin: 'チャンネル %s は強制参加チャンネルなので、退出できません。' +errmsgPermission: '権限 "%permission%" が無いため、実行できません。' +errmsgCannotLeaveGlobal: 'チャンネル %channel% はグローバルチャンネルなので、退出できません。' +errmsgCannotKickGlobal: 'チャンネル %channel% はグローバルチャンネルなので、キックできません。' +errmsgCannotBANGlobal: 'チャンネル %channel% はグローバルチャンネルなので、BANできません。' +errmsgCannotRemoveGlobal: 'チャンネル %channel% はグローバルチャンネルなので、削除できません。' +errmsgCannotModeratorGlobal: 'チャンネル %channel% はグローバルチャンネルなので、モデレーターを設定できません。' +errmsgCannotLeaveForceJoin: 'チャンネル %channel% は強制参加チャンネルなので、退出できません。' errmsgNotfoundPM: 'あなたが受信したプライベートメッセージがありません。' errmsgCannotSendPMSelf: '自分自身にプライベートメッセージを送ることはできません。' -errmsgCannotUseForChannel: '%s はチャンネル名に使用できない文字を含んでいます。' -errmsgCannotUseForChannelTooShort: '%s は短すぎてチャンネル名に使用できません。%d 文字以上にしてください。' -errmsgCannotUseForChannelTooLong: '%s は長すぎてチャンネル名に使用できません。%d 文字以下にしてください。' -errmsgCannotUseForGlobal: '%s はグローバルチャンネル名に使用できない文字を含んでいます。' -errmsgInvalidColorCode: '%s はカラーコードとして正しくありません。' +errmsgCannotUseForChannel: '%channel% はチャンネル名に使用できない文字を含んでいます。' +errmsgCannotUseForChannelTooShort: '%channel% は短すぎてチャンネル名に使用できません。%min% 文字以上にしてください。' +errmsgCannotUseForChannelTooLong: '%channel% は長すぎてチャンネル名に使用できません。%max% 文字以下にしてください。' +errmsgCannotUseForGlobal: '%word% はグローバルチャンネル名に使用できない文字を含んでいます。' +errmsgInvalidColorCode: '%value% はカラーコードとして正しくありません。' errmsgInvalidTemplateNumber: 'テンプレート番号は、0から9までの数字を指定してください。' -errmsgToolongDescription: '説明文は %d 文字以下にしてください。' -errmsgToolongAlias: 'チャンネル別名は %d 文字以下にしてください。' -errmsgToolongPassword: 'パスワードは %d 文字以下にしてください。' -errmsgInvalidBooleanOption: '%s は true/false で指定してください。' +errmsgToolongDescription: '説明文は %max% 文字以下にしてください。' +errmsgToolongAlias: 'チャンネル別名は %max% 文字以下にしてください。' +errmsgToolongPassword: 'パスワードは %max% 文字以下にしてください。' +errmsgInvalidBooleanOption: '%key% は true/false で指定してください。' errmsgInvalidRangeOption: 'range に正しくない値が指定されました。' -errmsgInvalidJapanizeOption: '%s に指定された %s は、Japanize変換タイプとして正しくありません。' +errmsgInvalidJapanizeOption: '%key% に指定された %value% は、Japanize変換タイプとして正しくありません。' errmsgCannotOffGlobalBroadcast: 'このチャンネルはグローバルチャンネルのため、ブロードキャストをオフにできません。' -errmsgFormatConstraint: '必須キーワード %s が指定されていません。' +errmsgFormatConstraint: '必須キーワード %key% が指定されていません。' errmsgInvalidBanExpireParameter: 'BAN期限(分)の指定が正しくありません。1 から 43200 の間の数値を指定してください。' errmsgInvalidMuteExpireParameter: 'Mute期限(分)の指定が正しくありません。1 から 43200 の間の数値を指定してください。' -errmsgNotInCheckRemoveConfirm: 'あなたはクリーンアップモードに入っていません。先に、/%s check を実行してください。' errmsgCannotHideSelf: '自分の発言を非表示にすることはできません。' -errmsgDuplicatedAlias: '指定されたチャンネル別名 %s は、チャンネル %s と重複するので設定できません。' +errmsgDuplicatedAlias: '指定されたチャンネル別名 %aliase% は、チャンネル %channel% と重複するので設定できません。' -errmsgNotPermission: '権限がありません&7(%s)' +errmsgNotPermission: '権限がありません&7(%permission%)' errmsgChannelChatDisabled: 'このサーバーでは、チャンネルチャットは動作しません。' -usageJoin: '&6/%s join (channel) &7- チャンネルに参加します。' -usageLeave: '&6/%s leave &7- 参加しているチャンネルから退出します。' -usageList: '&6/%s list &7- チャンネルのリストを表示します。' -usageInvite: '&6/%s invite (name) &7- 指定したプレイヤーをチャンネルチャットに招待します。' -usageAccept: '&6/%s accept &7- 招待を受けてチャンネルチャットに入室します。' -usageDeny: '&6/%s deny &7- 招待を拒否します。' -usageKick: '&6/%s kick (name) &7- 指定したプレイヤーをチャンネルチャットからキックします。' -usageBan: '&6/%s ban (name) &7- 指定したプレイヤーをチャンネルチャットからBANします。' -usageBan2: '&6/%s ban (name) [minutes] &7- 指定したプレイヤーを指定した分の間、BANします。' -usagePardon: '&6/%s pardon (name) &7- 指定したプレイヤーのBANを解除します。' -usageMute: '&6/%s mute (name) &7- 指定したプレイヤーのチャンネルでの発言権を剥奪します。' -usageMute2: '&6/%s mute (name) [minutes] &7- 指定したプレイヤーを指定した分の間、発言権剥奪します。' -usageUnmute: '&6/%s unmute (name) &7- 指定したプレイヤーのチャンネルでの発言権剥奪を解除します。' -usageHide: '&6/%s hide [channel] &7- 指定したチャンネルの発言内容を非表示にします。' -usageHidePlayer: '&6/%s hide (player) &7- 指定したプレイヤーの発言内容を非表示にします。' -usageUnhide: '&6/%s unhide [channel] &7- 指定したチャンネルの発言内容を非表示から表示に戻します。' -usageUnhidePlayer: '&6/%s unhide (player) &7- 指定したプレイヤーの発言内容を非表示から表示に戻します。' -usageInfo: '&6/%s info [channel] &7- チャンネルの情報を表示します。' -usageLog: '&6/%s log [channel] [p=player] [f=filter] [d=date] [r] &7- チャンネルの発言ログを表示します。' +usageJoin: '&6/%label% join (channel) &7- チャンネルに参加します。' +usageLeave: '&6/%label% leave &7- 参加しているチャンネルから退出します。' +usageList: '&6/%label% list &7- チャンネルのリストを表示します。' +usageInvite: '&6/%label% invite (name) &7- 指定したプレイヤーをチャンネルチャットに招待します。' +usageAccept: '&6/%label% accept &7- 招待を受けてチャンネルチャットに入室します。' +usageDeny: '&6/%label% deny &7- 招待を拒否します。' +usageKick: '&6/%label% kick (name) &7- 指定したプレイヤーをチャンネルチャットからキックします。' +usageBan: '&6/%label% ban (name) &7- 指定したプレイヤーをチャンネルチャットからBANします。' +usageBan2: '&6/%label% ban (name) [minutes] &7- 指定したプレイヤーを指定した分の間、BANします。' +usagePardon: '&6/%label% pardon (name) &7- 指定したプレイヤーのBANを解除します。' +usageMute: '&6/%label% mute (name) &7- 指定したプレイヤーのチャンネルでの発言権を剥奪します。' +usageMute2: '&6/%label% mute (name) [minutes] &7- 指定したプレイヤーを指定した分の間、発言権剥奪します。' +usageUnmute: '&6/%label% unmute (name) &7- 指定したプレイヤーのチャンネルでの発言権剥奪を解除します。' +usageHide: '&6/%label% hide [channel] &7- 指定したチャンネルの発言内容を非表示にします。' +usageHidePlayer: '&6/%label% hide (player) &7- 指定したプレイヤーの発言内容を非表示にします。' +usageUnhide: '&6/%label% unhide [channel] &7- 指定したチャンネルの発言内容を非表示から表示に戻します。' +usageUnhidePlayer: '&6/%label% unhide (player) &7- 指定したプレイヤーの発言内容を非表示から表示に戻します。' +usageInfo: '&6/%label% info [channel] &7- チャンネルの情報を表示します。' +usageLog: '&6/%label% log [channel] [p=player] [f=filter] [d=date] [r] &7- チャンネルの発言ログを表示します。' -usageCreate: '&6/%s create (channel) [description] &7- チャンネルを作成します。' -usageRemove: '&6/%s remove [channel] &7- チャンネルを削除します。' -usageFormat: '&6/%s format [channel] (format...) &7- チャンネルのメッセージフォーマットを設定します。' -usageModerator: '&6/%s moderator [channel] (player) &7- チャンネルのモデレーターを指定したプレイヤーに設定します。' -usageMod: '&6/%s mod [channel] (player) &7- チャンネルのモデレーターを指定したプレイヤーに設定します。' -usageDictionary: '&6/%s dictionary (add (word) (value)|remove (word)) &7- Japanize変換辞書に新しいワードを登録したり、指定したワードを削除したりします。' -usageDic: '&6/%s dic (add (word) (value)|remove (word)) &7- Japanize変換辞書に新しいワードを登録したり、指定したワードを削除したりします。' -usageOption: '&6/%s option [channel] (key=value...) &7- チャンネルのオプションを設定します。' -usageTemplate: '&6/%s template (number) (template...) &7- メッセージフォーマットのテンプレートを登録します。' -usageCheck1: '&6/%s check &7- モデレーターがいないチャンネルを一覧します。' -usageCheck2: '&6/%s check remove &7- /ch check で一覧されたチャンネルを全て削除します。' -usageReload: '&6/%s reload &7- config.ymlの再読み込みをします。' -usageHelp: '&6/%s help [user|mod|admin] [page] &7- ヘルプを表示します。' -usageSet1: '&6/%s set default (player) [channel] &7- 指定したプレイヤーの発言先チャンネルを、指定したチャンネルに設定します。' +usageCreate: '&6/%label% create (channel) [description] &7- チャンネルを作成します。' +usageRemove: '&6/%label% remove [channel] &7- チャンネルを削除します。' +usageFormat: '&6/%label% format [channel] (format...) &7- チャンネルのメッセージフォーマットを設定します。' +usageModerator: '&6/%label% moderator [channel] (player) &7- チャンネルのモデレーターを指定したプレイヤーに設定します。' +usageMod: '&6/%label% mod [channel] (player) &7- チャンネルのモデレーターを指定したプレイヤーに設定します。' +usageDictionary: '&6/%label% dictionary (add (word) (value)|remove (word)) &7- Japanize変換辞書に新しいワードを登録したり、指定したワードを削除したりします。' +usageDic: '&6/%label% dic (add (word) (value)|remove (word)) &7- Japanize変換辞書に新しいワードを登録したり、指定したワードを削除したりします。' +usageOption: '&6/%label% option [channel] (key=value...) &7- チャンネルのオプションを設定します。' +usageTemplate: '&6/%label% template (number) (template...) &7- メッセージフォーマットのテンプレートを登録します。' +usageCheck1: '&6/%label% check &7- モデレーターがいないチャンネルを一覧します。' +usageCheck2: '&6/%label% check remove &7- /ch check で一覧されたチャンネルを全て削除します。' +usageReload: '&6/%label% reload &7- config.ymlの再読み込みをします。' +usageHelp: '&6/%label% help [user|mod|admin] [page] &7- ヘルプを表示します。' +usageSet1: '&6/%label% set default (player) [channel] &7- 指定したプレイヤーの発言先チャンネルを、指定したチャンネルに設定します。' -usageMessage: '&6/%s (name) [message] &7- 指定したプレイヤーとの個人チャットを開始します。' -usageReply: '&6/%s [message] &7- 受信した個人チャットに返信します。' +usageMessage: '&6/%label% (name) [message] &7- 指定したプレイヤーとの個人チャットを開始します。' +usageReply: '&6/%label% [message] &7- 受信した個人チャットに返信します。' -usageJapanize: '&6/%s on|off &7- Turn on/off the Japanize conversion of your chat.' -usageJapanizeOther: '&6/%s (player) on|off &7- Turn on/off the Japanize conversion of other player''s chat.' +usageJapanize: '&6/%label% on|off &7- Turn on/off the Japanize conversion of your chat.' +usageJapanizeOther: '&6/%label% (player) on|off &7- Turn on/off the Japanize conversion of other player''s chat.' -usageTop: '&e----- &6LunaChat %s command (&c%d&6/&c%d&6) &e-----' +usageTop: '&e----- &6LunaChat %type% command (&c%num%&6/&c%max%&6) &e-----' usageFoot: '&e-----------------------------------------' -usageNoticeNextPage: '&6次のページを見るには、&c/ch help %s %d&6 と実行してください。' +usageNoticeNextPage: '&6次のページを見るには、&c/%label% help %type% %next%&6 と実行してください。' diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index fce629f..a3606d6 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -7,145 +7,143 @@ softdepend: [Vault, dynmap, Multiverse-Core, mcMMO] commands: lunachat: - description: lunachatのユーザーコマンド + description: lunachat command aliases: [ch, lc] usage: | - / join (channel) - チャンネルに参加します。 - / leave - 参加しているチャンネルから退出します。 - / list - チャンネルのリストを表示します。 - / invite (name) [force] - 指定した人をチャンネルチャットに招待します。 - / accept - 招待を受けてチャンネルチャットに入室します。 - / deny - 招待を拒否します。 - / kick (name) [channel] - 指定した人をチャンネルチャットからキックします。 - / ban (name) [channel] - 指定した人をチャンネルチャットからBANします。 - / ban (name) [minutes] - 指定した人を指定した分間、BANします。 - / pardon (name) [channel] - 指定した人のBANを解除します。 - / mute (name) [channel] - 指定した人をチャンネルチャットからMuteします。 - / mute (name) [minutes] - 指定した人を指定した分間、Muteします。 - / unmute (name) [channel] - 指定した人のMuteを解除します。 - / hide (channel) - 指定したチャンネルの発言内容を非表示にします。 - / hide channel (channel) - 指定したチャンネルの発言内容を非表示にします。 - / hide (player) - 指定したプレイヤーの発言内容を非表示にします。 - / hide player (player) - 指定したプレイヤーの発言内容を非表示にします。 - / unhide (channel) - 指定したチャンネルの発言内容を非表示から表示に戻します。 - / unhide channel (channel) - 指定したチャンネルの発言内容を非表示から表示に戻します。 - / unhide (player) - 指定したプレイヤーの発言内容を非表示から表示に戻します。 - / unhide player (player) - 指定したプレイヤーの発言内容を非表示から表示に戻します。 - / info [channel] - チャンネルの情報を表示します。 - / log [channel] [key=value...] - チャンネルのログを表示します。 - / create (channel) - チャンネルを作成します。 - / remove [channel] - チャンネルを削除します。 - / format [channel] (format...) - チャンネルのメッセージフォーマットを設定します。 - / moderator [channel] (player...) - チャンネルのモデレーターを指定したプレイヤーに設定します。 - / dictionary (add (word) (value)|remove (word)) - Japanize変換辞書に新しいワードを登録したり、指定したワードを削除したりします。 - / option (key=value...) - チャンネルのオプションを設定します。 - / template (number) (template...) - メッセージフォーマットのテンプレートを登録します。 - / check - モデレータがいないチャンネルを一覧します。 - / check remove - / check で一覧されたチャンネルを全て削除します。 - / set default (player) [channel] - 指定したプレイヤーの発言先チャンネルを、指定したチャンネルに設定します。 - / reload - config.ymlの再読み込みをします。 - / help [user|mod|admin] [page] - ヘルプを表示します。 + / join (channel) - join channel. + / leave - leave channel. + / list - display channel list. + / invite (name) [force] - invite the specified player to channel. + / accept - accept the invitation. + / deny - deny the invitation. + / kick (name) [channel] - kick the specified player. + / ban (name) [channel] - ban the specified player. + / ban (name) [minutes] - ban the specified player with expiration. + / pardon (name) [channel] - remove the ban of the specified player. + / mute (name) [channel] - deprive the voice of the specified player. + / mute (name) [minutes] - deprive the voice of the specified player with expiration. + / unmute (name) [channel] - remove the voice deprivation of the specified player. + / hide (channel) - mute the specified channel. + / hide channel (channel) - mute the specified channel. + / hide (player) - mute the specified player. + / hide player (player) - mute the specified player. + / unhide (channel) - remove the mute of the specified channel. + / unhide channel (channel) - remove the mute of the specified channel. + / unhide (player) - remove the mute of the specified player. + / unhide player (player) - remove the mute of the specified player. + / info [channel] - display the information of the channel. + / log [channel] [key=value...] - display the logs of the channel. + / create (channel) - create the channel. + / remove [channel] - remove the channel. + / format [channel] (format...) - set the message format of the channel. + / moderator [channel] (player...) - set the specified player as the moderator. + / dictionary (add (word) (value)|remove (word)) - add/remove the word into the japanize dictionary. + / option (key=value...) - set the options of the channel. + / template (number) (template...) - set the template of the message format. + / set default (player) [channel] - set the channel to which the specified player speaks to the specified channel. + / reload - reload config.yml. + / help [user|mod|admin] [page] - display the usage. permission: lunachat.command - permission-message: パーミッション "" が無いため、実行できません。 + permission-message: You don't have the permission "". tell: - description: 1:1チャット送信コマンド + description: 1 on 1 chat command aliases: [msg, message, m, t] - usage: / (name) [message] - 指定した人との1:1チャットを開始します。 + usage: / (name) [message] - send 1 on 1 chat to the specified player. permission: lunachat.message - permission-message: パーミッション "" が無いため、実行できません。 + permission-message: You don't have the permission "". reply: - description: 1:1チャット返信コマンド + description: 1 on 1 chat reply command aliases: [r] - usage: / [message] - 受信した1:1チャットに返信します。 + usage: / [message] - reply to the recieved 1 on 1 chat. permission: lunachat.reply - permission-message: パーミッション "" が無いため、実行できません。 + permission-message: You don't have the permission "". japanize: - description: lunachatのjapanizeオンオフ設定コマンド + description: turn on/off the japanize conversion aliases: [jp] usage: | - / on|off - Turn on/off the Japanize conversion of your chat. - / (player) (on|off) - Turn on/off the Japanize conversion of other player's chat. + / on|off - turn on/off the japanize conversion of your chat. + / (player) (on|off) - turn on/off the japanize conversion of the specified player's chat. permission: lunachat.japanize permission-message: You don't have the permission "". permissions: lunachat.command: - description: lunachatコマンドの使用権限 + description: lunachat command permission default: true lunachat.join: - description: joinコマンドの使用権限 + description: join command permission default: true lunachat.leave: - description: leaveコマンドの使用権限 + description: leave command permission default: true lunachat.list: - description: listコマンドの使用権限 + description: list command permission default: true lunachat.invite: - description: inviteコマンドの使用権限 + description: invite command permission default: true lunachat.accept: - description: acceptコマンドの使用権限 + description: accept command permission default: true lunachat.deny: - description: denyコマンドの使用権限 + description: deny command permission default: true lunachat.kick: - description: kickコマンドの使用権限 + description: kick command permission default: true lunachat.ban: - description: banコマンドの使用権限 + description: ban command permission default: true lunachat.pardon: - description: pardonコマンドの使用権限 + description: pardon command permission default: true lunachat.mute: - description: muteコマンドの使用権限 + description: mute command permission default: true lunachat.unmute: - description: unmuteコマンドの使用権限 + description: unmute command permission default: true lunachat.hide: - description: hideコマンドの使用権限 + description: hide command permission default: true lunachat.unhide: - description: unhideコマンドの使用権限 + description: unhide command permission default: true lunachat.info: - description: infoコマンドの使用権限 + description: info command permission default: true lunachat.log: - description: logコマンドの使用権限 + description: log command permission default: true lunachat.create: - description: createコマンドの使用権限 + description: create command permission default: true lunachat.remove: - description: removeコマンドの使用権限 + description: remove command permission default: true lunachat.format: - description: formatコマンドの使用権限 + description: format command permission default: true lunachat.moderator: - description: moderatorコマンドの使用権限 + description: moderator command permission default: true lunachat.option: - description: optionコマンドの使用権限 + description: option command permission default: true lunachat.message: - description: messageコマンドの使用権限 + description: message command permission default: true lunachat.reply: - description: replyコマンドの使用権限 + description: reply command permission default: true lunachat.help: - description: helpコマンドの使用権限 + description: help command permission default: true lunachat.japanize: - description: lunachatのjapanizeオンオフ設定コマンドの使用権限 + description: japanize command permission default: true lunachat.allowcc: - description: チャットにおけるカラーコードの使用権限 + description: premission to use the color codes default: true lunachat.*: children: @@ -175,34 +173,34 @@ permissions: lunachat.help: true lunachat.japanize: true lunachat.allowcc: true - description: 一般ユーザー向けの全コマンドの使用権限 + description: permissions for the general players lunachat.option.description: - description: descriptionオプション設定コマンドの使用権限 + description: description command permission default: true lunachat.option.alias: - description: aliasオプション設定コマンドの使用権限 + description: alias command permission default: true lunachat.option.color: - description: colorオプション設定コマンドの使用権限 + description: color command permission default: true lunachat.option.broadcast: - description: broadcastオプション設定コマンドの使用権限 + description: broadcast command permission default: op lunachat.option.range: - description: rangeオプション設定コマンドの使用権限 + description: range command permission default: op lunachat.option.password: - description: passwordオプション設定コマンドの使用権限 + description: password command permission default: true lunachat.option.visible: - description: visibleオプション設定コマンドの使用権限 + description: visible command permission default: true lunachat.option.allowcc: - description: allowccオプション設定コマンドの使用権限 + description: allowcc command permission default: true lunachat.option.japanize: - description: japanizeオプション設定コマンドの使用権限 + description: japanize command permission default: true lunachat.option.*: children: @@ -215,31 +213,31 @@ permissions: lunachat.option.visible: true lunachat.option.allowcc: true lunachat.option.japanize: true - description: オプション設定の全コマンドの使用権限 + description: permissions of the option command lunachat-admin.mod-all-channels: - description: 全チャンネルのモデレータ権限 + description: permission of the moderation all channels default: op lunachat-admin.listen-all-channels: - description: 全チャンネルのチャット表示権限 + description: premission to display the chats of all channels default: op lunachat-admin.template: - description: templateコマンドの使用権限 + description: template command permission default: op lunachat-admin.dictionary: - description: dictionaryコマンドの使用権限 + description: dictionary command permission default: op lunachat-admin.set: - description: setコマンドの使用権限 + description: set command permission default: op lunachat-admin.reload: - description: reloadコマンドの使用権限 + description: reload command permission default: op lunachat-admin.japanize-other: - description: 他者のjapanizeオンオフ設定コマンドの使用権限 + description: japanize other command permission default: op lunachat-admin.force-invite: - description: 強制入室コマンドの使用権限 + description: force invite command permission default: op lunachat-admin.*: children: @@ -251,4 +249,5 @@ permissions: lunachat-admin.reload: true lunachat-admin.japanize-other: true lunachat-admin.force-invite: true - description: 管理者向けの全コマンドの使用権限 + description: permissions for the administrator + \ No newline at end of file