Compare commits

...

14 Commits
1.4.0 ... 1.7.0

Author SHA1 Message Date
Auxilor
11a79a5352 libreforge-updater 2022-06-22 22:25:33 +01:00
Auxilor
9473deda7c Updated to 1.6.2 2022-06-22 13:59:42 +01:00
Auxilor
44676515b2 Fixed craft permission 2022-06-22 13:59:33 +01:00
Auxilor
4e7317e69a Updated to 1.6.1 2022-06-22 12:51:00 +01:00
Auxilor
8ca8018ab2 Added filters to xp gain 2022-06-22 12:50:51 +01:00
Auxilor
78e033990b libreforge-updater 2022-06-22 12:43:42 +01:00
Auxilor
033ac785d6 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	gradle.properties
2022-06-21 18:49:52 +01:00
Auxilor
6ddf34f7f6 Updated to 1.5.1 2022-06-21 18:49:41 +01:00
Auxilor
fb889b2936 Added discover-recipes 2022-06-21 18:49:34 +01:00
Auxilor
dcf89687e3 libreforge-updater 2022-06-21 08:29:46 +01:00
Auxilor
2835eeaa5d libreforge-updater 2022-06-20 21:38:10 +01:00
Auxilor
1647a5dfaf 1.4.0 2022-06-20 21:36:33 +01:00
Auxilor
3d260e82ae Fixed pet GUI 2022-06-20 21:36:24 +01:00
Auxilor
1fdbd064a9 Updated libreforge 2022-06-20 18:06:02 +01:00
8 changed files with 46 additions and 10 deletions

View File

@@ -48,7 +48,7 @@ allprojects {
dependencies {
compileOnly 'com.willfp:eco:6.37.1'
implementation 'com.willfp:libreforge:3.66.0'
implementation 'com.willfp:libreforge:3.69.0'
implementation 'org.joml:joml:1.10.4'
compileOnly 'org.jetbrains:annotations:23.0.0'

View File

@@ -7,6 +7,7 @@ import com.willfp.eco.util.toSingletonList
import com.willfp.ecopets.commands.CommandEcopets
import com.willfp.ecopets.commands.CommandPets
import com.willfp.ecopets.config.PetsYml
import com.willfp.ecopets.pets.DiscoverRecipeListener
import com.willfp.ecopets.pets.PetDisplay
import com.willfp.ecopets.pets.PetLevelListener
import com.willfp.ecopets.pets.PetTriggerXPGainListener
@@ -73,7 +74,8 @@ class EcoPetsPlugin : LibReforgePlugin() {
PetLevelListener(this),
PetTriggerXPGainListener,
SpawnEggHandler(this),
petDisplay
petDisplay,
DiscoverRecipeListener(this)
)
}

View File

@@ -0,0 +1,24 @@
package com.willfp.ecopets.pets
import com.willfp.eco.core.EcoPlugin
import org.bukkit.Bukkit
import org.bukkit.Keyed
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerJoinEvent
import org.bukkit.inventory.Recipe
class DiscoverRecipeListener(private val plugin: EcoPlugin) : Listener {
@EventHandler
fun onJoin(event: PlayerJoinEvent) {
if (!plugin.configYml.getBool("discover-recipes")) {
return
}
mutableListOf<Recipe>()
.apply { Bukkit.getServer().recipeIterator().forEachRemaining(this::add) }
.filterIsInstance<Keyed>().map { it.key }
.filter { it.namespace == plugin.name.lowercase() }
.filter { !it.key.contains("displayed") }
.forEach { event.player.discoverRecipe(it) }
}
}

View File

@@ -107,7 +107,7 @@ class Pet(
"${this.id}_spawn_egg",
egg,
config.getStrings("spawn-egg.recipe"),
config.getString("spawn-egg.recipe-permission")
config.getStringOrNull("spawn-egg.recipe-permission")
)
}
}
@@ -157,7 +157,8 @@ class Pet(
trigger to PetXPGain(
trigger,
multiplier,
conditions
conditions,
it.getSubsection("filters")
)
}.toMap()

View File

@@ -1,7 +1,9 @@
package com.willfp.ecopets.pets
import com.willfp.eco.core.config.interfaces.Config
import com.willfp.libreforge.conditions.ConfiguredCondition
import com.willfp.libreforge.events.TriggerPreProcessEvent
import com.willfp.libreforge.filters.ConfiguredFilter
import com.willfp.libreforge.triggers.Trigger
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
@@ -9,7 +11,8 @@ import org.bukkit.event.Listener
data class PetXPGain(
val trigger: Trigger,
val multiplier: Double,
val conditions: Iterable<ConfiguredCondition>
val conditions: Iterable<ConfiguredCondition>,
val filters: Config
)
object PetTriggerXPGainListener : Listener {
@@ -18,6 +21,7 @@ object PetTriggerXPGainListener : Listener {
val player = event.player
val trigger = event.trigger
val value = event.value
val data = event.data
val pet = event.player.activePet ?: return
@@ -27,6 +31,10 @@ object PetTriggerXPGainListener : Listener {
return
}
if (!ConfiguredFilter(xpGain.filters).matches(data)) {
return
}
player.givePetExperience(
pet,
value * xpGain.multiplier

View File

@@ -13,7 +13,6 @@ import org.bukkit.Material
import org.bukkit.Sound
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import org.checkerframework.checker.units.qual.m
import kotlin.math.ceil
import kotlin.math.max
import kotlin.math.min
@@ -42,8 +41,8 @@ object PetsGUI {
val bottomRightColumn = plugin.configYml.getInt("gui.pet-area.bottom-right.column")
petAreaSlots.clear()
for (column in topLeftColumn..bottomRightColumn) {
for (row in topLeftRow..bottomRightRow) {
for (row in topLeftRow..bottomRightRow) {
for (column in topLeftColumn..bottomRightColumn) {
petAreaSlots.add(Pair(row, column))
}
}

View File

@@ -3,6 +3,8 @@
# by Auxilor
#
discover-recipes: true
gui:
rows: 6

View File

@@ -1,4 +1,4 @@
#libreforge-updater
#Mon Jun 20 14:17:42 BST 2022
version=1.4.0
#Wed Jun 22 22:25:32 BST 2022
version=1.7.0
plugin-name=EcoPets