Skip to content

Commit 5ebc2a2

Browse files
authored
Merge pull request #62 from the-obsidian/core
Update support for Bukkit, Sponge, and Forge
2 parents 58b9475 + 83b3c9d commit 5ebc2a2

File tree

102 files changed

+2886
-1651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2886
-1651
lines changed

Diff for: .travis.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ jdk:
33
- oraclejdk8
44

55
after_success:
6-
- ./gradlew shadowJar
6+
- ./gradlew build
77

88
deploy:
99
provider: releases
1010
api_key:
1111
secure: KJd23J+YlpBuUs+5//5BjYlSQ9mVOsYnpfanE03ZQ4E9Qp+pGpMSaH60d/CXkSkDVr32QL5jk0VRDNVl0wvTZpRJfNclQgh3fh2iPkaBDmjun0YkGHfE6VeRzJZVuIF/F34pkziEC01B7Tq2loms+RSm9pNeWgN+ulaajNENUT2J4nmb33yyKbGN9I4EdjcMCQmgdnxn/4QNXV6T3Xls9S9X7AwA9pg4WNpdACqJ0oWj2YlSWKmAdcKw0iLQtRbQfbiqj6waOLODdxieIu0KVWEVQnTdcv7ElGl9BgDrHzXBjfS+9G112TBqsNIPx60o8Z7ThR02DYPWYXrRyfvaHM0FqXrBSaUZUxfHpGn5F4CRQLZh/jOnIOZ9hHmCSDD69pcS254tVCoB+hRuS7PBstuh8iUO7VGJASb5Mv34LZYLAxfvNDAKLeY60xdz/Uiku9JW0dpLQC+FWAvFZWdQ3IvCMYRnaT1fmjDJKanYvCw31l5ypACjfhIQfnwG7FKeLdh6BJx9CG/eHV2URO4do5OCLBkuL2IYQQXqlj6jU4QpXjfWDf7XCAW3MBthjwe5lnLeNZTkcwttQqIOZdCn7Qa/zaG+HJM62tnV9uhLpj4fhaGmf7tapdUWJ5cuUUGLA3MNmSqsZ3ohF5wGlKsGwFVOb6UhoB9szmA9p7zQGpw=
12-
file: build/DiscordBridge-*.jar
12+
file:
13+
- discordbridge-bukkit/build/libs/discordbridge-bukkit*.jar
14+
- discordbridge-spigot/build/libs/discordbridge-spigot*.jar
15+
- discordbridge-forge/build/libs/discordbridge-forge*.jargit
1316
file_glob: true
1417
on:
1518
repo: the-obsidian/DiscordBridge

Diff for: LICENSE-THIRD-PARTY.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,4 @@
204204
distributed under the License is distributed on an "AS IS" BASIS,
205205
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
206206
See the License for the specific language governing permissions and
207-
limitations under the License.
207+
limitations under the License.

Diff for: NOTICE-THIRD-PARTY.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ pegdown
22
Copyright (C) 2010-2011 Mathias Doenitz
33

44
Based on peg-markdown - markdown in c, implemented using PEG grammar
5-
Copyright (c) 2008 John MacFarlane (http://github.com/jgm/peg-markdown)
5+
Copyright (c) 2008 John MacFarlane (http://github.com/jgm/peg-markdown)

Diff for: README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
# DiscordBridge [![Build Status](https://travis-ci.org/the-obsidian/DiscordBridge.svg?branch=master)](https://travis-ci.org/the-obsidian/DiscordBridge)
22

3-
Bridges chat between Discord and Minecraft (Bukkit/Spigot).
3+
Bridges chat between Discord and Minecraft.
44

55
## Requirements
66

77
* Java 8
8+
9+
Any of:
810
* Spigot 1.12
11+
* Sponge 1.12
12+
* Forge 1.12
913

1014
## Installation
1115

1216

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

1822

@@ -112,7 +116,8 @@ templates:
112116
* Anything said in Minecraft chat will be sent to your chosen Discord channel
113117
* 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
114118
* 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`)
115-
* 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`)
119+
* 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)
120+
* Uploaded images and other files in Discord will show up in Minecraft chat as clickable URLs
116121
* You can link Minecraft accounts to Discord accounts and the bot will translate display names to match where the message appears
117122
* Join / leave messages can be sent to Discord
118123
* Death messages can be sent to Discord
@@ -129,6 +134,8 @@ templates:
129134
130135
## Permissions
131136
137+
***NOTE:*** Only the Spigot version supports permission nodes at this time.
138+
132139
- `discordbridge.discord` - ability to use any command in of the /discord subcommand tree
133140
- `discordbridge.discord.reload` - ability to reload configs and JDA
134141
- `discordbridge.discord.listmembers` - abiliyt to receive a list of members in the Discord channel
@@ -158,7 +165,6 @@ templates:
158165
159166
## Upcoming Features
160167
161-
* Add support for a URL shortening service so attachment URLs aren't so flipping long
162168
* Add support for relaying embeds
163169
* Make Discord responses for certain commands return in pretty embeds
164170
* More of the 'fun' commands that literally every Discord bot has (with matching Minecraft commands!)

