Skip to content

Commit

Permalink
[2.4-pre1] migrate to TabooLib 6.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Micalhl committed Aug 16, 2021
1 parent 8f6c9dc commit 15a0e4e
Show file tree
Hide file tree
Showing 55 changed files with 715 additions and 575 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.gradle
.idea
build
12 changes: 0 additions & 12 deletions .idea/TrHologram.iml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

12 changes: 12 additions & 0 deletions .idea/modules/TrHologram.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/modules/TrHologram.test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 0 additions & 70 deletions build.gradle

This file was deleted.

53 changes: 53 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
plugins {
id("java")
id("io.izzel.taboolib") version "1.18"
id("org.jetbrains.kotlin.jvm") version "1.5.10"
}

group = "me.arasple.mc.trhologram"
version = "2.4-pre1"
description = "Modern & Advanced Hologram-Plugin for Minecraft Servers"

taboolib {
install(
"common",
"common-5",
"platform-bukkit",
"module-configuration",
"module-chat",
"module-lang",
"module-nms",
"module-nms-util",
"module-metrics",
"module-kether"
)

description {
contributors {
name("Arasple")
}
dependencies {
name("PlaceholderAPI").optional(true)
}
}

classifier = null
version = "6.0.0-pre48"
}

repositories {
mavenCentral()
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://repo.codemc.org/repository/maven-public")
}

dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-stdlib")
compileOnly("ink.ptms.core:v11604:11604:all")
compileOnly("ink.ptms.core:v11600:11600:all")
compileOnly("ink.ptms.core:v11300:11300:all")
compileOnly("ink.ptms.core:v11200:11200:all")
compileOnly("ink.ptms.core:v10900:10900:all")
compileOnly("me.clip:placeholderapi:2.10.9")
compileOnly(fileTree("libs"))
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 0 additions & 2 deletions settings.gradle

This file was deleted.

2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = "TrHologram"

24 changes: 14 additions & 10 deletions src/main/kotlin/me/arasple/mc/trhologram/TrHologram.kt
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
package me.arasple.mc.trhologram

import io.izzel.taboolib.Version
import io.izzel.taboolib.loader.Plugin
import io.izzel.taboolib.loader.PluginBoot
import io.izzel.taboolib.module.locale.TLocale
import me.arasple.mc.trhologram.api.Settings
import me.arasple.mc.trhologram.module.conf.HologramLoader
import me.arasple.mc.trhologram.module.display.Hologram
import org.bukkit.Bukkit

import taboolib.common.platform.Plugin
import taboolib.common.platform.function.console
import taboolib.common.platform.function.disablePlugin
import taboolib.common.platform.function.pluginVersion
import taboolib.module.lang.sendLang
import taboolib.module.nms.MinecraftVersion
import taboolib.platform.BukkitPlugin

/**
* @author Arasple
* @date 2021/1/25 12:11
*/
object TrHologram : Plugin() {

val plugin by lazy { BukkitPlugin.getInstance() }

override fun onLoad() {
TLocale.sendToConsole("Plugin.Loading", Bukkit.getBukkitVersion())
console().sendLang("Plugin-Loading", Bukkit.getBukkitVersion())
}

override fun onEnable() {
if (Version.isBefore(Version.v1_9)) {
TLocale.sendToConsole("Plugin.UnsupportedVersion", plugin.description.version)
PluginBoot.setEnableBoot(false)
if (MinecraftVersion.majorLegacy >= 10900) {
console().sendLang("Plugin-UnsupportedVersion", pluginVersion)
disablePlugin()
return
}

Settings.init()
HologramLoader.load(Bukkit.getConsoleSender())
TLocale.sendToConsole("Plugin.Enabled", plugin.description.version)
console().sendLang("Plugin-Enabled", pluginVersion)
}

override fun onDisable() {
Expand Down
16 changes: 10 additions & 6 deletions src/main/kotlin/me/arasple/mc/trhologram/api/Settings.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package me.arasple.mc.trhologram.api

import io.izzel.taboolib.module.config.TConfig
import io.izzel.taboolib.module.inject.TInject
import io.izzel.taboolib.util.Baffle
import taboolib.common5.Baffle
import taboolib.common5.FileWatcher
import taboolib.module.configuration.Config
import taboolib.module.configuration.SecuredFile
import java.util.concurrent.TimeUnit

/**
Expand All @@ -13,14 +14,17 @@ class Settings {

companion object {

@TInject("settings.yml", locale = "Options.Language", migrate = true)
lateinit var CONF: TConfig
@Config("settings.yml", migrate = true)
lateinit var CONF: SecuredFile
private set

internal var INSTANCE = Settings()

fun init() {
CONF.listener { onSettingsReload() }.also { onSettingsReload() }
// CONF.listener { onSettingsReload() }.also { onSettingsReload() }
FileWatcher.INSTANCE.addSimpleListener(CONF.file) {
onSettingsReload()
}
}

fun onSettingsReload() {
Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/me/arasple/mc/trhologram/api/TrHologramAPI.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package me.arasple.mc.trhologram.api

import io.izzel.taboolib.kotlin.kether.KetherShell
import io.izzel.taboolib.kotlin.kether.common.util.LocalizedException
import me.arasple.mc.trhologram.api.hologram.HologramBuilder
import me.arasple.mc.trhologram.api.hologram.HologramComponent
import me.arasple.mc.trhologram.api.hologram.ItemHologram
Expand All @@ -11,6 +9,9 @@ import me.arasple.mc.trhologram.module.service.Performance
import org.bukkit.Location
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import taboolib.common.platform.function.adaptPlayer
import taboolib.library.kether.LocalizedException
import taboolib.module.kether.KetherShell
import java.util.concurrent.CompletableFuture

/**
Expand All @@ -34,10 +35,10 @@ object TrHologramAPI {

@JvmStatic
fun eval(player: Player, script: String): CompletableFuture<Any?> {
Performance.MIRROR.check("Hologram:Handler:ScriptEval") {
Performance.check("Hologram:Handler:ScriptEval") {
return try {
KetherShell.eval(script, namespace = listOf("trhologram", "trmenu")) {
sender = player
sender = adaptPlayer(player)
}
} catch (e: LocalizedException) {
println("[TrHologram] Unexpected exception while parsing kether shell:")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package me.arasple.mc.trhologram.api.event

import io.izzel.taboolib.module.event.EventCancellable
import io.izzel.taboolib.module.event.EventNormal
import me.arasple.mc.trhologram.module.display.Hologram
import org.bukkit.Bukkit
import org.bukkit.entity.Player
import taboolib.platform.type.BukkitProxyEvent

/**
* @author Arasple
* @date 2021/2/11 16:34
*/
class HologramInteractEvent(val player: Player, val type: Type, val hologram: Hologram) : EventCancellable<HologramInteractEvent>() {

init {
async(!Bukkit.isPrimaryThread())
}
class HologramInteractEvent(val player: Player, val type: Type, val hologram: Hologram) : BukkitProxyEvent() {

enum class Type {

Expand Down
Loading

0 comments on commit 15a0e4e

Please sign in to comment.