Skip to content

Commit 212875c

Browse files
committed
add paper module
1 parent 767ede9 commit 212875c

38 files changed

+1015
-60
lines changed

README.md

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1 @@
1-
![Ascend Banner](https://user-images.githubusercontent.com/28064149/192885894-e412f3e6-9efe-4195-891e-7ba54f0edd7e.jpg)
2-
3-
<br>
4-
5-
## 🚀 Ascend: Elevating Your Coding Experience
6-
[![Build Library](https://github.com/TheFruxz/Ascend/actions/workflows/build-Ascend.yml/badge.svg)](https://github.com/TheFruxz/Ascend/actions/workflows/build-Ascend.yml)
7-
[![Publish Library](https://github.com/TheFruxz/Ascend/actions/workflows/publish-Ascend.yml/badge.svg)](https://github.com/TheFruxz/Ascend/actions/workflows/publish-Ascend.yml)
8-
9-
Welcome to Ascend, your one-stop utility belt to supercharge your code.
10-
This toolkit is an ensemble of various nifty features and tools I've found essential for my projects.
11-
The design of these tools aims to be seamless, unobtrusive, and easily discoverable via code completions thanks to extensive use of extension functions.
12-
13-
> "Ascend is reshaping the coding landscape with its powerful suite of tools and extensions. Effortless to incorporate, intuitive to use, and transformative in effect, Ascend is an indispensable companion for the modern developer. It's more than just a toolkit: it's the launchpad for turning your coding dreams into reality."
14-
~ JetBrains AI Assistant
15-
16-
## 🔧 Setting the Stage - The Ascend Installation Guide
17-
18-
Depending on the nature of your project, you may incorporate Ascend via `Gradle`, or `Maven`. However, we highly recommend `Gradle` for a streamlined experience.
19-
(Gradle standard was Groovy, now is Kotlin)
20-
21-
### Use in your Gradle Project
22-
23-
#### Repository
24-
```kotlin
25-
maven("https://nexus.fruxz.dev/repository/public/")
26-
```
27-
28-
##### Dependency
29-
```kotlin
30-
implementation("dev.fruxz:ascend:$ascendVersion")
31-
```
32-
33-
# 💡 Collaboration - Together We Ascend!
34-
35-
Contribution to Ascend is deeply appreciated. When submitting pull requests, abide by the community guidelines of GitHub. Furthermore, respect licensing within this and all repositories you interact with. Feel free to initiate or engage in discussions in the repository's 'Discussions' section.
36-
37-
###### We build & use Ascend on Java 21 - [Eclipse Temurin](https://adoptium.net/).
38-
###### Also build & run Ascend with [Eclipse Temurin](https://adoptium.net/) to get the best possible development experience!
1+
> WIP: But basicly, I imported https://github.com/TheFruxz/Ascend and split it up and added custom paper & adventure modules. Just don't use this just yet

adventure/src/extensions/ComponentExtensions.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import net.kyori.adventure.audience.Audience
55
import net.kyori.adventure.text.Component
66
import net.kyori.adventure.text.TextReplacementConfig
77
import net.kyori.adventure.text.event.ClickEvent
8+
import net.kyori.adventure.text.format.NamedTextColor
89
import net.kyori.adventure.text.minimessage.MiniMessage
910
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver
1011
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
@@ -125,4 +126,13 @@ fun Component.legacy() = LegacyComponentSerializer.legacy('§').serialize(this)
125126
* @author Max Bossing
126127
* @since 0.0.1
127128
*/
128-
fun Component.plain() = PlainTextComponentSerializer.plainText().serialize(this)
129+
fun Component.plain() = PlainTextComponentSerializer.plainText().serialize(this)
130+
131+
/**
132+
* Convert a [NamedTextColor] into a [Component] of that color
133+
* @return A [Component] with the color of this [NamedTextColor]
134+
* @author Max Bossing
135+
* @since 0.0.1
136+
*/
137+
val NamedTextColor.component: Component
138+
get() = Component.text("?").color(this).replaceLiteral("?", "")

adventure/src/extensions/ReplaceExtensions.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import java.util.regex.Pattern
88
/**
99
* Replaces all occurrences of the given [key] with the given [value]
1010
* and then returns the result component.
11-
* @param key The key to replace.
11+
* @param key The regex to replace.
1212
* @param value The value to replace the key with.
1313
* @return The result component.
1414
* @author Fruxz
@@ -20,6 +20,21 @@ fun <T : Component> T.replace(@RegExp key: String, value: String): Component =
2020
it.replacement(value)
2121
}
2222

23+
/**
24+
* Replaces all occurrences of the given [key] with the given [value]
25+
* and then returns the result component.
26+
* @param key The key to replace.
27+
* @param value The value to replace the key with.
28+
* @return The result component.
29+
* @author InvalidJoker
30+
* @since 1.0
31+
*/
32+
fun <T : Component> T.replaceLiteral(key: String, value: String): Component =
33+
replaceText {
34+
it.matchLiteral(key)
35+
it.replacement(value)
36+
}
37+
2338
/**
2439
* Replaces all occurrences of the given [key] with the given [value]
2540
* and then returns the result component.

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ subprojects {
2727

2828
repositories {
2929
mavenCentral()
30+
maven("https://repo.papermc.io/repository/maven-public/")
3031
}
3132

3233
java {

core/src/annotation/ExperimentalAscendApi.kt renamed to core/src/annotation/ExperimentalGlueApi.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ package dev.fruxz.ascend.annotation
1111
**/
1212
@MustBeDocumented
1313
@RequiresOptIn("This is a experimental feature, proceed with caution!")
14-
annotation class ExperimentalAscendApi
14+
annotation class ExperimentalGlueApi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package dev.fruxz.ascend.annotation
2+
3+
/**
4+
* Marks the annotated element as part of the internal Ascend API.
5+
*
6+
* This annotation should be used to indicate that the annotated element is internal
7+
* and not intended for public use. It serves as a warning for developers to avoid
8+
* using the element outside of the Ascend library.
9+
* @author Fruxz
10+
* @since 2023.1
11+
**/
12+
@MustBeDocumented
13+
@RequiresOptIn("This is an internal feature, not intended for public use!")
14+
annotation class InternalGlueApi

core/src/extension/Developer.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,12 @@ inline fun <T> T?.ifNotNull(process: () -> Unit) = if (isNotNull) process() else
128128
* @since 2023.1
129129
*/
130130
fun <T, D> Pair<T?, D>.asDefaultNullDodge() = first.isNull.switch(first, second)
131+
132+
/**
133+
* Returns true if this [T] is annotated with [Deprecated], otherwise false.
134+
* @author InvalidJoker
135+
*/
136+
fun <T> T.isDeprecated(): Boolean {
137+
val deprecatedAnnotation = this?.javaClass?.isAnnotationPresent(Deprecated::class.java)
138+
return deprecatedAnnotation == true
139+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package dev.fruxz.ascend.tool.exception
2+
3+
import dev.fruxz.ascend.annotation.LanguageFeature
4+
5+
/**
6+
* Exception thrown when unreachable code is executed.
7+
* @author InvalidJoker
8+
*/
9+
class UnreachableCodeException : IllegalStateException("This code should be unreachable!")
10+
11+
/**
12+
* Marks a code path as unreachable.
13+
* @throws UnreachableCodeException always
14+
* @author InvalidJoker
15+
*/
16+
@LanguageFeature
17+
fun unreachable(): Nothing = throw UnreachableCodeException()

ext-utils/src/tool/map/CollectionMap.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dev.fruxz.tool.map
1+
package dev.fruxz.ascend.tool.map
22

33
/**
44
* This class represents a map of collections of type [C].

ext-utils/src/tool/map/MutableCollectionMap.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dev.fruxz.tool.map
1+
package dev.fruxz.ascend.tool.map
22

33
/**
44
* This class represents a mutable map of collections of type [C].

0 commit comments

Comments
 (0)