Merge pull request #12 from Tofaa2/feat/BuildChainRework

[Feat] Gradle Build Chain Rework
This commit is contained in:
Tofaa 2024-07-08 08:30:45 -05:00 committed by GitHub
commit 304606b2ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 569 additions and 876 deletions

View file

@ -1,15 +1,8 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
name: Gradle Package
on:
release:
types: [created]
types: [ created ]
jobs:
build:
@ -20,25 +13,45 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- uses: actions/checkout@v3
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Gradle
run: ./gradlew shadowJar
- name: Build with Gradle
run: chmod +x gradlew && ./gradlew build
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
run: ./gradlew publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build artifacts api
uses: actions/upload-artifact@v3
with:
name: api-build
path: api/build/libs
- name: Upload build artifacts common
uses: actions/upload-artifact@v3
with:
name: common-build
path: common/build/libs
- name: Upload build artifacts spigot
uses: actions/upload-artifact@v3
with:
name: spigot-build
path: platforms/spigot/build/libs
- name: Upload build artifacts velocity
uses: actions/upload-artifact@v3
with:
name: spigot-velocity
path: platforms/velocity/build/libs
- name: Upload build artifacts standalone
uses: actions/upload-artifact@v3
with:
name: standalone-build
path: platforms/standalone/build/libs

5
.gitignore vendored
View file

@ -9,10 +9,7 @@ test-plugin/run
!**/src/test/**/build/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
.idea/
*.iws
*.iml
*.ipr

View file

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/api" />
<option value="$PROJECT_DIR$/code-gen" />
<option value="$PROJECT_DIR$/common" />
<option value="$PROJECT_DIR$/model-engine-addon" />
<option value="$PROJECT_DIR$/platforms" />
<option value="$PROJECT_DIR$/platforms/spigot" />
<option value="$PROJECT_DIR$/platforms/standalone" />
<option value="$PROJECT_DIR$/platforms/velocity" />
<option value="$PROJECT_DIR$/test-plugin" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="corretto-1.8" project-jdk-type="JavaSDK" />
</project>

