Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78e033990b | ||
|
|
033ac785d6 | ||
|
|
6ddf34f7f6 | ||
|
|
fb889b2936 | ||
|
|
dcf89687e3 | ||
|
|
2835eeaa5d | ||
|
|
1647a5dfaf | ||
|
|
3d260e82ae | ||
|
|
1fdbd064a9 |
@@ -48,7 +48,7 @@ allprojects {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.willfp:eco:6.37.1'
|
compileOnly 'com.willfp:eco:6.37.1'
|
||||||
implementation 'com.willfp:libreforge:3.66.0'
|
implementation 'com.willfp:libreforge:3.68.0'
|
||||||
implementation 'org.joml:joml:1.10.4'
|
implementation 'org.joml:joml:1.10.4'
|
||||||
|
|
||||||
compileOnly 'org.jetbrains:annotations:23.0.0'
|
compileOnly 'org.jetbrains:annotations:23.0.0'
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.willfp.eco.util.toSingletonList
|
|||||||
import com.willfp.ecopets.commands.CommandEcopets
|
import com.willfp.ecopets.commands.CommandEcopets
|
||||||
import com.willfp.ecopets.commands.CommandPets
|
import com.willfp.ecopets.commands.CommandPets
|
||||||
import com.willfp.ecopets.config.PetsYml
|
import com.willfp.ecopets.config.PetsYml
|
||||||
|
import com.willfp.ecopets.pets.DiscoverRecipeListener
|
||||||
import com.willfp.ecopets.pets.PetDisplay
|
import com.willfp.ecopets.pets.PetDisplay
|
||||||
import com.willfp.ecopets.pets.PetLevelListener
|
import com.willfp.ecopets.pets.PetLevelListener
|
||||||
import com.willfp.ecopets.pets.PetTriggerXPGainListener
|
import com.willfp.ecopets.pets.PetTriggerXPGainListener
|
||||||
@@ -73,7 +74,8 @@ class EcoPetsPlugin : LibReforgePlugin() {
|
|||||||
PetLevelListener(this),
|
PetLevelListener(this),
|
||||||
PetTriggerXPGainListener,
|
PetTriggerXPGainListener,
|
||||||
SpawnEggHandler(this),
|
SpawnEggHandler(this),
|
||||||
petDisplay
|
petDisplay,
|
||||||
|
DiscoverRecipeListener(this)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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) }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,6 @@ import org.bukkit.Material
|
|||||||
import org.bukkit.Sound
|
import org.bukkit.Sound
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.inventory.ItemStack
|
import org.bukkit.inventory.ItemStack
|
||||||
import org.checkerframework.checker.units.qual.m
|
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
@@ -42,8 +41,8 @@ object PetsGUI {
|
|||||||
val bottomRightColumn = plugin.configYml.getInt("gui.pet-area.bottom-right.column")
|
val bottomRightColumn = plugin.configYml.getInt("gui.pet-area.bottom-right.column")
|
||||||
|
|
||||||
petAreaSlots.clear()
|
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))
|
petAreaSlots.add(Pair(row, column))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
# by Auxilor
|
# by Auxilor
|
||||||
#
|
#
|
||||||
|
|
||||||
|
discover-recipes: true
|
||||||
|
|
||||||
gui:
|
gui:
|
||||||
rows: 6
|
rows: 6
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#libreforge-updater
|
#libreforge-updater
|
||||||
#Mon Jun 20 14:17:42 BST 2022
|
#Wed Jun 22 12:43:42 BST 2022
|
||||||
version=1.4.0
|
version=1.6.0
|
||||||
plugin-name=EcoPets
|
plugin-name=EcoPets
|
||||||
|
|||||||
Reference in New Issue
Block a user