Rewrote plugin around libreforge
This commit is contained in:
+9
-7
@@ -4,7 +4,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,21 +30,23 @@ allprojects {
|
||||
mavenLocal()
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
|
||||
maven { url 'https://repo.codemc.org/repository/nms/' }
|
||||
maven { url 'https://repo.codemc.io/repository/maven-public/' }
|
||||
maven { url 'https://repo.dmulloy2.net/repository/public/' }
|
||||
maven { url 'https://repo.essentialsx.net/releases/' }
|
||||
}
|
||||
|
||||
jar {
|
||||
onlyIf { !sourceSets.main.allSource.files.isEmpty() }
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
relocate('com.willfp.libreforge', 'com.willfp.boosters.libreforge')
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.willfp:eco:6.24.0'
|
||||
implementation 'com.willfp:libreforge:3.17.0'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:19.0.0'
|
||||
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.5.21'
|
||||
compileOnly 'org.jetbrains:annotations:22.0.0'
|
||||
|
||||
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.6.10'
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
|
||||
@@ -2,12 +2,14 @@ group 'com.willfp'
|
||||
version rootProject.version
|
||||
|
||||
dependencies {
|
||||
compileOnly 'org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT'
|
||||
compileOnly 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.0'
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.7.0'
|
||||
compileOnly 'com.willfp:EcoEnchants:8.2.0'
|
||||
compileOnly 'com.willfp:EcoSkills:1.2.4'
|
||||
compileOnly 'com.github.brcdev-minecraft:shopgui-api:2.2.0'
|
||||
|
||||
compileOnly fileTree(dir: '../../lib', include: ['*.jar'])
|
||||
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
Library(MavenPublication) {
|
||||
from project.components.java
|
||||
artifact tasks.shadowJar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:JvmName("BoosterHandlers")
|
||||
|
||||
package com.willfp.boosters
|
||||
|
||||
import com.willfp.boosters.boosters.ActivatedBooster
|
||||
@@ -6,14 +8,13 @@ import com.willfp.boosters.boosters.Boosters
|
||||
import com.willfp.eco.core.data.PlayerProfile
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.OfflinePlayer
|
||||
import org.bukkit.Server
|
||||
import org.bukkit.Sound
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
private var active: ActivatedBooster? = null
|
||||
private val plugin = BoostersPlugin.instance
|
||||
|
||||
var Server.activeBooster: ActivatedBooster?
|
||||
var activeBooster: ActivatedBooster?
|
||||
get() {
|
||||
return active
|
||||
}
|
||||
@@ -58,10 +59,10 @@ fun Player.activateBooster(booster: Booster): Boolean {
|
||||
}
|
||||
|
||||
plugin.scheduler.runLater(booster.duration.toLong()) {
|
||||
for (expiryMessage in booster.getExpiryMessages()) {
|
||||
for (expiryMessage in booster.expiryMessages) {
|
||||
Bukkit.broadcastMessage(expiryMessage)
|
||||
}
|
||||
Bukkit.getServer().activeBooster = null
|
||||
activeBooster = null
|
||||
}
|
||||
|
||||
active = ActivatedBooster(booster, this.uniqueId)
|
||||
@@ -77,4 +78,3 @@ fun Player.activateBooster(booster: Booster): Boolean {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,34 @@
|
||||
package com.willfp.boosters
|
||||
|
||||
import com.willfp.boosters.boosters.Boosters
|
||||
import com.willfp.boosters.commands.CommandBoosters
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.boosters.config.BoostersYml
|
||||
import com.willfp.eco.core.command.impl.PluginCommand
|
||||
import com.willfp.eco.core.integrations.placeholder.PlaceholderEntry
|
||||
import com.willfp.eco.core.integrations.placeholder.PlaceholderManager
|
||||
import com.willfp.eco.util.formatEco
|
||||
import com.willfp.eco.util.savedDisplayName
|
||||
import com.willfp.libreforge.LibReforgePlugin
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.event.Listener
|
||||
|
||||
class BoostersPlugin : EcoPlugin() {
|
||||
override fun handleEnable() {
|
||||
class BoostersPlugin : LibReforgePlugin(0, 0, "") {
|
||||
val boostersYml = BoostersYml(this)
|
||||
|
||||
override fun handleEnableAdditional() {
|
||||
PlaceholderManager.registerPlaceholder(
|
||||
PlaceholderEntry(
|
||||
this,
|
||||
"booster_info",
|
||||
{
|
||||
val booster = server.activeBooster
|
||||
val booster = activeBooster
|
||||
|
||||
if (booster == null) {
|
||||
return@PlaceholderEntry "&cThere is no booster currently active!"
|
||||
return@PlaceholderEntry this.langYml.getString("no-currently-active")
|
||||
.formatEco(formatPlaceholders = false)
|
||||
} else {
|
||||
return@PlaceholderEntry "${Bukkit.getOfflinePlayer(booster.player).savedDisplayName} &fhas activated a &a${booster.booster.name}&f!"
|
||||
return@PlaceholderEntry this.langYml.getString("active-placeholder")
|
||||
.replace("%player%", Bukkit.getOfflinePlayer(booster.player).savedDisplayName)
|
||||
.replace("%booster%", booster.booster.name)
|
||||
.formatEco(formatPlaceholders = false)
|
||||
}
|
||||
},
|
||||
@@ -33,16 +37,6 @@ class BoostersPlugin : EcoPlugin() {
|
||||
)
|
||||
}
|
||||
|
||||
override fun handleReload() {
|
||||
for (booster in Boosters.values()) {
|
||||
this.eventManager.unregisterListener(booster)
|
||||
this.eventManager.registerListener(booster)
|
||||
}
|
||||
}
|
||||
|
||||
override fun handleDisable() {
|
||||
}
|
||||
|
||||
override fun loadListeners(): List<Listener> {
|
||||
return listOf(
|
||||
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
package com.willfp.boosters.boosters
|
||||
|
||||
import com.willfp.boosters.BoostersPlugin
|
||||
import com.willfp.boosters.getAmountOfBooster
|
||||
import com.willfp.eco.core.config.interfaces.Config
|
||||
import com.willfp.eco.core.data.keys.PersistentDataKey
|
||||
import com.willfp.eco.core.data.keys.PersistentDataKeyType
|
||||
import com.willfp.eco.core.items.Items
|
||||
import com.willfp.eco.core.items.builder.ItemStackBuilder
|
||||
import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.eco.util.formatEco
|
||||
import com.willfp.libreforge.Holder
|
||||
import com.willfp.libreforge.conditions.Conditions
|
||||
import com.willfp.libreforge.effects.Effects
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import java.util.UUID
|
||||
|
||||
abstract class Booster(
|
||||
private val plugin: BoostersPlugin,
|
||||
val id: String
|
||||
) : Listener {
|
||||
abstract val duration: Int
|
||||
class Booster(
|
||||
plugin: BoostersPlugin,
|
||||
val config: Config,
|
||||
) : Holder {
|
||||
val id = config.getString("id")
|
||||
|
||||
val dataKey = PersistentDataKey(
|
||||
plugin.namespacedKeyFactory.create(id),
|
||||
@@ -20,14 +28,50 @@ abstract class Booster(
|
||||
0
|
||||
)
|
||||
|
||||
val name = plugin.configYml.getFormattedString("messages.${this.id}.name")
|
||||
val name = config.getFormattedString("name")
|
||||
|
||||
init {
|
||||
register()
|
||||
val duration = config.getInt("duration")
|
||||
|
||||
fun getActivationMessages(player: Player): List<String> {
|
||||
val messages = mutableListOf<String>()
|
||||
|
||||
for (string in config.getFormattedStrings(
|
||||
"messages.activation",
|
||||
StringUtils.FormatOption.WITHOUT_PLACEHOLDERS
|
||||
)) {
|
||||
messages.add(string.replace("%player%", player.displayName))
|
||||
}
|
||||
|
||||
return messages
|
||||
}
|
||||
|
||||
private fun register() {
|
||||
Boosters.registerNewBooster(this)
|
||||
val expiryMessages = config.getStrings("messages.expiry")
|
||||
|
||||
fun getGuiItem(player: Player): ItemStack {
|
||||
return ItemStackBuilder(Items.lookup(config.getString("gui.item")))
|
||||
.setDisplayName(config.getFormattedString("gui.name"))
|
||||
.addLoreLines(
|
||||
config.getFormattedStrings("gui.lore", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS)
|
||||
.map { it.replace("%amount%", player.getAmountOfBooster(this).toString()) }
|
||||
.formatEco(player)
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
||||
val guiRow = config.getInt("gui.position.row")
|
||||
|
||||
val guiColumn = config.getInt("gui.position.column")
|
||||
|
||||
override val conditions = config.getSubsections("conditions").mapNotNull {
|
||||
Conditions.compile(it, "Booster $id")
|
||||
}.toSet()
|
||||
|
||||
override val effects = config.getSubsections("effects").mapNotNull {
|
||||
Effects.compile(it, "Booster $id")
|
||||
}.toSet()
|
||||
|
||||
init {
|
||||
Boosters.addNewBooster(this)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
@@ -41,23 +85,6 @@ abstract class Booster(
|
||||
override fun hashCode(): Int {
|
||||
return this.id.hashCode()
|
||||
}
|
||||
|
||||
fun getActivationMessages(player: Player): List<String> {
|
||||
val messages = mutableListOf<String>()
|
||||
|
||||
for (string in this.plugin.configYml.getFormattedStrings(
|
||||
"messages.${this.id}.activation",
|
||||
StringUtils.FormatOption.WITHOUT_PLACEHOLDERS
|
||||
)) {
|
||||
messages.add(string.replace("%player%", player.displayName))
|
||||
}
|
||||
|
||||
return messages
|
||||
}
|
||||
|
||||
fun getExpiryMessages(): List<String> {
|
||||
return this.plugin.configYml.getFormattedStrings("messages.${this.id}.expiry")
|
||||
}
|
||||
}
|
||||
|
||||
data class ActivatedBooster(
|
||||
|
||||
@@ -1,29 +1,76 @@
|
||||
package com.willfp.boosters.boosters
|
||||
|
||||
import com.willfp.boosters.boosters.boosters.Booster15SellMultiplier
|
||||
import com.willfp.boosters.boosters.boosters.Booster2SellMultiplier
|
||||
import com.willfp.boosters.boosters.boosters.BoosterSkillXP
|
||||
import com.google.common.collect.BiMap
|
||||
import com.google.common.collect.HashBiMap
|
||||
import com.google.common.collect.ImmutableList
|
||||
import com.willfp.boosters.BoostersPlugin
|
||||
import com.willfp.eco.core.config.updating.ConfigUpdater
|
||||
import com.willfp.libreforge.chains.EffectChains
|
||||
|
||||
object Boosters {
|
||||
private val byId = mutableMapOf<String, Booster>()
|
||||
|
||||
val SKILL_XP = BoosterSkillXP()
|
||||
val SELL_MULTIPLIER_LOW = Booster15SellMultiplier()
|
||||
val SELL_MULTIPLIER_HIGH = Booster2SellMultiplier()
|
||||
|
||||
fun getById(id: String): Booster? {
|
||||
return byId[id.lowercase()]
|
||||
}
|
||||
|
||||
fun registerNewBooster(booster: Booster) {
|
||||
byId[booster.id] = booster
|
||||
}
|
||||
/**
|
||||
* Registered boosters.
|
||||
*/
|
||||
private val BY_ID: BiMap<String, Booster> = HashBiMap.create()
|
||||
|
||||
/**
|
||||
* Get all registered [Booster]s.
|
||||
*
|
||||
* @return A list of all [Booster]s.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun values(): List<Booster> {
|
||||
return byId.values.toList()
|
||||
return ImmutableList.copyOf(BY_ID.values)
|
||||
}
|
||||
|
||||
fun names(): List<String> {
|
||||
return byId.keys.toList()
|
||||
/**
|
||||
* Get [Booster] matching ID.
|
||||
*
|
||||
* @param name The name to search for.
|
||||
* @return The matching [Booster], or null if not found.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getByID(name: String): Booster? {
|
||||
return BY_ID[name]
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all [Booster]s.
|
||||
*
|
||||
* @param plugin Instance of Booster.
|
||||
*/
|
||||
@ConfigUpdater
|
||||
@JvmStatic
|
||||
fun update(plugin: BoostersPlugin) {
|
||||
plugin.boostersYml.getSubsections("chains").mapNotNull {
|
||||
EffectChains.compile(it, "Effect Chains")
|
||||
}
|
||||
for (booster in values()) {
|
||||
removeSet(booster)
|
||||
}
|
||||
for (config in plugin.boostersYml.getSubsections("boosters")) {
|
||||
Booster(plugin, config)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new [Booster] to Booster.
|
||||
*
|
||||
* @param booster The [Booster] to add.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun addNewBooster(booster: Booster) {
|
||||
BY_ID.remove(booster.id)
|
||||
BY_ID[booster.id] = booster
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove [Booster] from Booster.
|
||||
*
|
||||
* @param booster The [Booster] to remove.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun removeSet(booster: Booster) {
|
||||
BY_ID.remove(booster.id)
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
package com.willfp.boosters.boosters.boosters
|
||||
|
||||
import com.willfp.boosters.BoostersPlugin
|
||||
import com.willfp.boosters.activeBooster
|
||||
import com.willfp.boosters.boosters.Booster
|
||||
import dev.norska.dsw.api.DeluxeSellwandSellEvent
|
||||
import net.brcdev.shopgui.event.ShopPreTransactionEvent
|
||||
import net.brcdev.shopgui.shop.ShopManager
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
|
||||
class Booster15SellMultiplier: Booster(
|
||||
BoostersPlugin.instance,
|
||||
"1_5sell_multiplier"
|
||||
) {
|
||||
override val duration = 72000
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
fun handle(event: ShopPreTransactionEvent) {
|
||||
if (Bukkit.getServer().activeBooster?.booster != this) {
|
||||
return
|
||||
}
|
||||
|
||||
if (event.isCancelled) {
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shopAction == ShopManager.ShopAction.BUY) {
|
||||
return
|
||||
}
|
||||
|
||||
event.price *= 1.5
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
fun handle(event: DeluxeSellwandSellEvent) {
|
||||
if (Bukkit.getServer().activeBooster?.booster != this) {
|
||||
return
|
||||
}
|
||||
|
||||
if (event.isCancelled) {
|
||||
return
|
||||
}
|
||||
|
||||
event.money *= 1.5
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
package com.willfp.boosters.boosters.boosters
|
||||
|
||||
import com.willfp.boosters.BoostersPlugin
|
||||
import com.willfp.boosters.activeBooster
|
||||
import com.willfp.boosters.boosters.Booster
|
||||
import dev.norska.dsw.api.DeluxeSellwandSellEvent
|
||||
import net.brcdev.shopgui.event.ShopPreTransactionEvent
|
||||
import net.brcdev.shopgui.shop.ShopManager
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
|
||||
class Booster2SellMultiplier: Booster(
|
||||
BoostersPlugin.instance,
|
||||
"2sell_multiplier"
|
||||
) {
|
||||
override val duration = 72000
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
fun handle(event: ShopPreTransactionEvent) {
|
||||
if (Bukkit.getServer().activeBooster?.booster != this) {
|
||||
return
|
||||
}
|
||||
|
||||
if (event.isCancelled) {
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shopAction == ShopManager.ShopAction.BUY) {
|
||||
return
|
||||
}
|
||||
|
||||
event.price *= 2
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
fun handle(event: DeluxeSellwandSellEvent) {
|
||||
if (Bukkit.getServer().activeBooster?.booster != this) {
|
||||
return
|
||||
}
|
||||
|
||||
if (event.isCancelled) {
|
||||
return
|
||||
}
|
||||
|
||||
event.money *= 2
|
||||
}
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
package com.willfp.boosters.boosters.boosters
|
||||
|
||||
import com.willfp.boosters.BoostersPlugin
|
||||
import com.willfp.boosters.activeBooster
|
||||
import com.willfp.boosters.boosters.Booster
|
||||
import com.willfp.ecoskills.api.PlayerSkillExpGainEvent
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
|
||||
class BoosterSkillXP: Booster(
|
||||
BoostersPlugin.instance,
|
||||
"skill_xp"
|
||||
) {
|
||||
override val duration = 72000
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
fun onGainSkillXP(event: PlayerSkillExpGainEvent) {
|
||||
if (Bukkit.getServer().activeBooster?.booster != this) {
|
||||
return
|
||||
}
|
||||
|
||||
if (event.isCancelled) {
|
||||
return
|
||||
}
|
||||
|
||||
event.amount *= 2
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class CommandGive(plugin: EcoPlugin) :
|
||||
return
|
||||
}
|
||||
|
||||
val booster = Boosters.getById(args[1].lowercase())
|
||||
val booster = Boosters.getByID(args[1].lowercase())
|
||||
|
||||
if (booster == null) {
|
||||
sender.sendMessage(plugin.langYml.getMessage("invalid-booster"))
|
||||
@@ -71,12 +71,12 @@ class CommandGive(plugin: EcoPlugin) :
|
||||
if (args.size == 2) {
|
||||
StringUtil.copyPartialMatches(
|
||||
args[1],
|
||||
Boosters.names(),
|
||||
Boosters.values().map { it.id },
|
||||
completions
|
||||
)
|
||||
return completions
|
||||
}
|
||||
|
||||
return emptyList<String>()
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.willfp.boosters.config
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.config.BaseConfig
|
||||
import com.willfp.eco.core.config.ConfigType
|
||||
|
||||
class BoostersYml(plugin: EcoPlugin) : BaseConfig(
|
||||
"boosters",
|
||||
plugin,
|
||||
false,
|
||||
ConfigType.YAML
|
||||
)
|
||||
@@ -5,28 +5,25 @@ import com.willfp.boosters.activateBooster
|
||||
import com.willfp.boosters.activeBooster
|
||||
import com.willfp.boosters.boosters.Booster
|
||||
import com.willfp.boosters.boosters.Boosters
|
||||
import com.willfp.boosters.getAmountOfBooster
|
||||
import com.willfp.eco.core.config.updating.ConfigUpdater
|
||||
import com.willfp.eco.core.gui.menu
|
||||
import com.willfp.eco.core.gui.menu.Menu
|
||||
import com.willfp.eco.core.gui.slot
|
||||
import com.willfp.eco.core.gui.slot.FillerMask
|
||||
import com.willfp.eco.core.gui.slot.MaskItems
|
||||
import com.willfp.eco.core.gui.slot.functional.SlotHandler
|
||||
import com.willfp.eco.core.items.builder.SkullBuilder
|
||||
import com.willfp.eco.util.StringUtils
|
||||
import com.willfp.eco.util.formatEco
|
||||
import com.willfp.ecoskills.tryAsPlayer
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.Material
|
||||
import com.willfp.libreforge.tryAsPlayer
|
||||
import org.bukkit.Sound
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
object BoosterGUI {
|
||||
private val plugin = BoostersPlugin.instance
|
||||
private lateinit var gui: Menu
|
||||
|
||||
private fun makeHandler(booster: Booster): SlotHandler {
|
||||
private fun makeHandler(booster: Booster, plugin: BoostersPlugin): SlotHandler {
|
||||
return SlotHandler { event, _, _ ->
|
||||
val player = event.whoClicked.tryAsPlayer() ?: return@SlotHandler
|
||||
|
||||
if (Bukkit.getServer().activeBooster != null) {
|
||||
if (activeBooster != null) {
|
||||
player.sendMessage(plugin.langYml.getMessage("already-active"))
|
||||
player.playSound(
|
||||
player.location,
|
||||
@@ -52,123 +49,34 @@ object BoosterGUI {
|
||||
}
|
||||
}
|
||||
|
||||
private val gui = menu(3) {
|
||||
setMask(
|
||||
FillerMask(
|
||||
Material.BLACK_STAINED_GLASS_PANE,
|
||||
"111111111",
|
||||
"101101101",
|
||||
"111111111"
|
||||
@JvmStatic
|
||||
@ConfigUpdater
|
||||
fun update(plugin: BoostersPlugin) {
|
||||
gui = menu(plugin.configYml.getInt("gui.rows")) {
|
||||
setMask(
|
||||
FillerMask(
|
||||
MaskItems.fromItemNames(plugin.configYml.getStrings("gui.mask.items")),
|
||||
*plugin.configYml.getStrings("gui.mask.pattern").toTypedArray()
|
||||
)
|
||||
)
|
||||
)
|
||||
setSlot(
|
||||
2,
|
||||
2,
|
||||
slot(
|
||||
SkullBuilder()
|
||||
.setSkullTexture("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTM0YjI3YmZjYzhmOWI5NjQ1OTRiNjE4YjExNDZhZjY5ZGUyNzhjZTVlMmUzMDEyY2I0NzFhOWEzY2YzODcxIn19fQ==")
|
||||
.build()
|
||||
) {
|
||||
setUpdater { player, _, previous ->
|
||||
val meta = previous.itemMeta ?: return@setUpdater previous
|
||||
val lore = mutableListOf<String>()
|
||||
|
||||
lore.add("")
|
||||
lore.add("&fGives everyone online a")
|
||||
lore.add("&a1.5x Sell Multiplier")
|
||||
lore.add("&fto make money faster!")
|
||||
lore.add("")
|
||||
lore.add("&fDuration: &a1 Hour")
|
||||
lore.add("")
|
||||
lore.add("&fYou have: &a${player.getAmountOfBooster(Boosters.SELL_MULTIPLIER_LOW)}")
|
||||
lore.add("&fGet more at &astore.ecomc.net")
|
||||
lore.add("")
|
||||
lore.add("&e&oClick to activate!")
|
||||
lore.add("")
|
||||
|
||||
meta.setDisplayName(StringUtils.format("&d1.5x Sell Multiplier"))
|
||||
|
||||
meta.lore = lore.formatEco()
|
||||
previous.itemMeta = meta
|
||||
previous
|
||||
}
|
||||
onLeftClick(makeHandler(Boosters.SELL_MULTIPLIER_LOW))
|
||||
})
|
||||
|
||||
setSlot(
|
||||
2,
|
||||
5,
|
||||
slot(
|
||||
SkullBuilder()
|
||||
.setSkullTexture("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjBhN2I5NGM0ZTU4MWI2OTkxNTlkNDg4NDZlYzA5MTM5MjUwNjIzN2M4OWE5N2M5MzI0OGEwZDhhYmM5MTZkNSJ9fX0=")
|
||||
.build()
|
||||
) {
|
||||
setUpdater { player, _, previous ->
|
||||
val meta = previous.itemMeta ?: return@setUpdater previous
|
||||
val lore = mutableListOf<String>()
|
||||
|
||||
lore.add("")
|
||||
lore.add("&fGives everyone online a")
|
||||
lore.add("&a2x Sell Multiplier")
|
||||
lore.add("&fto make money faster!")
|
||||
lore.add("")
|
||||
lore.add("&fDuration: &a1 Hour")
|
||||
lore.add("")
|
||||
lore.add("&fYou have: &a${player.getAmountOfBooster(Boosters.SELL_MULTIPLIER_HIGH)}")
|
||||
lore.add("&fGet more at &astore.ecomc.net")
|
||||
lore.add("")
|
||||
lore.add("&e&oClick to activate!")
|
||||
lore.add("")
|
||||
|
||||
meta.setDisplayName(StringUtils.format("&d2x Sell Multiplier"))
|
||||
|
||||
meta.lore = lore.apply {
|
||||
replaceAll { StringUtils.format(it) }
|
||||
for (booster in Boosters.values()) {
|
||||
setSlot(
|
||||
booster.guiRow,
|
||||
booster.guiColumn,
|
||||
slot(
|
||||
{ player, _ -> booster.getGuiItem(player) }
|
||||
) {
|
||||
setUpdater { player, _, _ ->
|
||||
booster.getGuiItem(player)
|
||||
}
|
||||
onLeftClick(makeHandler(booster, plugin))
|
||||
}
|
||||
previous.itemMeta = meta
|
||||
previous
|
||||
}
|
||||
onLeftClick(makeHandler(Boosters.SELL_MULTIPLIER_HIGH))
|
||||
build()
|
||||
)
|
||||
}
|
||||
)
|
||||
setSlot(
|
||||
2,
|
||||
8,
|
||||
slot(
|
||||
SkullBuilder()
|
||||
.setSkullTexture("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODkyNmMxZjJjM2MxNGQwODZjNDBjZmMyMzVmZTkzODY5NGY0YTUxMDY3YWRhNDcyNmI0ODZlYTFjODdiMDNlMiJ9fX0=")
|
||||
.build()
|
||||
) {
|
||||
setUpdater { player, _, previous ->
|
||||
val meta = previous.itemMeta ?: return@setUpdater previous
|
||||
val lore = mutableListOf<String>()
|
||||
|
||||
lore.add("")
|
||||
lore.add("&fGives everyone online a")
|
||||
lore.add("&a2x Skill XP Multiplier")
|
||||
lore.add("&fto level up faster!")
|
||||
lore.add("")
|
||||
lore.add("&fDuration: &a1 Hour")
|
||||
lore.add("")
|
||||
lore.add("&fYou have: &a${player.getAmountOfBooster(Boosters.SKILL_XP)}")
|
||||
lore.add("&fGet more at &astore.ecomc.net")
|
||||
lore.add("")
|
||||
lore.add("&e&oClick to activate!")
|
||||
lore.add("")
|
||||
|
||||
meta.setDisplayName(StringUtils.format("&d2x Skill XP Multiplier"))
|
||||
|
||||
meta.lore = lore.apply {
|
||||
replaceAll { StringUtils.format(it) }
|
||||
}
|
||||
previous.itemMeta = meta
|
||||
previous
|
||||
}
|
||||
onLeftClick(makeHandler(Boosters.SKILL_XP))
|
||||
}
|
||||
)
|
||||
setTitle("Boosters")
|
||||
setTitle(plugin.configYml.getFormattedString("gui.title"))
|
||||
}
|
||||
}
|
||||
|
||||
fun open(player: Player) {
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
boosters:
|
||||
- id: 1_5sell_multiplier
|
||||
name: "1.5x Sell Multiplier"
|
||||
duration: 72000
|
||||
effects:
|
||||
- id: sell_multiplier
|
||||
args:
|
||||
multiplier: 1.5
|
||||
conditions: []
|
||||
messages:
|
||||
activation:
|
||||
- ""
|
||||
- " %player%&f has activated a &a1.5x Sell Multiplier Booster&f!"
|
||||
- " &fThis booster will last an hour, be sure to thank them!"
|
||||
- ""
|
||||
expiry:
|
||||
- ""
|
||||
- " &fThe &a1.5x Sell Multiplier Booster&f has ended"
|
||||
- " &fGet another one here: &ahttps://store.ecomc.net/package/756887"
|
||||
- ""
|
||||
gui:
|
||||
item: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTM0YjI3YmZjYzhmOWI5NjQ1OTRiNjE4YjExNDZhZjY5ZGUyNzhjZTVlMmUzMDEyY2I0NzFhOWEzY2YzODcxIn19fQ==
|
||||
name: "&d1.5x Sell Multiplier"
|
||||
lore:
|
||||
- ""
|
||||
- "&fGives everyone online a"
|
||||
- "&a1.5x Sell Multiplier"
|
||||
- "&fto make money faster!"
|
||||
- ""
|
||||
- "&fDuration: &a1 Hour"
|
||||
- ""
|
||||
- "&fYou have: &a%amount%"
|
||||
- "&fGet more at &astore.ecomc.net"
|
||||
- ""
|
||||
- "&e&oClick to activate!"
|
||||
- ""
|
||||
position:
|
||||
row: 2
|
||||
column: 2
|
||||
- id: 2sell_multiplier
|
||||
name: "2x Sell Multiplier"
|
||||
duration: 72000
|
||||
effects:
|
||||
- id: sell_multiplier
|
||||
args:
|
||||
multiplier: 1.5
|
||||
conditions: []
|
||||
messages:
|
||||
activation:
|
||||
- ""
|
||||
- " %player%&f has activated a &a2x Sell Multiplier Booster&f!"
|
||||
- " &fThis booster will last an hour, be sure to thank them!"
|
||||
- ""
|
||||
expiry:
|
||||
- ""
|
||||
- " &fThe &a2x Sell Multiplier Booster&f has ended"
|
||||
- " &fGet another one here: &ahttps://store.ecomc.net/package/756888"
|
||||
- ""
|
||||
gui:
|
||||
item: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjBhN2I5NGM0ZTU4MWI2OTkxNTlkNDg4NDZlYzA5MTM5MjUwNjIzN2M4OWE5N2M5MzI0OGEwZDhhYmM5MTZkNSJ9fX0=
|
||||
name: "&d2x Sell Multiplier"
|
||||
lore:
|
||||
- ""
|
||||
- "&fGives everyone online a"
|
||||
- "&a2x Sell Multiplier"
|
||||
- "&fto make money faster!"
|
||||
- ""
|
||||
- "&fDuration: &a1 Hour"
|
||||
- ""
|
||||
- "&fYou have: &a%amount%"
|
||||
- "&fGet more at &astore.ecomc.net"
|
||||
- ""
|
||||
- "&e&oClick to activate!"
|
||||
- ""
|
||||
position:
|
||||
row: 2
|
||||
column: 5
|
||||
- id: skill_xp
|
||||
name: "2x Skill XP Multiplier"
|
||||
duration: 72000
|
||||
effects:
|
||||
- id: skill_xp_multiplier
|
||||
args:
|
||||
multiplier: 1.5
|
||||
conditions: []
|
||||
messages:
|
||||
activation:
|
||||
- ""
|
||||
- " %player%&f has activated a &a2x Skill XP Booster&f!"
|
||||
- " &fThis booster will last an hour, be sure to thank them!"
|
||||
- ""
|
||||
expiry:
|
||||
- ""
|
||||
- " &fThe &a2x Skill XP Booster&f has ended"
|
||||
- " &fGet another one here: &ahttps://store.ecomc.net/package/756893"
|
||||
- ""
|
||||
gui:
|
||||
item: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODkyNmMxZjJjM2MxNGQwODZjNDBjZmMyMzVmZTkzODY5NGY0YTUxMDY3YWRhNDcyNmI0ODZlYTFjODdiMDNlMiJ9fX0=
|
||||
name: "&d2x Skill XP Multiplier"
|
||||
lore:
|
||||
- ""
|
||||
- "&fGives everyone online a"
|
||||
- "&a2x Skill XP Multiplier"
|
||||
- "&fto level up faster!"
|
||||
- ""
|
||||
- "&fDuration: &a1 Hour"
|
||||
- ""
|
||||
- "&fYou have: &a%amount%"
|
||||
- "&fGet more at &astore.ecomc.net"
|
||||
- ""
|
||||
- "&e&oClick to activate!"
|
||||
- ""
|
||||
position:
|
||||
row: 2
|
||||
column: 8
|
||||
@@ -3,42 +3,41 @@
|
||||
# by Auxilor
|
||||
#
|
||||
|
||||
log-autosaves: true # If auto-save messages should be sent to console
|
||||
gui:
|
||||
title: Boosters
|
||||
rows: 3
|
||||
mask:
|
||||
items:
|
||||
- black_stained_glass_Pane
|
||||
pattern:
|
||||
- "111111111"
|
||||
- "101101101"
|
||||
- "111111111"
|
||||
|
||||
messages:
|
||||
1_5sell_multiplier:
|
||||
activation:
|
||||
- ""
|
||||
- " %player%&f has activated a &a1.5x Sell Multiplier Booster&f!"
|
||||
- " &fThis booster will last an hour, be sure to thank them!"
|
||||
- ""
|
||||
expiry:
|
||||
- ""
|
||||
- " &fThe &a1.5x Sell Multiplier Booster&f has ended"
|
||||
- " &fGet another one here: &ahttps://store.ecomc.net/package/756887"
|
||||
- ""
|
||||
name: "1.5x Sell Multiplier"
|
||||
2sell_multiplier:
|
||||
activation:
|
||||
- ""
|
||||
- " %player%&f has activated a &a2x Sell Multiplier Booster&f!"
|
||||
- " &fThis booster will last an hour, be sure to thank them!"
|
||||
- ""
|
||||
expiry:
|
||||
- ""
|
||||
- " &fThe &a2x Sell Multiplier Booster&f has ended"
|
||||
- " &fGet another one here: &ahttps://store.ecomc.net/package/756888"
|
||||
- ""
|
||||
name: "2x Sell Multiplier"
|
||||
skill_xp:
|
||||
activation:
|
||||
- ""
|
||||
- " %player%&f has activated a &a2x Skill XP Booster&f!"
|
||||
- " &fThis booster will last an hour, be sure to thank them!"
|
||||
- ""
|
||||
expiry:
|
||||
- ""
|
||||
- " &fThe &a2x Skill XP Booster&f has ended"
|
||||
- " &fGet another one here: &ahttps://store.ecomc.net/package/756893"
|
||||
- ""
|
||||
name: "2x Skill XP Multiplier"
|
||||
cooldown:
|
||||
in-actionbar: true
|
||||
sound:
|
||||
enabled: true
|
||||
sound: "BLOCK_NOTE_BLOCK_PLING"
|
||||
pitch: 0.5
|
||||
|
||||
cannot-afford:
|
||||
in-actionbar: true
|
||||
sound:
|
||||
enabled: true
|
||||
sound: "BLOCK_NOTE_BLOCK_PLING"
|
||||
pitch: 0.5
|
||||
|
||||
cannot-afford-type:
|
||||
in-actionbar: true
|
||||
sound:
|
||||
enabled: true
|
||||
sound: "BLOCK_NOTE_BLOCK_PLING"
|
||||
pitch: 0.5
|
||||
|
||||
point-names: # If you have point names that look ugly (eg g_souls) then you can map them to nice names to be shown to players.
|
||||
example_point: "Nicely Formatted Point"
|
||||
|
||||
use-faster-move-trigger: true # Disable if you want move trigger to detect sub-1-block movements
|
||||
raytrace-distance: 80 # The distance that alt_click should check for a location
|
||||
block-item-drop-place-check: true # If the block_item_drop trigger should only fire on naturally placed blocks (prevents dupes)
|
||||
@@ -11,3 +11,9 @@ messages:
|
||||
gave-booster: "Gave %player% %booster%!"
|
||||
already-active: "&cA booster is already active!"
|
||||
dont-have: "&cYou don't have any of these boosters! Get some at &astore.ecomc.net"
|
||||
on-cooldown: "&cThis effect is on cooldown! &fTime left: &a%seconds% seconds"
|
||||
cannot-afford: "&cYou can't afford to do this! &fCost: &a$$%cost%"
|
||||
cannot-afford-type: "&cYou can't afford to do this! &fCost: &a%cost% %type%"
|
||||
|
||||
no-currently-active: "&cThere is no booster currently active!"
|
||||
active-placeholder: "%player% &fhas activated a %booster%&f!"
|
||||
|
||||
@@ -8,9 +8,6 @@ load: POSTWORLD
|
||||
depend:
|
||||
- eco
|
||||
- PlaceholderAPI
|
||||
- EcoSkills
|
||||
- ShopGUIPlus
|
||||
- DeluxeSellwands
|
||||
|
||||
commands:
|
||||
boosters:
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
version = 1.3.2
|
||||
version = 2.0.0
|
||||
plugin-name = Boosters
|
||||
Binary file not shown.
Reference in New Issue
Block a user