View file

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -1,431 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="9d5d9b6f-43c8-41a4-bb42-a66ffc96c9b0" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/platforms/spigot/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/platforms/spigot/build.gradle" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ExternalProjectsData">
<projectState path="$PROJECT_DIR$">
<ProjectState />
</projectState>
<projectState path="$PROJECT_DIR$/pathfinding">
<ProjectState />
</projectState>
</component>
<component name="ExternalProjectsManager">
<system id="GRADLE">
<state>
<task path="$PROJECT_DIR$">
<activation />
</task>
<task path="$PROJECT_DIR$/test-plugin">
<activation />
</task>
<task path="$PROJECT_DIR$/api">
<activation />
</task>
<projects_view>
<tree_state>
<expand />
<select />
</tree_state>
</projects_view>
</state>
</system>
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Kotlin Class" />
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.2.0/f981796d809d02eee3e485167b2476ed766be882/api-2.2.0.jar!/com/github/retrooper/packetevents/wrapper/play/server/WrapperPlayServerUpdateAttributes.class" root0="SKIP_INSPECTION" />
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.3.0/a199b900341990aa6a2899e42e396800c83601f0/api-2.3.0-default.jar!/com/github/retrooper/packetevents/protocol/attribute/Attribute.class" root0="SKIP_INSPECTION" />
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.3.0/a199b900341990aa6a2899e42e396800c83601f0/api-2.3.0-default.jar!/com/github/retrooper/packetevents/protocol/attribute/Attributes.class" root0="SKIP_INSPECTION" />
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.3.0/a199b900341990aa6a2899e42e396800c83601f0/api-2.3.0-default.jar!/com/github/retrooper/packetevents/wrapper/play/server/WrapperPlayServerSpawnEntity.class" root0="SKIP_INSPECTION" />
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.3.0/a199b900341990aa6a2899e42e396800c83601f0/api-2.3.0-default.jar!/com/github/retrooper/packetevents/wrapper/play/server/WrapperPlayServerSpawnPainting.class" root0="SKIP_INSPECTION" />
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.3.0/a199b900341990aa6a2899e42e396800c83601f0/api-2.3.0-default.jar!/com/github/retrooper/packetevents/wrapper/play/server/WrapperPlayServerSpawnWeatherEntity.class" root0="SKIP_INSPECTION" />
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.3.0/a199b900341990aa6a2899e42e396800c83601f0/api-2.3.0-default.jar!/com/github/retrooper/packetevents/wrapper/play/server/WrapperPlayServerUpdateAttributes.class" root0="SKIP_INSPECTION" />
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/velocity/2.3.0/aba4fb09c29c8a071cac36acba545ed37bb80268/velocity-2.3.0-default.jar!/io/github/retrooper/packetevents/bstats/Metrics.class" root0="SKIP_INSPECTION" />
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/velocity/2.3.0/aba4fb09c29c8a071cac36acba545ed37bb80268/velocity-2.3.0-default.jar!/io/github/retrooper/packetevents/velocity/factory/VelocityPacketEventsBuilder.class" root0="SKIP_INSPECTION" />
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.0/c4ba5371a29ac9b2ad6129b1d39ea38750043eff/gson-2.8.0.jar!/com/google/gson/JsonArray.class" root0="SKIP_INSPECTION" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProblemsViewState">
<option name="autoscrollToSource" value="true" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 8
}</component>
<component name="ProjectId" id="2YjbRUeaUVrjckNx4bRHlK0Dq9m" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="false" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;Downloaded.Files.Path.Enabled&quot;: &quot;false&quot;,
&quot;Gradle.Build EntityLib.executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib [dependencies].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib [publish].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib [runServer] (1).executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib [runServer].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib:code-gen [:code-gen:Main.main()].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib:test-plugin [cleanAllRunTaskCaches].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib:test-plugin [cleanCustomServiceCaches].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib:test-plugin [cleanPaperCache].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib:test-plugin [cleanPaperPluginsCache].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib:test-plugin [publish].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib:test-plugin [runServer].executor&quot;: &quot;Run&quot;,
&quot;Gradle.EntityLib:test-plugin [shadowJar].executor&quot;: &quot;Run&quot;,
&quot;JAR Application.Unnamed.executor&quot;: &quot;Run&quot;,
&quot;Repository.Attach.Annotations&quot;: &quot;false&quot;,
&quot;Repository.Attach.JavaDocs&quot;: &quot;false&quot;,
&quot;Repository.Attach.Sources&quot;: &quot;false&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;jdk.selected.JAVA_MODULE&quot;: &quot;corretto-17&quot;,
&quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/Github/EntityLib&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;project.structure.last.edited&quot;: &quot;Modules&quot;,
&quot;project.structure.proportion&quot;: &quot;0.15&quot;,
&quot;project.structure.side.proportion&quot;: &quot;0.2&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.editor&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
},
&quot;keyToStringList&quot;: {
&quot;kotlin-gradle-user-dirs&quot;: [
&quot;/home/tofaa/.gradle&quot;
]
}
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/model-engine-addon" />
<recent name="D:\Github\EntityLib\api\src\main\java\me\tofaa\entitylib\extras" />
<recent name="D:\Github\EntityLib\api\src\main\java\me\tofaa\entitylib\meta" />
<recent name="D:\Github\EntityLib\test-plugin" />
</key>
</component>
<component name="RunManager" selected="Gradle.EntityLib [runServer]">
<configuration name="EntityLib [runServer] (1)" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runServer" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
<configuration name="EntityLib [runServer]" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/test-plugin" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runServer" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
<configuration name="EntityLib:test-plugin [cleanAllRunTaskCaches]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/test-plugin" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="cleanAllRunTaskCaches" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
<configuration name="EntityLib:test-plugin [cleanCustomServiceCaches]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/test-plugin" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="cleanCustomServiceCaches" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
<configuration name="EntityLib:test-plugin [cleanPaperCache]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/test-plugin" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="cleanPaperCache" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
<configuration name="EntityLib:test-plugin [cleanPaperPluginsCache]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/test-plugin" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="cleanPaperPluginsCache" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
<list>
<item itemvalue="Gradle.EntityLib [runServer]" />
<item itemvalue="Gradle.EntityLib [runServer] (1)" />
<item itemvalue="Gradle.EntityLib:test-plugin [cleanAllRunTaskCaches]" />
<item itemvalue="Gradle.EntityLib:test-plugin [cleanCustomServiceCaches]" />
<item itemvalue="Gradle.EntityLib:test-plugin [cleanPaperCache]" />
<item itemvalue="Gradle.EntityLib:test-plugin [cleanPaperPluginsCache]" />
</list>
<recent_temporary>
<list>
<item itemvalue="Gradle.EntityLib:test-plugin [cleanPaperPluginsCache]" />
<item itemvalue="Gradle.EntityLib:test-plugin [cleanPaperCache]" />
<item itemvalue="Gradle.EntityLib:test-plugin [cleanCustomServiceCaches]" />
<item itemvalue="Gradle.EntityLib:test-plugin [cleanAllRunTaskCaches]" />
<item itemvalue="Gradle.EntityLib [runServer] (1)" />
</list>
</recent_temporary>
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-jdk-9f38398b9061-39b83d9b5494-intellij.indexing.shared.core-IU-241.15989.150" />
<option value="bundled-js-predefined-1d06a55b98c1-91d5c284f522-JavaScript-IU-241.15989.150" />
</set>
</attachedChunks>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="9d5d9b6f-43c8-41a4-bb42-a66ffc96c9b0" name="Changes" comment="" />
<created>1701041928897</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1701041928897</updated>
<workItem from="1701041929906" duration="2150000" />
<workItem from="1701044331518" duration="1122000" />
<workItem from="1701051624677" duration="11941000" />
<workItem from="1701177452430" duration="3325000" />
<workItem from="1701275091116" duration="5456000" />
<workItem from="1701362298296" duration="540000" />
<workItem from="1701785373720" duration="3616000" />
<workItem from="1702559541907" duration="2322000" />
<workItem from="1702674760415" duration="697000" />
<workItem from="1702821988396" duration="6226000" />
<workItem from="1702850453043" duration="3006000" />
<workItem from="1703243394746" duration="1121000" />
<workItem from="1703383601686" duration="636000" />
<workItem from="1704150906846" duration="3659000" />
<workItem from="1704213149835" duration="14000" />
<workItem from="1704484509353" duration="822000" />
<workItem from="1704485939274" duration="2440000" />
<workItem from="1704502790346" duration="6191000" />
<workItem from="1705192736239" duration="496000" />
<workItem from="1705534524814" duration="15424000" />
<workItem from="1705578156456" duration="78000" />
<workItem from="1705636302508" duration="7111000" />
<workItem from="1705951390204" duration="3936000" />
<workItem from="1705984769972" duration="76000" />
<workItem from="1706183895216" duration="664000" />
<workItem from="1706187926445" duration="4339000" />
<workItem from="1706248178234" duration="17096000" />
<workItem from="1706284605696" duration="11691000" />
<workItem from="1706371324325" duration="1187000" />
<workItem from="1706443875388" duration="4827000" />
<workItem from="1706513591682" duration="8659000" />
<workItem from="1706592660140" duration="89000" />
<workItem from="1706601592145" duration="1670000" />
<workItem from="1706614921404" duration="10508000" />
<workItem from="1706696719616" duration="4783000" />
<workItem from="1706784821835" duration="7882000" />
<workItem from="1706858181164" duration="925000" />
<workItem from="1707159905372" duration="3391000" />
<workItem from="1707210065718" duration="4823000" />
<workItem from="1707219870641" duration="5522000" />
<workItem from="1707300688189" duration="1512000" />
<workItem from="1707381529971" duration="921000" />
<workItem from="1708165509853" duration="12086000" />
<workItem from="1708264836358" duration="46000" />
<workItem from="1708265094998" duration="204000" />
<workItem from="1708265345702" duration="358000" />
<workItem from="1708343107313" duration="8276000" />
<workItem from="1708352150286" duration="3592000" />
<workItem from="1708462795417" duration="1244000" />
<workItem from="1708508458793" duration="103000" />
<workItem from="1708512937708" duration="3296000" />
<workItem from="1708549665711" duration="100000" />
<workItem from="1708550708196" duration="523000" />
<workItem from="1708591139716" duration="1553000" />
<workItem from="1708597333736" duration="3637000" />
<workItem from="1708679023133" duration="6858000" />
<workItem from="1708698582801" duration="3731000" />
<workItem from="1708809296046" duration="2479000" />
<workItem from="1708858398530" duration="1080000" />
<workItem from="1709057446428" duration="195000" />
<workItem from="1709074092924" duration="24000" />
<workItem from="1709139306864" duration="1813000" />
<workItem from="1709142473633" duration="2565000" />
<workItem from="1714477887801" duration="3618000" />
<workItem from="1714566597065" duration="351000" />
<workItem from="1715283453023" duration="949000" />
<workItem from="1715621781474" duration="1673000" />
<workItem from="1715623728886" duration="900000" />
<workItem from="1715624837981" duration="637000" />
<workItem from="1715625940853" duration="108000" />
<workItem from="1715627329632" duration="41000" />
<workItem from="1715627440179" duration="1000" />
<workItem from="1715634060575" duration="111000" />
<workItem from="1715634183157" duration="2701000" />
<workItem from="1715678868119" duration="29000" />
<workItem from="1715759348557" duration="1699000" />
<workItem from="1716022802329" duration="1089000" />
<workItem from="1716206341414" duration="1609000" />
<workItem from="1716212065238" duration="80000" />
<workItem from="1716488324710" duration="3710000" />
<workItem from="1716722129881" duration="965000" />
<workItem from="1716926795264" duration="1000" />
<workItem from="1718023888535" duration="2457000" />
<workItem from="1719160307151" duration="7080000" />
<workItem from="1719172087999" duration="1867000" />
<workItem from="1719236981913" duration="33000" />
<workItem from="1719246637584" duration="6142000" />
<workItem from="1719306268310" duration="4050000" />
<workItem from="1719569161589" duration="807000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="UnknownFeatures">
<option featureType="dependencySupport" implementationName="java:net.kyori:adventure-api" />
<option featureType="dependencySupport" implementationName="java:org.spigotmc:spigot-api" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.spigotmc/spigot-api/1.20.1-R0.1-SNAPSHOT/db707b55ae958245adecc7f15b611e1a571e7fe4/spigot-api-1.20.1-R0.1-SNAPSHOT-sources.jar!/org/bukkit/Material.java</url>
<line>6787</line>
<option name="timeStamp" value="1" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/api/src/main/java/me/tofaa/entitylib/wrapper/hologram/LegacyHologram.java</url>
<line>42</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/test-plugin/src/main/java/me/tofaa/testentitylib/TestPlayerCommand.java</url>
<line>77</line>
<option name="timeStamp" value="4" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-method">
<url>file://$PROJECT_DIR$/src/main/java/me/tofaa/entitylib/meta/types/DisplayMeta.java</url>
<line>153</line>
<properties class="me.tofaa.entitylib.meta.types.DisplayMeta">
<option name="EMULATED" value="true" />
<option name="WATCH_EXIT" value="false" />
</properties>
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>

