Skip to content

Commit

Permalink
Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
DevScyu committed Aug 17, 2021
1 parent 88f6240 commit b50c918
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.derongan.minecraft.deeperworld.services.canMoveSections
import com.derongan.minecraft.deeperworld.world.section.inSectionTransition
import com.derongan.minecraft.deeperworld.world.section.section
import com.mineinabyss.idofront.messaging.error
import com.mineinabyss.idofront.messaging.info
import org.bukkit.GameMode.CREATIVE
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
Expand All @@ -15,9 +14,9 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.ENDER_PEARL
object PlayerListener : Listener {
@EventHandler
fun PlayerTeleportEvent.onPlayerTeleport() {
if (player.gameMode == CREATIVE) return player.info("Creative mode allowed")
if (cause != ENDER_PEARL && cause != CHORUS_FRUIT) return player.info("non epearl tp allowed")
if (!player.canMoveSections) return player.info("dw tp off")
if (player.gameMode == CREATIVE) return
if (cause != ENDER_PEARL && cause != CHORUS_FRUIT) return
if (!player.canMoveSections) return

if (
to.section == null ||
Expand All @@ -31,4 +30,4 @@ object PlayerListener : Listener {
}

//TODO move into idofront
private operator fun PlayerTeleportEvent.component4() = cause
private operator fun PlayerTeleportEvent.component4() = cause

0 comments on commit b50c918

Please sign in to comment.