Compare commits

..

16 Commits
1.14 ... master

Author SHA1 Message Date
坏黑 be620a1247 1.27 Fix website 2021-09-13 23:14:19 +08:00
坏黑 b7d5a97452 1.26 2021-08-25 16:19:52 +08:00
坏黑 ce8fe9c4bf 1.26 2021-08-25 16:19:20 +08:00
坏黑 8596bcae2c 1.25 2021-08-23 16:42:16 +08:00
坏黑 9dfb9d1876 1.24 2021-08-23 14:26:01 +08:00
坏黑 9c88efae69 Merge branch 'master' of https://github.com/TabooLib/taboolib-gradle-plugin
# Conflicts:
#	build.gradle
2021-08-23 14:11:32 +08:00
坏黑 43fc609549 1.23 2021-08-23 14:10:09 +08:00
坏黑 07512c45d9
Update build.gradle 2021-08-19 17:43:03 +08:00
坏黑 2a93a9e3d5
Merge pull request #7 from Itsusinn/master
build: update asm version
2021-08-19 17:42:48 +08:00
坏黑 3360b596d5
Update build.gradle 2021-08-19 17:40:53 +08:00
坏黑 8633b8e40d 1.20 2021-08-19 17:14:08 +08:00
坏黑 49751521f8 1.19 2021-08-19 16:06:03 +08:00
itsusinn 329f659f41
build: update asm version
support java bytecode version 16,17,18
2021-08-19 09:12:24 +08:00
坏黑 b53a0d68d2 1.18 2021-08-16 22:37:07 +08:00
坏黑 ec7038c311 1.17 2021-08-15 21:17:37 +08:00
坏黑 4d2bbc8054 1.16 2021-08-15 03:57:11 +08:00
18 changed files with 552 additions and 53 deletions

View File

@ -3,10 +3,13 @@ plugins {
id 'maven-publish'
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.12.0'
id 'org.jetbrains.kotlin.jvm' version '1.5.10'
}
apply plugin: 'kotlin'
group 'io.izzel.taboolib'
version '1.14'
version '1.27'
configurations {
embed
@ -21,9 +24,10 @@ dependencies {
compile 'org.codehaus.groovy:groovy:2.5.13'
compile gradleApi()
compile localGroovy()
embed 'org.ow2.asm:asm:8.0.1'
embed 'org.ow2.asm:asm-commons:8.0.1'
embed 'org.ow2.asm:asm:9.2'
embed 'org.ow2.asm:asm-commons:9.2'
embed 'com.google.code.gson:gson:2.8.7'
embed 'org.jetbrains.kotlin:kotlin-stdlib'
}
jar {
@ -54,3 +58,15 @@ publishing {
}
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
distributionUrl=https://skymc.oss-cn-shanghai.aliyuncs.com/files/gradle-6.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -50,6 +50,6 @@ class KotlinAnnotationVisitor extends AnnotationVisitor {
}
String getKotlinVersionEscape() {
return getKotlinVersion().replaceAll("[.-]", "_")
return getKotlinVersion().replaceAll("[._-]", "")
}
}

View File

@ -0,0 +1,29 @@
package io.izzel.taboolib.gradle
import org.gradle.api.Project
import org.objectweb.asm.AnnotationVisitor
import org.objectweb.asm.Opcodes
class KotlinMetaAnnotationVisitor extends AnnotationVisitor {
Project project
KotlinMetaAnnotationVisitor(AnnotationVisitor annotationVisitor, project) {
super(Opcodes.ASM7, annotationVisitor)
this.project = project
}
@Override
void visit(String name, Object value) {
if (value instanceof String) {
super.visit(name, value.replace("taboolib", "${project.group.replace('.', '/')}/taboolib"))
} else {
super.visit(name, value)
}
}
@Override
AnnotationVisitor visitArray(String name) {
return new KotlinMetaAnnotationVisitor(super.visitArray(name), project)
}
}

View File

