Skip to content

Commit

Permalink
Merge pull request #80 from MineInAbyss/epearl_tp
Browse files Browse the repository at this point in the history
Disable epearl/chorus tp between sections to avoid exploit
  • Loading branch information
0ffz authored Aug 15, 2021
2 parents d2274e2 + ecf8d94 commit bedd89b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import com.derongan.minecraft.deeperworld.world.section.section
import com.mineinabyss.idofront.destructure.component1
import com.mineinabyss.idofront.destructure.component2
import com.mineinabyss.idofront.destructure.component3
import org.bukkit.GameMode
import com.mineinabyss.idofront.messaging.error
import org.bukkit.GameMode.ADVENTURE
import org.bukkit.GameMode.SURVIVAL
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
Expand All @@ -17,11 +18,13 @@ object PlayerListener : Listener {
@EventHandler
fun onPlayerTeleport(event: PlayerTeleportEvent) {
val (player, _, to, cause) = event
if (player.gameMode == SURVIVAL
if (
(player.gameMode == SURVIVAL || player.gameMode == ADVENTURE)
&& (cause == ENDER_PEARL || cause == CHORUS_FRUIT)
&& to?.section == null
&& (to.section != player.location.section || to.section == null)
&& player.canMoveSections
) {
player.error("Teleportation is disabled between Layers and Sections.")
event.isCancelled = true
}
}
Expand Down

0 comments on commit bedd89b

Please sign in to comment.