Skip to content

Commit

Permalink
Visualiser not updating when changing edit tool mode (#3)
Browse files Browse the repository at this point in the history
Simply just needed to call the visualiser refresh method when clicking
the button.
  • Loading branch information
mizarc committed Sep 27, 2023
2 parents 11807c2 + 41748e9 commit 66ac6bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
### Fixed
- GUIs consuming items placed into them.
- Deselecting all permissions/flags only deselecting one before throwing error.
- Visualiser not updating when changing edit tool mode.

## [0.1.0]
- Initial Pre-Release for Minecraft 1.20. Watch out for bugs!
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class EditToolListener(private val claims: ClaimRepository,
if (event.hand == EquipmentSlot.OFF_HAND) {
val location = event.clickedBlock?.location ?: return
val partition: Partition? = partitionService.getByLocation(location)
EditToolMenu(claimService, partitionService, playerStateService, event.player, partition)
EditToolMenu(claimService, partitionService, playerStateService, event.player, visualiser, partition)
.openEditToolMenu()
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import dev.mizarc.bellclaims.api.PartitionService
import dev.mizarc.bellclaims.api.PlayerStateService
import dev.mizarc.bellclaims.api.events.PartitionModificationEvent
import dev.mizarc.bellclaims.domain.partitions.Partition
import dev.mizarc.bellclaims.interaction.visualisation.Visualiser
import dev.mizarc.bellclaims.utils.lore
import dev.mizarc.bellclaims.utils.name

class EditToolMenu(private val claimService: ClaimService, private val partitionService: PartitionService,
private val playerStateService: PlayerStateService, private val player: Player,
private val partition: Partition? = null) {
private val visualiser: Visualiser, private val partition: Partition? = null) {
fun openEditToolMenu() {
val gui = ChestGui(1, "Claim Tool")
gui.setOnTopClick { guiEvent -> guiEvent.isCancelled = true }
Expand All @@ -36,6 +37,7 @@ class EditToolMenu(private val claimService: ClaimService, private val partition
modeSwitchItem.lore("Edit Mode")
guiModeSwitchItem = GuiItem(modeSwitchItem) {
playerState.claimToolMode = 1
visualiser.refresh(player)
openEditToolMenu()
}
}
Expand All @@ -44,6 +46,7 @@ class EditToolMenu(private val claimService: ClaimService, private val partition
modeSwitchItem.lore("> Edit Mode")
guiModeSwitchItem = GuiItem(modeSwitchItem) {
playerState.claimToolMode = 0
visualiser.refresh(player)
openEditToolMenu()
}
}
Expand Down

0 comments on commit 66ac6bb

Please sign in to comment.