View file

@ -1,7 +0,0 @@
dependencies {
api 'org.jetbrains:annotations:24.0.0'
compileOnlyApi(adventureDependencies)
compileOnlyApi 'com.github.retrooper.packetevents:api:2.3.0'
}

18
api/build.gradle.kts Normal file
View file

@ -0,0 +1,18 @@
plugins {
entitylib.`library-conventions`
entitylib.`shadow-conventions`
`el-version`
}
dependencies {
api(libs.jetbrains.annotations)
compileOnlyApi(libs.bundles.adventure)
compileOnlyApi(libs.packetevents.api)
}
tasks {
generateVersionsFile {
packageName = "me.tofaa.entitylib.utils"
}
}

View file

@ -1,17 +1,8 @@
package me.tofaa.entitylib;
import com.github.retrooper.packetevents.PacketEventsAPI;
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;
import me.tofaa.entitylib.utils.GithubUpdater;
import org.jetbrains.annotations.Blocking;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
public final class APIConfig {
private final PacketEventsAPI<?> packetEvents;
@ -27,13 +18,6 @@ public final class APIConfig {
this.packetEvents = packetEvents;
}
@Blocking
public boolean requiresUpdate() throws IOException {
if (!checkForUpdates) return false;
GithubUpdater updater = new GithubUpdater("Tofaa2", "EntityLib", EntityLib.getVersion());
return !updater.isLatestVersion();
}
public @NotNull APIConfig useBstats() {
this.bstats = true;
return this;

View file

@ -1,6 +1,9 @@
package me.tofaa.entitylib;
import java.io.IOException;
import com.github.retrooper.packetevents.util.PEVersion;
import me.tofaa.entitylib.utils.ELVersions;
import me.tofaa.entitylib.utils.GithubUpdater;
import java.util.Optional;
import java.util.logging.Level;
@ -15,21 +18,13 @@ public final class EntityLib {
EntityLib.platform = platform;
platform.setupApi(settings);
api = platform.getAPI();
if (api.getSettings().shouldCheckForUpdate()) {
try {
if (api.getSettings().isDebugMode()) {
platform.getLogger().log(Level.INFO, "Checking for updates...");
}
if (api.getSettings().requiresUpdate()) {
platform.getLogger().log(Level.WARNING, "You are using an outdated version of EntityLib. Please take a look at the Github releases page.");
}
else {
platform.getLogger().log(Level.INFO, "No EntityLib updates found.");
}
} catch (IOException e) {
platform.getLogger().log(Level.WARNING, e, () -> "EntityLib failed to check for updates.");
if (api.getSettings().shouldCheckForUpdate()) {
if (api.getSettings().isDebugMode()) {
platform.getLogger().log(Level.INFO, "Checking for updates...");
}
new GithubUpdater("Tofaa2", "EntityLib").checkForUpdates();
}
}
@ -45,7 +40,7 @@ public final class EntityLib {
return platform;
}
public static String getVersion() {
return "2.3.1-SNAPSHOT";
public static PEVersion getVersion() {
return ELVersions.CURRENT;
}
}

View file

@ -1,7 +1,9 @@
package me.tofaa.entitylib.utils;
import com.github.retrooper.packetevents.util.PEVersion;
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
import com.google.gson.JsonObject;
import me.tofaa.entitylib.EntityLib;
import org.jetbrains.annotations.Blocking;
import java.io.BufferedReader;
@ -9,45 +11,61 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
public final class GithubUpdater {
private final String org;
private final String repo;
private final String currentVersion;
private final PEVersion currentVersion;
private final Logger logger;
public GithubUpdater(String org, String repo, String currentVersion) {
public GithubUpdater(String org, String repo) {
this.org = org;
this.repo = repo;
this.currentVersion = currentVersion;
this.currentVersion = ELVersions.CURRENT;
this.logger = EntityLib.getPlatform().getLogger();
}
@Blocking
public boolean isLatestVersion() throws IOException {
String latest = getLatestVersion();
return latest != null && latest.equals(currentVersion);
}
@Blocking
public String getLatestVersion() throws IOException {
URL url = new URL("https://api.github.com/repos/" + org + "/" + repo + "/releases/latest");
URLConnection connection = url.openConnection();
connection.addRequestProperty("User-Agent", "Mozilla/5.0");
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader reader = new BufferedReader(isr);
String response = reader.readLine();
JsonObject json = AdventureSerializer.getGsonSerializer().serializer().fromJson(response, JsonObject.class);
reader.close();
isr.close();
if (json.has("name")) {
return json.get("name").getAsString();
public void checkForUpdates() {
CompletableFuture.runAsync(() -> {
try {
PEVersion latestVersion = getLatestVersion();
if (currentVersion.isOlderThan(latestVersion)) {
logger.log(Level.WARNING, "You are using an outdated version of EntityLib. Please take a look at the Github releases page.");
} else if (currentVersion.isNewerThan(latestVersion)) {
logger.log(Level.INFO, "No EntityLib updates found.");
}
} catch (Exception ex) {
logger.warning("Failed to check for updates: " + ex.getMessage());
}
throw new IOException("Could not find name attribute in github api fetch");
});
}
@Blocking
private PEVersion getLatestVersion() throws IOException {
URL url = new URL("https://api.github.com/repos/" + org + "/" + repo + "/releases/latest");
URLConnection connection = url.openConnection();
connection.addRequestProperty("User-Agent", "Mozilla/5.0");
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader reader = new BufferedReader(isr);
String response = reader.readLine();
JsonObject json = AdventureSerializer.getGsonSerializer().serializer().fromJson(response, JsonObject.class);
reader.close();
isr.close();
if (json.has("tag_name")) {
return PEVersion.fromString(json.get("tag_name").getAsString().replaceFirst("^[vV]", ""));
}
throw new IOException("Could not find name attribute in github api fetch");
}
@Deprecated
public String getCurrentVersion() {
return currentVersion;
return currentVersion.toString();
}
public String getOrg() {

View file

@ -1,66 +0,0 @@
plugins {
id 'java'
id 'java-library'
id 'maven-publish'
}
allprojects {
project.ext.adventureVersion = '4.15.0'
project.ext.adventureDependencies = ["net.kyori:adventure-api:${adventureVersion}",
"net.kyori:adventure-text-serializer-gson:${adventureVersion}",
"net.kyori:adventure-text-serializer-legacy:${adventureVersion}",
"net.kyori:adventure-nbt:${adventureVersion}"]
project.ext.peVersion = '2.4.0'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
group = 'me.tofaa.entitylib'
version = '2.4.1-SNAPSHOT'
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
java {
withSourcesJar()
withJavadocJar()
}
repositories {
mavenCentral()
maven {
url = 'https://jitpack.io/'
}
maven {
name = 'papermc'
url = 'https://repo.papermc.io/repository/maven-public/'
}
maven {
name = 'codemc-repo'
url = 'https://repo.codemc.io/repository/maven-releases/'
}
maven {
url = "https://oss.sonatype.org/content/groups/public/"
}
maven { url = "https://repo.codemc.org/repository/maven-public/" }
}
publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from components.java
}
}
}
}
dependencies {
compileOnlyApi 'com.github.retrooper:packetevents-spigot:${project.ext.peVersion}'
}

27
build.gradle.kts Normal file
View file

@ -0,0 +1,27 @@
import java.io.ByteArrayOutputStream
plugins {
entitylib.`library-conventions`
}
group = "me.tofaa.entitylib"
description = rootProject.name
val fullVersion = "2.4.1"
val snapshot = true
fun getVersionMeta(): String {
if (!snapshot) {
return ""
}
var commitHash = ""
if (file(".git").isDirectory) {
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = stdout
}
commitHash = "+${stdout.toString().trim()}"
}
return "$commitHash-SNAPSHOT"
}
version = "$fullVersion${getVersionMeta()}"

18
buildSrc/build.gradle.kts Normal file
View file

@ -0,0 +1,18 @@
plugins {
`kotlin-dsl`
}
kotlin {
compilerOptions {
jvmToolchain(8)
}
}
repositories {
gradlePluginPortal()
mavenCentral()
}
dependencies {
implementation(libs.shadow)
}

View file

@ -0,0 +1,5 @@
[versions]
shadow = "8.1.8"
[libraries]
shadow = { group = "io.github.goooler.shadow", name = "shadow-gradle-plugin", version.ref = "shadow" }

View file

@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("libs.versions.toml"))
}
}
}

View file

@ -0,0 +1,50 @@
plugins {
`java-library`
`maven-publish`
}
group = rootProject.group
version = rootProject.version
description = project.description
repositories {
mavenLocal()
mavenCentral()
maven("https://repo.codemc.io/repository/maven-releases/")
maven("https://repo.codemc.io/repository/maven-snapshots/")
}
java {
withSourcesJar()
withJavadocJar()
disableAutoTargetJvm()
toolchain.languageVersion = JavaLanguageVersion.of(21)
}
tasks {
processResources {
inputs.property("version", project.version)
filesMatching(listOf("plugin.yml", "velocity-plugin.json")) {
expand("version" to project.version)
}
}
withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release = 8
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(components["java"])
}
}
}
defaultTasks("build")
}

