Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b81123e1b5 | |||
| 21ec1abc57 | |||
| 6335f0d3c6 | |||
| 69a51a9ee9 |
@@ -50,8 +50,8 @@ messages:
|
||||
- **Nachrichtenformate**: Anpassung der Nachrichten mit Platzhaltern `{username}` und `{message}`.
|
||||
|
||||
## Befehle
|
||||
- `/tg`: Wechselt in den Telegram-Chatmodus.
|
||||
- `/chat`: Wechselt in den Minecraft-Chatmodus.
|
||||
- `/tg on`: Wechselt in den Telegram-Chatmodus.
|
||||
- `/tg off`: Wechselt in den Minecraft-Chatmodus.
|
||||
- `/link`: Verknüpft dein Minecraft-Konto mit einem Telegram-Konto.
|
||||
- `/tb [reload|info|help]`: Verwaltet das Plugin (einige Unterbefehle nur für Admins).
|
||||
|
||||
|
||||
148
pom.xml
148
pom.xml
@@ -1,74 +1,74 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>dev.viper</groupId>
|
||||
<artifactId>TelegramChatBridge</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<name>TelegramChatBridge</name>
|
||||
<description>Bridge between Minecraft and Telegram chat</description>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<telegrambots.version>6.5.0</telegrambots.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- Telegram Bots -->
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>${telegrambots.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Bukkit/Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Compiler Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<release>17</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Shade Plugin: packt Telegram-Bibliothek in die JAR -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals><goal>shade</goal></goals>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.telegram</pattern>
|
||||
<shadedPattern>dev.viper.shaded.telegram</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>dev.viper</groupId>
|
||||
<artifactId>TelegramChatBridge</artifactId>
|
||||
<version>1.1</version>
|
||||
|
||||
<name>TelegramChatBridge</name>
|
||||
<description>Bridge between Minecraft and Telegram chat</description>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<telegrambots.version>6.5.0</telegrambots.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- Telegram Bots -->
|
||||
<dependency>
|
||||
<groupId>org.telegram</groupId>
|
||||
<artifactId>telegrambots</artifactId>
|
||||
<version>${telegrambots.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Bukkit/Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Compiler Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<release>17</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Shade Plugin: packt Telegram-Bibliothek in die JAR -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals><goal>shade</goal></goals>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.telegram</pattern>
|
||||
<shadedPattern>dev.viper.shaded.telegram</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,65 +1,83 @@
|
||||
package dev.viper.telegramchat;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TelegramCommand implements CommandExecutor {
|
||||
private final TelegramChatBridge plugin;
|
||||
private final ChatModeManager chatModeManager;
|
||||
|
||||
public TelegramCommand(TelegramChatBridge plugin, ChatModeManager manager) {
|
||||
this.plugin = plugin;
|
||||
this.chatModeManager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player player)) {
|
||||
sender.sendMessage(ChatColor.RED + "Dieser Befehl kann nur von einem Spieler ausgeführt werden.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
// Wechsel in Telegram-Chatmodus
|
||||
chatModeManager.setMode(player.getUniqueId(), ChatModeManager.ChatMode.TELEGRAM);
|
||||
String msg = plugin.getConfig().getString("messages.mode-set-telegram", "Du bist jetzt im Telegram-Chatmodus.");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
|
||||
return true;
|
||||
}
|
||||
|
||||
String sub = args[0].toLowerCase();
|
||||
|
||||
if (sub.equals("info")) {
|
||||
player.sendMessage(ChatColor.DARK_GRAY + "=== TelegramChatBridge Info ===");
|
||||
player.sendMessage(ChatColor.GRAY + "Version: " + ChatColor.WHITE + plugin.getDescription().getVersion());
|
||||
player.sendMessage(ChatColor.GRAY + "Ersteller: " + ChatColor.WHITE + "M_Viper");
|
||||
|
||||
String chatId = plugin.getChatId();
|
||||
String chatType = "Unbekannt";
|
||||
if (chatId != null) {
|
||||
if (chatId.startsWith("-")) {
|
||||
chatType = "Gruppenchat";
|
||||
} else {
|
||||
chatType = "Privat Chat";
|
||||
}
|
||||
}
|
||||
player.sendMessage(ChatColor.GRAY + "Chat-Typ: " + ChatColor.WHITE + chatType);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sub.equals("help")) {
|
||||
player.sendMessage(ChatColor.GREEN + "=== TelegramChatBridge Befehle ===");
|
||||
player.sendMessage(ChatColor.YELLOW + "/tg" + ChatColor.WHITE + " - Wechsel in Telegram-Chatmodus");
|
||||
player.sendMessage(ChatColor.YELLOW + "/tg info" + ChatColor.WHITE + " - Plugin-Informationen anzeigen");
|
||||
player.sendMessage(ChatColor.YELLOW + "/tg help" + ChatColor.WHITE + " - Diese Hilfe anzeigen");
|
||||
return true;
|
||||
}
|
||||
|
||||
player.sendMessage(ChatColor.RED + "Unbekannter Unterbefehl. Nutze /tg help");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
package dev.viper.telegramchat;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TelegramCommand implements CommandExecutor {
|
||||
private final TelegramChatBridge plugin;
|
||||
private final ChatModeManager chatModeManager;
|
||||
|
||||
public TelegramCommand(TelegramChatBridge plugin, ChatModeManager manager) {
|
||||
this.plugin = plugin;
|
||||
this.chatModeManager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player player)) {
|
||||
sender.sendMessage(ChatColor.RED + "Dieser Befehl kann nur von einem Spieler ausgeführt werden.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Wenn keine Argumente angegeben wurden, standardmäßig den Telegram-Modus aktivieren
|
||||
if (args.length == 0) {
|
||||
chatModeManager.setMode(player.getUniqueId(), ChatModeManager.ChatMode.TELEGRAM);
|
||||
String msg = plugin.getConfig().getString("messages.mode-set-telegram", "Du bist jetzt im Telegram-Chatmodus.");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
|
||||
return true;
|
||||
}
|
||||
|
||||
String sub = args[0].toLowerCase();
|
||||
|
||||
// Befehl: /tg on
|
||||
if (sub.equals("on")) {
|
||||
chatModeManager.setMode(player.getUniqueId(), ChatModeManager.ChatMode.TELEGRAM);
|
||||
String msg = plugin.getConfig().getString("messages.mode-set-telegram", "Du bist jetzt im Telegram-Chatmodus.");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Befehl: /tg off
|
||||
if (sub.equals("off")) {
|
||||
chatModeManager.setMode(player.getUniqueId(), ChatModeManager.ChatMode.MINECRAFT);
|
||||
String msg = plugin.getConfig().getString("messages.mode-set-minecraft", "Du bist jetzt im Minecraft-Chatmodus.");
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sub.equals("info")) {
|
||||
player.sendMessage(ChatColor.DARK_GRAY + "=== TelegramChatBridge Info ===");
|
||||
player.sendMessage(ChatColor.GRAY + "Version: " + ChatColor.WHITE + plugin.getDescription().getVersion());
|
||||
player.sendMessage(ChatColor.GRAY + "Ersteller: " + ChatColor.WHITE + "M_Viper");
|
||||
|
||||
String chatId = plugin.getChatId();
|
||||
String chatType = "Unbekannt";
|
||||
if (chatId != null) {
|
||||
if (chatId.startsWith("-")) {
|
||||
chatType = "Gruppenchat";
|
||||
} else {
|
||||
chatType = "Privat Chat";
|
||||
}
|
||||
}
|
||||
player.sendMessage(ChatColor.GRAY + "Chat-Typ: " + ChatColor.WHITE + chatType);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sub.equals("help")) {
|
||||
player.sendMessage(ChatColor.GREEN + "=== TelegramChatBridge Befehle ===");
|
||||
player.sendMessage(ChatColor.YELLOW + "/tg" + ChatColor.WHITE + " - Wechsel in Telegram-Chatmodus");
|
||||
player.sendMessage(ChatColor.YELLOW + "/tg on" + ChatColor.WHITE + " - Aktiviert den Telegram-Chatmodus");
|
||||
player.sendMessage(ChatColor.YELLOW + "/tg off" + ChatColor.WHITE + " - Deaktiviert den Telegram-Chatmodus (Normaler Chat)");
|
||||
player.sendMessage(ChatColor.YELLOW + "/tg info" + ChatColor.WHITE + " - Plugin-Informationen anzeigen");
|
||||
player.sendMessage(ChatColor.YELLOW + "/tg help" + ChatColor.WHITE + " - Diese Hilfe anzeigen");
|
||||
return true;
|
||||
}
|
||||
|
||||
player.sendMessage(ChatColor.RED + "Unbekannter Unterbefehl. Nutze /tg help");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,27 @@
|
||||
name: TelegramChatBridge
|
||||
version: 1.0
|
||||
main: dev.viper.telegramchat.TelegramChatBridge
|
||||
api-version: '1.21'
|
||||
|
||||
commands:
|
||||
tg:
|
||||
description: Wechselt in den Telegram-Chatmodus
|
||||
usage: /<command>
|
||||
chat:
|
||||
description: Wechselt in den Minecraft-Chatmodus
|
||||
usage: /<command>
|
||||
link:
|
||||
description: Verknüpft deinen Minecraft-Account mit Telegram
|
||||
usage: /<command>
|
||||
tb:
|
||||
description: Verwaltet das TelegramChatBridge-Plugin
|
||||
usage: /<command> [reload|info|help]
|
||||
|
||||
permissions:
|
||||
telegramchat.use:
|
||||
description: Erlaubt die Nutzung der TelegramChatBridge Befehle
|
||||
default: true
|
||||
|
||||
telegramchat.admin:
|
||||
description: Erlaubt die Nutzung der Admin-Befehle von TelegramChatBridge
|
||||
default: op
|
||||
name: TelegramChatBridge
|
||||
version: 1.1
|
||||
main: dev.viper.telegramchat.TelegramChatBridge
|
||||
api-version: '1.21'
|
||||
|
||||
commands:
|
||||
tg:
|
||||
description: Wechselt in den Telegram-Chatmodus
|
||||
usage: /<command>
|
||||
chat:
|
||||
description: Wechselt in den Minecraft-Chatmodus
|
||||
usage: /<command>
|
||||
link:
|
||||
description: Verknüpft deinen Minecraft-Account mit Telegram
|
||||
usage: /<command>
|
||||
tb:
|
||||
description: Verwaltet das TelegramChatBridge-Plugin
|
||||
usage: /<command> [reload|info|help]
|
||||
|
||||
permissions:
|
||||
telegramchat.use:
|
||||
description: Erlaubt die Nutzung der TelegramChatBridge Befehle
|
||||
default: true
|
||||
|
||||
telegramchat.admin:
|
||||
description: Erlaubt die Nutzung der Admin-Befehle von TelegramChatBridge
|
||||
default: op
|
||||
|
||||
Reference in New Issue
Block a user