@ -0,0 +1,17 @@
package io.izzel.taboolib.gradle
import groovy.transform.EqualsAndHashCode
import groovy.transform.TupleConstructor
@TupleConstructor
@EqualsAndHashCode
class MethodVisit {
String owner
String name
@Override
String toString() {
return owner.substring(owner.lastIndexOf("/") + 1) + "." + name + "()"
}
}

View File

@ -41,30 +41,72 @@ class RelocateJar extends DefaultTask {
@TaskAction
def relocate() {
//
def optimize = []
def isolated = new TreeMap<String, List<String>>()
def methodVisits = new TreeMap<String, Set<MethodVisit>>()
//
def mapping = relocations.collectEntries { [(it.key.replace('.', '/')), it.value.replace('.', '/')] }
def remapper = new RelocateRemapper(relocations, mapping as Map<String, String>)
//
def index = inJar.name.lastIndexOf('.')
def name = inJar.name.substring(0, index) + (classifier == null ? "" : "-" + classifier) + inJar.name.substring(index)
def outJar = new File(inJar.getParentFile(), name)
def tempOut1 = File.createTempFile(name, ".jar")
//
new JarOutputStream(new FileOutputStream(tempOut1)).withCloseable { out ->
int n
def buf = new byte[32768]
new JarFile(inJar).withCloseable { jarFile ->
jarFile.entries().each { def jarEntry ->
if (tabooExt.exclude.stream().noneMatch { String e -> jarEntry.name.matches(e) }) {
jarFile.entries().each { JarEntry jarEntry ->
def path = jarEntry.name
//
if (tabooExt.exclude.stream().any { String e -> path.startsWith(e) }) {
return
}
//
if (path.endsWith(".kotlin_module")) {
return
}
//
if (path.startsWith("META-INF/tf") && path.endsWith(".json")) {
optimize.add(Bridge.newOptimizeFileReader(project, jarFile.getInputStream(jarEntry)))
return
}
// Kotlin
def options = tabooExt.options
if (path == "taboolib/common/env/KotlinEnv.class" && options.contains("skip-kotlin")) {
return
}
//
if (path.startsWith("taboolib/common/env") && options.contains("skip-env")) {
return
}
// common
if (path.startsWith("taboolib/library/asm") || path.startsWith("taboolib/library/jarrelocator")) {
if (options.contains("skip-env") || options.contains("skip-env-relocate")) {
return
}
}
jarFile.getInputStream(jarEntry).withCloseable {
if (jarEntry.name.endsWith(".class")) {
if (path.endsWith(".class")) {
def reader = new ClassReader(it)
def writer = new ClassWriter(0)
def visitor = new TabooLibClassVisitor(writer, project)
def rem = new ClassRemapper(visitor, remapper)
remapper.remapper = rem
reader.accept(rem, 0)
//
isolated.putAll(visitor.isolated)
// 访
methodVisits.put(relocate(project, jarEntry.name), visitor.methodVisits)
//
//
try {
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
out.putNextEntry(new JarEntry(remapper.map(path)))
} catch (ZipException zipException) {
println(zipException)
return true
@ -72,7 +114,7 @@ class RelocateJar extends DefaultTask {
out.write(writer.toByteArray())
} else {
try {
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
out.putNextEntry(new JarEntry(remapper.map(path)))
} catch (ZipException ex) {
println(ex)
return true
@ -86,7 +128,9 @@ class RelocateJar extends DefaultTask {
}
}
}
}
//
// -> 使
def use = new TreeMap<String, Set<String>>()
remapper.use.each {
it.value.each { e ->
@ -95,11 +139,19 @@ class RelocateJar extends DefaultTask {
use.computeIfAbsent(key) { new HashSet() }.add(value)
}
}
def visits = methodVisits[methodVisits.keySet().first()]
if (visits != null) {
visits.each {
println(it)
}
}
def transfer = new TreeMap()
isolated.each {
transfer[relocate(project, it.key)] = it.value.stream().map { i -> relocate(project, i) }.collect(Collectors.toList())
}
isolated = transfer
//
def tempOut2 = File.createTempFile(name, ".jar")
new JarOutputStream(new FileOutputStream(tempOut2)).withCloseable { out ->
int n
@ -107,14 +159,16 @@ class RelocateJar extends DefaultTask {
def del = new HashSet()
def exclude = new HashSet()
new JarFile(tempOut1).withCloseable { jarFile ->
jarFile.entries().each { def jarEntry ->
jarFile.entries().each { JarEntry jarEntry ->
if (optimize.any { it.exclude(jarEntry.name, use) }) {
return
}
jarFile.getInputStream(jarEntry).withCloseable {
if (jarEntry.name.endsWith(".class")) {
def nameWithOutExtension = getNameWithOutExtension(jarEntry.name)
if (use.containsKey(nameWithOutExtension.toString()) && !exclude.contains(nameWithOutExtension)) {
exclude.add(nameWithOutExtension)
if (isIsolated(use, use[nameWithOutExtension], isolated, nameWithOutExtension)) {
println(" Isolated ${nameWithOutExtension}")
del.add(nameWithOutExtension)
}
}
@ -173,4 +227,10 @@ class RelocateJar extends DefaultTask {
return false
}
}
@Override
public String toString() {
return "RelocateJar{}";
}
}

View File

@ -29,6 +29,9 @@ class RelocateRemapper extends Remapper {
if (remapper != null) {
use.computeIfAbsent(remapper.className) { new HashSet() }.add(internalName)
}
if (internalName.startsWith('kotlin/Metadata')) {
return internalName
}
def match = slash.find { internalName.startsWith(it.key) }
if (match) {
return match.value + internalName.substring(match.key.length())

View File

@ -3,14 +3,19 @@ package io.izzel.taboolib.gradle
import org.gradle.api.Project
import org.objectweb.asm.AnnotationVisitor
import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes
class TabooLibClassVisitor extends ClassVisitor {
String name
Project project
Map<String, List<String>> isolated = new HashMap()
Set<MethodVisit> methodVisits = new HashSet<>()
List<String> annotations = [
"Lorg/spongepowered/api/plugin/Plugin;",
"Lorg/spongepowered/plugin/jvm/Plugin;",
@ -28,9 +33,16 @@ class TabooLibClassVisitor extends ClassVisitor {
super.visit(version, access, name, signature, superName, interfaces)
}
@Override
MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
return new TabooLibMethodVisitor(super.visitMethod(access, name, descriptor, signature, exceptions), this)
}
@Override
AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
if (descriptor == "L${project.group.replace('.', '/')}/taboolib/common/Isolated;") {
if (descriptor == "Lkotlin/Metadata;") {
return new KotlinMetaAnnotationVisitor(super.visitAnnotation(descriptor, visible), project)
} else if (descriptor == "L${project.group.replace('.', '/')}/taboolib/common/Isolated;") {
return new IsolatedAnnotationVisitor(super.visitAnnotation(descriptor, visible), project, name, this)
} else if (descriptor == "L${project.group.replace('.', '/')}/taboolib/common/env/RuntimeDependency;") {
return new KotlinAnnotationVisitor(super.visitAnnotation(descriptor, visible), project)

View File

@ -19,10 +19,16 @@ class TabooLibExtension {
Map<String, String> relocation = new LinkedHashMap<>()
List<String> options = []
def install(String... name) {
name.each { modules += it }
}
def options(String... opt) {
opt.each { options += it }
}
def exclude(String match) {
exclude += match
}

View File

@ -0,0 +1,183 @@
package io.izzel.taboolib.gradle
import groovy.transform.EqualsAndHashCode
import groovy.transform.TupleConstructor
import org.objectweb.asm.AnnotationVisitor
import org.objectweb.asm.Attribute
import org.objectweb.asm.Handle
import org.objectweb.asm.Label
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes
import org.objectweb.asm.TypePath
class TabooLibMethodVisitor extends MethodVisitor {
TabooLibClassVisitor classVisitor
TabooLibMethodVisitor(MethodVisitor methodVisitor, TabooLibClassVisitor classVisitor) {
super(Opcodes.ASM7, methodVisitor)
this.classVisitor = classVisitor
}
@Override
void visitParameter(String name, int access) {
super.visitParameter(name, access)
}
@Override
AnnotationVisitor visitAnnotationDefault() {
return super.visitAnnotationDefault()
}
@Override
AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return super.visitAnnotation(descriptor, visible)
}
@Override
AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String descriptor, boolean visible) {
return super.visitTypeAnnotation(typeRef, typePath, descriptor, visible)
}
@Override
void visitAnnotableParameterCount(int parameterCount, boolean visible) {
super.visitAnnotableParameterCount(parameterCount, visible)
}
@Override
AnnotationVisitor visitParameterAnnotation(int parameter, String descriptor, boolean visible) {
return super.visitParameterAnnotation(parameter, descriptor, visible)
}
@Override
void visitAttribute(Attribute attribute) {
super.visitAttribute(attribute)
}
@Override
void visitCode() {
super.visitCode()
}
@Override
void visitFrame(int type, int numLocal, Object[] local, int numStack, Object[] stack) {
super.visitFrame(type, numLocal, local, numStack, stack)
}
@Override
void visitInsn(int opcode) {
super.visitInsn(opcode)
}
@Override
void visitIntInsn(int opcode, int operand) {
super.visitIntInsn(opcode, operand)
}
@Override
void visitVarInsn(int opcode, int i) {
super.visitVarInsn(opcode, i)
}
@Override
void visitTypeInsn(int opcode, String type) {
super.visitTypeInsn(opcode, type)
}
@Override
void visitFieldInsn(int opcode, String owner, String name, String descriptor) {
super.visitFieldInsn(opcode, owner, name, descriptor)
}
@Override
void visitMethodInsn(int opcode, String owner, String name, String descriptor) {
super.visitMethodInsn(opcode, owner, name, descriptor)
}
@Override
void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) {
classVisitor.methodVisits.add(new MethodVisit(owner, name))
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface)
}
@Override
void visitInvokeDynamicInsn(String name, String descriptor, Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) {
super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments)
}
@Override
void visitJumpInsn(int opcode, Label label) {
super.visitJumpInsn(opcode, label)
}
@Override
void visitLabel(Label label) {
super.visitLabel(label)
}
@Override
void visitLdcInsn(Object value) {
super.visitLdcInsn(value)
}
@Override
void visitIincInsn(int i, int increment) {
super.visitIincInsn(i, increment)
}
@Override
void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) {
super.visitTableSwitchInsn(min, max, dflt, labels)
}
@Override
void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
super.visitLookupSwitchInsn(dflt, keys, labels)
}
@Override
void visitMultiANewArrayInsn(String descriptor, int numDimensions) {
super.visitMultiANewArrayInsn(descriptor, numDimensions)
}
@Override
AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String descriptor, boolean visible) {
return super.visitInsnAnnotation(typeRef, typePath, descriptor, visible)
}
@Override
void visitTryCatchBlock(Label start, Label end, Label handler, String type) {
super.visitTryCatchBlock(start, end, handler, type)
}
@Override
AnnotationVisitor visitTryCatchAnnotation(int typeRef, TypePath typePath, String descriptor, boolean visible) {
return super.visitTryCatchAnnotation(typeRef, typePath, descriptor, visible)
}
@Override
void visitLocalVariable(String name, String descriptor, String signature, Label start, Label end, int index) {
super.visitLocalVariable(name, descriptor, signature, start, end, index)
}
@Override
AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String descriptor, boolean visible) {
return super.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, descriptor, visible)
}
@Override
void visitLineNumber(int line, Label start) {
super.visitLineNumber(line, start)
}
@Override
void visitMaxs(int maxStack, int maxLocals) {
super.visitMaxs(maxStack, maxLocals)
}
@Override
void visitEnd() {
super.visitEnd()
}
}

View File

@ -22,7 +22,7 @@ class TabooLibPlugin implements Plugin<Project> {
project.tasks.jar.configure { Jar task ->
task.from(taboo.collect { it.isDirectory() ? it : project.zipTree(it) })
}
def kv = project.plugins.findPlugin("org.jetbrains.kotlin.jvm").kotlinPluginVersion.replaceAll("[.-]", "_")
def kv = project.plugins.findPlugin("org.jetbrains.kotlin.jvm").kotlinPluginVersion.replaceAll("[._-]", "")
def jarTask = project.tasks.jar as Jar
tabooTask.configure { RelocateJar task ->
task.tabooExt = tabooExt
@ -30,8 +30,10 @@ class TabooLibPlugin implements Plugin<Project> {
task.inJar = task.inJar ?: jarTask.archivePath
task.relocations = tabooExt.relocation
task.classifier = tabooExt.classifier
task.relocations['kotlin'] = 'taboolib.library.kotlin_' + kv
task.relocations['taboolib'] = project.group.toString() + '.taboolib'
if (!tabooExt.options.contains("skip-kotlin") && !tabooExt.options.contains("skip-kotlin-relocate")) {
task.relocations['kotlin.'] = 'kotlin' + kv + '.'
}
}
}
}

View File

@ -13,8 +13,8 @@ class BuilderBungee extends Builder {
write(body, description.lin.links['homepage'], 'website')
writeLine(body)
// authors
def con = description.con.contributors.collect { it.name }
writeList(body, con, 'authors')
def con = description.con.contributors.collect { it.name }.join(', ')
write(body, con, 'author')
writeLine(body)
// dependency
writeList(body, description.dep.dependencies

View File

@ -8,7 +8,6 @@ class BuilderVelocity extends Builder {
@Override
byte[] build(Description description, Project project) {
def json = new JsonArray()
def info = new JsonObject()
info.addProperty('id', project.name.toLowerCase())
info.addProperty('name', project.name)
@ -21,7 +20,6 @@ class BuilderVelocity extends Builder {
writeList(info, description.dep.dependencies
.findAll { it.with == null || it.with.equalsIgnoreCase('velocity') }
.collect { it.name }, 'dependencies')
json.add(info)
return bytes(json)
return bytes(info)
}
}

View File

@ -23,5 +23,10 @@ class Links {
this.url = url
return this
}
@Override
String toString() {
return url
}
}
}

View File

@ -2,23 +2,25 @@ package io.izzel.taboolib.gradle.description
enum Platforms {
BUKKIT('platform-bukkit', 'plugin.yml', new BuilderBukkit()),
BUKKIT('Bukkit', 'platform-bukkit', 'plugin.yml', new BuilderBukkit()),
NUKKIT('platform-nukkit', 'nukkit.yml', new BuilderNukkit()),
NUKKIT('Nukkit', 'platform-nukkit', 'nukkit.yml', new BuilderNukkit()),
BUNGEE('platform-bungee', 'bungee.yml', new BuilderBungee()),
BUNGEE('Bungee', 'platform-bungee', 'bungee.yml', new BuilderBungee()),
VELOCITY('platform-velocity', 'velocity-plugin.json', new BuilderVelocity()),
VELOCITY('Velocity', 'platform-velocity', 'velocity-plugin.json', new BuilderVelocity()),
SPONGE7('platform-sponge-api7', 'mcmod.info', new BuilderSponge7()),
SPONGE7('Sponge7', 'platform-sponge-api7', 'mcmod.info', new BuilderSponge7()),
SPONGE8('platform-sponge-api8', 'META-INF/plugins.json', new BuilderSponge8());
SPONGE8('Sponge8', 'platform-sponge-api8', 'META-INF/plugins.json', new BuilderSponge8());
String key
String module
String file
Builder builder
Platforms(module, file, builder) {
Platforms(key, module, file, builder) {
this.key = key
this.module = module
this.file = file
this.builder = builder

View File

@ -0,0 +1,19 @@
package io.izzel.taboolib.gradle;
import org.gradle.api.Project;
import java.io.InputStream;
/**
* taboolib-gradle-plugin
* io.izzel.taboolib.gradle.KotlinFactory
*
* @author sky
* @since 2021/8/14 1:43 下午
*/
public class Bridge {
public static OptimizeFileReader newOptimizeFileReader(Project project, InputStream inputStream) {
return new OptimizeFileReader(project, inputStream);
}
}

View File

@ -0,0 +1,134 @@
package io.izzel.taboolib.gradle
import com.google.gson.JsonParser
import org.gradle.api.Project
import java.io.InputStream
import java.nio.charset.StandardCharsets
/**
* taboolib-gradle-plugin
* io.izzel.taboolib.gradle.OptimizeFileReader
*
* @author sky
* @since 2021/8/14 1:18 下午
*/
class OptimizeFileReader(project: Project, input: InputStream) {
val optimize = ArrayList<Optimize>()
val group = ArrayList<Group>()
val exclude = ArrayList<String>()
init {
try {
val jsonSource = input.readBytes().toString(StandardCharsets.UTF_8)
val json = JsonParser.parseString(jsonSource).asJsonObject
if (json.has("optimize")) {
json.getAsJsonArray("optimize").forEach { ele ->
optimize += Optimize(
relocate(project, ele.asJsonObject["class"].asString),
Optimize.Type.valueOf(ele.asJsonObject["type"].asString)
)
}
}
if (json.has("group")) {
json.getAsJsonArray("group").forEach { ele ->
var depend: Group.Depend? = null
if (ele.asJsonObject.has("depend")) {
depend = Group.Depend(
ele.asJsonObject["depend"].asJsonObject["name"].asJsonArray.map { relocate(project, it.asString) },
ele.asJsonObject["depend"].asJsonObject["exclude"].asJsonArray.map { relocate(project, it.asString) }
)
}
group += Group(
ele.asJsonObject["check"].asJsonArray.map { relocate(project, it.asString) },
ele.asJsonObject["member"].asJsonArray.map { relocate(project, it.asString) },
ele.asJsonObject["exclude"]?.asJsonArray?.map { relocate(project, it.asString) }?.toList() ?: emptyList(),
depend,
Group.Mode.valueOf(ele.asJsonObject["mode"].asString)
)
}
}
if (json.has("exclude")) {
exclude += json.getAsJsonArray("exclude").map { relocate(project, it.asString) }
}
} catch (ex: Throwable) {
ex.printStackTrace()
}
}
fun relocate(project: Project, name: String): String {
return if (name.startsWith("taboolib")) {
project.group.toString().replace('.', '/') + '/' + name.replace('.', '/')
} else {
name.replace('.', '/')
}
}
fun exclude(name: String, use: Map<String, Set<String>>): Boolean {
if (exclude.any { name.startsWith(it) }) {
return true
}
if (group.any { it.exclude(name, use) }) {
return true
}
return false
}
class Optimize(val path: String, val type: Type) {
enum class Type {
METHOD
}
}
class Group(check: List<String>, member: List<String>, exclude: List<String>, val depend: Depend? = null, val mode: Mode) {
val check = check.platformFlatten()
val member = member.platformFlatten()
val exclude = exclude.platformFlatten()
class Depend(name: List<String>, exclude: List<String>) {
val name = name.platformFlatten()
val exclude = exclude.platformFlatten()
}
enum class Mode {
REMOVE
}
fun exclude(name: String, use: Map<String, Set<String>>): Boolean {
if (member.any { name.startsWith(it) }) {
if (depend != null) {
val fail = depend.name.any { n ->
val set = use[n]?.toMutableList() ?: ArrayList()
set.remove(n)
set.removeAll(depend.exclude)
set.isNotEmpty()
}
if (fail) {
return false
}
}
for (s in check) {
val set = use[s]?.toMutableList() ?: ArrayList()
set.remove(s)
set.removeAll(check)
set.removeAll(member)
set.removeAll(exclude)
if (set.isNotEmpty()) {
return false
}
}
return true
} else {
return false
}
}
}
}

View File

@ -0,0 +1,13 @@
package io.izzel.taboolib.gradle
val platforms = listOf("Bukkit", "Nukkit", "Bungee", "Sponge7", "Sponge8", "Velocity")
fun List<String>.platformFlatten(): List<String> {
return flatMap {
if (it.contains("{platform}")) {
platforms.map { p -> it.replace("{platform}", p) }
} else {
listOf(it)
}
}
}