Verified Commit ebce14bc authored by Andret2344's avatar Andret2344 💬
Browse files

#5: Added .idea, adjusted to 1.18, removed delombok task

parent 154e366e
Pipeline #554080121 passed with stages
in 4 minutes and 18 seconds
/.idea/
/.gradle/
/build/
......@@ -32,17 +32,6 @@ compile:
<<: *wrapper
policy: pull
delombok:
stage: build
script:
- ./gradlew delombok
artifacts:
paths:
- build/delombok/**
cache:
<<: *wrapper
policy: pull
junit:
stage: verify
dependencies:
......@@ -92,7 +81,6 @@ badges:
- apt-get -qq install python3 python3-pip --yes
- pip3 install anybadge
- ./gradlew build -q
- anybadge -l version -v "$(./gradlew version -q)" -f version.svg -c "#007ec6"
- anybadge -l spigot -v "$(./gradlew spigotVersion -q)" -f spigot.svg -c "#007ec6"
- anybadge -l atsArguments -v "$(./gradlew argumentsVersion -q)" -f arguments.svg -c "#007ec6"
artifacts:
......
# Default ignored files
/shelf/
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
/sonarlint/
/workspace.xml
/gradle.xml
/compiler.xml
/discord.xml
atsBlockGenerator
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
<option name="value" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ClassCanBeRecord" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaDocConfiguration">
<GENERAL>
<MODE>UPDATE</MODE>
<OVERRIDDEN_METHODS>false</OVERRIDDEN_METHODS>
<SPLITTED_CLASS_NAME>true</SPLITTED_CLASS_NAME>
<LEVELS>
<LEVEL>TYPE</LEVEL>
<LEVEL>METHOD</LEVEL>
<LEVEL>FIELD</LEVEL>
</LEVELS>
<VISIBILITIES>
<VISIBILITY>DEFAULT</VISIBILITY>
<VISIBILITY>PUBLIC</VISIBILITY>
<VISIBILITY>PROTECTED</VISIBILITY>
</VISIBILITIES>
</GENERAL>
<TEMPLATES>
<CLASSES>
<CLASS>
<KEY>^.*(public|protected|private)*.+interface\s+\w+.*</KEY>
<VALUE>/**\n
* The interface ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+enum\s+\w+.*</KEY>
<VALUE>/**\n
* The enum ${name}.\n
*/</VALUE>
</CLASS>
<CLASS>
<KEY>^.*(public|protected|private)*.+class\s+\w+.*</KEY>
<VALUE>/**\n
* The type ${name}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
*/</VALUE>
</CLASS>
<CLASS>
<KEY>.+</KEY>
<VALUE>/**\n
* The type ${name}.\n
*/</VALUE>
</CLASS>
</CLASSES>
<CONSTRUCTORS>
<CONSTRUCTOR>
<KEY>.+</KEY>
<VALUE>/**\n
* Instantiates a new ${name}.\n
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</CONSTRUCTOR>
</CONSTRUCTORS>
<METHODS>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(\w(\s*&lt;.+&gt;)*)+\s+get\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Gets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>^.*(public|protected|private)*\s*.*(void|\w(\s*&lt;.+&gt;)*)+\s+set\w+\s*\(.*\).+</KEY>
<VALUE>/**\n
* Sets ${partName}.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${partName}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+</KEY>
<VALUE>/**\n
* The entry point of application.\n
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
* @param ${element.parameterList.parameters[0].name} the input arguments\n
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
<METHOD>
<KEY>.+</KEY>
<VALUE>/**\n
* ${name}&lt;#if isNotVoid&gt; ${return}&lt;/#if&gt;.\n
&lt;#if element.typeParameters?has_content&gt; * \n
&lt;/#if&gt;
&lt;#list element.typeParameters as typeParameter&gt;
* @param &lt;${typeParameter.name}&gt; the type parameter\n
&lt;/#list&gt;
&lt;#if element.parameterList.parameters?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.parameterList.parameters as parameter&gt;
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
&lt;/#list&gt;
&lt;#if isNotVoid&gt;
*\n
* @return the ${return}\n
&lt;/#if&gt;
&lt;#if element.throwsList.referenceElements?has_content&gt;
*\n
&lt;/#if&gt;
&lt;#list element.throwsList.referenceElements as exception&gt;
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
&lt;/#list&gt;
*/</VALUE>
</METHOD>
</METHODS>
<FIELDS>
<FIELD>
<KEY>^.*(public|protected|private)*.+static.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
* The constant ${element.getName()}.\n
*/</VALUE>
</FIELD>
<FIELD>
<KEY>^.*(public|protected|private)*.*(\w\s\w)+.+</KEY>
<VALUE>/**\n
&lt;#if element.parent.isInterface()&gt;
* The constant ${element.getName()}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt; */</VALUE>
</FIELD>
<FIELD>
<KEY>.+</KEY>
<VALUE>/**\n
&lt;#if element.parent.isEnum()&gt;
*${name} ${typeName}.\n
&lt;#else&gt;
* The ${name}.\n
&lt;/#if&gt;*/</VALUE>
</FIELD>
</FIELDS>
</TEMPLATES>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven3" />
<option name="name" value="maven3" />
<option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven6" />
<option name="name" value="maven6" />
<option name="url" value="https://gitlab.com/api/v4/projects/12063927/packages/maven" />
</remote-repository>
<remote-repository>
<option name="id" value="maven4" />
<option name="name" value="maven4" />
<option name="url" value="https://papermc.io/repo/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="Gradle Central Plugin Repository" />
<option name="name" value="Gradle Central Plugin Repository" />
<option name="url" value="https://plugins.gradle.org/m2" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:/$MAVEN_REPOSITORY$/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA">
<option name="configuration">
<map>
<entry key="checkstyle-version" value="8.37" />
<entry key="copy-libs" value="true" />
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
<entry key="scan-before-checkin" value="false" />
<entry key="scanscope" value="JavaOnly" />
<entry key="suppress-errors" value="false" />
</map>
</option>
</component>
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
<component name="ProjectType">
<option name="id" value="jpab" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SaveActionSettings">
<option name="actions">
<set>
<option value="activate" />
<option value="noActionIfCompileErrors" />
<option value="organizeImports" />
<option value="reformat" />
<option value="fieldCanBeFinal" />
<option value="localCanBeFinal" />
<option value="missingOverrideAnnotation" />
<option value="useBlocks" />
<option value="generateSerialVersionUID" />
<option value="unnecessaryThis" />
<option value="finalPrivateMethod" />
<option value="explicitTypeCanBeDiamond" />
<option value="unnecessarySemicolon" />
</set>
</option>
<option name="configurationPath" value="" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="IssueNavigationConfiguration">
<option name="links">
<list>
<IssueNavigationLink>
<option name="issueRegexp" value="#(\d+)" />
<option name="linkRegexp" value="https://gitlab.com/andret-tools-system/spigot/ats-block-generator/-/issues/$1" />
</IssueNavigationLink>
</list>
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
# atsBlockGenerator
The plugin allows to craft the block generatorItem block, that will generate another (or the same - decide!) block above itself as in the infinite loop with certain delay,
The plugin allows to craft the generator block, that will generate another (or the same - you decide!) block above
itself as in the infinite loop with certain delay.
## Details
You can define any amount of own generators in the `config.yml` file. Name needs to be present to correct working, **has to** be unique in a plugin. You are able to configure the generatorItem block as a `ItemStack`, what means you can set it's material, name and lore as you wish. The same situation is with the blocks that are generatedItem above the generators, you have to set the material and can (but don't have to) set the name and lore. You can also define own crafting for each generatorItem (crafting recipes **have to** be unique in the whole plugin!), and define the regen delay set in ticks (20 ticks = 1s, 100 ticks = 5s).
## Details
You can define any amount of own generators in the `config.yml` file. The generator's name **has to** be unique in a
plugin. You are able to configure the generatorItem block as a `ItemStack`, so you can set it's material, name and lore
as you wish. The same situation is with the blocks that are generated above the generators, you have to set the material
and can (but don't have to) set the name and lore. You can also define own crafting for each generatorItem (crafting
recipes **have to** be unique in the whole plugin!), and define the regen delay set in ticks (20 ticks = 1s, 100 ticks =
5s).
An example config that includes 2 different generators is present as a default config.
## Downloading
You can download the plugin from here: [atsBlockGenerator](https://ats.andret.eu/atsBlockGenerator-2.3.jar "Download directly from author")
You can download the plugin from
here: [spigotmc.org/atsBlockGenerator](https://www.spigotmc.org/resources/atsblockgenerator-craftable-infinite-block-generator.96216/ "atsBlockGenerator")
## Contributing
If you wish to contribute it with me, just send the join request :)
import io.franzbecker.gradle.lombok.task.DelombokTask
buildscript {
dependencies { classpath 'io.franzbecker:gradle-lombok:5.0' }
}
plugins {
id 'de.jansauer.printcoverage' version '2.0.0'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'kr.entree.spigradle' version '2.3.4'
id 'io.franzbecker.gradle-lombok' version '5.0.0'
}
apply plugin: 'idea'
......@@ -28,18 +21,18 @@ repositories {
dependencies {
compileOnly group: 'org.spigotmc', name: 'spigot-api', version: "${spigotVersion}-R0.1-SNAPSHOT"
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.22'
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
compileOnly group: 'org.jetbrains', name: 'annotations', version: '23.0.0'
implementation group: 'eu.andret', name: 'ats-arguments', version: argumentsVersion
implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.22'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
testCompileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.22'
testCompileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.7.0'
testImplementation group: 'org.spigotmc', name: 'spigot-api', version: "${spigotVersion}-R0.1-SNAPSHOT"
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.7.0'
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.22'
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
}
compileJava.options.compilerArgs << '-parameters' << '-g' << '-Xlint:deprecation' << '-Xlint:unchecked'
......@@ -47,9 +40,10 @@ compileTestJava.options.compilerArgs << '-parameters' << '-g' << '-Xlint:depreca
spigot {
authors = ['Andret']
apiVersion = '1.18'
apiVersion = '1.17'
description = 'A plugin that allows to craft the blocks, that are generating other blocks.'
version = project.version
libraries = ['org.jetbrains:annotations:23.0.0']
//noinspection GroovyAssignabilityCheck
commands {
......@@ -93,7 +87,7 @@ javadoc {
setMemberLevel JavadocMemberLevel.PUBLIC
setAuthor true
links 'https://docs.oracle.com/en/java/javase/11/docs/api/'
links 'https://docs.oracle.com/en/java/javase/17/docs/api/'
}
}
......@@ -138,22 +132,10 @@ shadowJar {
archiveFileName = "${project.name}-${project.version}.jar"
relocate "eu.andret.arguments", "eu.andret.ats.blockgenerator.arguments"
relocate "org.bstats", "eu.andret.ats.blockgenerator.bstats"
project.configurations.implementation.canBeResolved = true
configurations = [project.configurations.implementation]
}
build.dependsOn(shadowJar)
task delombok(type: DelombokTask, dependsOn: compileJava) {
ext.outputDir = file("$buildDir/delombok")
outputs.dir(outputDir)
sourceSets.main.java.srcDirs.each {
inputs.dir(it)
args(it, '-d', outputDir)
}
doFirst { outputDir.deleteDir() }
}
tasks.register('spigotVersion') {
doLast {
println(spigotVersion)
......@@ -165,9 +147,3 @@ tasks.register('argumentsVersion') {
println(argumentsVersion)
}
}
tasks.register('version') {
doLast {
println(version)
}
}
group=eu.andret.ats
version=2.4.1
version=2.4.1-SNAPSHOT
codeName=block-generator
spigotVersion=1.18.2
argumentsVersion=0.1.3
......@@ -8,7 +8,6 @@ import eu.andret.ats.blockgenerator.entity.NamedItem;
import eu.andret.ats.blockgenerator.utils.ConfigLoader;
import eu.andret.ats.blockgenerator.utils.RandomCollection;
import lombok.Getter;
import lombok.extern.java.Log;
import org.bstats.bukkit.Metrics;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
......@@ -19,7 +18,6 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Log
public class BlockGeneratorPlugin extends JavaPlugin {
@Getter
private final List<GeneratorPattern> patternList = new ArrayList<>();
......@@ -42,32 +40,35 @@ public class BlockGeneratorPlugin extends JavaPlugin {
.map(NamedItem::getName)
.collect(Collectors.toSet()));
command.addArgumentMapper("generatorName", NamedItem.class, name -> patternList.stream()
.map(GeneratorPattern::getGeneratorItem)
.filter(p -> p.getName().equals(name))
.findAny()
.orElse(null), FallbackConstants.ON_NULL);
.map(GeneratorPattern::getGeneratorItem)
.filter(item -> item.getName().equals(name))
.findAny()
.orElse(null),
FallbackConstants.ON_NULL);
command.addArgumentCompleter("generatedName", () -> patternList.stream()
.map(GeneratorPattern::getGeneratedItem)
.map(NamedItem::getName)
.collect(Collectors.toList()));
.toList());
command.addArgumentMapper("generatedName", NamedItem.class, name -> patternList.stream()
.map(GeneratorPattern::getGeneratedItem)
.filter(p -> p.getName().equals(name))
.findAny()
.orElse(null), FallbackConstants.ON_NULL);
.map(GeneratorPattern::getGeneratedItem)
.filter(item -> item.getName().equals(name))
.findAny()
.orElse(null),
FallbackConstants.ON_NULL);
command.addArgumentCompleter("itemName", () -> patternList.stream()
.map(GeneratorPattern::getDropItems)
.map(RandomCollection::getItems)
.flatMap(Collection::stream)
.map(NamedItem::getName)
.collect