View file

@ -0,0 +1,19 @@
plugins {
java
io.github.goooler.shadow
}
tasks {
shadowJar {
archiveFileName = "EntityLib-${project.name}-${project.version}.jar"
archiveClassifier = null
mergeServiceFiles()
}
assemble {
dependsOn(shadowJar)
}
}
configurations.implementation.get().extendsFrom(configurations.shadow.get())

View file

@ -0,0 +1,31 @@
package me.tofaa.entitylib.version
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.kotlin.dsl.getByName
import org.gradle.kotlin.dsl.register
class ELVersionPlugin : Plugin<Project> {
override fun apply(target: Project) {
val task = target.tasks.register<ELVersionTask>(ELVersionTask.TASK_NAME) {
group = target.rootProject.name.toString()
version = target.version.toString()
outputDir = target.layout.buildDirectory.dir("generated/sources/src/java/main")
}
target.afterEvaluate {
val sourceSets = target.extensions.getByName<SourceSetContainer>("sourceSets")
sequenceOf(SourceSet.MAIN_SOURCE_SET_NAME, SourceSet.TEST_SOURCE_SET_NAME).forEach {
sourceSets.getByName(it).java.srcDir(task.flatMap { it.outputDir })
}
task.get().generate()
}
}
}

View file

@ -0,0 +1,80 @@
package me.tofaa.entitylib.version
import org.gradle.api.DefaultTask
import org.gradle.api.file.Directory
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
abstract class ELVersionTask : DefaultTask() {
companion object {
const val TASK_NAME = "generateVersionsFile"
}
@get:Input
abstract var packageName: String
@get:Input
abstract var version: String
@get:OutputDirectory
abstract var outputDir: Provider<Directory>
@TaskAction
fun generate() {
val dir = outputDir.get().dir(packageName.replace('.', '/'))
dir.asFile.mkdirs()
val file = dir.file("ELVersions.java").asFile
if (!file.exists()) {
file.createNewFile()
}
val ver = Version.fromString(version)
logger.info("Generating ELVersions.java with version $ver")
file.writeText("""
/**
* This file is generated by the auto-version task. Modifying it will have no effect.
*/
package $packageName;
import com.github.retrooper.packetevents.util.PEVersion;
public final class ELVersions {
public static final String RAW = "$version";
public static final PEVersion CURRENT = new PEVersion(${ver.major}, ${ver.minor}, ${ver.patch}, ${ver.snapShot});
public static final PEVersion UNKNOWN = new PEVersion(0, 0, 0);
private ELVersions() {
throw new IllegalStateException();
}
}
""".trimIndent())
}
private data class Version(
val major: Int,
val minor: Int,
val patch: Int,
val snapShot: Boolean
) {
companion object {
private val REGEX = Regex("""(\d+)\.(\d+)\.(\d+)(?:\+[0-9a-f]+)?(-SNAPSHOT)?""")
fun fromString(version: String): Version {
val match = REGEX.matchEntire(version) ?: throw IllegalArgumentException("Invalid version: $version")
return Version(
match.groupValues[1].toInt(),
match.groupValues[2].toInt(),
match.groupValues[3].toInt(),
match.groupValues[4].isNotEmpty()
)
}
}
}
}

