-
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.
refactor: GearyContexts, reworked Addon system etc (#30)
* feat: Add support for generating typescript definitions from all registered prefabs * refactor: Swap to using proper dependency injection throughout in anticipation of multi-world ticking support * chore: Bump geary * chore: Bump geary * chore: Update .gitignore * chore: Remove print statement * feat: allow baseMaterial and itemPredicates.customModelData to inherit from set.item component * chore: Continue work upating geary for per world ticking * refactor: Continue migrating to geary di update * chore: Get compiling * fix: Move features to load after geary starts, add GearyWorldLoadEvent in preparation for future refactor * fix(commands): Use namespaced keys for prefab arguments instead of strings * chore: Bump ido commands * chore: Bump deps * fix: Get building after merge * feat: Add helpers for getting geary world off Bukkit classes * chore: Bump geary with prefab loading changes * refactor: pass initial argument in withGeary block * chore: Bump geary * fix: BlockTracking tracking after all entities have been set * chore: bump idofront --------- Co-authored-by: Danielle Voznyy <[email protected]>
- Loading branch information
Showing
105 changed files
with
1,267 additions
and
683 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 |
---|---|---|
|
@@ -14,3 +14,4 @@ eclipse | |
|
||
logs | ||
/truckconfig.json | ||
.kotlin |
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
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
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
1 change: 1 addition & 0 deletions
1
geary-papermc-core/src/main/kotlin/com/mineinabyss/geary/papermc/FeatureContext.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
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
15 changes: 15 additions & 0 deletions
15
geary-papermc-core/src/main/kotlin/com/mineinabyss/geary/papermc/GearyPaper.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 com.mineinabyss.geary.papermc | ||
|
||
import com.mineinabyss.geary.addons.dsl.AddonSetup | ||
import com.mineinabyss.geary.modules.Geary | ||
|
||
class GearyPaper( | ||
val plugin: GearyPlugin, | ||
world: Geary, | ||
) : Geary by world | ||
|
||
inline fun AddonSetup<*>.onPluginEnable(crossinline run: GearyPaper.() -> Unit) { | ||
onStart { | ||
GearyPaper(application.koin.get<GearyPlugin>(), this).run() | ||
} | ||
} |
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
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
17 changes: 17 additions & 0 deletions
17
geary-papermc-core/src/main/kotlin/com/mineinabyss/geary/papermc/Helpers.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,17 @@ | ||
package com.mineinabyss.geary.papermc | ||
|
||
import com.mineinabyss.geary.modules.Geary | ||
import com.mineinabyss.geary.prefabs.PrefabKey | ||
import com.mineinabyss.geary.prefabs.entityOfOrNull | ||
import com.mineinabyss.idofront.typealiases.BukkitEntity | ||
import org.bukkit.block.Block | ||
import org.bukkit.block.TileState | ||
|
||
context(Geary) | ||
fun PrefabKey.toEntityOrNull() = entityOfOrNull(this) | ||
|
||
inline fun <T, R : BukkitEntity> R.withGeary(run: Geary.(R) -> T) = with(world.toGeary()) { run(this@withGeary) } | ||
|
||
inline fun <T, R : TileState> R.withGeary(run: Geary.(R) -> T) = with(world.toGeary()) { run(this@withGeary) } | ||
|
||
inline fun <T, R : Block> R.withGeary(run: Geary.(R) -> T) = with(world.toGeary()) { run(this@withGeary) } |
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
20 changes: 20 additions & 0 deletions
20
geary-papermc-core/src/main/kotlin/com/mineinabyss/geary/papermc/WorldManager.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,20 @@ | ||
package com.mineinabyss.geary.papermc | ||
|
||
import com.mineinabyss.geary.modules.Geary | ||
import com.mineinabyss.idofront.typealiases.BukkitEntity | ||
import org.bukkit.World | ||
|
||
// TODO per world engine support in the future | ||
class WorldManager { | ||
private var _globalEngine: Geary? = null | ||
|
||
fun getGearyWorld(world: World): Geary? = _globalEngine | ||
|
||
fun setGlobalEngine(engine: Geary) { | ||
_globalEngine = engine | ||
} | ||
|
||
val global get() = _globalEngine ?: error("No global Geary engine set") | ||
} | ||
|
||
fun World.toGeary() = gearyPaper.worldManager.getGearyWorld(this) ?: error("No Geary engine found for world $name") |
25 changes: 25 additions & 0 deletions
25
...-papermc-core/src/main/kotlin/com/mineinabyss/geary/papermc/events/GearyWorldLoadEvent.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,25 @@ | ||
package com.mineinabyss.geary.papermc.events | ||
|
||
import com.mineinabyss.geary.addons.dsl.createAddon | ||
import com.mineinabyss.geary.modules.GearySetup | ||
import org.bukkit.event.Event | ||
import org.bukkit.event.HandlerList | ||
|
||
data class GearyWorldLoadEvent( | ||
val setup: GearySetup, | ||
) : Event() { | ||
fun configure(run: GearySetup.() -> Unit) { | ||
run.invoke(setup) | ||
} | ||
|
||
companion object { | ||
@JvmStatic | ||
private val HANDLER_LIST = HandlerList() | ||
|
||
@JvmStatic | ||
fun getHandlerList() = HANDLER_LIST | ||
} | ||
|
||
override fun getHandlers() = HANDLER_LIST | ||
|
||
} |
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
Oops, something went wrong.