Compare commits
No commits in common. "178399bf94fd7d1378958e1b1f43d09ae31ffae9" and "5dee2150a8dd22f1391cf1746cc2f71a1b09ac65" have entirely different histories.
178399bf94
...
5dee2150a8
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +0,0 @@
|
|||||||
/.idea
|
|
||||||
*.class
|
|
||||||
/target
|
|
||||||
*.iml
|
|
30
README.md
30
README.md
@ -1,43 +1,21 @@
|
|||||||
[![GitHub last commit](https://img.shields.io/github/last-commit/mastercake10/TelegramChat.svg)](https://github.com/mastercake10/TelegramChat/commits/master)
|
[![GitHub last commit](https://img.shields.io/github/last-commit/mastercake10/TelegramChat.svg)](https://github.com/mastercake10/TelegramChat/commits/master)
|
||||||
[![build status](https://ci.spaceio.xyz/buildStatus/icon?job=TelegramChat)](https://ci.spaceio.xyz/job/TelegramChat/lastBuild/xyz.spaceio$telegramchat/)
|
|
||||||
[![discord](https://discordapp.com/api/guilds/330725294749122561/widget.png)](https://discord.gg/3xgsPh8)
|
[![discord](https://discordapp.com/api/guilds/330725294749122561/widget.png)](https://discord.gg/3xgsPh8)
|
||||||
[![view on SpigotMC](https://img.shields.io/badge/view%20on-spigotmc-orange.svg)](https://www.spigotmc.org/resources/telegramchat.16576/)
|
[![view on SpigotMC](https://img.shields.io/badge/view%20on-spigotmc-orange.svg)](https://www.spigotmc.org/resources/telegramchat.16576/)
|
||||||
|
|
||||||
![resource icon](https://www.spigotmc.org/data/resource_icons/16/16576.jpg?1476392100)
|
![resource icon](https://www.spigotmc.org/data/resource_icons/16/16576.jpg?1476392100)
|
||||||
|
|
||||||
## Welcome to the TelegramChat GitHub repository!
|
## Welcome to the TelegramChat GitHub repository!
|
||||||
TelegramChat is a Bukkit plugin compatible with Paper/Spigot versions 1.7 through 1.18.*, that connects Telegram with Minecraft.
|
TelegramChat is a Spigot plugin compatible with Spigot versions 1.7 through 1.16.*, that connects Telegram with Minecraft.
|
||||||
|
|
||||||
## Usage
|
### Usage
|
||||||
1. Create a new bot by messaging the @BotFather and following the instructions.
|
1. Create a new bot by messaging the @BotFather and following the instructions.
|
||||||
2. Obtain the token (`/tokentype` in Telegram) and type `/linktelegram <token>` to link the newly created Bot to your Server. This needs to be done once.
|
2. Obtain the token (`/tokentype` in Telegram) and type `/linktelegram <token>` to link the newly created Bot to your Server. This needs to be done once.
|
||||||
3. Each user needs to be linked to their Telegram account in order to chat mc <-> telegram.
|
3. Each user needs to be linked to their Telegram account in order to chat mc <-> telegram.
|
||||||
|
|
||||||
### Private chats
|
## Private chats
|
||||||
1. Your users need to type `/telegram` in-game to get a temporary code for linking
|
1. Your users need to type `/telegram` in-game to get a temporary code for linking
|
||||||
2. The code is then sent to the Telegram bot.
|
2. The code is then sent to the Telegram bot.
|
||||||
|
|
||||||
### Group chats
|
## Group chats
|
||||||
1. As an admin, you need to set the privacy setting to disabled using the BotFather. This is done by typing `/setprivacy` and then disabled.
|
1. As an admin, you need to set the privacy setting to disabled using the BotFather. This is done by typing `/setprivacy` and then disabled.
|
||||||
2. Users just need to join the group to see the MC chat. They might want to link their account by posting their /linktelegram code in the group chat.
|
2. Users just need to join the group to see the MC chat. They might want to link their account by posting their /linktelegram code in the group chat.
|
||||||
|
|
||||||
## Developers
|
|
||||||
* [Jenkins](https://ci.spaceio.xyz/job/TelegramChat/lastBuild/xyz.spaceio$telegramchat/) latest builds, including unstable ones
|
|
||||||
* [Repository](https://repo.spaceio.xyz/#browse/browse:maven-snapshots:xyz%2Fspaceio%2Ftelegramchat)
|
|
||||||
|
|
||||||
### API
|
|
||||||
```xml
|
|
||||||
<repository>
|
|
||||||
<id>spaceio-repo</id>
|
|
||||||
<url>https://repo.spaceio.xyz/repository/maven-public/</url>
|
|
||||||
</repository>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>xyz.spaceio</groupId>
|
|
||||||
<artifactId>telegramchat</artifactId>
|
|
||||||
<version>VERSION_HERE-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
```
|
|
||||||
|
29
pom.xml
29
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>xyz.spaceio</groupId>
|
<groupId>xyz.spaceio</groupId>
|
||||||
<artifactId>telegramchat</artifactId>
|
<artifactId>telegramchat</artifactId>
|
||||||
<version>1.0.18-SNAPSHOT</version>
|
<version>1.0.17-SNAPSHOT</version>
|
||||||
<name>TelegramChat</name>
|
<name>TelegramChat</name>
|
||||||
<url>https://www.spigotmc.org/resources/telegramchat.16576/</url>
|
<url>https://www.spigotmc.org/resources/telegramchat.16576/</url>
|
||||||
|
|
||||||
@ -25,24 +25,15 @@
|
|||||||
<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.spigotmc</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>craftbukkit</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>
|
||||||
@ -51,16 +42,16 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
|
||||||
<id>spaceio-releases</id>
|
|
||||||
<name>releases</name>
|
|
||||||
<url>https://repo.spaceio.xyz/repository/maven-releases/</url>
|
|
||||||
</repository>
|
|
||||||
<snapshotRepository>
|
<snapshotRepository>
|
||||||
<id>spaceio-snapshots</id>
|
<id>spaceio-snapshots</id>
|
||||||
<name>snapshots</name>
|
<name>snapshots</name>
|
||||||
<url>https://repo.spaceio.xyz/repository/maven-snapshots/</url>
|
<url>https://repo.spaceio.xyz/repository/maven-snapshots/</url>
|
||||||
</snapshotRepository>
|
</snapshotRepository>
|
||||||
|
<repository>
|
||||||
|
<id>spaceio-releases</id>
|
||||||
|
<name>releases</name>
|
||||||
|
<url>https://repo.spaceio.xyz/repository/maven-releases/</url>
|
||||||
|
</repository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
<build>
|
<build>
|
||||||
<!-- Uses the properties in this file for plugin.yml and config.yml -->
|
<!-- Uses the properties in this file for plugin.yml and config.yml -->
|
||||||
@ -81,8 +72,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.1</version>
|
<version>3.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>9</source>
|
<source>1.8</source>
|
||||||
<target>9</target>
|
<target>1.8</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) -->
|
||||||
|
@ -27,7 +27,7 @@ import net.milkbowl.vault.permission.Permission;
|
|||||||
public class CommandHandler extends ConsoleHandler implements TelegramActionListener {
|
public class CommandHandler extends ConsoleHandler implements TelegramActionListener {
|
||||||
|
|
||||||
private Permission permissionsAdapter;
|
private Permission permissionsAdapter;
|
||||||
private long lastChatId = -1;
|
private int lastChatId = -1;
|
||||||
private long lastCommandTyped;
|
private long lastCommandTyped;
|
||||||
|
|
||||||
private Telegram telegram;
|
private Telegram telegram;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
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,8 +12,6 @@ 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;
|
||||||
@ -42,25 +40,17 @@ 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();
|
||||||
@ -200,10 +190,6 @@ 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";
|
||||||
@ -228,10 +214,6 @@ 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";
|
||||||
@ -256,9 +238,4 @@ public class TelegramChat extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TelegramChat getInstance()
|
|
||||||
{
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package de.Linus122.TelegramComponents;
|
package de.Linus122.TelegramComponents;
|
||||||
|
|
||||||
public class User {
|
public class User {
|
||||||
private long id;
|
private int id;
|
||||||
private boolean is_bot;
|
private boolean is_bot;
|
||||||
private String first_name;
|
private String first_name;
|
||||||
private String last_name;
|
private String last_name;
|
||||||
|
|
||||||
public long getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(long id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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, SuperVanish, PremiumVanish]
|
softdepend: [Vault]
|
||||||
description: Brings minecraft chat to Telegram!
|
description: Brings minecraft chat to Telegram!
|
||||||
commands:
|
commands:
|
||||||
telegram:
|
telegram:
|
||||||
|
Loading…
Reference in New Issue
Block a user