Diff for: build.gradle

+59-69
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.apache.tools.ant.filters.ReplaceTokens
22

33
buildscript {
4-
ext.kotlin_version = '1.2.0'
4+
ext.kotlin_version = '1.2.10'
55

66
repositories {
77
mavenCentral()
@@ -11,84 +11,74 @@ buildscript {
1111

1212
dependencies {
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14+
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
1415
}
15-
}
16-
17-
plugins {
18-
id 'java'
19-
id 'com.github.johnrengelman.shadow' version '1.2.4'
20-
}
21-
22-
apply plugin: 'kotlin'
23-
24-
group = 'gg.obsidian'
25-
version = '3.1.0'
26-
description = """Bridge chat between Minecraft and Discord"""
27-
ext.url = 'https://github.com/the-obsidian/DiscordBridge'
2816

29-
repositories {
30-
mavenCentral()
31-
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
32-
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
33-
maven { url 'http://lutece.paris.fr/nexus/content/repositories/lutece_third_party' }
34-
maven { url 'https://github.com/DV8FromTheWorld/Maven-Repository/raw/master/repo' }
35-
36-
jcenter()
37-
}
38-
39-
dependencies {
40-
compile group: 'org.spigotmc', name: 'spigot-api', version: '1.12-R0.1-SNAPSHOT'
41-
compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: '1.1.3-2'
42-
compile group: 'net.dv8tion', name: 'JDA', version: '3.3.1_286'
43-
compile group: 'com.michaelwflaherty', name: 'cleverbotapi', version: '1.0.1'
44-
compile group: 'org.pegdown', name:'pegdown', version: '1.6.0'
45-
compile group: 'org.json', name: 'json', version: '20160810'
46-
47-
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
48-
compile files('libraries/dynmap-api-2.5-SNAPSHOT.jar')
17+
configurations.all {
18+
resolutionStrategy {
19+
force 'org.ow2.asm:asm:6.0_BETA'
20+
}
21+
}
4922
}
5023

51-
compileKotlin {
52-
sourceCompatibility = JavaVersion.VERSION_1_8
53-
targetCompatibility = JavaVersion.VERSION_1_8
24+
subprojects {
25+
apply plugin: 'java'
26+
apply plugin: 'kotlin'
27+
apply plugin: 'com.github.johnrengelman.shadow'
5428

55-
kotlinOptions {
56-
jvmTarget = "1.8"
29+
sourceSets {
30+
main.java.srcDirs += 'src/main/kotlin'
5731
}
58-
}
5932

60-
processResources {
61-
filter ReplaceTokens, tokens: [
62-
'DESCRIPTION': project.property('description'),
63-
'URL' : project.property('url'),
64-
'VERSION' : project.property('version')
65-
]
66-
}
33+
group = 'gg.obsidian'
34+
version = '4.0.0'
35+
description = """Bridge chat between Minecraft and Discord"""
36+
ext.url = 'https://github.com/the-obsidian/DiscordBridge'
37+
ext.modid = 'discordbridge-obsidian'
38+
processResources {
39+
filter ReplaceTokens, tokens: [
40+
'DESCRIPTION': project.property('description'),
41+
'URL' : project.property('url'),
42+
'VERSION' : project.property('version'),
43+
'MODID' : project.property('modid')
44+
]
45+
}
6746

68-
//noinspection GroovyAssignabilityCheck
69-
build.finalizedBy(shadowJar)
47+
repositories {
48+
maven { url 'https://github.com/DV8FromTheWorld/Maven-Repository/raw/master/repo' }
49+
jcenter()
50+
}
7051

71-
shadowJar {
72-
relocate 'org.apache', 'shadow.apache'
73-
relocate 'org.json', 'shadow.json'
74-
classifier 'dist'
7552
dependencies {
76-
//noinspection GroovyAssignabilityCheck
77-
exclude(dependency('org.spigotmc:.*:.*'))
53+
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
7854
}
79-
exclude '.cache'
80-
}
8155

82-
task copyFinalJar(type: Copy) {
83-
from "build/libs/${shadowJar.archiveName}"
84-
into "build"
85-
rename(
86-
shadowJar.archiveName,
87-
"${project.property('name')}-${project.property('version')}.jar"
88-
)
89-
}
90-
91-
shadowJar.finalizedBy(copyFinalJar)
92-
sourceSets {
93-
main.java.srcDirs += 'src/main/kotlin'
56+
shadowJar {
57+
classifier = null
58+
dependencies {
59+
// Kotlin Runtime
60+
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"))
61+
62+
// Dependencies for JDA
63+
include(dependency('net.dv8tion:JDA:3.3.1_286'))
64+
include(dependency('com.squareup.okhttp3:okhttp:'))
65+
include(dependency('com.squareup.okio:okio'))
66+
include(dependency('com.neovisionaries:nv-websocket-client'))
67+
include(dependency('org.json:json'))
68+
include(dependency('org.slf4j:slf4j-api'))
69+
include(dependency('org.slf4j:slf4j-simple'))
70+
71+
// Dependency for SnakeYAML
72+
include(dependency(group: 'org.yaml', name: 'snakeyaml', version: '1.19'))
73+
74+
// Dependencies for PegDown
75+
include(dependency(group: 'org.pegdown', name:'pegdown', version: '1.6.0'))
76+
include(dependency(group: 'commons-lang', name:'commons-lang', version: '2.3'))
77+
include(dependency('org.parboiled:parboiled-core'))
78+
include(dependency('org.parboiled:parboiled-java'))
79+
80+
// Dependency for CleverbotAPI
81+
include(dependency(group: 'com.michaelwflaherty', name: 'cleverbotapi', version: '1.0.1'))
82+
}
83+
}
9484
}

Diff for: discordbridge-bukkit/build.gradle

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
repositories {
2+
mavenCentral()
3+
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
4+
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
5+
}
6+
7+
dependencies {
8+
compile project(':discordbridge-core')
9+
compile group: 'org.spigotmc', name: 'spigot-api', version: '1.12-R0.1-SNAPSHOT'
10+
compile (group: 'org.pegdown', name:'pegdown', version: '1.6.0')
11+
compile files('../libraries/dynmap-api-2.5-SNAPSHOT.jar')
12+
}
13+
14+
shadowJar {
15+
dependencies {
16+
include(project(':discordbridge-core'))
17+
include(dependency('org.ow2.asm:asm'))
18+
include(dependency('org.ow2.asm:asm-analysis'))
19+
include(dependency('org.ow2.asm:asm-tree'))
20+
include(dependency('org.ow2.asm:asm-util'))
21+
}
22+
relocate 'org.json', 'shadow.json'
23+
}
24+
build.dependsOn(shadowJar)
25+
26+
artifacts {
27+
archives shadowJar
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package gg.obsidian.discordbridge
2+
3+
import gg.obsidian.discordbridge.wrapper.DbBukkitServer
4+
import org.bukkit.plugin.java.JavaPlugin
5+
import org.slf4j.Logger
6+
import org.slf4j.LoggerFactory
7+
8+
/**
9+
* The primary Plugin class that maintains the plugin's connection with Bukkit
10+
*/
11+
class BukkitDiscordBridge : JavaPlugin() {
12+
private lateinit var instance: BukkitDiscordBridge
13+
private lateinit var logger: Logger
14+
15+
override fun onLoad() {
16+
logger = LoggerFactory.getLogger("DiscordBrdige")
17+
logger.info("Loading DiscordBridge")
18+
}
19+
20+
override fun onEnable() {
21+
logger.info("Enabling DiscordBridge")
22+
instance = this
23+
val isMultiverse = server.pluginManager.getPlugin("Multiverse-Core") != null
24+
DiscordBridge.init(DbBukkitServer(this, this.server), dataFolder, isMultiverse=isMultiverse)
25+
26+
server.pluginManager.registerEvents(EventListener(), this)
27+
28+
getCommand("discord").executor = EventListener()
29+
getCommand("f").executor = EventListener()
30+
getCommand("rate").executor = EventListener()
31+
getCommand("8ball").executor = EventListener()
32+
getCommand("insult").executor = EventListener()
33+
getCommand("choose").executor = EventListener()
34+
getCommand("talk").executor = EventListener()
35+
getCommand("roll").executor = EventListener()
36+
37+
DiscordBridge.handleServerStart()
38+
}
39+
40+
override fun onDisable() {
41+
DiscordBridge.handleServerStop()
42+
}
43+
}

0 commit comments

Comments
 (0)