Skip to content

Commit

Permalink
Merge pull request #62 from the-obsidian/core
Browse files Browse the repository at this point in the history
Update support for Bukkit, Sponge, and Forge
  • Loading branch information
DiamondIceNS authored Feb 7, 2018
2 parents 58b9475 + 83b3c9d commit 5ebc2a2
Show file tree
Hide file tree
Showing 102 changed files with 2,886 additions and 1,651 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ jdk:
- oraclejdk8

after_success:
- ./gradlew shadowJar
- ./gradlew build

deploy:
provider: releases
api_key:
secure: KJd23J+YlpBuUs+5//5BjYlSQ9mVOsYnpfanE03ZQ4E9Qp+pGpMSaH60d/CXkSkDVr32QL5jk0VRDNVl0wvTZpRJfNclQgh3fh2iPkaBDmjun0YkGHfE6VeRzJZVuIF/F34pkziEC01B7Tq2loms+RSm9pNeWgN+ulaajNENUT2J4nmb33yyKbGN9I4EdjcMCQmgdnxn/4QNXV6T3Xls9S9X7AwA9pg4WNpdACqJ0oWj2YlSWKmAdcKw0iLQtRbQfbiqj6waOLODdxieIu0KVWEVQnTdcv7ElGl9BgDrHzXBjfS+9G112TBqsNIPx60o8Z7ThR02DYPWYXrRyfvaHM0FqXrBSaUZUxfHpGn5F4CRQLZh/jOnIOZ9hHmCSDD69pcS254tVCoB+hRuS7PBstuh8iUO7VGJASb5Mv34LZYLAxfvNDAKLeY60xdz/Uiku9JW0dpLQC+FWAvFZWdQ3IvCMYRnaT1fmjDJKanYvCw31l5ypACjfhIQfnwG7FKeLdh6BJx9CG/eHV2URO4do5OCLBkuL2IYQQXqlj6jU4QpXjfWDf7XCAW3MBthjwe5lnLeNZTkcwttQqIOZdCn7Qa/zaG+HJM62tnV9uhLpj4fhaGmf7tapdUWJ5cuUUGLA3MNmSqsZ3ohF5wGlKsGwFVOb6UhoB9szmA9p7zQGpw=
file: build/DiscordBridge-*.jar
file:
- discordbridge-bukkit/build/libs/discordbridge-bukkit*.jar
- discordbridge-spigot/build/libs/discordbridge-spigot*.jar
- discordbridge-forge/build/libs/discordbridge-forge*.jargit
file_glob: true
on:
repo: the-obsidian/DiscordBridge
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-THIRD-PARTY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
2 changes: 1 addition & 1 deletion NOTICE-THIRD-PARTY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pegdown
Copyright (C) 2010-2011 Mathias Doenitz

