From 7870f31a298785287cc53f8ef6a8ecd28f69b380 Mon Sep 17 00:00:00 2001 From: James Harrell <53633325+Jaimss@users.noreply.github.com> Date: Mon, 24 Aug 2020 01:27:25 -0400 Subject: [PATCH] Update to v2.1.1 (#5) * some minor updates * minor changes * Update .gitignore * add repos * Delete gradle.properties * update documentation --- .gitignore | 2 + build.gradle | 35 ++++---- .../jaims/mcutils/bukkit/BukkitCoroutines.kt | 16 ++-- .../dev/jaims/mcutils/bukkit/BukkitUtil.kt | 6 +- .../dev/jaims/mcutils/bukkit/ItemBuilder.kt | 19 ++--- .../jaims/mcutils/tests}/BukkitTests.kt | 2 + .../-item-builder/-init-.html | 2 +- .../-item-builder/add-enchantments.html | 2 +- .../-item-builder/index.html | 12 +-- .../dev.jaims.mcutils.bukkit/async.html | 4 +- .../dev.jaims.mcutils.bukkit/colorize.html | 4 +- .../dev.jaims.mcutils.bukkit/index.html | 12 +-- .../dev.jaims.mcutils.bukkit/sync.html | 4 +- docs/scripts/pages.js | 82 +++++++++---------- gradle.properties | 0 15 files changed, 99 insertions(+), 103 deletions(-) rename bukkit/src/test/kotlin/{ => dev/jaims/mcutils/tests}/BukkitTests.kt (92%) delete mode 100644 gradle.properties diff --git a/.gitignore b/.gitignore index 9838463..d257aaf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .idea build/ .gradle + +gradle.properties \ No newline at end of file diff --git a/build.gradle b/build.gradle index 76b3b80..d6e598e 100644 --- a/build.gradle +++ b/build.gradle @@ -11,24 +11,8 @@ allprojects { apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'com.github.johnrengelman.shadow' - publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } - repositories { - mavenLocal() - } - } - shadowJar { archiveClassifier.set("") -// relocate('org.intellij.lang.annotations', 'dev.jaims.mcutils.libs.org.intellij.lang.annotations') -// relocate('org.jetbrains.annotations', 'dev.jaims.mcutils.libs.org.jetbrains.annotations') -// relocate('org.json', 'dev.jaims.mcutils.libs.org.json') -// relocate('kotlin', 'dev.jaims.mcutils.libs.kotlin') -// relocate('khttp', 'dev.jaims.mcutils.libs.khttp') } repositories { @@ -58,7 +42,26 @@ subprojects { group 'dev.jaims.mcutils' version ver + publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + repositories { + mavenLocal() + maven { + def releasesRepoUrl = "https://repo.jaims.dev/repository/maven-releases/" + def snapshotsRepoUrl = "https://repo.jaims.dev/repository/maven-snapshots/" + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + credentials { + username = project.property('sonatype.user') + password = project.property('sonatype.password') + } + } + } + } } diff --git a/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/BukkitCoroutines.kt b/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/BukkitCoroutines.kt index 5bcc903..944842d 100644 --- a/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/BukkitCoroutines.kt +++ b/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/BukkitCoroutines.kt @@ -7,21 +7,21 @@ package dev.jaims.mcutils.bukkit import org.bukkit.plugin.Plugin /** - * Executes the given [f] via the [plugin] asynchronous. + * Executes the given [block] via the [plugin] asynchronous. */ -fun async(plugin: Plugin, delayTicks: Long = 0L, repeatingTicks: Long = 0L, f: () -> Unit) { +fun async(plugin: Plugin, delayTicks: Long = 0L, repeatingTicks: Long = 0L, block: () -> Unit) { when (repeatingTicks > 0) { - true -> plugin.server.scheduler.runTaskTimerAsynchronously(plugin, f, delayTicks, repeatingTicks) - false -> plugin.server.scheduler.runTaskLaterAsynchronously(plugin, f, delayTicks) + true -> plugin.server.scheduler.runTaskTimerAsynchronously(plugin, block, delayTicks, repeatingTicks) + false -> plugin.server.scheduler.runTaskLaterAsynchronously(plugin, block, delayTicks) } } /** - * Executes the given [f] via the [plugin] synchronized with the server tick. + * Executes the given [block] via the [plugin] synchronized with the server tick. */ -fun sync(plugin: Plugin, delayTicks: Long = 0L, repeatingTicks: Long = 0L, f: () -> Unit) { +fun sync(plugin: Plugin, delayTicks: Long = 0L, repeatingTicks: Long = 0L, block: () -> Unit) { when (repeatingTicks > 0) { - true -> plugin.server.scheduler.runTaskTimer(plugin, f, delayTicks, repeatingTicks) - false -> plugin.server.scheduler.runTaskLater(plugin, f, delayTicks) + true -> plugin.server.scheduler.runTaskTimer(plugin, block, delayTicks, repeatingTicks) + false -> plugin.server.scheduler.runTaskLater(plugin, block, delayTicks) } } \ No newline at end of file diff --git a/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/BukkitUtil.kt b/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/BukkitUtil.kt index 0e1bb8c..c900a7f 100644 --- a/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/BukkitUtil.kt +++ b/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/BukkitUtil.kt @@ -6,10 +6,10 @@ import org.bukkit.entity.Player import java.util.regex.Pattern /** - * A chat colorization util that supports hex. + * A chat colorization util that supports hex and PlaceholderAPI placeholders for a [player] if one is provided. * Loosely based off of https://gist.github.com/iGabyTM/7415263c2209653ede82457c289de697 * - * @param player the player to use for color codes + * @sample dev.jaims.mcutils.tests.BukkitTests.chatColorizeTest() */ fun String.colorize(player: Player? = null): String { val pattern = Pattern.compile( @@ -28,7 +28,7 @@ fun String.colorize(player: Player? = null): String { } final = when (player == null) { true -> final - false -> PlaceholderAPI.setPlaceholders(player, this) + false -> PlaceholderAPI.setPlaceholders(player, final) } return ChatColor.translateAlternateColorCodes('&', final) diff --git a/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/ItemBuilder.kt b/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/ItemBuilder.kt index 2048faa..aefeb90 100644 --- a/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/ItemBuilder.kt +++ b/bukkit/src/main/kotlin/dev/jaims/mcutils/bukkit/ItemBuilder.kt @@ -8,15 +8,8 @@ import org.bukkit.inventory.meta.Damageable import java.util.function.Supplier /** - * @param material The only required parameter. This will be the items material - * @param amount the amount of the item - * @param damage the damage on the item - * @param name the name of the item - * @param lore the lore of the item - * @param enchantments the enchantments on the item - * @param glow should the item have a glow or not - * @param unbreakable should the item be breakable - * @param itemflags the item flags on the item + * An item builder class. The only required parameter to initialize this is [material], then you can use the methods + * in the builder to build the item. */ @Suppress("unused") class ItemBuilder( @@ -95,9 +88,8 @@ class ItemBuilder( fun addLore(newlore: String) = apply { lore.add(newlore) } /** - * Add a map of enchantments to the item + * Add a map of [newenchantments] the enchantment map to add * - * @param newenchantments the enchantment map to add * @return an [ItemBuilder] */ fun addEnchantments(newenchantments: Map) = @@ -145,4 +137,7 @@ class ItemBuilder( */ fun addItemFlag(newitemflag: ItemFlag) = apply { itemflags.add(newitemflag) } -} \ No newline at end of file +} + + + diff --git a/bukkit/src/test/kotlin/BukkitTests.kt b/bukkit/src/test/kotlin/dev/jaims/mcutils/tests/BukkitTests.kt similarity index 92% rename from bukkit/src/test/kotlin/BukkitTests.kt rename to bukkit/src/test/kotlin/dev/jaims/mcutils/tests/BukkitTests.kt index 7cc596f..7cb78a1 100644 --- a/bukkit/src/test/kotlin/BukkitTests.kt +++ b/bukkit/src/test/kotlin/dev/jaims/mcutils/tests/BukkitTests.kt @@ -1,3 +1,5 @@ +package dev.jaims.mcutils.tests + import dev.jaims.mcutils.bukkit.colorize import net.md_5.bungee.api.ChatColor import org.junit.Test diff --git a/docs/project/dev.jaims.mcutils.bukkit/-item-builder/-init-.html b/docs/project/dev.jaims.mcutils.bukkit/-item-builder/-init-.html index 78f147e..1e1767a 100644 --- a/docs/project/dev.jaims.mcutils.bukkit/-item-builder/-init-.html +++ b/docs/project/dev.jaims.mcutils.bukkit/-item-builder/-init-.html @@ -26,7 +26,7 @@

<init>

-

Parameters

amount
the amount of the item
damage
the damage on the item
enchantments
the enchantments on the item
glow
should the item have a glow or not
itemflags
the item flags on the item
lore
the lore of the item
material
The only required parameter. This will be the items material
name
the name of the item
unbreakable
should the item be breakable
+
diff --git a/docs/project/dev.jaims.mcutils.bukkit/-item-builder/add-enchantments.html b/docs/project/dev.jaims.mcutils.bukkit/-item-builder/add-enchantments.html index b21e444..297ef38 100644 --- a/docs/project/dev.jaims.mcutils.bukkit/-item-builder/add-enchantments.html +++ b/docs/project/dev.jaims.mcutils.bukkit/-item-builder/add-enchantments.html @@ -26,7 +26,7 @@

addEnchantments

-
Add a map of enchantments to the item

Return

Parameters

newenchantments
the enchantment map to add
+
Add a map of newenchantments the enchantment map to add

Return

diff --git a/docs/project/dev.jaims.mcutils.bukkit/-item-builder/index.html b/docs/project/dev.jaims.mcutils.bukkit/-item-builder/index.html index 8dff911..874a585 100644 --- a/docs/project/dev.jaims.mcutils.bukkit/-item-builder/index.html +++ b/docs/project/dev.jaims.mcutils.bukkit/-item-builder/index.html @@ -25,19 +25,15 @@

ItemBuilder

-
class ItemBuilder(material: Material,amount: Int,damage: Int,name: String?,lore: MutableList<String>,enchantments: MutableMap<Enchantment, Int>,glow: Boolean,unbreakable: Boolean,itemflags: MutableList<ItemFlag>) : Supplier +
An item builder class. The only required parameter to initialize this is material, then you can use the methods in the builder to build the item.
class ItemBuilder(material: Material,amount: Int,damage: Int,name: String?,lore: MutableList<String>,enchantments: MutableMap<Enchantment, Int>,glow: Boolean,unbreakable: Boolean,itemflags: MutableList<ItemFlag>) : Supplier
-
+
-

Parameters

-
-
amount
the amount of the item
damage
the damage on the item
enchantments
the enchantments on the item
glow
should the item have a glow or not
itemflags
the item flags on the item
lore
the lore of the item
material
The only required parameter. This will be the items material
name
the name of the item
unbreakable
should the item be breakable
-

Constructors

@@ -56,7 +52,7 @@

Constructors

-
The only required parameter. This will be the items material
fun <init>(material: Material, amount: Int, damage: Int, name: String?, lore: MutableList<String>, enchantments: MutableMap<Enchantment, Int>, glow: Boolean, unbreakable: Boolean, itemflags: MutableList<ItemFlag>) +
fun <init>(material: Material, amount: Int, damage: Int, name: String?, lore: MutableList<String>, enchantments: MutableMap<Enchantment, Int>, glow: Boolean, unbreakable: Boolean, itemflags: MutableList<ItemFlag>)
-
Add a map of enchantments to the item
+
Add a map of newenchantments the enchantment map to add
diff --git a/docs/project/dev.jaims.mcutils.bukkit/async.html b/docs/project/dev.jaims.mcutils.bukkit/async.html index 8bc5390..80e5755 100644 --- a/docs/project/dev.jaims.mcutils.bukkit/async.html +++ b/docs/project/dev.jaims.mcutils.bukkit/async.html @@ -26,11 +26,11 @@

async

-
Executes the given f via the plugin asynchronous.
+
Executes the given block via the plugin asynchronous.
-
fun async(plugin: Plugin, delayTicks: Long, repeatingTicks: Long, f: () -> Unit) +
fun async(plugin: Plugin, delayTicks: Long, repeatingTicks: Long, block: () -> Unit) -
A chat colorization util that supports hex. Loosely based off of https://gist.github.com/iGabyTM/7415263c2209653ede82457c289de697

Parameters

player
the player to use for color codes
+
A chat colorization util that supports hex and PlaceholderAPI placeholders for a player if one is provided. Loosely based off of https://gist.github.com/iGabyTM/7415263c2209653ede82457c289de697

Samples

dev.jaims.mcutils.tests.BukkitTests.chatColorizeTest
diff --git a/docs/project/dev.jaims.mcutils.bukkit/index.html b/docs/project/dev.jaims.mcutils.bukkit/index.html index 01e91d1..58f44f7 100644 --- a/docs/project/dev.jaims.mcutils.bukkit/index.html +++ b/docs/project/dev.jaims.mcutils.bukkit/index.html @@ -46,7 +46,7 @@

Types

-
+
An item builder class. The only required parameter to initialize this is material, then you can use the methods in the builder to build the item.
@@ -78,11 +78,11 @@

Functions

-
Executes the given f via the plugin asynchronous.
+
Executes the given block via the plugin asynchronous.
-
fun async(plugin: Plugin, delayTicks: Long, repeatingTicks: Long, f: () -> Unit) +
fun async(plugin: Plugin, delayTicks: Long, repeatingTicks: Long, block: () -> Unit)
-
A chat colorization util that supports hex. Loosely based off of https://gist.github.com/iGabyTM/7415263c2209653ede82457c289de697
+
A chat colorization util that supports hex and PlaceholderAPI placeholders for a player if one is provided. Loosely based off of https://gist.github.com/iGabyTM/7415263c2209653ede82457c289de697
@@ -392,11 +392,11 @@

Functions

-
Executes the given f via the plugin synchronized with the server tick.
+
Executes the given block via the plugin synchronized with the server tick.
-
fun sync(plugin: Plugin, delayTicks: Long, repeatingTicks: Long, f: () -> Unit) +
fun sync(plugin: Plugin, delayTicks: Long, repeatingTicks: Long, block: () -> Unit) -
Executes the given f via the plugin synchronized with the server tick.
+
Executes the given block via the plugin synchronized with the server tick.
-
fun sync(plugin: Plugin, delayTicks: Long, repeatingTicks: Long, f: () -> Unit) +
fun sync(plugin: Plugin, delayTicks: Long, repeatingTicks: Long, block: () -> Unit)