View file

@ -0,0 +1 @@
implementation-class=me.tofaa.entitylib.version.ELVersionPlugin

View file

@ -1,7 +0,0 @@
dependencies {
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.squareup:javapoet:1.13.0'
implementation 'com.github.retrooper.packetevents:api:2.2.0'
implementation 'org.jetbrains:annotations:24.0.0'
}

11
code-gen/build.gradle.kts Normal file
View file

@ -0,0 +1,11 @@
plugins {
entitylib.`library-conventions`
entitylib.`shadow-conventions`
}
dependencies {
implementation(libs.gson)
implementation(libs.javapoet)
implementation(libs.packetevents.api)
implementation(libs.jetbrains.annotations)
}

View file

@ -1,4 +0,0 @@
dependencies {
api(project(":api"))
}

8
common/build.gradle.kts Normal file
View file

@ -0,0 +1,8 @@
plugins {
entitylib.`library-conventions`
entitylib.`shadow-conventions`
}
dependencies {
api(project(":api"))
}

View file

@ -1,6 +1,6 @@
#Mon Nov 27 02:38:48 TRT 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0
gradlew vendored Normal file → Executable file
View file

31
libs.versions.toml Normal file
View file

@ -0,0 +1,31 @@
[versions]
adventure = "4.16.0"
jetbrains-annotations = "24.0.0"
gson = "2.11.0"
packetevents = "2.4.1-SNAPSHOT"
paper = "1.21-R0.1-SNAPSHOT"
velocity = "3.3.0-SNAPSHOT"
run-paper = "2.3.0"
javapoet = "1.13.0"
[libraries]
adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
adventure-text-serializer-gson = { group = "net.kyori", name = "adventure-text-serializer-gson", version.ref = "adventure" }
adventure-text-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" }
adventure-text-serializer-gson-legacy = { group = "net.kyori", name = "adventure-text-serializer-gson-legacy-impl", version.ref = "adventure" }
adventure-nbt = { group = "net.kyori", name = "adventure-nbt", version.ref = "adventure" }
jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
packetevents-api = { group = "com.github.retrooper", name = "packetevents-api", version.ref = "packetevents" }
packetevents-spigot = { group = "com.github.retrooper", name = "packetevents-spigot", version.ref = "packetevents" }
packetevents-velocity = { group = "com.github.retrooper", name = "packetevents-velocity", version.ref = "packetevents" }
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
javapoet = { group = "com.squareup", name = "javapoet", version.ref = "javapoet" }
[bundles]
adventure = ["adventure-api", "adventure-text-serializer-gson", "adventure-text-serializer-legacy", "adventure-nbt"]
[plugins]
run-paper = { id = "xyz.jpenilla.run-paper", version.ref = "run-paper" }
run-velocity = { id = "xyz.jpenilla.run-velocity", version.ref = "run-paper" }

