Skip to content

Commit

Permalink
API Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Arasple committed Feb 16, 2021
1 parent 4ca307c commit 329b6f3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group 'me.arasple.mc.trhologram'
version '2.2-BETA'
version '2.2'

task buildJar(dependsOn: [clean, shadowJar])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package me.arasple.mc.trhologram.module.display

import io.izzel.taboolib.kotlin.Tasks
import me.arasple.mc.trhologram.api.Position
import me.arasple.mc.trhologram.api.TrHologramAPI
import me.arasple.mc.trhologram.api.base.BaseCondition
import me.arasple.mc.trhologram.api.base.ClickHandler
import me.arasple.mc.trhologram.api.hologram.HologramBuilder
import me.arasple.mc.trhologram.api.hologram.HologramComponent
import me.arasple.mc.trhologram.api.hologram.ItemHologram
import me.arasple.mc.trhologram.api.hologram.TextHologram
Expand Down Expand Up @@ -145,4 +147,27 @@ class Hologram(
externalHolograms.remove(this)
}

/**
* WARNING: This will make all custom interspace invalid
*/
fun rebuild(): HologramBuilder {
destroy()

return TrHologramAPI.builder(position.toLocation()).run {
viewDistance(viewDistance)
refreshCondition(refreshCondition)
click(reactions)

viewCondition?.let { viewCondition(it) }
components.forEach {
when (it) {
is TextHologram -> append(it.text, it.period, onTick = it.onTick)
is ItemHologram -> append(it.display, it.period, onTick = it.onTick)
}
}

this
}
}

}

0 comments on commit 329b6f3

Please sign in to comment.