Skip to content

Commit

Permalink
Merge branch 'refs/heads/beta' into fork/j10a1n15/fix/objective
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Oct 11, 2024
2 parents bdb63d7 + 7c2d4ed commit ed55165
Show file tree
Hide file tree
Showing 121 changed files with 943 additions and 595 deletions.
3 changes: 2 additions & 1 deletion .idea/dictionaries/default_user.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ object SkillAPI {
1 -> listOf("levelwithxp", "xpforlevel", "goal")
2 -> if (strings[0].lowercase() == "goal") CommandBase.getListOfStringsMatchingLastWord(
strings,
SkillType.entries.map { it.displayName })
SkillType.entries.map { it.displayName }
)
else
listOf()

Expand All @@ -502,7 +503,8 @@ object SkillAPI {
"§6/shskills goal - §bView your current goal",
"§6/shskills goal <skill> <level> - §bDefine your goal for <skill>",
"",
).joinToString("\n"), prefix = false
).joinToString("\n"),
prefix = false
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,27 @@ object ConfigUpdaterMigrator {
logger.log("Starting config transformation from $i to ${i + 1}")
val storage = accumulator["storage"]?.asJsonObject
val dynamicPrefix: Map<String, List<String>> = mapOf(
"#profile" to
(storage?.get("players")?.asJsonObject?.entrySet()
"#profile" to (
storage?.get("players")?.asJsonObject?.entrySet()
?.flatMap { player ->
player.value.asJsonObject["profiles"]?.asJsonObject?.entrySet()?.map {
"storage.players.${player.key}.profiles.${it.key}"
} ?: listOf()
}
?: listOf()),
"#player" to
(storage?.get("players")?.asJsonObject?.entrySet()?.map { "storage.players.${it.key}" }
?: listOf()),
?: listOf()
),
"#player" to (
storage?.get("players")?.asJsonObject?.entrySet()?.map { "storage.players.${it.key}" }
?: listOf()
),
)
val migration = ConfigFixEvent(accumulator, JsonObject().also {
it.add("lastVersion", JsonPrimitive(i + 1))
}, i, 0, dynamicPrefix).also { it.postAndCatch() }
val migration = ConfigFixEvent(
accumulator,
JsonObject().also {
it.add("lastVersion", JsonPrimitive(i + 1))
},
i, 0, dynamicPrefix
).also { it.postAndCatch() }
logger.log("Transformations scheduled: ${migration.new}")
val mergesPerformed = merge(migration.old, migration.new)
logger.log("Migration done with $mergesPerformed merges and ${migration.movesPerformed} moves performed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,9 @@ object Commands {
private fun developersCodingHelp() {
registerCommand("shrepopatterns", "See where regexes are loaded from") { RepoPatternGui.open() }
registerCommand("shtest", "Unused test command.") { SkyHanniDebugsAndTests.testCommand(it) }
registerCommand("shtestrabbitpaths", "Tests pathfinding to rabbit eggs. Use a number 0-14.") { HoppityEggLocator.testPathfind(it) }
registerCommand("shtestrabbitpaths", "Tests pathfinding to rabbit eggs. Use a number 0-14.") {
HoppityEggLocator.testPathfind(it)
}
registerCommand(
"shtestitem",
"test item internal name resolving",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public class FishingConfig {
@Accordion
public SeaCreatureTrackerConfig seaCreatureTracker = new SeaCreatureTrackerConfig();

@Expose
@ConfigOption(name = "Lava Replacement", desc = "")
@Accordion
public LavaReplacementConfig lavaReplacement = new LavaReplacementConfig();

@Expose
@ConfigOption(
name = "Shark Fish Counter",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package at.hannibal2.skyhanni.config.features.fishing;

import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorButton;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
import io.github.notenoughupdates.moulconfig.observer.Property;
import net.minecraft.client.Minecraft;

public class LavaReplacementConfig {

@Expose
@ConfigOption(name = "Enabled", desc = "Replace the lava texture with the water texture.")
@ConfigEditorBoolean
@FeatureToggle
public Property<Boolean> enabled = Property.of(false);

@Expose
@ConfigOption(name = "Only In Crimson Isle", desc = "Enable the water texture only in Crimson Isle.")
@ConfigEditorBoolean
public Property<Boolean> onlyInCrimsonIsle = Property.of(true);
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,32 +125,38 @@ object PlayerNameFormatter {
fun onPrivateChat(event: PrivateMessageChatEvent) {
if (!isEnabled()) return
event.chatComponent =
StringUtils.replaceIfNeeded(event.chatComponent, Text.text("§d${event.direction}") {
appendText(" ")
appendSibling(nameFormat(event.authorComponent))
appendText("§f: ")
appendSibling(event.messageComponent.intoComponent())
}) ?: return
StringUtils.replaceIfNeeded(
event.chatComponent,
Text.text("§d${event.direction}") {
appendText(" ")
appendSibling(nameFormat(event.authorComponent))
appendText("§f: ")
appendSibling(event.messageComponent.intoComponent())
}
) ?: return
}

@SubscribeEvent
fun onPlayerShowItemChat(event: PlayerShowItemChatEvent) {
if (!isEnabled()) return
event.chatComponent = StringUtils.replaceIfNeeded(event.chatComponent, Text.text("") {
appendSibling(
nameFormat(
event.authorComponent,
levelColor = event.levelComponent?.sampleStyleAtStart()?.color?.toString(),
level = event.levelComponent
event.chatComponent = StringUtils.replaceIfNeeded(
event.chatComponent,
Text.text("") {
appendSibling(
nameFormat(
event.authorComponent,
levelColor = event.levelComponent?.sampleStyleAtStart()?.color?.toString(),
level = event.levelComponent
)
)
)

appendText(" ")
appendSibling(event.action.intoComponent().changeColor(LorenzColor.GRAY))
appendText(" ")
appendSibling(event.action.intoComponent().changeColor(LorenzColor.GRAY))

appendText(" ")
appendSibling(event.item.intoComponent())
}) ?: return
appendText(" ")
appendSibling(event.item.intoComponent())
}
) ?: return
}

private fun nameFormat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ class PlayerAllChatEvent(
val isAGuest by lazy { privateIslandGuest != null }

companion object {
private val listenerList = ListenerList(AbstractChatEvent(
ComponentSpan.empty(),
ComponentSpan.empty(),
ChatComponentText(""),
"").listenerList)
private val listenerList = ListenerList(
AbstractChatEvent(
ComponentSpan.empty(),
ComponentSpan.empty(),
ChatComponentText(""),
""
).listenerList
)
}

/**
Expand All @@ -45,8 +48,10 @@ class PlayerAllChatEvent(
* This method is required if [setup] is present.
*/
@ApiStatus.Internal
constructor() : this(null, null, null, "",
ComponentSpan.empty(), ComponentSpan.empty(), ChatComponentText(""))
constructor() : this(
null, null, null, "",
ComponentSpan.empty(), ComponentSpan.empty(), ChatComponentText("")
)

/**
* This method is required if [setup] is present.
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/at/hannibal2/skyhanni/data/mob/Mob.kt
Original file line number Diff line number Diff line change
Expand Up @@ -154,25 +154,28 @@ class Mob(
relativeBoundingBox =
if (extraEntities.isNotEmpty()) makeRelativeBoundingBox() else null // Inlined updateBoundingBox()

owner = (ownerName ?: if (mobType == Type.SLAYER) hologram2?.let {
summonOwnerPattern.matchMatcher(it.cleanName()) { this.group("name") }
} else null)?.let { MobUtils.OwnerShip(it) }
owner = (
ownerName ?: if (mobType == Type.SLAYER) hologram2?.let {
summonOwnerPattern.matchMatcher(it.cleanName()) { this.group("name") }
} else null
)?.let { MobUtils.OwnerShip(it) }
}

private fun removeExtraEntitiesFromChecking() =
extraEntities.count { MobData.retries[it.entityId] != null }.also {
MobData.externRemoveOfRetryAmount += it
}

fun updateBoundingBox() {
private fun updateBoundingBox() {
relativeBoundingBox = if (extraEntities.isNotEmpty()) makeRelativeBoundingBox() else null
}

private fun makeRelativeBoundingBox() =
(baseEntity.entityBoundingBox.union(
private fun makeRelativeBoundingBox() = (
baseEntity.entityBoundingBox.union(
extraEntities.filter { it !is EntityArmorStand }
.mapNotNull { it.entityBoundingBox },
))?.offset(-baseEntity.posX, -baseEntity.posY, -baseEntity.posZ)
)
)?.offset(-baseEntity.posX, -baseEntity.posY, -baseEntity.posZ)

fun fullEntityList() =
baseEntity.toSingletonListOrEmpty() +
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/at/hannibal2/skyhanni/data/mob/MobDetection.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ object MobDetection {
}

private fun Mob.watchdogCheck(world: World): Boolean =
this.baseEntity.worldObj != world || (this.armorStand?.let { it.worldObj != world }
?: false) || this.extraEntities.any { it.worldObj != world }
this.baseEntity.worldObj != world || (
this.armorStand?.let { it.worldObj != world } ?: false
) || this.extraEntities.any { it.worldObj != world }

@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
Expand Down Expand Up @@ -338,7 +339,7 @@ object MobDetection {

private fun handleEntityUpdate(entityID: Int): Boolean {
val entity = EntityUtils.getEntityByID(entityID) as? EntityLivingBase ?: return false
getRetry(entity)?.apply { this.entity = entity }
getRetry(entity)?.entity = entity
MobData.currentEntityLiving.refreshReference(entity)
MobData.previousEntityLiving.refreshReference(entity)
// update map
Expand All @@ -353,10 +354,10 @@ object MobDetection {
is S0CPacketSpawnPlayer -> addEntityUpdate(packet.entityID)
// is S0EPacketSpawnObject -> addEntityUpdate(packet.entityID)
is S01PacketJoinGame -> // one of the first packets that is sent when switching servers inside the BungeeCord Network (please some prove this, I just found it out via Testing)
{
shouldClear.set(true)
allEntitiesViaPacketId.clear()
}
{
shouldClear.set(true)
allEntitiesViaPacketId.clear()
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/data/mob/MobFilter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,10 @@ object MobFilter {
baseEntity,
armorStand,
extraEntityList,
) else (MobFactories.basic(baseEntity, armorStand, extraEntityList)
?: MobFactories.dojo(baseEntity, armorStand))
) else (
MobFactories.basic(baseEntity, armorStand, extraEntityList)
?: MobFactories.dojo(baseEntity, armorStand)
)

private fun noArmorStandMobs(baseEntity: EntityLivingBase): MobResult? = when {
baseEntity is EntityBat -> createBat(baseEntity)
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ class RepoManager(private val configLocation: File) {
}
}

private fun reloadRepository(answerMessage: String = ""): CompletableFuture<Void?> {
val comp = CompletableFuture<Void?>()
private fun reloadRepository(answerMessage: String = ""): CompletableFuture<Unit?> {
val comp = CompletableFuture<Unit?>()
if (!atomicShouldManuallyReload.get()) return comp
ErrorManager.resetCache()
DelayedRun.onThread.execute {
Expand Down Expand Up @@ -232,8 +232,10 @@ class RepoManager(private val configLocation: File) {
if (unsuccessfulConstants.isNotEmpty()) {
val text = mutableListOf<IChatComponent>()
text.add(
("§c[SkyHanni-${SkyHanniMod.version}] §7Repo Issue! Some features may not work. " +
"Please report this error on the Discord!").asComponent(),
(
"§c[SkyHanni-${SkyHanniMod.version}] §7Repo Issue! Some features may not work. " +
"Please report this error on the Discord!"
).asComponent(),
)
text.add("§7Repo Auto Update Value: §c${config.repoAutoUpdate}".asComponent())
text.add("§7If you have Repo Auto Update turned off, please try turning that on.".asComponent())
Expand Down Expand Up @@ -286,13 +288,13 @@ class RepoManager(private val configLocation: File) {
val repoUser = config.location.user
val repoName = config.location.name
val repoBranch = config.location.branch
return String.format("https://api.github.com/repos/%s/%s/commits/%s", repoUser, repoName, repoBranch)
return "https://api.github.com/repos/$repoUser/$repoName/commits/$repoBranch"
}

private fun getDownloadUrl(commitId: String?): String {
val repoUser = config.location.user
val repoName = config.location.name
return String.format("https://github.com/%s/%s/archive/%s.zip", repoUser, repoName, commitId)
return "https://github.com/$repoUser/$repoName/archive/$commitId.zip"
}

@Throws(IOException::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ object BingoCardDisplay {

if (BingoAPI.bingoGoals.isEmpty()) {
newList.add(Renderable.string("§6Bingo Goals:"))
newList.add(Renderable.clickAndHover("§cOpen the §e/bingo §ccard.",
listOf("Click to run §e/bingo"),
onClick = {
HypixelCommands.bingo()
}
))
newList.add(
Renderable.clickAndHover(
"§cOpen the §e/bingo §ccard.",
listOf("Click to run §e/bingo"),
onClick = {
HypixelCommands.bingo()
}
)
)
} else {
if (!config.hideCommunityGoals.get()) {
newList.addCommunityGoals()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ object BingoCardTips {
for (line in bingoTip.guide) {
toolTip.add(index++, " $line")
}
bingoTip.found?.let {
toolTip.add(index++, "§7Found by: §e$it")
}
toolTip.add(index++, "§7Found by: §e${bingoTip.found}")
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ object BingoNextStepHelper {
"Emerald",
160 * 32,
mapOf("Emerald" to 1, "Enchanted Emerald" to 160)
) requires IslandType.DWARVEN_MINES.getStep())
) requires IslandType.DWARVEN_MINES.getStep()
)
}

if (description == "Obtain a Mathematical Hoe Blueprint.") {
Expand All @@ -285,7 +286,8 @@ object BingoNextStepHelper {
"Jacob's Ticket",
32,
mapOf("Jacob's Ticket" to 1)
).addItemRequirements() requires IslandType.GARDEN.getStep())
).addItemRequirements() requires IslandType.GARDEN.getStep()
)
}

crystalPattern.matchMatcher(description) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
class CollectionStep(collectionName: String, amountNeeded: Int) :
ProgressionStep(amountNeeded.shortFormat() + " $collectionName Collection", amountNeeded.toLong()) {

val internalName by lazy { NEUInternalName.fromItemName(if (collectionName == "Mushroom") "Red Mushroom" else collectionName) }
val internalName by lazy {
NEUInternalName.fromItemName(if (collectionName == "Mushroom") "Red Mushroom" else collectionName)
}
}
Loading

0 comments on commit ed55165

Please sign in to comment.