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
import br.com.devsrsouza.kotlinbukkitapi.attributestorage.setStorageData | |
import br.com.devsrsouza.kotlinbukkitapi.dsl.item.meta | |
import org.bukkit.inventory.ItemStack | |
import org.bukkit.inventory.meta.ItemMeta | |
import java.util.* | |
class EnchantmentCustom( | |
val uuid: UUID, | |
val name: String, | |
val maxLevel: Int |
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
class Root<E>(var value: E, var root: Root<E>?, var left: Root<E>? = null, var right: Root<E>? = null) | |
enum class Ordem { V, R, L } | |
interface IBinaryTree<E> { | |
val size: Int | |
fun insert(element: 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
/** | |
* @author DevSrSouza | |
* github: https://github.com/DevSrSouza | |
* twitter: https://twitter.com/DevSrSouza | |
*/ | |
val BLOCK_NAMES_PT_BR = mapOf( | |
MaterialData(Material.ACACIA_FENCE, 0) to "Cerca de Acácia", | |
MaterialData(Material.ACACIA_FENCE_GATE, 0) to "Portão de Acácia", | |
MaterialData(Material.ACTIVATOR_RAIL, 0) to "Trilho Ativador", |
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
import br.com.devsrsouza.kotlinbukkitapi.server.extensions.itemFromByteArray | |
import br.com.devsrsouza.kotlinbukkitapi.server.extensions.toByteArray | |
import org.bukkit.inventory.ItemStack | |
import org.jetbrains.exposed.dao.Entity | |
import org.jetbrains.exposed.sql.Column | |
import java.sql.Blob | |
import javax.sql.rowset.serial.SerialBlob | |
import kotlin.reflect.KProperty | |
fun Entity<*>.itemStack(column: Column<Blob>) = ItemStackExposedDelegate(column) |
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
fun <T : CommandSender> Executor<T>.argumentExecutorBuilder( | |
posIndex: Int = 1, | |
label: String | |
) = Executor( | |
sender, | |
[email protected] + " " + label, | |
runCatching { args.sliceArray(posIndex..args.size) }.getOrDefault((emptyArray())), | |
command | |
) |
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
package br.com.devsrsouza.kotlinbukkitapi.controllers | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.runBlocking | |
import java.util.concurrent.ConcurrentHashMap | |
import kotlin.coroutines.CoroutineContext | |
import kotlin.coroutines.coroutineContext | |
import kotlin.system.measureTimeMillis | |
fun main() { |
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
import android.app.Service | |
import android.content.ComponentName | |
import android.content.Context | |
import android.content.Intent | |
import android.content.ServiceConnection | |
import android.os.IBinder | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.suspendCoroutine | |
suspend inline fun <reified S : Service, B : IBinder> Context.connectService( |
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
inline fun <T> List<T>.selectRouletteWheelWithMinimum( | |
min: Double = 100.0, | |
sum: (T) -> Double | |
): T? { | |
if(isEmpty()) return null | |
val total = reversed().sumByDouble(sum) | |
val random = (Math.random() * if(total > min) total else min) |
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
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.ListAdapter | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.viewbinding.ViewBinding | |
typealias InflateBindingCallback<BINDING> = (LayoutInflater, ViewGroup, viewType: Int) -> BINDING | |
typealias GetViewFromBindingCallback<BINDING> = (BINDING) -> View |