View file

@ -1,8 +0,0 @@
repositories {
maven { url 'https://mvn.lumine.io/repository/maven-public/' }
}
dependencies {
// compileOnly 'com.ticxo.modelengine:ModelEngine:R4.0.4'
api(project(":api"))
}

View file

@ -0,0 +1,15 @@
plugins {
entitylib.`library-conventions`
entitylib.`shadow-conventions`
}
repositories {
maven {
url = uri("https://mvn.lumine.io/repository/maven-public/")
}
}
dependencies {
// compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.4")
api(project(":api"))
}

View file

@ -1,6 +0,0 @@
dependencies {
api(project(":common"))
compileOnly('com.github.retrooper:packetevents-spigot:' + peVersion)
compileOnly('org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT')
}

View file

@ -0,0 +1,14 @@
plugins {
entitylib.`library-conventions`
entitylib.`shadow-conventions`
}
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
}
dependencies {
api(project(":common"))
compileOnly(libs.paper)
compileOnly(libs.packetevents.spigot)
}

View file

@ -45,8 +45,9 @@ public class SpigotEntityLibPlatform extends AbstractPlatform<JavaPlugin> {
if (settings.shouldUseBstats()) {
PacketEventsAPI<Plugin> pe = (PacketEventsAPI<Plugin>)api.getPacketEvents();
Metrics metrics = new Metrics((JavaPlugin) pe.getPlugin(), 21916);
metrics.addCustomChart(new Metrics.SimplePie("entitylib-version", EntityLib::getVersion));
metrics.addCustomChart(new Metrics.SimplePie("entitylib-version", () -> EntityLib.getVersion().toString()));
}
}

