From 50a7deb856c5b0edf8f19ffe82af02e062f0bc58 Mon Sep 17 00:00:00 2001 From: kraftwerk28 Date: Thu, 13 Feb 2020 17:12:50 +0200 Subject: [PATCH] add: README chore(build.gradle): refactor & output directory chore: rename packages --- .idea/misc.xml | 3 ++ .idea/spigot-tg-bridge.iml | 2 ++ README.md | 36 +++++++++++++++++++ build.gradle | 7 ++-- gradle.properties | 2 +- settings.gradle | 2 +- .../Bot.kt | 2 +- .../Plugin.kt | 2 +- src/main/resources/config.yml | 2 +- src/main/resources/plugin.yml | 6 ++-- 10 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 .idea/spigot-tg-bridge.iml create mode 100644 README.md rename src/main/kotlin/org/kraftwerk28/{rzcraft_bridge => spigot_tg_bridge}/Bot.kt (99%) rename src/main/kotlin/org/kraftwerk28/{rzcraft_bridge => spigot_tg_bridge}/Plugin.kt (98%) diff --git a/.idea/misc.xml b/.idea/misc.xml index 5acab24..17ae061 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -6,6 +6,9 @@ + + diff --git a/.idea/spigot-tg-bridge.iml b/.idea/spigot-tg-bridge.iml new file mode 100644 index 0000000..78b2cc5 --- /dev/null +++ b/.idea/spigot-tg-bridge.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..107833d --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# Spigot <-> Telegram bridge plugin + +### This plugin will send chat messages from Minecraft to Telegram, and from Telegram to Minecraft. + +## How to use: + +1. Download .jar file from [releases page](https://github.com/kraftwerk28/spigot-tg-bridge/releases), and put it in `plugins/` directory on your server **OR** clone this repo and run `gradle shadowJar` inside repo's directory + +2. Choose one of below to configure plugin: + 1. Run Spigot server, plugin will log `"No config file found! Saving default one."`. After that, stop server and proceed to 3rd step. + + **OR** + 2. Copy [config.yml](https://raw.githubusercontent.com/kraftwerk28/spigot-tg-bridge/master/src/main/resources/config.yml) to `plugins/SpigotTGBridge/` in your server directory. + +3. Modify `plugins/SpigotTGBridge/config.yml` with text editor, where each field is described in table below. + +4. Run server. + +#### config.yml: +| Field | Description | Type | Required | Default | +| --- | --- | --- | --- | --- | +| botToken | Telegram bot token ([How to create bot](https://core.telegram.org/bots#3-how-do-i-create-a-bot)) | string | :heavy_check_mark: | - | +| botUsername | Telegram bot username | string | :heavy_check_mark: | - | +| chats | Chats, where bot will work (to prevent using bot by unknown chats) | number[] | :heavy_check_mark: | [] | +| serverStartMessage | What will be sent to chats when server starts | string | :x: | 'Server started.' | +| serverStopMessage | What will be sent to chats when server stops | string | :x: | 'Server stopped.' | +| logJoinLeave | If true, plugin will send corresponding messages to chats, when player joins or leaves server | boolean | :x: | true | +| logFromMCtoTG | If true, plugin will send messages from players on server, to Telegram chats | boolean | :x: | true | +| logFromTGtoMC | If true, plugin will send messages from chats, to Minecraft server | boolean | :x: | true | +| strings | Dictionary of tokens - strings for plugin i18n | Map | :x: | See default config | + +## Commands: +| Command | description | +| --- | --- | +| `/online` | Get players, currently online | +| `/time` | Get [time](https://minecraft.gamepedia.com/Day-night_cycle) on server | diff --git a/build.gradle b/build.gradle index 1191202..4a0d4e8 100644 --- a/build.gradle +++ b/build.gradle @@ -5,9 +5,10 @@ plugins { } group 'org.kraftwerk28' -version '1.0-SNAPSHOT' -rootProject.libsDirName = - "$System.env.HOME/MinecraftServers/spigot_1.15.2/plugins/" +version '0.0.4-SNAPSHOT' + +def defaultOutDir = "$System.env.HOME/MinecraftServers/spigot_1.15.2/plugins/" +rootProject.libsDirName = System.getenv("OUT_DIR") ?: defaultOutDir sourceCompatibility = 1.8 targetCompatibility = 1.8 diff --git a/gradle.properties b/gradle.properties index 29e08e8..7fc6f1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official diff --git a/settings.gradle b/settings.gradle index 4c807d2..72a073a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = 'rzcraft-bridge' +rootProject.name = 'spigot-tg-bridge' diff --git a/src/main/kotlin/org/kraftwerk28/rzcraft_bridge/Bot.kt b/src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/Bot.kt similarity index 99% rename from src/main/kotlin/org/kraftwerk28/rzcraft_bridge/Bot.kt rename to src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/Bot.kt index 0501ddd..9949bd1 100644 --- a/src/main/kotlin/org/kraftwerk28/rzcraft_bridge/Bot.kt +++ b/src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/Bot.kt @@ -1,4 +1,4 @@ -package org.kraftwerk28.rzcraft_bridge +package org.kraftwerk28.spigot_tg_bridge import org.telegram.telegrambots.bots.TelegramLongPollingBot import org.telegram.telegrambots.meta.api.methods.ParseMode diff --git a/src/main/kotlin/org/kraftwerk28/rzcraft_bridge/Plugin.kt b/src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/Plugin.kt similarity index 98% rename from src/main/kotlin/org/kraftwerk28/rzcraft_bridge/Plugin.kt rename to src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/Plugin.kt index c30eb52..3ebbc12 100644 --- a/src/main/kotlin/org/kraftwerk28/rzcraft_bridge/Plugin.kt +++ b/src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/Plugin.kt @@ -1,4 +1,4 @@ -package org.kraftwerk28.rzcraft_bridge +package org.kraftwerk28.spigot_tg_bridge import com.vdurmont.emoji.EmojiParser import org.bukkit.event.EventHandler diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 5055b06..de39637 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,7 +1,7 @@ botToken: abcdef123456789 botUsername: sample_username chats: - - -1001281720535 + - -1234567890123 serverStartMessage: 'Server started.' serverStopMessage: 'Server stopped.' logJoinLeave: true diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 54abef4..5d16868 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ -name: RZCraftBridge +name: SpigotTGBridge version: 0.0.4 api-version: '1.15' -main: org.kraftwerk28.rzcraft_bridge.Plugin -description: Telegram <-> Minecraft communication plugin for RzaszkówCraft. +main: org.kraftwerk28.spigot_tg_bridge.Plugin +description: Telegram <-> Minecraft communication plugin for Spigot. load: STARTUP