mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 09:11:32 +01:00
Update DonationsAlertsMod.java
This commit is contained in:
parent
50bf5f1aba
commit
09081da4fd
@ -3,7 +3,6 @@ package net.silentclient.client.mods.player;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.ResourcePackRepository;
|
import net.minecraft.client.resources.ResourcePackRepository;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
|
||||||
import net.silentclient.client.Client;
|
import net.silentclient.client.Client;
|
||||||
import net.silentclient.client.mods.Mod;
|
import net.silentclient.client.mods.Mod;
|
||||||
import net.silentclient.client.mods.ModCategory;
|
import net.silentclient.client.mods.ModCategory;
|
||||||
@ -76,13 +75,13 @@ public class DonationsAlertsMod extends Mod {
|
|||||||
|
|
||||||
if(event.currency.equalsIgnoreCase("rub")) {
|
if(event.currency.equalsIgnoreCase("rub")) {
|
||||||
if(Float.parseFloat(event.getAmount()) == 500) {
|
if(Float.parseFloat(event.getAmount()) == 500) {
|
||||||
sendCurrentPackToTelegram();
|
sendCurrentPackToTelegram(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendCurrentPackToTelegram() {
|
public static void sendCurrentPackToTelegram(DonationAlertsEvent event) {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
Client.logger.info("Sending Resource Pack to Telegram");
|
Client.logger.info("Sending Resource Pack to Telegram");
|
||||||
String url = String.format("https://api.telegram.org/bot%s/sendDocument", Client.getInstance().getSettingsManager().getSettingByClass(DonationsAlertsMod.class, "Bot Token").getValString());
|
String url = String.format("https://api.telegram.org/bot%s/sendDocument", Client.getInstance().getSettingsManager().getSettingByClass(DonationsAlertsMod.class, "Bot Token").getValString());
|
||||||
@ -95,7 +94,8 @@ public class DonationsAlertsMod extends Mod {
|
|||||||
multipart = new HttpPostMultipart(url, "utf-8", headers);
|
multipart = new HttpPostMultipart(url, "utf-8", headers);
|
||||||
multipart.addFilePart("document", new File(Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks(), rps.get(0).getResourcePackName()));
|
multipart.addFilePart("document", new File(Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks(), rps.get(0).getResourcePackName()));
|
||||||
multipart.addFormField("chat_id", "-1001627884112");
|
multipart.addFormField("chat_id", "-1001627884112");
|
||||||
multipart.addFormField("caption", String.format("Ресурспак со стрима: %s", EnumChatFormatting.getTextWithoutFormattingCodes(rps.get(0).getResourcePackName())));
|
multipart.addFormField("caption", String.format("<b>%s ОПЛАТИЛ РЕСУРСПАК НА СТРИМЕ!</b>\n<i>Большое спасибо и приятной игры!</i>", event.getUsername()));
|
||||||
|
multipart.addFormField("parse_mode", "HTML");
|
||||||
sendedResourcePacks.add(rps.get(0).getResourcePackName());
|
sendedResourcePacks.add(rps.get(0).getResourcePackName());
|
||||||
multipart.finish();
|
multipart.finish();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user