View file

@ -1,6 +0,0 @@
dependencies {
api(project(":common"))
compileOnly('com.github.retrooper.packetevents:api:2.3.0')
}

View file

@ -0,0 +1,9 @@
plugins {
entitylib.`library-conventions`
entitylib.`shadow-conventions`
}
dependencies {
api(project(":common"))
compileOnly(libs.packetevents.api)
}

View file

@ -1,20 +0,0 @@
repositories {
maven {
name = 'papermc'
url = 'https://repo.papermc.io/repository/maven-public/'
}
}
tasks {
compileJava {
options.release.set(17)
}
}
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
dependencies {
api(project(":common"))
compileOnly('com.github.retrooper.packetevents:velocity:' + peVersion)
compileOnly 'com.velocitypowered:velocity-api:3.3.0-SNAPSHOT'
}

View file

@ -0,0 +1,22 @@
plugins {
entitylib.`library-conventions`
entitylib.`shadow-conventions`
}
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
}
dependencies {
api(project(":common"))
compileOnly(libs.velocity)
compileOnly(libs.packetevents.velocity)
annotationProcessor(libs.velocity)
}
tasks {
withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release = 17
}
}

View file

@ -1,21 +0,0 @@
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
rootProject.name = 'EntityLib'
//include 'test-plugin'
include 'api'
include 'platforms:spigot'
findProject(':platforms:spigot')?.name = 'spigot'
include 'common'
if (!Boolean.parseBoolean(System.getenv("JITPACK"))) {
include 'code-gen'
include 'test-plugin'
include 'model-engine-addon'
}
include 'platforms:velocity'
findProject(':platforms:velocity')?.name = 'velocity'
include 'platforms:standalone'
findProject(':platforms:standalone')?.name = 'standalone'

