Skip to content

Instantly share code, notes, and snippets.

View entrypointkr's full-sized avatar

Junhyung Im entrypointkr

View GitHub Profile
@entrypointkr
entrypointkr / BukkitBossBar.kt
Last active January 23, 2024 12:03
Bukkit boss bar immutable util
import org.bukkit.Bukkit
import org.bukkit.boss.BarColor
import org.bukkit.boss.BarStyle
import org.bukkit.boss.BossBar
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerQuitEvent
import org.bukkit.plugin.Plugin
import org.bukkit.scheduler.BukkitRunnable
@entrypointkr
entrypointkr / build.sbt
Last active February 15, 2022 13:39
sbt exclude scala 3 library
// https://github.com/sbt/sbt-assembly#excluding-scala-library-jars
assembly / assemblyExcludedJars := {
val cp = (assembly / fullClasspath).value
cp filter { attr =>
val name = attr.data.getName
name.startsWith("scala-") || name.startsWith("scala3-")
}
}
@entrypointkr
entrypointkr / JavaCVPlayer.java
Last active April 4, 2022 08:24
Minecraft draw video frame using JavaCV, OpenGL
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Frame;
import org.bytedeco.javacv.FrameGrabber;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL30;
import javax.sound.sampled.*;
import java.awt.image.*;
import java.io.File;
@entrypointkr
entrypointkr / Agent.java
Last active May 24, 2021 02:23
Java Byte Code Instrumentation Example
package kr.rvs.instrumentation;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.lang.instrument.ClassDefinition;
import java.lang.instrument.Instrumentation;
/**
* Created by Junhyeong Lim on 2017-02-02.
*/
@entrypointkr
entrypointkr / auto_include.ms
Created December 15, 2016 16:47
CommandHelper subset_of() example
/* 아이템 배열 비교 */
@parent = array('type': 32, 'meta': array(
'lore': array('a', 'b', 'c'),
'display': 'Test'
))
@item = array('data': 0, 'type': 32, 'qty': 10, 'flags': array(), 'meta': array(
'lore': array('a', 'b', 'c'),
'display': 'Test'
))
if (_subset_of(@parent, @item)) {
@entrypointkr
entrypointkr / main.ms
Created December 15, 2016 16:34
CommandHelper TabAutoComplete
@key = 'registered_aliases';
@prevAliases = get_value(@key);
# Ensure
if (!@prevAliases) {
@prevAliases = array();
}
set_timeout(0, closure() {
@completes = array();
foreach (@alias in get_aliases()) {
@name = substr(
@entrypointkr
entrypointkr / auto_include.ms
Last active March 8, 2017 03:57
CommandHelper subset_of() Procedure
proc _subset_of(@arrayA, @arrayB) {
if (!is_array(@arrayA) || !is_array(@arrayB) ||
is_associative(@arrayA) != is_associative(@arrayB)) {
return(false)
}
foreach (@key : @valueA in @arrayA) {
@valueB = array_get(@arrayB, @key, null)
if (@valueB == null
|| typeof(@valueB) != typeof(@valueA)) {
return(false)
/* _take_item() 예제:
# if (_take_item(player(), 아이템)) {
# msg('아이템 1개를 뺐었습니다.')
# } else {
# msg('아이템 1개가 부족합니다.')
# }
# if (_take_item(player(), 아이템, 100)) {
# msg('아이템 100 개를 뺐었습니다.')
# } else {
/* aliases.msa (파일) */
*:/opchat = >>>
/*
# @isOpChat 변수에 닉네임.opchat 라는 전역변수의 값을 넣습니다.
# 커맨드헬퍼는 'test' 'abc' 를 할 경우 test 와 abc 사이의 공백과 무관하게
# 두 값을 띄워주는데, (마침표) . 를 사이에 넣을 경우 값을 붙여줍니다.
# 예: msg('test' 'abc') test abc
# 예: msg('test''abc') test abc