Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Nov 27, 2023
0 parents commit 2a80b1b
Show file tree
Hide file tree
Showing 26 changed files with 752 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @WillFP
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord
url: https://discord.gg/ZcwpSsE/
about: Issues have moved to Discord, please join the server to get help!
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/report-a-bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Report a Bug
about: Report an issue with the plugin
title: ''
labels: bug
assignees: ''
---

# Please report bugs on the discord!

[Join by clicking here](https://discord.gg/ZcwpSsE/)
33 changes: 33 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish Packages
on:
workflow_dispatch:
release:
types: [ created ]
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest
steps:

- name: Checkout latest code
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17

- name: Change wrapper permissions
run: chmod +x ./gradlew

- name: Publish package
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Java
*.class

# Eclipse IDE
.settings/
bin/
.classpath
.project

# IntelliJ IDEA
.idea/
*.iml

# Gradle
.gradle
**/build/
!src/**/build/
.gradletasknamecache
!gradle-wrapper.jar
gradle-app.setting

# Mac OSX
.DS_Store
23 changes: 23 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The MIT License (MIT)
=====================

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ModelEngineBridge

Provides a minimal bridge to allow limited API support for Model Engine v3 and v4.

## API

Repository:
```kts
repositories {
maven("https://repo.auxilor.io/repository/maven-public/")
}
```

Dependency:
```kts
dependencies {
implementation("com.willfp:ModelEngineBridge:1.0.0")
}
```


<h1 align="center">
Check out our partners!
<br>
<div style="width: 50%; margin: 0 auto;">
<br>
<a href="https://gamersupps.gg/discount/Auxilor?afmc=Auxilor" target="_blank">
<img src="https://i.imgur.com/7mFhlQO.png" alt="supps banner">
</a>
<a href="https://dedimc.promo/Auxilor" target="_blank">
<img src="https://i.imgur.com/x9aeH38.png" alt="dedimc banner">
</a>
<br>
</div>
</h1>
7 changes: 7 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
group = "com.willfp"
version = rootProject.version

dependencies {
compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT")
compileOnly("com.ticxo.modelengine:api:R3.1.8")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.willfp.modelenginebridge

interface BridgedActiveModel {
val id: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.willfp.modelenginebridge

interface BridgedModeledEntity {
var isBaseEntityVisible: Boolean

fun addModel(model: BridgedActiveModel)

fun removeModel(model: BridgedActiveModel)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.willfp.modelenginebridge

import org.bukkit.Bukkit
import org.bukkit.entity.Entity

interface ModelEngineBridge {
fun createActiveModel(id: String): BridgedActiveModel?

fun createModeledEntity(entity: Entity): BridgedModeledEntity

companion object {
val instance: ModelEngineBridge = createInstance()

private fun createInstance(): ModelEngineBridge {
val plugin = Bukkit.getPluginManager().getPlugin("ModelEngine")
?: throw IllegalStateException("ModelEngineBridge requires ModelEngine to be installed.")

@Suppress("DEPRECATION")
val version = plugin.description.version

return if (version.startsWith("R3")) {
val clazz = Class.forName("com.willfp.modelenginebridge.v3.ModelEngineBridgeV3")
clazz.constructors[0].newInstance() as ModelEngineBridge
} else if (version.startsWith("R4")) {
val clazz = Class.forName("com.willfp.modelenginebridge.v4.ModelEngineBridgeV4")
clazz.constructors[0].newInstance() as ModelEngineBridge
} else {
throw IllegalStateException("ModelEngineBridge requires version 3 or 4 of Model Engine!")
}
}
}
}
92 changes: 92 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
plugins {
java
`java-library`
`maven-publish`
kotlin("jvm") version "1.7.10"
id("com.github.johnrengelman.shadow") version "8.0.0"
}

group = "com.willfp"
version = findProperty("version")!!

dependencies {
implementation(project(":api"))
implementation(project(":v3"))
implementation(project(":v4"))
}

allprojects {
apply(plugin = "java")
apply(plugin = "kotlin")
apply(plugin = "maven-publish")
apply(plugin = "com.github.johnrengelman.shadow")

repositories {
mavenLocal()
mavenCentral()

maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.auxilor.io/repository/maven-public/")
maven("https://jitpack.io")
maven("https://mvn.lumine.io/repository/maven-public/")
}

dependencies {
compileOnly("com.willfp:eco:6.65.0")
compileOnly("org.jetbrains:annotations:23.0.0")
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
}

java {
withSourcesJar()
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

tasks {
compileKotlin {
kotlinOptions {
jvmTarget = "17"
}
}

compileJava {
options.isDeprecation = true
options.encoding = "UTF-8"

dependsOn(clean)
}

build {
dependsOn(shadowJar)
}
}
}

tasks {
build {
dependsOn(publishToMavenLocal)
}
}

publishing {
publications {
register<MavenPublication>("maven") {
groupId = project.group.toString()
version = project.version.toString()
artifactId = rootProject.name

artifact(rootProject.tasks.shadowJar.get().archiveFile)
}
}

repositories {
maven {
name = "auxilor"
url = uri("https://repo.auxilor.io/repository/maven-releases/")
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=1.0.0
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 2a80b1b

Please sign in to comment.