Skip to content

Commit

Permalink
fix: Players in Adventure mode shouldn't use discs (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsSourCream authored Jun 19, 2024
1 parent 96d9f8a commit 041789e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package su.plo.voice.discs.event

import kotlinx.coroutines.*
import kotlinx.coroutines.future.await
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.TextComponent
import net.kyori.adventure.text.format.NamedTextColor
import org.bukkit.Bukkit
import org.bukkit.GameMode
import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.block.Block
Expand All @@ -17,7 +16,6 @@ import org.bukkit.event.block.Action
import org.bukkit.event.block.BlockBreakEvent
import org.bukkit.event.entity.EntityExplodeEvent
import org.bukkit.event.inventory.InventoryMoveItemEvent
import org.bukkit.event.inventory.InventoryType
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.event.world.ChunkLoadEvent
import org.bukkit.event.world.ChunkUnloadEvent
Expand Down Expand Up @@ -68,6 +66,8 @@ class JukeboxEventListener(

if (event.action != Action.RIGHT_CLICK_BLOCK) return

if (event.player.gameMode == GameMode.ADVENTURE) return

val block = event.clickedBlock ?: return

val jukebox = block.asJukebox() ?: return
Expand Down Expand Up @@ -113,7 +113,7 @@ class JukeboxEventListener(
event.block
.takeIf { it.isJukebox() }
?.also {
it.asJukebox()?.stopPlaying();
it.asJukebox()?.stopPlaying()
}
?.let { jobByBlock.remove(it) }
?.cancel()
Expand Down

0 comments on commit 041789e

Please sign in to comment.