Coder Social home page Coder Social logo

highright1234 / shotokonoko Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 2.0 276 KB

Utilities for Paper and BungeeCord plugin with Kotlin

Home Page: https://github.com/highright1234/shotokonoko/wiki

License: Other

Kotlin 100.00%
async bukkit-library bungeecord-library kotlin minecraft paper spigot suspend coroutines dsl

shotokonoko's Introduction

Shotokonoko

Maven Central Maven Central

Utilities for Paper Kotlin plugin

이름은 이렇지만 당신도 쓰게될거야

특징:

  • monun님의 라이브러리들의 DSL 빌더의 실행부분을 suspend 형식 지원
  • kommand 느낌의 papi expansion dsl builder
  • MutableDelay( 한글로 뭐라고 할지 모르겠음 )
  • 스토리지 기능
    • Json, MongoDB 지원
  • 채팅 스캐너
  • 코틀린을 위한 리스닝 최적화
  • 플레이어 데이터 자동제거 collection
  • DynamicLoader(central 이외의 RemoteRepository서버 이용가능)
  • BungeeUtil
  • PluginMessageUtil
  • 번지코드 config api

TODO:

  • storage 업그레이드
  • MutableDelay 최적화
  • 버킷의 문제인지 라이브러리의 문제인진 모르겠지만
    1틱정도 후에 리스너가 실행되는것같음

예제:

사용법

build.gradle.kts

kotlin {
  jvmToolchain {
    languageVersion.set(JavaLanguageVersion.of(17))
  }
}

repositories {
    mavenCentral()
}

dependencies {
    // for bukkit
    compileOnly("io.github.highright1234:shotokonoko-bukkit:VERSION")
    // for bungee
    compileOnly("io.github.highright1234:shotokonoko-bungee:VERSION")
}

plugin.yml

libraries:
  - io.github.highright1234:shotokonoko-bukkit:VERSION

bungee.yml

libraries:
  - io.github.highright1234:shotokonoko-bungee:VERSION

대충 버킷 코드

kommand {
  register("command") {
    suspendingExecutes {
      ...
    }
  }
}

papi {
  expansion("placeholder") {
    argument("value") {
      executes {
        val value: String by arguments
        value
      }
    }
  }
}

val players = newPlayerArrayList() // it removes a player who exit
val cooldownData = CooldownAttribute<UUID>(5000L)

...

val event = listen<PlayerJoinEvent> { it.player.name == "HighRight" }
val player = event.player
// 쿨다운중 아니면 아래 코드들 실행함
cooldownData.withCoolDown(player.uniqueId) {
  return
}
val storage = withContext(plugin.asyncDispatcher) {
    getDataStore("${player.uniqueId}")
}
player.sendMessage("비밀 이야기 해봐")
// 10초 지나면 밑에 코드들 작동 안함
ChatScanner(player).await().onSuccess { component ->
  val chat = component.string // Component to String
  Bukkit.broadcast(text("<${player.name}> $chat"))
  storage.set("secret", chat)
  events<EntityDamageEvent>().filter { it.entity == player }.collect {
    event.player.sendMessage("허접♥")    
  }
}.onFailture { throwable ->
  when (throwable) {
    is TimeoutCancellationException {
      ...
    }
    is PlayerQuitException {
      ...
    }
  }
}

shotokonoko's People

Contributors

highright1234 avatar r2turntrue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.