Update TelegramChat.java

This commit is contained in:
iCaitlyn 2022-02-09 00:47:49 +08:00 committed by GitHub
parent 81429cd517
commit 10fe3f3ad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,20 +139,20 @@ public class TelegramChat extends JavaPlugin implements Listener {
sendToMC(chatMsg.getUuid_sender(), chatMsg.getContent(), chatMsg.getChatID_sender()); sendToMC(chatMsg.getUuid_sender(), chatMsg.getContent(), chatMsg.getChatID_sender());
} }
private static void sendToMC(UUID uuid, String msg, int sender_chat) { private static void sendToMC(UUID uuid, String msg, long sender_chat) {
OfflinePlayer op = Bukkit.getOfflinePlayer(uuid); OfflinePlayer op = Bukkit.getOfflinePlayer(uuid);
List<Integer> recievers = new ArrayList<Integer>(); List<Long> recievers = new ArrayList<Long>();
recievers.addAll(TelegramChat.data.chat_ids); recievers.addAll(TelegramChat.data.chat_ids);
recievers.remove((Object) sender_chat); recievers.remove((Object) sender_chat);
String msgF = Utils.formatMSG("general-message-to-mc", op.getName(), msg)[0]; String msgF = Utils.formatMSG("general-message-to-mc", op.getName(), msg)[0];
for (int id : recievers) { for (long id : recievers) {
telegramHook.sendMsg(id, msgF.replaceAll("§.", "")); telegramHook.sendMsg(id, msgF.replaceAll("§.", ""));
} }
Bukkit.broadcastMessage(msgF.replace("&", "§")); Bukkit.broadcastMessage(msgF.replace("&", "§"));
} }
public static void link(UUID player, int userID) { public static void link(UUID player, long userID) {
TelegramChat.data.addChatPlayerLink(userID, player); TelegramChat.data.addChatPlayerLink(userID, player);
OfflinePlayer p = Bukkit.getOfflinePlayer(player); OfflinePlayer p = Bukkit.getOfflinePlayer(player);
telegramHook.sendMsg(userID, "Success! Linked " + p.getName()); telegramHook.sendMsg(userID, "Success! Linked " + p.getName());