Yeetus kotlin extensions
This commit is contained in:
parent
5cbb05d30d
commit
d77a012ca9
4 changed files with 4 additions and 90 deletions
|
@ -4,9 +4,7 @@
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="9d5d9b6f-43c8-41a4-bb42-a66ffc96c9b0" name="Changes" comment="">
|
<list default="true" id="9d5d9b6f-43c8-41a4-bb42-a66ffc96c9b0" name="Changes" comment="" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
</list>
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
@ -55,6 +53,7 @@
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="HighlightingSettingsPerFile">
|
<component name="HighlightingSettingsPerFile">
|
||||||
|
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.2.1/c70f2380ee7c60be444e22a10e679577ab9f8afa/api-2.2.1-default.jar!/com/github/retrooper/packetevents/protocol/item/ItemStack.class" root0="SKIP_INSPECTION" />
|
||||||
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.2.1/c70f2380ee7c60be444e22a10e679577ab9f8afa/api-2.2.1-default.jar!/com/github/retrooper/packetevents/protocol/player/TextureProperty.class" root0="SKIP_INSPECTION" />
|
<setting file="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.github.retrooper.packetevents/api/2.2.1/c70f2380ee7c60be444e22a10e679577ab9f8afa/api-2.2.1-default.jar!/com/github/retrooper/packetevents/protocol/player/TextureProperty.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" />
|
<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" />
|
||||||
<setting file="jar://$USER_HOME$/.jdks/corretto-17.0.10/lib/src.zip!/java.base/java/util/List.java" root0="SKIP_INSPECTION" />
|
<setting file="jar://$USER_HOME$/.jdks/corretto-17.0.10/lib/src.zip!/java.base/java/util/List.java" root0="SKIP_INSPECTION" />
|
||||||
|
@ -312,6 +311,7 @@
|
||||||
<workItem from="1709142473633" duration="2565000" />
|
<workItem from="1709142473633" duration="2565000" />
|
||||||
<workItem from="1714477887801" duration="3618000" />
|
<workItem from="1714477887801" duration="3618000" />
|
||||||
<workItem from="1714566597065" duration="351000" />
|
<workItem from="1714566597065" duration="351000" />
|
||||||
|
<workItem from="1715283453023" duration="949000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
plugins {
|
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly(project(":platforms:spigot"))
|
|
||||||
compileOnly('com.github.retrooper.packetevents:spigot:2.0.2')
|
|
||||||
compileOnly('org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT')
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlin {
|
|
||||||
jvmToolchain(8)
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
package me.tofaa.entitylib.kotlin
|
|
||||||
|
|
||||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper
|
|
||||||
import io.github.retrooper.packetevents.util.SpigotConversionUtil
|
|
||||||
import me.tofaa.entitylib.EntityLib
|
|
||||||
import me.tofaa.entitylib.EntityLibAPI
|
|
||||||
import me.tofaa.entitylib.Platform
|
|
||||||
import me.tofaa.entitylib.spigot.SpigotEntityLibAPI
|
|
||||||
import me.tofaa.entitylib.wrapper.WrapperEntity
|
|
||||||
import me.tofaa.entitylib.wrapper.WrapperEntityEquipment
|
|
||||||
import org.bukkit.Location
|
|
||||||
import org.bukkit.entity.Entity
|
|
||||||
import org.bukkit.inventory.ItemStack
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin
|
|
||||||
|
|
||||||
fun JavaPlugin.getEntityLibApi(): EntityLibAPI<SpigotEntityLibAPI> {
|
|
||||||
return EntityLib.getApi<SpigotEntityLibAPI>()!!
|
|
||||||
}
|
|
||||||
|
|
||||||
fun JavaPlugin.getEntityLibPlatform(): Platform<*> {
|
|
||||||
return EntityLib.getPlatform()!!
|
|
||||||
}
|
|
||||||
|
|
||||||
fun WrapperEntity.asBukkitEntity(location: Location): Entity {
|
|
||||||
val world = location.world ?: throw IllegalArgumentException("Location world is null");
|
|
||||||
val entity = world.spawnEntity(location, SpigotConversionUtil.toBukkitEntityType(this.entityType));
|
|
||||||
// TODO: Copy entity data
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
fun WrapperEntity.sendPacketToViewersAndCallback(packet: PacketWrapper<*>, callback: () -> Unit) {
|
|
||||||
this.sendPacketsToViewers(packet);
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
|
|
||||||
fun WrapperEntity.sendPacketsToViewersAndCallback(vararg packets: PacketWrapper<*>, callback: () -> Unit) {
|
|
||||||
this.sendPacketsToViewers(*packets);
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Entity.asWrapperEntity(location: Location): WrapperEntity {
|
|
||||||
return EntityLib.getApi<SpigotEntityLibAPI>().cloneEntity(this, SpigotConversionUtil.fromBukkitLocation(location));
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Entity.asWrapperEntity(): WrapperEntity {
|
|
||||||
return asWrapperEntity(this.location);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun WrapperEntityEquipment.setMainHand(stack: ItemStack) {
|
|
||||||
this.mainHand = SpigotConversionUtil.fromBukkitItemStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun WrapperEntityEquipment.setOffHand(stack: ItemStack) {
|
|
||||||
this.offhand = SpigotConversionUtil.fromBukkitItemStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun WrapperEntityEquipment.setHelmet(stack: ItemStack) {
|
|
||||||
this.helmet = SpigotConversionUtil.fromBukkitItemStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun WrapperEntityEquipment.setChestplate(stack: ItemStack) {
|
|
||||||
this.chestplate = SpigotConversionUtil.fromBukkitItemStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun WrapperEntityEquipment.setLeggings(stack: ItemStack) {
|
|
||||||
this.leggings = SpigotConversionUtil.fromBukkitItemStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
fun WrapperEntityEquipment.setBoots(stack: ItemStack) {
|
|
||||||
this.boots = SpigotConversionUtil.fromBukkitItemStack(stack);
|
|
||||||
}
|
|
|
@ -7,13 +7,11 @@ include 'api'
|
||||||
include 'platforms:spigot'
|
include 'platforms:spigot'
|
||||||
findProject(':platforms:spigot')?.name = 'spigot'
|
findProject(':platforms:spigot')?.name = 'spigot'
|
||||||
include 'common'
|
include 'common'
|
||||||
include 'code-gen'
|
|
||||||
|
|
||||||
if (!Boolean.parseBoolean(System.getenv("JITPACK"))) {
|
if (!Boolean.parseBoolean(System.getenv("JITPACK"))) {
|
||||||
|
include 'code-gen'
|
||||||
include 'test-plugin'
|
include 'test-plugin'
|
||||||
}
|
}
|
||||||
include 'kotlin:kotlin-extensions-spigot'
|
|
||||||
findProject(':kotlin:kotlin-extensions-spigot')?.name = 'kotlin-extensions-spigot'
|
|
||||||
include 'platforms:velocity'
|
include 'platforms:velocity'
|
||||||
findProject(':platforms:velocity')?.name = 'velocity'
|
findProject(':platforms:velocity')?.name = 'velocity'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue