-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed most of the syntax and added some new syntax. I might break s…
…ome stuff
- Loading branch information
Showing
22 changed files
with
163 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
.../bypixeltv/skcloudnet/elements/expressions/tasks/ExprAllPreparedCloudnetServicesOnTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package de.bypixeltv.skcloudnet.elements.expressions.tasks | ||
|
||
import ch.njol.skript.Skript | ||
import ch.njol.skript.lang.Expression | ||
import ch.njol.skript.lang.ExpressionType | ||
import ch.njol.skript.lang.SkriptParser | ||
import ch.njol.skript.lang.util.SimpleExpression | ||
import ch.njol.util.Kleenean | ||
import eu.cloudnetservice.driver.inject.InjectionLayer | ||
import eu.cloudnetservice.driver.provider.CloudServiceProvider | ||
import org.bukkit.event.Event | ||
|
||
|
||
class ExprAllPreparedCloudnetServicesOnTask : SimpleExpression<String>() { | ||
|
||
private val cnServiceProvider: CloudServiceProvider = InjectionLayer.ext().instance(CloudServiceProvider::class.java) | ||
|
||
companion object{ | ||
init { | ||
Skript.registerExpression( | ||
ExprAllPreparedCloudnetServicesOnTask::class.java, String::class.java, | ||
ExpressionType.SIMPLE, "[(all [[of] the]|the)] prepapred cloudnet services on [(the task|task|cloudnet task|the cloudnet task)] %string%") | ||
} | ||
} | ||
|
||
private var task: Expression<String>? = null | ||
|
||
override fun isSingle(): Boolean { | ||
return false | ||
} | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
override fun init( | ||
exprs: Array<Expression<*>>, | ||
matchedPattern: Int, | ||
isDelayed: Kleenean?, | ||
parseResult: SkriptParser.ParseResult? | ||
): Boolean { | ||
this.task = exprs[0] as Expression<String>? | ||
return true | ||
} | ||
override fun get(e: Event?): Array<String?>? { | ||
val task = this.task?.getSingle(e) | ||
val preparedServices = mutableListOf<String?>() | ||
if (task != null) { | ||
for (service in cnServiceProvider.servicesByTask(task)) { | ||
if (service.lifeCycle().name == "PREPARED") { | ||
preparedServices.add(service.name()) | ||
} | ||
} | ||
val preparedServicesArray = preparedServices.toTypedArray() | ||
return preparedServicesArray | ||
} | ||
return null | ||
} | ||
|
||
override fun getReturnType(): Class<out String> { | ||
return String::class.java | ||
} | ||
|
||
override fun toString(e: Event?, debug: Boolean): String { | ||
return "all prepared cloudnet services on task ${this.task?.getSingle(e)}" | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
...e/bypixeltv/skcloudnet/elements/expressions/tasks/ExprAllRunningCloudnetServicesOnTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package de.bypixeltv.skcloudnet.elements.expressions.tasks | ||
|
||
import ch.njol.skript.Skript | ||
import ch.njol.skript.lang.Expression | ||
import ch.njol.skript.lang.ExpressionType | ||
import ch.njol.skript.lang.SkriptParser | ||
import ch.njol.skript.lang.util.SimpleExpression | ||
import ch.njol.util.Kleenean | ||
import eu.cloudnetservice.driver.inject.InjectionLayer | ||
import eu.cloudnetservice.driver.provider.CloudServiceProvider | ||
import org.bukkit.event.Event | ||
|
||
|
||
class ExprAllRunningCloudnetServicesOnTask : SimpleExpression<String>() { | ||
|
||
private val cnServiceProvider: CloudServiceProvider = InjectionLayer.ext().instance(CloudServiceProvider::class.java) | ||
|
||
companion object{ | ||
init { | ||
Skript.registerExpression( | ||
ExprAllRunningCloudnetServicesOnTask::class.java, String::class.java, | ||
ExpressionType.SIMPLE, "[(all [[of] the]|the)] (running|started) cloudnet services on [(the task|task|cloudnet task|the cloudnet task)] %string%") | ||
} | ||
} | ||
|
||
private var task: Expression<String>? = null | ||
|
||
override fun isSingle(): Boolean { | ||
return false | ||
} | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
override fun init( | ||
exprs: Array<Expression<*>>, | ||
matchedPattern: Int, | ||
isDelayed: Kleenean?, | ||
parseResult: SkriptParser.ParseResult? | ||
): Boolean { | ||
this.task = exprs[0] as Expression<String>? | ||
return true | ||
} | ||
override fun get(e: Event?): Array<String?>? { | ||
val task = this.task?.getSingle(e) | ||
val preparedServices = mutableListOf<String?>() | ||
if (task != null) { | ||
for (service in cnServiceProvider.servicesByTask(task)) { | ||
if (service.lifeCycle().name == "RUNNING") { | ||
preparedServices.add(service.name()) | ||
} | ||
} | ||
val preparedServicesArray = preparedServices.toTypedArray() | ||
return preparedServicesArray | ||
} | ||
return null | ||
} | ||
|
||
override fun getReturnType(): Class<out String> { | ||
return String::class.java | ||
} | ||
|
||
override fun toString(e: Event?, debug: Boolean): String { | ||
return "all cloudnet services on task ${this.task?.getSingle(e)}" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters