Skip to content

Commit

Permalink
Fix enable jump mode on world changed (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
imDMK committed May 13, 2024
1 parent f5b0ef9 commit d62328c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
7 changes: 4 additions & 3 deletions doublejump-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ repositories {
mavenCentral()
mavenLocal()

maven("https://oss.sonatype.org/content/repositories/central")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://maven.enginehub.org/repo/")
}

dependencies {
compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT")
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.9")

testImplementation(platform("org.junit:junit-bom:5.9.1"))
Expand All @@ -42,4 +43,4 @@ tasks.test {
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.add("-parameters")
}
}
1 change: 1 addition & 0 deletions doublejump-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ repositories {
mavenCentral()

maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
maven { url = uri("https://storehouse.okaeri.eu/repository/maven-public/") }
maven { url = uri("https://repo.panda-lang.org/releases") }
maven { url = uri("https://repo.eternalcode.pl/releases") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
Expand Down Expand Up @@ -100,4 +101,22 @@ public void onPlayerJoin(PlayerJoinEvent event) {
this.taskScheduler.runLaterAsync(() -> this.jumpPlayerService.enable(player, true), 40L);
}
}

@EventHandler
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();

if (this.jumpPlayerManager.isDoubleJumpMode(player)) {
return;
}

if (this.jumpRestrictionService.isPassedRestrictions(player, false)) {
return;
}

if (this.jumpSettings.enableJumpModeOnJoinForPlayers || this.jumpSettings.enableJumpModeOnJoinForAdmins && player.isOp()) {
this.taskScheduler.runLaterAsync(() -> this.jumpPlayerService.enable(player, true), 40L);
}
}

}

0 comments on commit d62328c

Please sign in to comment.