|
@@ -12,6 +12,8 @@ import java.util.Random;
|
|
|
import java.util.UUID;
|
|
|
import java.util.logging.Level;
|
|
|
|
|
|
+import de.Linus122.Handlers.VanishHandler;
|
|
|
+import de.myzelyam.api.vanish.VanishAPI;
|
|
|
import org.bukkit.Bukkit;
|
|
|
import org.bukkit.OfflinePlayer;
|
|
|
import org.bukkit.configuration.file.FileConfiguration;
|
|
@@ -40,17 +42,25 @@ public class TelegramChat extends JavaPlugin implements Listener {
|
|
|
|
|
|
private static Data data = new Data();
|
|
|
public static Telegram telegramHook;
|
|
|
+ private static TelegramChat instance;
|
|
|
+ private static boolean isSuperVanish;
|
|
|
|
|
|
@Override
|
|
|
public void onEnable() {
|
|
|
this.saveDefaultConfig();
|
|
|
cfg = this.getConfig();
|
|
|
+ instance = this;
|
|
|
Utils.cfg = cfg;
|
|
|
|
|
|
Bukkit.getPluginCommand("telegram").setExecutor(new TelegramCmd());
|
|
|
Bukkit.getPluginCommand("linktelegram").setExecutor(new LinkTelegramCmd());
|
|
|
Bukkit.getPluginManager().registerEvents(this, this);
|
|
|
|
|
|
+ if (Bukkit.getPluginManager().isPluginEnabled("SuperVanish") || Bukkit.getPluginManager().isPluginEnabled("PremiumVanish")) {
|
|
|
+ isSuperVanish = true;
|
|
|
+ Bukkit.getPluginManager().registerEvents(new VanishHandler(), this);
|
|
|
+ }
|
|
|
+
|
|
|
File dir = new File("plugins/TelegramChat/");
|
|
|
dir.mkdir();
|
|
|
data = new Data();
|
|
@@ -190,6 +200,10 @@ public class TelegramChat extends JavaPlugin implements Listener {
|
|
|
public void onJoin(PlayerJoinEvent e) {
|
|
|
if (!this.getConfig().getBoolean("enable-joinquitmessages"))
|
|
|
return;
|
|
|
+
|
|
|
+ if(isSuperVanish && VanishAPI.isInvisible(e.getPlayer()))
|
|
|
+ return;
|
|
|
+
|
|
|
if (telegramHook.connected) {
|
|
|
ChatMessageToTelegram chat = new ChatMessageToTelegram();
|
|
|
chat.parse_mode = "Markdown";
|
|
@@ -214,6 +228,10 @@ public class TelegramChat extends JavaPlugin implements Listener {
|
|
|
public void onQuit(PlayerQuitEvent e) {
|
|
|
if (!this.getConfig().getBoolean("enable-joinquitmessages"))
|
|
|
return;
|
|
|
+
|
|
|
+ if(isSuperVanish && VanishAPI.isInvisible(e.getPlayer()))
|
|
|
+ return;
|
|
|
+
|
|
|
if (telegramHook.connected) {
|
|
|
ChatMessageToTelegram chat = new ChatMessageToTelegram();
|
|
|
chat.parse_mode = "Markdown";
|
|
@@ -238,4 +256,9 @@ public class TelegramChat extends JavaPlugin implements Listener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static TelegramChat getInstance()
|
|
|
+ {
|
|
|
+ return instance;
|
|
|
+ }
|
|
|
+
|
|
|
}
|