From ccae6a623a9425f06b178a35b205e0fa28321fea Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 4 May 2021 01:33:46 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E3=81=84=E3=82=84=E3=81=99=E3=81=8F?= =?UTF-8?q?=E3=81=97=E3=81=9F=20&=20=E4=B8=80=E9=83=A8=E8=BB=BD=E9=87=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/clockclap/tct/api/Utilities.java | 20 +++++++++++++++++++ .../main/java/me/clockclap/tct/game/Game.java | 7 ++++--- .../me/clockclap/tct/japanize/Japanizer.java | 11 +++++++++- .../clockclap/tct/japanize/KanaConverter.java | 18 ----------------- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/7miTCT/src/main/java/me/clockclap/tct/api/Utilities.java b/7miTCT/src/main/java/me/clockclap/tct/api/Utilities.java index 03491ba..fb5974e 100644 --- a/7miTCT/src/main/java/me/clockclap/tct/api/Utilities.java +++ b/7miTCT/src/main/java/me/clockclap/tct/api/Utilities.java @@ -254,4 +254,24 @@ public Player getNearestPlayer(Player player) { return result; } + public PlayerData getPlayerData(String coloredName) { + String name = resetColor(coloredName); + return NanamiTct.plugin.getGame().getReference().PLAYERDATA.get(name); + } + + public Collection getOnlinePlayersData() { + Collection players = Bukkit.getOnlinePlayers(); + Collection datas = new ArrayList<>(); + for(Player p : players) { + if(p != null) { + String name = resetColor(p.getName()); + PlayerData data = getPlayerData(name); + if (data != null) { + datas.add(data); + } + } + } + return datas; + } + } diff --git a/7miTCT/src/main/java/me/clockclap/tct/game/Game.java b/7miTCT/src/main/java/me/clockclap/tct/game/Game.java index 63bb593..1739f4d 100644 --- a/7miTCT/src/main/java/me/clockclap/tct/game/Game.java +++ b/7miTCT/src/main/java/me/clockclap/tct/game/Game.java @@ -349,7 +349,7 @@ private void giveRole(int playersCount) { int resultCount = villagersMin + healersMin + detectivesMin + wolvesMin + fanaticsMin + foxesMin + immoralMin; if(playersCount >= resultCount) { Collection players = Bukkit.getOnlinePlayers(); - for(Player p : Bukkit.getOnlinePlayers()) { + for(Player p : players) { if (getReference().PLAYERDATA.get(NanamiTct.utilities.resetColor(p.getName())).getRole() != GameRoles.VILLAGER) { players.remove(p); } @@ -463,7 +463,7 @@ private void giveRole(int playersCount) { } getRoleCount().getCustomRoleCount().initialize(); customRoles.clear(); - for (Player p : Bukkit.getOnlinePlayers()) { + for (Player p : players) { if (p != null) { PlayerData data = getReference().PLAYERDATA.get(NanamiTct.utilities.resetColor(p.getName())); if (data != null) { @@ -497,7 +497,8 @@ private void giveRole(int playersCount) { } public void giveItem() { - for(Player p : Bukkit.getOnlinePlayers()) { + Collection players = Bukkit.getOnlinePlayers(); + for(Player p : players) { PlayerData data = getReference().PLAYERDATA.get(NanamiTct.utilities.resetColor(p.getName())); if(!data.isSpectator()) { p.getInventory().setItem(4, getLog().getItem()); diff --git a/7miTCT/src/main/java/me/clockclap/tct/japanize/Japanizer.java b/7miTCT/src/main/java/me/clockclap/tct/japanize/Japanizer.java index 03e6616..918f91b 100644 --- a/7miTCT/src/main/java/me/clockclap/tct/japanize/Japanizer.java +++ b/7miTCT/src/main/java/me/clockclap/tct/japanize/Japanizer.java @@ -7,6 +7,7 @@ import org.bukkit.entity.Player; import java.io.UnsupportedEncodingException; +import java.util.Collection; public class Japanizer { @@ -101,10 +102,18 @@ public static String japanize(String input) throws UnsupportedEncodingException } result = KanaConverter.conv(msg); if(ime) { + result = result.replaceAll("むらびと", "村人"); + result = result.replaceAll("いしゃ", "医者"); + result = result.replaceAll("たんてい", "探偵"); + result = result.replaceAll("じんろう", "人狼"); + result = result.replaceAll("きょうじん", "狂人"); + result = result.replaceAll("ようこ", "妖狐"); + result = result.replaceAll("はいとくしゃ", "背徳者"); result = GoogleIME.convByGoogleIME(result); } if(jpn) { - for (Player p : Bukkit.getOnlinePlayers()) { + Collection players = Bukkit.getOnlinePlayers(); + for (Player p : players) { String name = NanamiTct.utilities.resetColor(p.getName()); String japanizedName = KanaConverter.conv(name); if(ime) japanizedName = GoogleIME.convByGoogleIME(japanizedName); diff --git a/7miTCT/src/main/java/me/clockclap/tct/japanize/KanaConverter.java b/7miTCT/src/main/java/me/clockclap/tct/japanize/KanaConverter.java index 7ecacc3..8f3cf39 100644 --- a/7miTCT/src/main/java/me/clockclap/tct/japanize/KanaConverter.java +++ b/7miTCT/src/main/java/me/clockclap/tct/japanize/KanaConverter.java @@ -21,24 +21,6 @@ protected KanaConverter() { static { ImmutableSortedMap.Builder builder = ImmutableSortedMap.reverseOrder(); - // 単語 - builder.put("kyoujin", "狂人"); - builder.put("kyoujinn", "狂人"); - builder.put("kyouzin", "狂人"); - builder.put("kyouzinn", "狂人"); - builder.put("youko", "妖狐"); - builder.put("jinrou", "人狼"); - builder.put("jinnrou", "人狼"); - builder.put("zinrou", "人狼"); - builder.put("zinnrou", "人狼"); - builder.put("tantei", "探偵"); - builder.put("tanntei", "探偵"); - builder.put("murabito", "村人"); - builder.put("kuro", "黒"); - builder.put("siro", "白"); - builder.put("isya", "医者"); - builder.put("isha", "医者"); - // ひらがな builder.put("a", "あ"); builder.put("i", "い").put("yi", "い");