()
+ fun listener(event: PlayerSettingsChangeEvent, api: LangApiImpl) {
+ if (!locales.containsKey(event.player)) {
+ locales[event.player] = event.player.locale
+ MinecraftServer.getGlobalEventHandler().call(
+ PlayerLanguageChangeEvent(
+ event.player,
+ event.player.locale!!, true
+ )
+ )
+ }
+ if (locales[event.player] != event.player.locale) {
+ locales[event.player] = event.player.locale
+ if (api.isClientLocale(event.player)) MinecraftServer.getGlobalEventHandler().call(
+ PlayerLanguageChangeEvent(
+ event.player,
+ event.player.locale!!, true
+ )
+ )
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/org/hypejet/hype/location/Location.kt b/src/main/kotlin/org/hypejet/hype/location/Location.kt
new file mode 100644
index 0000000..36ca1d1
--- /dev/null
+++ b/src/main/kotlin/org/hypejet/hype/location/Location.kt
@@ -0,0 +1,6 @@
+package org.hypejet.hype.location
+
+import net.minestom.server.coordinate.Pos
+import net.minestom.server.instance.Instance
+
+data class Location(val instance: Instance, val pos: Pos){}
\ No newline at end of file
diff --git a/src/main/kotlin/org/hypejet/hype/permission/GlobalPermissionProvider.kt b/src/main/kotlin/org/hypejet/hype/permission/GlobalPermissionProvider.kt
new file mode 100644
index 0000000..6f74537
--- /dev/null
+++ b/src/main/kotlin/org/hypejet/hype/permission/GlobalPermissionProvider.kt
@@ -0,0 +1,26 @@
+package org.hypejet.hype.permission
+
+import net.minestom.server.entity.Player
+
+object GlobalPermissionProvider {
+ /**
+ * Check if the player has a root permission. Uses op level 4 by default.
+ * @param player the player
+ * @param permission The permission to check
+ * @return if the player has the permission
+ */
+ fun hasPermission(player: Player, permission: String?): Boolean {
+ return player.hasPermission("*") || player.hasPermission(permission!!) || player.permissionLevel >= 4
+ }
+
+ /**
+ * Check if the player has a root permission.
+ * @param player the player
+ * @param permission The permission to check
+ * @param opLevel the minimum permission level where the player bypasses permission check.
+ * @return if the player has the permission
+ */
+ fun hasPermission(player: Player, permission: String?, opLevel: Int): Boolean {
+ return player.hasPermission("*") || player.hasPermission(permission!!) || player.permissionLevel >= opLevel
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/org/hypejet/hype/permission/PermissionProvider.kt b/src/main/kotlin/org/hypejet/hype/permission/PermissionProvider.kt
new file mode 100644
index 0000000..ff2f10b
--- /dev/null
+++ b/src/main/kotlin/org/hypejet/hype/permission/PermissionProvider.kt
@@ -0,0 +1,113 @@
+package org.hypejet.hype.permission
+
+import net.minestom.server.entity.Player
+
+open class PermissionProvider {
+ /**
+ * Permission
+ */
+ //@Getter Kotlin does not support lombok yet
+ var extensionPermission: String
+
+ /**
+ *
+ * The minimum permission level where the player bypasses permission check.
+ * 1-4, 5 to disable.
+
*
+ */
+ //@Getter Kotlin does not support lombok yet
+ //@Setter Kotlin does not support lombok yet
+ var opLevell: Int
+ open fun getOpLevel(): Int {
+ return opLevell
+ }
+ open fun setOpLevel(lvl: Int) {
+ opLevell = lvl
+ }
+
+ /**
+ * Creates a new PermissionProvider
+ * @param extensionPermission The permission that this that will be checked
+ */
+ constructor(extensionPermission: String) {
+ this.extensionPermission = extensionPermission
+ opLevell = 4
+ }
+
+ /**
+ * Creates a new PermissionProvider
+ * @param opLevel The permission level where a player will be able to bypass permissions
+ * @param extensionPermission The permission that this that will be checked
+ */
+ constructor(opLevel: Int, extensionPermission: String) {
+ this.extensionPermission = extensionPermission
+ this.opLevell = opLevel
+ }
+
+ /**
+ * Replaces permission with new permissions
+ * @param extensionPermission The new permissions
+ */
+ open fun updatePermissions(extensionPermission: String) {
+ this.extensionPermission = extensionPermission
+ opLevell = 4
+ }
+
+ /**
+ * Replaces permission with new permissions
+ * @param opLevel the new op level
+ * @param extensionPermission The new permissions
+ */
+ open fun updatePermissions(opLevel: Int, extensionPermission: String) {
+ this.extensionPermission = extensionPermission
+ this.opLevell = opLevel
+ }
+
+ /**
+ * Checks if the player has a subpermission
+ * @param player the player to check
+ * @param permission the permission
+ * @return if the player has the permission
+ */
+ fun hasPermission(player: Player, permission: String): Boolean {
+ return if (player.hasPermission("*") || player.permissionLevel >= opLevell) true else player.hasPermission("$extensionPermission.*") || player.hasPermission(
+ "$extensionPermission.$permission"
+ )
+ }
+
+ /**
+ * Checks if the player has one of the provider permissions
+ * @param player the player to check
+ * @return if the player has permission
+ */
+ fun hasPermission(player: Player): Boolean {
+ return if (player.hasPermission("*") || player.permissionLevel >= opLevell) true else player.hasPermission(
+ extensionPermission
+ )
+ }
+
+ /**
+ * Checks if the player has a subpermission
+ * @param player the player to check
+ * @param permission the permission
+ * @param opLevel override the default provider op level
+ * @return if the player has the permission
+ */
+ fun hasPermission(player: Player, permission: String, opLevel: Int): Boolean {
+ return if (player.hasPermission("*") || player.permissionLevel >= opLevel) true else player.hasPermission("$extensionPermission.*") || player.hasPermission(
+ "$extensionPermission.$permission"
+ )
+ }
+
+ /**
+ * Checks if the player has one of the provider permissions
+ * @param player the player to check
+ * @param opLevel override the default provider op level
+ * @return if the player has permission
+ */
+ fun hasPermission(player: Player, opLevel: Int): Boolean {
+ return if (player.hasPermission("*") || player.permissionLevel >= opLevel) true else player.hasPermission(
+ extensionPermission
+ )
+ }
+}
diff --git a/src/main/kotlin/org/hypejet/hype/permission/SubPermission.kt b/src/main/kotlin/org/hypejet/hype/permission/SubPermission.kt
new file mode 100644
index 0000000..5d9d59a
--- /dev/null
+++ b/src/main/kotlin/org/hypejet/hype/permission/SubPermission.kt
@@ -0,0 +1,51 @@
+package org.hypejet.hype.permission
+
+class SubPermission : PermissionProvider {
+ /**
+ * The parent permission.
+ */
+ //@Getter Kotlin does not support lombok yet
+ var parent: PermissionProvider
+
+ /**
+ * Creates a new subpermission
+ * @param parent The parent permission can be either a permission provider or a SubPermission
+ * @param extensionPermission The permission that this that will be checked
+ */
+ constructor(
+ parent: PermissionProvider,
+ extensionPermission: String
+ ) : super(parent.extensionPermission + "." + extensionPermission) {
+ this.parent = parent
+ }
+
+ /**
+ * Creates a new subpermission
+ * @param parent The parent permission can be either a permission provider or a SubPermission
+ * @param opLevel The permission level where a player will be able to bypass permissions
+ * @param extensionPermission The permission that will be checked
+ */
+ constructor(parent: PermissionProvider, opLevel: Int, extensionPermission: String) : super(
+ opLevel,
+ parent.extensionPermission + "." + extensionPermission
+ ) {
+ this.parent = parent
+ }
+
+ /**
+ * Replaces permission with new permissions
+ * @param extensionPermission The new permission
+ */
+ override fun updatePermissions(extensionPermission: String) {
+ super.updatePermissions(parent.extensionPermission + "." + extensionPermission)
+ }
+
+ /**
+ * Replaces permission with new permissions
+ * @param opLevel the new op level
+ * @param extensionPermission The new permission
+ */
+ override fun updatePermissions(opLevel: Int, extensionPermission: String) {
+ super.updatePermissions(opLevel, parent.extensionPermission + "." + extensionPermission)
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/org/hypejet/hype/runnable/MinestomRunnable.kt b/src/main/kotlin/org/hypejet/hype/runnable/MinestomRunnable.kt
new file mode 100644
index 0000000..74ae674
--- /dev/null
+++ b/src/main/kotlin/org/hypejet/hype/runnable/MinestomRunnable.kt
@@ -0,0 +1,52 @@
+package org.hypejet.hype.runnable
+
+import net.minestom.server.MinecraftServer
+import net.minestom.server.timer.ExecutionType
+import net.minestom.server.timer.Task
+import net.minestom.server.timer.TaskSchedule
+import java.time.Duration
+
+abstract class MinestomRunnable : Runnable {
+ private var task: Task? = null
+ private var delay = TaskSchedule.immediate()
+ private var repeat = TaskSchedule.stop()
+ private var executionType = ExecutionType.SYNC
+
+ constructor()
+ constructor(delay: TaskSchedule, repeat: TaskSchedule) {
+ this.delay = delay
+ this.repeat = repeat
+ }
+
+ fun delay(delay: Duration) {
+ if (delay === Duration.ZERO) return
+ this.delay = TaskSchedule.duration(delay)
+ }
+
+ fun delay(delay: TaskSchedule) {
+ this.delay = delay
+ }
+
+ fun repeat(repeat: Duration) {
+ if (repeat === Duration.ZERO) return
+ this.repeat = TaskSchedule.duration(repeat)
+ }
+
+ fun repeat(repeat: TaskSchedule) {
+ this.repeat = repeat
+ }
+
+ fun type(type: ExecutionType) {
+ executionType = type
+ }
+
+ fun schedule(): Task {
+ val manager = MinecraftServer.getSchedulerManager()
+ task = manager.scheduleTask(this, delay, repeat, executionType)
+ return task as Task
+ }
+
+ fun cancel() {
+ if (task != null) task!!.cancel()
+ }
+}
diff --git a/src/main/kotlin/org/hypejet/hype/tablist/GlobalTablist.kt b/src/main/kotlin/org/hypejet/hype/tablist/GlobalTablist.kt
new file mode 100644
index 0000000..f45d801
--- /dev/null
+++ b/src/main/kotlin/org/hypejet/hype/tablist/GlobalTablist.kt
@@ -0,0 +1,55 @@
+package org.hypejet.hype.tablist
+
+import lombok.Getter
+import lombok.Setter
+import net.kyori.adventure.text.Component
+import net.kyori.adventure.text.JoinConfiguration
+import net.minestom.server.entity.Player
+
+class GlobalTablist : Tablist() {
+ override fun createPlayerList(player: Player?): Array?> {
+ return arrayOfNulls>(2)
+ }
+
+ @Getter
+ @Setter
+ private val header = ArrayList()
+
+ @Getter
+ @Setter
+ private val footer = ArrayList()
+ fun addHeaderLine(line: Component) {
+ header.add(line)
+ }
+
+ fun addFooterLine(line: Component) {
+ footer.add(line)
+ }
+
+ fun removeHeaderLine(line: Component) {
+ header.remove(line)
+ }
+
+ fun removeFooterLine(line: Component) {
+ footer.remove(line)
+ }
+
+ fun removeHeaderLine(line: Int) {
+ header.removeAt(line)
+ }
+
+ fun removeFooterLine(line: Int) {
+ footer.removeAt(line)
+ }
+
+ override fun refresh() {
+ val str1 = Component.join(JoinConfiguration.separator(Component.text("\n")), header)
+ val str2 = Component.join(JoinConfiguration.separator(Component.text("\n")), footer)
+
+ //Class extends Tablist> cls = this.getClass();
+ for (player in players) {
+ //str1.replaceText(TextReplacementConfig.builder().match(Pattern.compile("$.*@")).replacement().build());
+ player.sendPlayerListHeaderAndFooter(str1, str2)
+ }
+ }
+}
diff --git a/src/main/kotlin/org/hypejet/hype/tablist/Tablist.kt b/src/main/kotlin/org/hypejet/hype/tablist/Tablist.kt
new file mode 100644
index 0000000..bed0b0f
--- /dev/null
+++ b/src/main/kotlin/org/hypejet/hype/tablist/Tablist.kt
@@ -0,0 +1,50 @@
+package org.hypejet.hype.tablist
+
+import lombok.Getter
+import net.kyori.adventure.text.Component
+import net.kyori.adventure.text.JoinConfiguration
+import net.minestom.server.entity.Player
+
+abstract class Tablist {
+ @Getter
+ var players = ArrayList()
+ abstract fun createPlayerList(player: Player?): Array?>
+ fun addPlayer(player: Player) {
+ players.add(player)
+ }
+
+ fun removePlayer(player: Player) {
+ players.remove(player)
+ }
+
+ fun removePlayer(player: Int) {
+ players.removeAt(player)
+ }
+
+ open fun refresh() {
+
+ //Class extends Tablist> cls = this.getClass();
+ for (player in players) {
+ val arr = createPlayerList(player)
+ if (arr.size != 2) {
+ throw RuntimeException("Array size must be 2!")
+ }
+ var str1: Component = Component.empty()
+ if(arr[0] != null) {
+ str1 = Component.join(
+ JoinConfiguration.separator(Component.text("\n")),
+ arr[0]!!
+ )
+ }
+ var str2: Component = Component.empty()
+ if(arr[1] != null) {
+ str2 = Component.join(
+ JoinConfiguration.separator(Component.text("\n")),
+ arr[1]!!
+ )
+ }
+ //str1.replaceText(TextReplacementConfig.builder().match(Pattern.compile("$.*@")).replacement().build());
+ player.sendPlayerListHeaderAndFooter(str1, str2)
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/org/hypejet/hype/utils/ChatUtil.kt b/src/main/kotlin/org/hypejet/hype/utils/ChatUtil.kt
new file mode 100644
index 0000000..f554dc5
--- /dev/null
+++ b/src/main/kotlin/org/hypejet/hype/utils/ChatUtil.kt
@@ -0,0 +1,11 @@
+package org.hypejet.hype.utils
+
+import net.kyori.adventure.text.Component
+import net.kyori.adventure.text.format.TextDecoration
+import net.kyori.adventure.text.minimessage.MiniMessage
+
+object ChatUtil {
+ fun format(message: String): Component {
+ return MiniMessage.miniMessage().deserialize(message).decoration(TextDecoration.ITALIC, false)
+ }
+}