Based on peg-markdown - markdown in c, implemented using PEG grammar
Copyright (c) 2008 John MacFarlane (http://github.com/jgm/peg-markdown)
Copyright (c) 2008 John MacFarlane (http://github.com/jgm/peg-markdown)
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# DiscordBridge [![Build Status](https://travis-ci.org/the-obsidian/DiscordBridge.svg?branch=master)](https://travis-ci.org/the-obsidian/DiscordBridge)

Bridges chat between Discord and Minecraft (Bukkit/Spigot).
Bridges chat between Discord and Minecraft.

## Requirements

* Java 8

Any of:
* Spigot 1.12
* Sponge 1.12
* Forge 1.12

## Installation


1. Download the latest release from GitHub
2. Add it to your plugins folder
3. Either run Bukkit/Spigot once to generate DiscordBridge/config.yml or create it using the guide below.
2. Add it to your plugin/mod folder
3. Either run your server once to generate DiscordBridge/config.yml or create it using the guide below.
4. All done!


Expand Down Expand Up @@ -112,7 +116,8 @@ templates:
* Anything said in Minecraft chat will be sent to your chosen Discord channel
* If Multiverse-Core is installed and the `%w` tag is specified in your relay message syntax, the alias assigned to your Multiverse worlds will be displayed
* Anything said in your chosen Discord channel will be sent to your Minecraft chat (if the `%w` tag is used in your relay message syntax, Discord messages will display `Discord`)
* If Dynmap is installed, anything said over Dynmap chat will be relayed to your chosen Discord channel (if the `%w` tag is used in your relay messag syntax, Dynmap messages will display `Dynmap`)
* If Dynmap is installed, anything said over Dynmap chat will be relayed to your chosen Discord channel (if the `%w` tag is used in your relay messag syntax, Dynmap messages will display `Dynmap`) (Spigot only for now)
* Uploaded images and other files in Discord will show up in Minecraft chat as clickable URLs
* You can link Minecraft accounts to Discord accounts and the bot will translate display names to match where the message appears
* Join / leave messages can be sent to Discord
* Death messages can be sent to Discord
Expand All @@ -129,6 +134,8 @@ templates:
## Permissions
***NOTE:*** Only the Spigot version supports permission nodes at this time.
- `discordbridge.discord` - ability to use any command in of the /discord subcommand tree
- `discordbridge.discord.reload` - ability to reload configs and JDA
- `discordbridge.discord.listmembers` - abiliyt to receive a list of members in the Discord channel
Expand Down Expand Up @@ -158,7 +165,6 @@ templates:
## Upcoming Features
* Add support for a URL shortening service so attachment URLs aren't so flipping long
* Add support for relaying embeds
* Make Discord responses for certain commands return in pretty embeds
* More of the 'fun' commands that literally every Discord bot has (with matching Minecraft commands!)
Expand Down
128 changes: 59 additions & 69 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.apache.tools.ant.filters.ReplaceTokens

buildscript {
ext.kotlin_version = '1.2.0'
ext.kotlin_version = '1.2.10'

repositories {
mavenCentral()
Expand All @@ -11,84 +11,74 @@ buildscript {

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
}
}

plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '1.2.4'
}

apply plugin: 'kotlin'

group = 'gg.obsidian'
version = '3.1.0'
description = """Bridge chat between Minecraft and Discord"""
ext.url = 'https://github.com/the-obsidian/DiscordBridge'

repositories {
mavenCentral()
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'http://lutece.paris.fr/nexus/content/repositories/lutece_third_party' }
maven { url 'https://github.com/DV8FromTheWorld/Maven-Repository/raw/master/repo' }

jcenter()
}

dependencies {
compile group: 'org.spigotmc', name: 'spigot-api', version: '1.12-R0.1-SNAPSHOT'
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.1.3-2'
compile group: 'net.dv8tion', name: 'JDA', version: '3.3.1_286'
compile group: 'com.michaelwflaherty', name: 'cleverbotapi', version: '1.0.1'
compile group: 'org.pegdown', name:'pegdown', version: '1.6.0'
compile group: 'org.json', name: 'json', version: '20160810'

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile files('libraries/dynmap-api-2.5-SNAPSHOT.jar')
configurations.all {
resolutionStrategy {
force 'org.ow2.asm:asm:6.0_BETA'
}
}
}

compileKotlin {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
subprojects {
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'com.github.johnrengelman.shadow'

kotlinOptions {
jvmTarget = "1.8"
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}

processResources {
filter ReplaceTokens, tokens: [
'DESCRIPTION': project.property('description'),
'URL' : project.property('url'),
'VERSION' : project.property('version')
]
}
group = 'gg.obsidian'
version = '4.0.0'
description = """Bridge chat between Minecraft and Discord"""
ext.url = 'https://github.com/the-obsidian/DiscordBridge'
ext.modid = 'discordbridge-obsidian'
processResources {
filter ReplaceTokens, tokens: [
'DESCRIPTION': project.property('description'),
'URL' : project.property('url'),
'VERSION' : project.property('version'),
'MODID' : project.property('modid')
]
}

//noinspection GroovyAssignabilityCheck
build.finalizedBy(shadowJar)
repositories {
maven { url 'https://github.com/DV8FromTheWorld/Maven-Repository/raw/master/repo' }
jcenter()
}

shadowJar {
relocate 'org.apache', 'shadow.apache'
relocate 'org.json', 'shadow.json'
classifier 'dist'
dependencies {
//noinspection GroovyAssignabilityCheck
exclude(dependency('org.spigotmc:.*:.*'))
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
exclude '.cache'
}

task copyFinalJar(type: Copy) {
from "build/libs/${shadowJar.archiveName}"
into "build"
rename(
shadowJar.archiveName,
"${project.property('name')}-${project.property('version')}.jar"
)
}

shadowJar.finalizedBy(copyFinalJar)
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
shadowJar {
classifier = null
dependencies {
// Kotlin Runtime
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"))

// Dependencies for JDA
include(dependency('net.dv8tion:JDA:3.3.1_286'))
include(dependency('com.squareup.okhttp3:okhttp:'))
include(dependency('com.squareup.okio:okio'))
include(dependency('com.neovisionaries:nv-websocket-client'))
include(dependency('org.json:json'))
include(dependency('org.slf4j:slf4j-api'))
include(dependency('org.slf4j:slf4j-simple'))

// Dependency for SnakeYAML
include(dependency(group: 'org.yaml', name: 'snakeyaml', version: '1.19'))

// Dependencies for PegDown
include(dependency(group: 'org.pegdown', name:'pegdown', version: '1.6.0'))
include(dependency(group: 'commons-lang', name:'commons-lang', version: '2.3'))
include(dependency('org.parboiled:parboiled-core'))
include(dependency('org.parboiled:parboiled-java'))

// Dependency for CleverbotAPI
include(dependency(group: 'com.michaelwflaherty', name: 'cleverbotapi', version: '1.0.1'))
}
}
}
28 changes: 28 additions & 0 deletions discordbridge-bukkit/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
repositories {
mavenCentral()
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

dependencies {
compile project(':discordbridge-core')
compile group: 'org.spigotmc', name: 'spigot-api', version: '1.12-R0.1-SNAPSHOT'
compile (group: 'org.pegdown', name:'pegdown', version: '1.6.0')
compile files('../libraries/dynmap-api-2.5-SNAPSHOT.jar')
}

shadowJar {
dependencies {
include(project(':discordbridge-core'))
include(dependency('org.ow2.asm:asm'))
include(dependency('org.ow2.asm:asm-analysis'))
include(dependency('org.ow2.asm:asm-tree'))
include(dependency('org.ow2.asm:asm-util'))
}
relocate 'org.json', 'shadow.json'
}
build.dependsOn(shadowJar)

artifacts {
archives shadowJar
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package gg.obsidian.discordbridge

import gg.obsidian.discordbridge.wrapper.DbBukkitServer
import org.bukkit.plugin.java.JavaPlugin
import org.slf4j.Logger
import org.slf4j.LoggerFactory

/**
* The primary Plugin class that maintains the plugin's connection with Bukkit
*/
class BukkitDiscordBridge : JavaPlugin() {
private lateinit var instance: BukkitDiscordBridge
private lateinit var logger: Logger

override fun onLoad() {
logger = LoggerFactory.getLogger("DiscordBrdige")
logger.info("Loading DiscordBridge")
}

override fun onEnable() {
logger.info("Enabling DiscordBridge")
instance = this
val isMultiverse = server.pluginManager.getPlugin("Multiverse-Core") != null
DiscordBridge.init(DbBukkitServer(this, this.server), dataFolder, isMultiverse=isMultiverse)

server.pluginManager.registerEvents(EventListener(), this)

getCommand("discord").executor = EventListener()
getCommand("f").executor = EventListener()
getCommand("rate").executor = EventListener()
getCommand("8ball").executor = EventListener()
getCommand("insult").executor = EventListener()
getCommand("choose").executor = EventListener()
getCommand("talk").executor = EventListener()
getCommand("roll").executor = EventListener()

DiscordBridge.handleServerStart()
}

override fun onDisable() {
DiscordBridge.handleServerStop()
}
}
Loading

0 comments on commit 5ebc2a2

Please sign in to comment.