From d77a012ca9dc9337463d488927b285f3a52b948d Mon Sep 17 00:00:00 2001
From: Tofaa <82680183+Tofaa2@users.noreply.github.com>
Date: Thu, 9 May 2024 23:57:15 +0400
Subject: [PATCH] Yeetus kotlin extensions
---
.idea/workspace.xml | 6 +-
kotlin/kotlin-extensions-spigot/build.gradle | 13 ----
.../entitylib/kotlin/EntityExtensions.kt | 71 -------------------
settings.gradle | 4 +-
4 files changed, 4 insertions(+), 90 deletions(-)
delete mode 100644 kotlin/kotlin-extensions-spigot/build.gradle
delete mode 100644 kotlin/kotlin-extensions-spigot/src/main/kotlin/me/tofaa/entitylib/kotlin/EntityExtensions.kt
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b1a67bd..c18a2ca 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,7 @@
-
-
-
+
@@ -55,6 +53,7 @@
+
@@ -312,6 +311,7 @@
+
diff --git a/kotlin/kotlin-extensions-spigot/build.gradle b/kotlin/kotlin-extensions-spigot/build.gradle
deleted file mode 100644
index 12d1029..0000000
--- a/kotlin/kotlin-extensions-spigot/build.gradle
+++ /dev/null
@@ -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)
-}
\ No newline at end of file
diff --git a/kotlin/kotlin-extensions-spigot/src/main/kotlin/me/tofaa/entitylib/kotlin/EntityExtensions.kt b/kotlin/kotlin-extensions-spigot/src/main/kotlin/me/tofaa/entitylib/kotlin/EntityExtensions.kt
deleted file mode 100644
index 101399a..0000000
--- a/kotlin/kotlin-extensions-spigot/src/main/kotlin/me/tofaa/entitylib/kotlin/EntityExtensions.kt
+++ /dev/null
@@ -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 {
- return EntityLib.getApi()!!
-}
-
-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().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);
-}
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index dde460f..522ac72 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,13 +7,11 @@ include 'api'
include 'platforms:spigot'
findProject(':platforms:spigot')?.name = 'spigot'
include 'common'
-include 'code-gen'
if (!Boolean.parseBoolean(System.getenv("JITPACK"))) {
+ include 'code-gen'
include 'test-plugin'
}
-include 'kotlin:kotlin-extensions-spigot'
-findProject(':kotlin:kotlin-extensions-spigot')?.name = 'kotlin-extensions-spigot'
include 'platforms:velocity'
findProject(':platforms:velocity')?.name = 'velocity'