Merge pull request #17 from mind-overflow/premiumvanish-support
SuperVanish/PremiumVanish support
This commit is contained in:
commit
8f24cd35ac
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/.idea
|
||||||
|
*.class
|
||||||
|
/target
|
||||||
|
*.iml
|
17
pom.xml
17
pom.xml
@ -25,15 +25,24 @@
|
|||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
<url>https://jitpack.io</url>
|
<url>https://jitpack.io</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>nexus-snapshots</id>
|
||||||
|
<url>https://services.mind-overflow.net/nexus/repository/maven-releases/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.LeonMangler</groupId>
|
||||||
|
<artifactId>PremiumVanishAPI</artifactId>
|
||||||
|
<version>2.7.3</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.MilkBowl</groupId>
|
<groupId>com.github.MilkBowl</groupId>
|
||||||
<artifactId>VaultAPI</artifactId>
|
<artifactId>VaultAPI</artifactId>
|
||||||
@ -72,8 +81,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.1</version>
|
<version>3.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>9</source>
|
||||||
<target>1.8</target>
|
<target>9</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Sets the custom JARfile name (Project name without spaces is good) -->
|
<!-- Sets the custom JARfile name (Project name without spaces is good) -->
|
||||||
|
44
src/main/java/de/Linus122/Handlers/VanishHandler.java
Normal file
44
src/main/java/de/Linus122/Handlers/VanishHandler.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package de.Linus122.Handlers;
|
||||||
|
|
||||||
|
import de.Linus122.Telegram.Utils;
|
||||||
|
import de.Linus122.TelegramChat.TelegramChat;
|
||||||
|
import de.Linus122.TelegramComponents.ChatMessageToTelegram;
|
||||||
|
import de.myzelyam.api.vanish.PlayerHideEvent;
|
||||||
|
import de.myzelyam.api.vanish.PlayerShowEvent;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
public class VanishHandler implements Listener
|
||||||
|
{
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onVanish(PlayerHideEvent e) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
if(e.isCancelled()) return;
|
||||||
|
|
||||||
|
if (!TelegramChat.getInstance().getConfig().getBoolean("enable-joinquitmessages"))
|
||||||
|
return;
|
||||||
|
if (TelegramChat.telegramHook.connected) {
|
||||||
|
ChatMessageToTelegram chat = new ChatMessageToTelegram();
|
||||||
|
chat.parse_mode = "Markdown";
|
||||||
|
chat.text = Utils.formatMSG("quit-message", e.getPlayer().getName())[0];
|
||||||
|
TelegramChat.telegramHook.sendAll(chat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onShow(PlayerShowEvent e) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
if(e.isCancelled()) return;
|
||||||
|
|
||||||
|
if (!TelegramChat.getInstance().getConfig().getBoolean("enable-joinquitmessages"))
|
||||||
|
return;
|
||||||
|
if (TelegramChat.telegramHook.connected) {
|
||||||
|
ChatMessageToTelegram chat = new ChatMessageToTelegram();
|
||||||
|
chat.parse_mode = "Markdown";
|
||||||
|
chat.text = Utils.formatMSG("join-message", e.getPlayer().getName())[0];
|
||||||
|
TelegramChat.telegramHook.sendAll(chat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,8 @@ import java.util.Random;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import de.Linus122.Handlers.VanishHandler;
|
||||||
|
import de.myzelyam.api.vanish.VanishAPI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -40,17 +42,25 @@ public class TelegramChat extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
private static Data data = new Data();
|
private static Data data = new Data();
|
||||||
public static Telegram telegramHook;
|
public static Telegram telegramHook;
|
||||||
|
private static TelegramChat instance;
|
||||||
|
private static boolean isSuperVanish;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
this.saveDefaultConfig();
|
this.saveDefaultConfig();
|
||||||
cfg = this.getConfig();
|
cfg = this.getConfig();
|
||||||
|
instance = this;
|
||||||
Utils.cfg = cfg;
|
Utils.cfg = cfg;
|
||||||
|
|
||||||
Bukkit.getPluginCommand("telegram").setExecutor(new TelegramCmd());
|
Bukkit.getPluginCommand("telegram").setExecutor(new TelegramCmd());
|
||||||
Bukkit.getPluginCommand("linktelegram").setExecutor(new LinkTelegramCmd());
|
Bukkit.getPluginCommand("linktelegram").setExecutor(new LinkTelegramCmd());
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
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/");
|
File dir = new File("plugins/TelegramChat/");
|
||||||
dir.mkdir();
|
dir.mkdir();
|
||||||
data = new Data();
|
data = new Data();
|
||||||
@ -190,6 +200,10 @@ public class TelegramChat extends JavaPlugin implements Listener {
|
|||||||
public void onJoin(PlayerJoinEvent e) {
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
if (!this.getConfig().getBoolean("enable-joinquitmessages"))
|
if (!this.getConfig().getBoolean("enable-joinquitmessages"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(isSuperVanish && VanishAPI.isInvisible(e.getPlayer()))
|
||||||
|
return;
|
||||||
|
|
||||||
if (telegramHook.connected) {
|
if (telegramHook.connected) {
|
||||||
ChatMessageToTelegram chat = new ChatMessageToTelegram();
|
ChatMessageToTelegram chat = new ChatMessageToTelegram();
|
||||||
chat.parse_mode = "Markdown";
|
chat.parse_mode = "Markdown";
|
||||||
@ -214,6 +228,10 @@ public class TelegramChat extends JavaPlugin implements Listener {
|
|||||||
public void onQuit(PlayerQuitEvent e) {
|
public void onQuit(PlayerQuitEvent e) {
|
||||||
if (!this.getConfig().getBoolean("enable-joinquitmessages"))
|
if (!this.getConfig().getBoolean("enable-joinquitmessages"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(isSuperVanish && VanishAPI.isInvisible(e.getPlayer()))
|
||||||
|
return;
|
||||||
|
|
||||||
if (telegramHook.connected) {
|
if (telegramHook.connected) {
|
||||||
ChatMessageToTelegram chat = new ChatMessageToTelegram();
|
ChatMessageToTelegram chat = new ChatMessageToTelegram();
|
||||||
chat.parse_mode = "Markdown";
|
chat.parse_mode = "Markdown";
|
||||||
@ -238,4 +256,9 @@ public class TelegramChat extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TelegramChat getInstance()
|
||||||
|
{
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ name: TelegramChat
|
|||||||
main: de.Linus122.TelegramChat.TelegramChat
|
main: de.Linus122.TelegramChat.TelegramChat
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
authors: [Linus122]
|
authors: [Linus122]
|
||||||
softdepend: [Vault]
|
softdepend: [Vault, SuperVanish, PremiumVanish]
|
||||||
description: Brings minecraft chat to Telegram!
|
description: Brings minecraft chat to Telegram!
|
||||||
commands:
|
commands:
|
||||||
telegram:
|
telegram:
|
||||||
|
Loading…
Reference in New Issue
Block a user