-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = false | ||
indent_size = 4 | ||
indent_style = space | ||
|
||
# intellij idea | ||
ij_continuation_indent_size = 8 | ||
ij_java_do_not_wrap_after_single_annotation = true | ||
ij_java_class_count_to_use_import_on_demand = 10 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: 'build' | ||
|
||
on: [ 'push', 'pull_request' ] | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- name: 'checkout repo' | ||
uses: 'actions/checkout@v2' | ||
- name: 'setup JDK 1.8' | ||
uses: 'actions/setup-java@v1' | ||
with: | ||
java-version: 1.8 | ||
- name: 'build' | ||
run: './gradlew build' | ||
- name: 'publish' | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
run: './gradlew publish' | ||
env: | ||
ORG_GRADLE_PROJECT_unnamedRepositoryUsername: '${{ secrets.REPO_USER }}' | ||
ORG_GRADLE_PROJECT_unnamedRepositoryPassword: '${{ secrets.REPO_PASSWORD }}' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Gradle files | ||
.gradle | ||
|
||
# Output files | ||
/build/ | ||
/*/build/ | ||
|
||
# Editors files | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# AWS User-specific | ||
.idea/**/aws.xml | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
.idea/artifacts | ||
.idea/compiler.xml | ||
.idea/jarRepositories.xml | ||
.idea/modules.xml | ||
.idea/*.iml | ||
.idea/modules | ||
*.iml | ||
*.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# SonarLint plugin | ||
.idea/sonarlint/ | ||
|
||
# Discord plugin | ||
.idea/discord.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
plugins { | ||
id("creative.publishing-conventions") | ||
} | ||
|
||
dependencies { | ||
api("team.unnamed:creative-api:$version") | ||
api("net.kyori:adventure-api:4.13.1") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* This file is part of creative, licensed under the MIT license | ||
* | ||
* Copyright (c) 2021-2023 Unnamed Team | ||
* | ||
* 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. | ||
*/ | ||
package team.unnamed.creative.central; | ||
|
||
import team.unnamed.creative.ResourcePack; | ||
import team.unnamed.creative.central.event.EventBus; | ||
import team.unnamed.creative.central.request.ResourcePackRequestSender; | ||
import team.unnamed.creative.central.server.CentralResourcePackServer; | ||
import team.unnamed.creative.central.server.ServeOptions; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
/** | ||
* @since 1.0.0 | ||
*/ | ||
public interface CreativeCentral { | ||
|
||
CentralResourcePackServer server(); | ||
|
||
ServeOptions serveOptions(); | ||
|
||
ResourcePackRequestSender requestSender(); | ||
|
||
EventBus eventBus(); | ||
|
||
CompletableFuture<ResourcePack> generate(); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* This file is part of creative, licensed under the MIT license | ||
* | ||
* Copyright (c) 2021-2023 Unnamed Team | ||
* | ||
* 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. | ||
*/ | ||
package team.unnamed.creative.central; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
/** | ||
* Static provider for the {@link CreativeCentral} instance | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
public final class CreativeCentralProvider { | ||
|
||
// Very based on: | ||
// https://github.com/LuckPerms/LuckPerms/blob/master/api/src/main/java/net/luckperms/api/LuckPermsProvider.java | ||
|
||
private static @Nullable CreativeCentral instance; | ||
|
||
private CreativeCentralProvider() { | ||
} | ||
|
||
public static CreativeCentral get() { | ||
CreativeCentral instance = CreativeCentralProvider.instance; | ||
if (instance == null) { | ||
throw new NotLoadedException(); | ||
} | ||
return instance; | ||
} | ||
|
||
@ApiStatus.Internal | ||
public static void set(CreativeCentral instance) { | ||
requireNonNull(instance, "instance"); | ||
if (CreativeCentralProvider.instance != null) { | ||
throw new IllegalStateException("Service was already set, you cannot set it twice!"); | ||
} | ||
CreativeCentralProvider.instance = instance; | ||
} | ||
|
||
@ApiStatus.Internal | ||
public static void unset() { | ||
CreativeCentralProvider.instance = null; | ||
} | ||
|
||
private static final class NotLoadedException extends IllegalStateException { | ||
|
||
private static final String MESSAGE = "Creative Central isn't loaded yet!\n" + | ||
"This could be because:\n" + | ||
" a) The Creative Central plugin is not installed or it failed to enable\n" + | ||
" b) The plugin in the stacktrace does not declare a dependency on Creative Central\n" + | ||
" c) The plugin in the stacktrace is retrieving the API before the plugin 'enable' phase\n" + | ||
" (call the #get method in onEnable, not the constructor!)\n"; | ||
|
||
NotLoadedException() { | ||
super(MESSAGE); | ||
} | ||
|
||
} | ||
|
||
} |