41
settings.gradle.kts Normal file
View file

@ -0,0 +1,41 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver") version "0.8.0"
}
toolchainManagement {
jvm {
javaRepositories {
repository("foojay") {
resolverClass.set(org.gradle.toolchains.foojay.FoojayToolchainResolver::class.java)
}
}
}
}
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("libs.versions.toml"))
}
}
}
rootProject.name = "EntityLib"
include(":common")
include(":api")
include(":platforms:spigot")
include(":platforms:velocity")
include(":platforms:standalone")
if (!System.getenv("JITPACK").toBoolean()) {
include(":code-gen")
include(":test-plugin")
include(":model-engine-addon")
}

View file

@ -1,46 +0,0 @@
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.1.2'
//id("io.papermc.paperweight.userdev") version "1.5.11"
id 'xyz.jpenilla.run-paper' version '2.2.2'
}
group = 'me.tofaa.peentitymeta'
version = '1.0-SNAPSHOT'
// java 21
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
repositories {
mavenCentral()
maven {
name = 'papermc'
url = 'https://repo.papermc.io/repository/maven-public/'
}
maven {
name = 'codemc-repo'
url = 'https://repo.codemc.io/repository/maven-releases/'
}
maven {
url = "https://oss.sonatype.org/content/groups/public/"
}
maven { url = "https://repo.codemc.org/repository/maven-public/" }
}
dependencies {
compileOnly('org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT')
compileOnly('com.github.retrooper:packetevents-spigot:' + peVersion)
// implementation(project(":platforms:spigot"))
implementation(project(":platforms:spigot"))
}
runServer {
minecraftVersion("1.21")
downloadPlugins {
modrinth("packetevents", "MfD5eOYA")
}
}

View file

@ -0,0 +1,62 @@
plugins {
entitylib.`library-conventions`
entitylib.`shadow-conventions`
alias(libs.plugins.run.paper)
}
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
}
dependencies {
compileOnly(libs.paper)
compileOnly(libs.packetevents.spigot)
implementation(project(":platforms:spigot"))
}
tasks {
// 1.8.8 - 1.16.5 = Java 8
// 1.17 = Java 16
// 1.18 - 1.20.4 = Java 17
// 1-20.5+ = Java 21
val version = "1.21"
val javaVersion = JavaLanguageVersion.of(21)
val jvmArgsExternal = listOf(
"-Dcom.mojang.eula.agree=true"
)
val sharedBukkitPlugins = runPaper.downloadPluginsSpec {
modrinth("packetevents", "MfD5eOYA")
}
runServer {
minecraftVersion(version)
runDirectory = rootDir.resolve("run/paper/$version")
javaLauncher = project.javaToolchains.launcherFor {
languageVersion = javaVersion
}
downloadPlugins {
from(sharedBukkitPlugins)
}
jvmArgs = jvmArgsExternal
}
runPaper.folia.registerTask {
minecraftVersion(version)
runDirectory = rootDir.resolve("run/folia/$version")
javaLauncher = project.javaToolchains.launcherFor {
languageVersion = javaVersion
}
downloadPlugins {
from(sharedBukkitPlugins)
}
jvmArgs = jvmArgsExternal
}
}

View file

@ -30,6 +30,7 @@ public class TestEntityLibPlugin extends JavaPlugin {
SpigotEntityLibPlatform platform = new SpigotEntityLibPlatform(this);
APIConfig settings = new APIConfig(PacketEvents.getAPI())
.debugMode()
.checkForUpdates()
.tickTickables()
.trackPlatformEntities()
.useBstats()

View file

@ -1,5 +1,5 @@
name: EntityLibPlugin
version: 1.0.0
version: ${version}
depend:
- packetevents
main: me.tofaa.testentitylib.TestEntityLibPlugin