Skip to content

Commit

Permalink
Merge branch 'main' into kt/chat
Browse files Browse the repository at this point in the history
Signed-off-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com>
  • Loading branch information
j10a1n15 authored Jul 24, 2024
2 parents 12a5609 + fa52c71 commit fce5a91
Show file tree
Hide file tree
Showing 14 changed files with 298 additions and 265 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ import me.partlysanestudios.partlysaneskies.features.gui.hud.rngdropbanner.DropW
import me.partlysanestudios.partlysaneskies.features.gui.hud.rngdropbanner.RareDropGUIManager
import me.partlysanestudios.partlysaneskies.features.gui.mainmenu.PSSMainMenu
import me.partlysanestudios.partlysaneskies.features.information.WikiArticleOpener
import me.partlysanestudios.partlysaneskies.features.mining.MiningEvents
import me.partlysanestudios.partlysaneskies.features.mining.PickaxeWarning
import me.partlysanestudios.partlysaneskies.features.mining.crystalhollows.WormWarning
import me.partlysanestudios.partlysaneskies.features.mining.crystalhollows.gemstonewaypoints.GemstoneData
import me.partlysanestudios.partlysaneskies.features.mining.crystalhollows.gemstonewaypoints.GemstoneWaypointRender
import me.partlysanestudios.partlysaneskies.features.mining.events.MiningEventNotifier
import me.partlysanestudios.partlysaneskies.features.security.PrivacyMode
import me.partlysanestudios.partlysaneskies.features.security.modschecker.ModChecker
import me.partlysanestudios.partlysaneskies.features.skills.BestiaryLevelUpWebhook
Expand Down Expand Up @@ -236,7 +236,6 @@ class PartlySaneSkies {
registerEvent(this)
registerEvent(PartyManager())
registerEvent(PartyFriendManager())
registerEvent(MiningEvents())
registerEvent(MinionData())
registerEvent(SkyblockDataManager)
registerEvent(DropBannerDisplay)
Expand Down Expand Up @@ -279,6 +278,7 @@ class PartlySaneSkies {
registerEvent(PSSMainMenu)
registerEvent(WrongToolCropWarning.CropToolData)
registerEvent(PetAlert)
registerEvent(MiningEventNotifier)
registerEvent(SkillUpgradeWebhook)
registerEvent(CropMilestoneWebhook)
registerEvent(BestiaryMilestoneWebhook)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1257,13 +1257,6 @@ object OneConfigScreen : Config(


//Events
@Info(
type = InfoType.INFO,
text = "Some Events may not trigger, not all have been tested. If you find an event that doesn't trigger, please report it on our discord server.",
category = "Mining",
subcategory = "Events",
size = 2
)
@Switch(name = "Main Toggle", description = "Toggles the events.", category = "Mining", subcategory = "Events")
var miningEventsToggle = true

Expand Down Expand Up @@ -1365,14 +1358,6 @@ object OneConfigScreen : Config(
)
var miningEventBannerTime = 3.5f

@Color(
name = "Event Banner Color",
description = "The color of the event banner text.",
category = "Mining",
subcategory = "Events"
)
var miningEventBannerColor = OneColor(255, 255, 255)

// ------------- Category: Farming ---------------------------------
// Hoes
@Switch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ enum class IslandType(val islandName: String) {
DEEP_CAVERNS("Deep Caverns"),
DWARVEN_MINES("Dwarven Mines"),
CRYSTAL_HOLLOWS("Crystal Hollows"),
MINESHAFT("Mineshaft"),
FARMING_ISLAND("The Farming Islands"),
WINTER_ISLAND("Jerry's Workshop"), // value by sh, unconfirmed
WINTER_ISLAND("Jerry's Workshop"),
RIFT("The Rift"),
CATACOMBS("Catacombs"),
KUUDRA("Kuudra"),

NONE("");

fun onIsland(): Boolean {
return this == IslandType.getCurrentIsland()
}
fun onIsland() = this == IslandType.getCurrentIsland()

companion object {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package me.partlysanestudios.partlysaneskies.events
import me.partlysanestudios.partlysaneskies.events.minecraft.render.RenderWaypointEvent
import me.partlysanestudios.partlysaneskies.events.skyblock.dungeons.DungeonEndEvent
import me.partlysanestudios.partlysaneskies.events.skyblock.dungeons.DungeonStartEvent
import me.partlysanestudios.partlysaneskies.events.skyblock.mining.MinesEvent
import me.partlysanestudios.partlysaneskies.utils.SystemUtils.log
import net.minecraftforge.client.event.ClientChatReceivedEvent
import net.minecraftforge.client.event.RenderWorldLastEvent
Expand All @@ -33,7 +34,7 @@ object EventManager {
if (functionParameters.size != 2) { // if there is not only 1 parameter (param 1 is always the instance parameter
log(
Level.WARN,
"Unable to add ${function.name} due to incorrect number of function parameters (${functionParameters.size}"
"Unable to add ${function.name} due to incorrect number of function parameters (${functionParameters.size}",
)
continue
}
Expand All @@ -49,18 +50,16 @@ object EventManager {

@SubscribeEvent
fun onScreenRender(event: RenderWorldLastEvent) {
RenderWaypointEvent.onEventCall(
event.partialTicks,
registeredFunctions[RenderWaypointEvent::class] ?: ArrayList()
)
RenderWaypointEvent.onEventCall(event.partialTicks, registeredFunctions[RenderWaypointEvent::class] ?: ArrayList())
}

@SubscribeEvent
fun onChatRecievedEvent(event: ClientChatReceivedEvent) {
fun onChatReceivedEvent(event: ClientChatReceivedEvent) {
val message = event.message.formattedText
DungeonStartEvent.onMessageRecieved(registeredFunctions[DungeonStartEvent::class] ?: ArrayList(), message)
DungeonEndEvent.onMessageRecieved(registeredFunctions[DungeonEndEvent::class] ?: ArrayList(), message)
DungeonStartEvent.onMessageReceived(registeredFunctions[DungeonStartEvent::class] ?: ArrayList(), message)
DungeonEndEvent.onMessageReceived(registeredFunctions[DungeonEndEvent::class] ?: ArrayList(), message)
MinesEvent.onMessageReceived(registeredFunctions[MinesEvent::class] ?: ArrayList(), message)
}

internal class EventFunction(val obj: Any, val function: KFunction<*>)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class LoadPublicDataEvent {
function.function.call(function.obj, event)
} catch (e: Exception) {
e.printStackTrace()
} finally {

}
}
}.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import me.partlysanestudios.partlysaneskies.events.EventManager

class DungeonEndEvent {
companion object {
internal fun onMessageRecieved(functionList: List<EventManager.EventFunction>, formattedMessage: String) {
internal fun onMessageReceived(functionList: List<EventManager.EventFunction>, formattedMessage: String) {
if (formattedMessage.contains("§r§c☠ §r§eDefeated §r")) {
for (function in functionList) {
try {
Expand All @@ -16,4 +16,4 @@ class DungeonEndEvent {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import me.partlysanestudios.partlysaneskies.utils.StringUtils.removeColorCodes

class DungeonStartEvent {
companion object {
internal fun onMessageRecieved(functionList: List<EventManager.EventFunction>, formattedMessage: String) {
internal fun onMessageReceived(functionList: List<EventManager.EventFunction>, formattedMessage: String) {
val message = formattedMessage.removeColorCodes()
if (message.contains("Starting in 1 second.") && IslandType.CATACOMBS.onIsland()) {
for (function in functionList) {
Expand All @@ -25,4 +25,4 @@ class DungeonStartEvent {
}
}
}
}
}
Loading

0 comments on commit fce5a91

Please sign in to comment.