Release 0.0.5

Add chat id logging
This commit is contained in:
kraftwerk28 2020-05-18 10:55:00 +03:00
parent 7b8a7d9859
commit f293d8ae62
9 changed files with 19 additions and 7 deletions

1
.gitignore vendored
View File

@ -24,3 +24,4 @@ hs_err_pid*
build/ build/
.gradle/ .gradle/
local.properties

Binary file not shown.

6
.idea/compiler.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>

View File

@ -4,16 +4,17 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="delegatedBuild" value="true" />
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="/usr/share/java/gradle" /> <option name="gradleHome" value="/usr/share/java/gradle" />
<option name="gradleJvm" value="11" /> <option name="gradleJvm" value="13" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
</set> </set>
</option> </option>
<option name="useAutoImport" value="true" />
<option name="useQualifiedModuleNames" value="true" /> <option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings> </GradleProjectSettings>
</option> </option>

View File

@ -6,10 +6,13 @@
</list> </list>
</component> </component>
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="JavaScriptSettings"> <component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" /> <option name="languageLevel" value="ES6" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_13" project-jdk-name="13" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_13" default="false" project-jdk-name="13" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

View File

@ -1,5 +1,5 @@
#Sat Feb 08 20:44:49 EET 2020 #Sat Feb 08 20:44:49 EET 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -23,6 +23,7 @@ class Bot(private var plugin: Plugin) : TelegramLongPollingBot() {
override fun onUpdateReceived(update: Update?) { override fun onUpdateReceived(update: Update?) {
val msg = update?.message val msg = update?.message
plugin.logger.info("chat id: ${msg?.chatId}, message id: ${msg?.messageId}")
if (msg == null || msg.text == null) return if (msg == null || msg.text == null) return
if (!allowedChats.contains(msg.chatId)) return if (!allowedChats.contains(msg.chatId)) return

View File

@ -68,7 +68,7 @@ class Plugin : JavaPlugin(), Listener {
fun onPlayerJoin(event: PlayerJoinEvent) { fun onPlayerJoin(event: PlayerJoinEvent) {
if (config.getBoolean("logJoinLeave", false)) { if (config.getBoolean("logJoinLeave", false)) {
val joinStr = config.getString("strings.joined", "joined") val joinStr = config.getString("strings.joined", "joined")
tgBot?.broadcastToTG("${event.player.displayName} $joinStr.") tgBot?.broadcastToTG("<b>${event.player.displayName}</b> $joinStr.")
} }
} }
@ -76,7 +76,7 @@ class Plugin : JavaPlugin(), Listener {
fun onPlayerLeave(event: PlayerQuitEvent) { fun onPlayerLeave(event: PlayerQuitEvent) {
if (config.getBoolean("logJoinLeave", false)) { if (config.getBoolean("logJoinLeave", false)) {
val leftStr = config.getString("strings.left", "joined") val leftStr = config.getString("strings.left", "joined")
tgBot?.broadcastToTG("${event.player.displayName} $leftStr.") tgBot?.broadcastToTG("<b>${event.player.displayName}</b> $leftStr.")
} }
} }
} }

View File

@ -1,5 +1,5 @@
name: SpigotTGBridge name: SpigotTGBridge
version: 0.0.4 version: 0.0.5
api-version: '1.15' api-version: '1.15'
main: org.kraftwerk28.spigot_tg_bridge.Plugin main: org.kraftwerk28.spigot_tg_bridge.Plugin
description: Telegram <-> Minecraft communication plugin for Spigot. description: Telegram <-> Minecraft communication plugin for Spigot.