-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 793d9bc
Showing
18 changed files
with
673 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.gradle | ||
.idea | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
repositories { | ||
maven { url = bukkit_repo } | ||
} | ||
|
||
dependencies { | ||
compile 'org.bukkit:bukkit:1.10.2-R0.1-SNAPSHOT' | ||
compile project(':KotlinFunBungeeChat') | ||
} | ||
|
||
|
||
shadowJar { | ||
dependencies { | ||
include project(':KotlinFunBungeeChat') | ||
} | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
include 'plugin.yml' | ||
|
||
expand 'version':project.version | ||
} | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
exclude 'plugin.yml' | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
KotlinFunBukkit/src/main/kotlin/br/com/gamemods/kotlinfun/bukkit/bukkit.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
@file:JvmName(name = "BukkitUtil") | ||
package br.com.gamemods.kotlinfun.bukkit | ||
|
||
import br.com.gamemods.kotlinfun.ColorizedBase | ||
import org.bukkit.ChatColor | ||
import org.bukkit.plugin.java.JavaPlugin | ||
import java.util.* | ||
|
||
class KotlinFun : JavaPlugin() | ||
|
||
class Colorized(str: String) : ColorizedBase<ChatColor>(str) { | ||
override val format : EnumSet<ChatColor> = EnumSet.noneOf(ChatColor::class.java) | ||
|
||
fun currentFormat() = format.clone() | ||
|
||
private fun setColor(c: ChatColor?) : Colorized { | ||
color = c | ||
return this | ||
} | ||
|
||
private fun addFormat(f: ChatColor) : Colorized { | ||
format.add(f) | ||
return this | ||
} | ||
|
||
override fun black() = setColor(ChatColor.BLACK) | ||
override fun darkBlue() = setColor(ChatColor.DARK_BLUE) | ||
override fun darkGreen() = setColor(ChatColor.DARK_GREEN) | ||
override fun darkAqua() = setColor(ChatColor.DARK_AQUA) | ||
override fun darkRed() = setColor(ChatColor.DARK_RED) | ||
override fun darkPurple() = setColor(ChatColor.DARK_PURPLE) | ||
override fun gold() = setColor(ChatColor.GOLD) | ||
override fun gray() = setColor(ChatColor.GRAY) | ||
override fun darkGray() = setColor(ChatColor.DARK_GRAY) | ||
override fun blue() = setColor(ChatColor.BLUE) | ||
override fun green() = setColor(ChatColor.GREEN) | ||
override fun aqua() = setColor(ChatColor.AQUA) | ||
override fun red() = setColor(ChatColor.RED) | ||
override fun lightPurple() = setColor(ChatColor.LIGHT_PURPLE) | ||
override fun yellow() = setColor(ChatColor.YELLOW) | ||
override fun white() = setColor(ChatColor.WHITE) | ||
override fun reset() = setColor(ChatColor.RESET) | ||
|
||
override fun magic() = addFormat(ChatColor.MAGIC) | ||
override fun bold() = addFormat(ChatColor.BOLD) | ||
override fun strike() = addFormat(ChatColor.STRIKETHROUGH) | ||
override fun underline() = addFormat(ChatColor.UNDERLINE) | ||
override fun italic() = addFormat(ChatColor.ITALIC) | ||
} | ||
|
||
fun String.black() = Colorized(this).black() | ||
fun String.darkBlue() = Colorized(this).darkBlue() | ||
fun String.darkGreen() = Colorized(this).darkGreen() | ||
fun String.darkAqua() = Colorized(this).darkAqua() | ||
fun String.darkRed() = Colorized(this).darkRed() | ||
fun String.darkPurple() = Colorized(this).darkPurple() | ||
fun String.gold() = Colorized(this).gold() | ||
fun String.gray() = Colorized(this).gray() | ||
fun String.darkGray() = Colorized(this).darkGray() | ||
fun String.blue() = Colorized(this).blue() | ||
fun String.green() = Colorized(this).green() | ||
fun String.aqua() = Colorized(this).aqua() | ||
fun String.red() = Colorized(this).red() | ||
fun String.lightPurple() = Colorized(this).lightPurple() | ||
fun String.yellow() = Colorized(this).yellow() | ||
fun String.white() = Colorized(this).white() | ||
fun String.reset() = Colorized(this).reset() | ||
fun String.magic() = Colorized(this).magic() | ||
fun String.bold() = Colorized(this).bold() | ||
fun String.strike() = Colorized(this).strike() | ||
fun String.underline() = Colorized(this).underline() | ||
fun String.italic() = Colorized(this).italic() | ||
|
||
operator fun ChatColor.plus(str : String) = this.toString() + str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: KotlinFun | ||
version: ${version} | ||
author: joserobjr | ||
main: br.com.gamemods.kotlinfun.bukkit.KotlinFun |
15 changes: 15 additions & 0 deletions
15
KotlinFunBukkit/src/test/kotlin/br/com/gamemods/kotlinfun/bukkit/KotlinFunTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package br.com.gamemods.kotlinfun.bukkit | ||
|
||
import org.junit.Assert.* | ||
import org.junit.Test | ||
|
||
class KotlinFunTest { | ||
|
||
@Test | ||
fun colors() { | ||
assertEquals("§cTest", "Test".red().toString()) | ||
assertEquals("§cTest§9§l 123", "Test".red() + " 123".blue().bold()) | ||
assertEquals("§cTest§9§l 123", "Test".red() + " 123".bold().blue()) | ||
assertEquals("§l§oBold and Italic", "Bold and Italic".bold().italic().toString()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
dependencies { | ||
compile 'net.md-5:bungeecord-api:1.10-SNAPSHOT' | ||
compile project(':KotlinFunBungeeChat') | ||
} | ||
|
||
shadowJar { | ||
dependencies { | ||
include project(':KotlinFunBungeeChat') | ||
} | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
include 'bungee.yml' | ||
|
||
expand 'version':project.version | ||
} | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
exclude 'bungee.yml' | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
KotlinFunBungee/src/main/kotlin/br/com/gamemods/kotlinfun/bungee/bungee.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@file:JvmName(name = "BungeeUtil") | ||
package br.com.gamemods.kotlinfun.bungee | ||
|
||
import net.md_5.bungee.api.plugin.Plugin | ||
|
||
class KotlinFun : Plugin() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: KotlinFun | ||
version: ${version} | ||
author: joserobjr | ||
main: br.com.gamemods.kotlinfun.bungee.KotlinFun |
71 changes: 71 additions & 0 deletions
71
KotlinFunBungeeChat/src/main/kotlin/br/com/gamemods/kotlinfun/bungee/Colorized.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@file:JvmName(name = "BungeeColorUtil") | ||
package br.com.gamemods.kotlinfun.bungee | ||
|
||
import br.com.gamemods.kotlinfun.ColorizedBase | ||
import net.md_5.bungee.api.ChatColor | ||
import java.util.* | ||
|
||
class Colorized(str: String) : ColorizedBase<ChatColor>(str) { | ||
override val format : EnumSet<ChatColor> = EnumSet.noneOf(ChatColor::class.java) | ||
|
||
fun currentFormat() = format.clone() | ||
|
||
private fun setColor(c: ChatColor?) : Colorized { | ||
color = c | ||
return this | ||
} | ||
|
||
private fun addFormat(f: ChatColor) : Colorized { | ||
format.add(f) | ||
return this | ||
} | ||
|
||
override fun black() = setColor(ChatColor.BLACK) | ||
override fun darkBlue() = setColor(ChatColor.DARK_BLUE) | ||
override fun darkGreen() = setColor(ChatColor.DARK_GREEN) | ||
override fun darkAqua() = setColor(ChatColor.DARK_AQUA) | ||
override fun darkRed() = setColor(ChatColor.DARK_RED) | ||
override fun darkPurple() = setColor(ChatColor.DARK_PURPLE) | ||
override fun gold() = setColor(ChatColor.GOLD) | ||
override fun gray() = setColor(ChatColor.GRAY) | ||
override fun darkGray() = setColor(ChatColor.DARK_GRAY) | ||
override fun blue() = setColor(ChatColor.BLUE) | ||
override fun green() = setColor(ChatColor.GREEN) | ||
override fun aqua() = setColor(ChatColor.AQUA) | ||
override fun red() = setColor(ChatColor.RED) | ||
override fun lightPurple() = setColor(ChatColor.LIGHT_PURPLE) | ||
override fun yellow() = setColor(ChatColor.YELLOW) | ||
override fun white() = setColor(ChatColor.WHITE) | ||
override fun reset() = setColor(ChatColor.RESET) | ||
|
||
override fun magic() = addFormat(ChatColor.MAGIC) | ||
override fun bold() = addFormat(ChatColor.BOLD) | ||
override fun strike() = addFormat(ChatColor.STRIKETHROUGH) | ||
override fun underline() = addFormat(ChatColor.UNDERLINE) | ||
override fun italic() = addFormat(ChatColor.ITALIC) | ||
} | ||
|
||
fun String.black() = Colorized(this).black() | ||
fun String.darkBlue() = Colorized(this).darkBlue() | ||
fun String.darkGreen() = Colorized(this).darkGreen() | ||
fun String.darkAqua() = Colorized(this).darkAqua() | ||
fun String.darkRed() = Colorized(this).darkRed() | ||
fun String.darkPurple() = Colorized(this).darkPurple() | ||
fun String.gold() = Colorized(this).gold() | ||
fun String.gray() = Colorized(this).gray() | ||
fun String.darkGray() = Colorized(this).darkGray() | ||
fun String.blue() = Colorized(this).blue() | ||
fun String.green() = Colorized(this).green() | ||
fun String.aqua() = Colorized(this).aqua() | ||
fun String.red() = Colorized(this).red() | ||
fun String.lightPurple() = Colorized(this).lightPurple() | ||
fun String.yellow() = Colorized(this).yellow() | ||
fun String.white() = Colorized(this).white() | ||
fun String.reset() = Colorized(this).reset() | ||
fun String.magic() = Colorized(this).magic() | ||
fun String.bold() = Colorized(this).bold() | ||
fun String.strike() = Colorized(this).strike() | ||
fun String.underline() = Colorized(this).underline() | ||
fun String.italic() = Colorized(this).italic() | ||
|
||
operator fun ChatColor.plus(str : String) = this.toString() + str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
allprojects { | ||
group 'br.com.gamemods.kotlinfun' | ||
version '1.0-SNAPSHOT' | ||
} | ||
|
||
buildscript { | ||
ext.kotlin_version = '1.0.3' | ||
ext.bukkit_repo = 'https://hub.spigotmc.org/nexus/content/groups/public/' | ||
|
||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' | ||
} | ||
} | ||
|
||
apply plugin: 'kotlin' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
} | ||
|
||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
|
||
subprojects { | ||
apply plugin: 'kotlin' | ||
apply plugin: 'com.github.johnrengelman.shadow' | ||
|
||
sourceCompatibility = 1.6 | ||
targetCompatibility = 1.6 | ||
tasks.withType(JavaCompile) { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' } | ||
} | ||
|
||
dependencies { | ||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" | ||
compile "org.jetbrains.kotlin:kotlin-runtime:$kotlin_version" | ||
compile rootProject | ||
testCompile group: 'junit', name: 'junit', version: '4.11' | ||
} | ||
|
||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
|
||
shadowJar { | ||
dependencies { | ||
include dependency("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") | ||
include dependency("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version") | ||
include dependency("org.jetbrains.kotlin:kotlin-runtime:$kotlin_version") | ||
include dependency(rootProject) | ||
} | ||
|
||
classifier = null | ||
// relocate 'kotlin', 'br.com.gamemods.kotlinfun.kotlin' | ||
} | ||
|
||
build.finalizedBy shadowJar | ||
} | ||
|
||
project(':KotlinFunBungeeChat') { | ||
dependencies { | ||
compile 'net.md-5:bungeecord-chat:1.10-SNAPSHOT' | ||
} | ||
} | ||
|
||
project(':KotlinFunUniversal') { | ||
repositories { | ||
maven { url = bukkit_repo } | ||
} | ||
|
||
dependencies { | ||
compile project(':KotlinFunBungee') | ||
compile project(':KotlinFunBukkit') | ||
} | ||
|
||
shadowJar { | ||
dependencies { | ||
include project(':KotlinFunBungee') | ||
include project(':KotlinFunBukkit') | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gradle-wrapper.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Wed Oct 19 20:45:31 BRT 2016 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip |
Oops, something went wrong.