Rewrote plugin around libreforge

This commit is contained in:
Auxilor
2022-02-11 09:12:50 +00:00
parent a23c59dc61
commit 3a54e6d01c
18 changed files with 363 additions and 379 deletions
+9 -7
View File
@@ -4,7 +4,7 @@ buildscript {
} }
dependencies { 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() mavenLocal()
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' } 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 { jar {
onlyIf { !sourceSets.main.allSource.files.isEmpty() } onlyIf { !sourceSets.main.allSource.files.isEmpty() }
} }
shadowJar {
relocate('com.willfp.libreforge', 'com.willfp.boosters.libreforge')
}
dependencies { dependencies {
compileOnly 'com.willfp:eco:6.24.0' compileOnly 'com.willfp:eco:6.24.0'
implementation 'com.willfp:libreforge:3.17.0'
compileOnly 'org.jetbrains:annotations:19.0.0' compileOnly 'org.jetbrains:annotations:22.0.0'
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.5.21'
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.6.10'
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
+10 -8
View File
@@ -2,12 +2,14 @@ group 'com.willfp'
version rootProject.version version rootProject.version
dependencies { dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.4-R0.1-SNAPSHOT' compileOnly 'org.spigotmc:spigot-api:1.16.5-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' publishing {
compileOnly 'com.willfp:EcoSkills:1.2.4' publications {
compileOnly 'com.github.brcdev-minecraft:shopgui-api:2.2.0' Library(MavenPublication) {
from project.components.java
compileOnly fileTree(dir: '../../lib', include: ['*.jar']) artifact tasks.shadowJar
}
}
} }
@@ -1,3 +1,5 @@
@file:JvmName("BoosterHandlers")
package com.willfp.boosters package com.willfp.boosters
import com.willfp.boosters.boosters.ActivatedBooster import com.willfp.boosters.boosters.ActivatedBooster
@@ -6,14 +8,13 @@ import com.willfp.boosters.boosters.Boosters
import com.willfp.eco.core.data.PlayerProfile import com.willfp.eco.core.data.PlayerProfile
import org.bukkit.Bukkit import org.bukkit.Bukkit
import org.bukkit.OfflinePlayer import org.bukkit.OfflinePlayer
import org.bukkit.Server
import org.bukkit.Sound import org.bukkit.Sound
import org.bukkit.entity.Player import org.bukkit.entity.Player
private var active: ActivatedBooster? = null private var active: ActivatedBooster? = null
private val plugin = BoostersPlugin.instance private val plugin = BoostersPlugin.instance
var Server.activeBooster: ActivatedBooster? var activeBooster: ActivatedBooster?
get() { get() {
return active return active
} }
@@ -58,10 +59,10 @@ fun Player.activateBooster(booster: Booster): Boolean {
} }
plugin.scheduler.runLater(booster.duration.toLong()) { plugin.scheduler.runLater(booster.duration.toLong()) {
for (expiryMessage in booster.getExpiryMessages()) { for (expiryMessage in booster.expiryMessages) {
Bukkit.broadcastMessage(expiryMessage) Bukkit.broadcastMessage(expiryMessage)
} }
Bukkit.getServer().activeBooster = null activeBooster = null
} }
active = ActivatedBooster(booster, this.uniqueId) active = ActivatedBooster(booster, this.uniqueId)
@@ -77,4 +78,3 @@ fun Player.activateBooster(booster: Booster): Boolean {
return true return true
} }
@@ -1,30 +1,34 @@
package com.willfp.boosters package com.willfp.boosters
import com.willfp.boosters.boosters.Boosters
import com.willfp.boosters.commands.CommandBoosters 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.command.impl.PluginCommand
import com.willfp.eco.core.integrations.placeholder.PlaceholderEntry import com.willfp.eco.core.integrations.placeholder.PlaceholderEntry
import com.willfp.eco.core.integrations.placeholder.PlaceholderManager import com.willfp.eco.core.integrations.placeholder.PlaceholderManager
import com.willfp.eco.util.formatEco import com.willfp.eco.util.formatEco
import com.willfp.eco.util.savedDisplayName import com.willfp.eco.util.savedDisplayName
import com.willfp.libreforge.LibReforgePlugin
import org.bukkit.Bukkit import org.bukkit.Bukkit
import org.bukkit.event.Listener import org.bukkit.event.Listener
class BoostersPlugin : EcoPlugin() { class BoostersPlugin : LibReforgePlugin(0, 0, "") {
override fun handleEnable() { val boostersYml = BoostersYml(this)
override fun handleEnableAdditional() {
PlaceholderManager.registerPlaceholder( PlaceholderManager.registerPlaceholder(
PlaceholderEntry( PlaceholderEntry(
this, this,
"booster_info", "booster_info",
{ {
val booster = server.activeBooster val booster = activeBooster
if (booster == null) { if (booster == null) {
return@PlaceholderEntry "&cThere is no booster currently active!" return@PlaceholderEntry this.langYml.getString("no-currently-active")
.formatEco(formatPlaceholders = false) .formatEco(formatPlaceholders = false)
} else { } 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) .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> { override fun loadListeners(): List<Listener> {
return listOf( return listOf(
@@ -1,18 +1,26 @@
package com.willfp.boosters.boosters package com.willfp.boosters.boosters
import com.willfp.boosters.BoostersPlugin 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.PersistentDataKey
import com.willfp.eco.core.data.keys.PersistentDataKeyType 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.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.entity.Player
import org.bukkit.event.Listener import org.bukkit.inventory.ItemStack
import java.util.UUID import java.util.UUID
abstract class Booster( class Booster(
private val plugin: BoostersPlugin, plugin: BoostersPlugin,
val id: String val config: Config,
) : Listener { ) : Holder {
abstract val duration: Int val id = config.getString("id")
val dataKey = PersistentDataKey( val dataKey = PersistentDataKey(
plugin.namespacedKeyFactory.create(id), plugin.namespacedKeyFactory.create(id),
@@ -20,14 +28,50 @@ abstract class Booster(
0 0
) )
val name = plugin.configYml.getFormattedString("messages.${this.id}.name") val name = config.getFormattedString("name")
init { val duration = config.getInt("duration")
register()
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))
} }
private fun register() { return messages
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 { override fun equals(other: Any?): Boolean {
@@ -41,23 +85,6 @@ abstract class Booster(
override fun hashCode(): Int { override fun hashCode(): Int {
return this.id.hashCode() 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( data class ActivatedBooster(
@@ -1,29 +1,76 @@
package com.willfp.boosters.boosters package com.willfp.boosters.boosters
import com.willfp.boosters.boosters.boosters.Booster15SellMultiplier import com.google.common.collect.BiMap
import com.willfp.boosters.boosters.boosters.Booster2SellMultiplier import com.google.common.collect.HashBiMap
import com.willfp.boosters.boosters.boosters.BoosterSkillXP 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 { object Boosters {
private val byId = mutableMapOf<String, Booster>() /**
* Registered boosters.
val SKILL_XP = BoosterSkillXP() */
val SELL_MULTIPLIER_LOW = Booster15SellMultiplier() private val BY_ID: BiMap<String, Booster> = HashBiMap.create()
val SELL_MULTIPLIER_HIGH = Booster2SellMultiplier()
fun getById(id: String): Booster? {
return byId[id.lowercase()]
}
fun registerNewBooster(booster: Booster) {
byId[booster.id] = booster
}
/**
* Get all registered [Booster]s.
*
* @return A list of all [Booster]s.
*/
@JvmStatic
fun values(): List<Booster> { 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)
} }
} }
@@ -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
}
}
@@ -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
}
}
@@ -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 return
} }
val booster = Boosters.getById(args[1].lowercase()) val booster = Boosters.getByID(args[1].lowercase())
if (booster == null) { if (booster == null) {
sender.sendMessage(plugin.langYml.getMessage("invalid-booster")) sender.sendMessage(plugin.langYml.getMessage("invalid-booster"))
@@ -71,12 +71,12 @@ class CommandGive(plugin: EcoPlugin) :
if (args.size == 2) { if (args.size == 2) {
StringUtil.copyPartialMatches( StringUtil.copyPartialMatches(
args[1], args[1],
Boosters.names(), Boosters.values().map { it.id },
completions completions
) )
return 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.activeBooster
import com.willfp.boosters.boosters.Booster import com.willfp.boosters.boosters.Booster
import com.willfp.boosters.boosters.Boosters 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
import com.willfp.eco.core.gui.menu.Menu
import com.willfp.eco.core.gui.slot import com.willfp.eco.core.gui.slot
import com.willfp.eco.core.gui.slot.FillerMask 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.gui.slot.functional.SlotHandler
import com.willfp.eco.core.items.builder.SkullBuilder import com.willfp.libreforge.tryAsPlayer
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 org.bukkit.Sound import org.bukkit.Sound
import org.bukkit.entity.Player import org.bukkit.entity.Player
object BoosterGUI { 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, _, _ -> return SlotHandler { event, _, _ ->
val player = event.whoClicked.tryAsPlayer() ?: return@SlotHandler val player = event.whoClicked.tryAsPlayer() ?: return@SlotHandler
if (Bukkit.getServer().activeBooster != null) { if (activeBooster != null) {
player.sendMessage(plugin.langYml.getMessage("already-active")) player.sendMessage(plugin.langYml.getMessage("already-active"))
player.playSound( player.playSound(
player.location, player.location,
@@ -52,123 +49,34 @@ object BoosterGUI {
} }
} }
private val gui = menu(3) { @JvmStatic
@ConfigUpdater
fun update(plugin: BoostersPlugin) {
gui = menu(plugin.configYml.getInt("gui.rows")) {
setMask( setMask(
FillerMask( FillerMask(
Material.BLACK_STAINED_GLASS_PANE, MaskItems.fromItemNames(plugin.configYml.getStrings("gui.mask.items")),
"111111111", *plugin.configYml.getStrings("gui.mask.pattern").toTypedArray()
"101101101",
"111111111"
) )
) )
for (booster in Boosters.values()) {
setSlot( setSlot(
2, booster.guiRow,
2, booster.guiColumn,
slot( slot(
SkullBuilder() { player, _ -> booster.getGuiItem(player) }
.setSkullTexture("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTM0YjI3YmZjYzhmOWI5NjQ1OTRiNjE4YjExNDZhZjY5ZGUyNzhjZTVlMmUzMDEyY2I0NzFhOWEzY2YzODcxIn19fQ==")
.build()
) { ) {
setUpdater { player, _, previous -> setUpdater { player, _, _ ->
val meta = previous.itemMeta ?: return@setUpdater previous booster.getGuiItem(player)
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)) onLeftClick(makeHandler(booster, plugin))
})
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) }
}
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 setTitle(plugin.configYml.getFormattedString("gui.title"))
} }
onLeftClick(makeHandler(Boosters.SKILL_XP))
}
)
setTitle("Boosters")
} }
fun open(player: Player) { 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 # 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: cooldown:
1_5sell_multiplier: in-actionbar: true
activation: sound:
- "" enabled: true
- " %player%&f has activated a &a1.5x Sell Multiplier Booster&f!" sound: "BLOCK_NOTE_BLOCK_PLING"
- " &fThis booster will last an hour, be sure to thank them!" pitch: 0.5
- ""
expiry: cannot-afford:
- "" in-actionbar: true
- " &fThe &a1.5x Sell Multiplier Booster&f has ended" sound:
- " &fGet another one here: &ahttps://store.ecomc.net/package/756887" enabled: true
- "" sound: "BLOCK_NOTE_BLOCK_PLING"
name: "1.5x Sell Multiplier" pitch: 0.5
2sell_multiplier:
activation: cannot-afford-type:
- "" in-actionbar: true
- " %player%&f has activated a &a2x Sell Multiplier Booster&f!" sound:
- " &fThis booster will last an hour, be sure to thank them!" enabled: true
- "" sound: "BLOCK_NOTE_BLOCK_PLING"
expiry: pitch: 0.5
- ""
- " &fThe &a2x Sell Multiplier Booster&f has ended" 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.
- " &fGet another one here: &ahttps://store.ecomc.net/package/756888" example_point: "Nicely Formatted Point"
- ""
name: "2x Sell Multiplier" use-faster-move-trigger: true # Disable if you want move trigger to detect sub-1-block movements
skill_xp: raytrace-distance: 80 # The distance that alt_click should check for a location
activation: block-item-drop-place-check: true # If the block_item_drop trigger should only fire on naturally placed blocks (prevents dupes)
- ""
- " %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"
@@ -11,3 +11,9 @@ messages:
gave-booster: "Gave %player% %booster%!" gave-booster: "Gave %player% %booster%!"
already-active: "&cA booster is already active!" already-active: "&cA booster is already active!"
dont-have: "&cYou don't have any of these boosters! Get some at &astore.ecomc.net" 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: depend:
- eco - eco
- PlaceholderAPI - PlaceholderAPI
- EcoSkills
- ShopGUIPlus
- DeluxeSellwands
commands: commands:
boosters: boosters:
+1 -1
View File
@@ -1,2 +1,2 @@
version = 1.3.2 version = 2.0.0
plugin-name = Boosters plugin-name = Boosters
Binary file not shown.