-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08600cc
commit 59a82ec
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...aff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/listener/staffmode/OnWorldChange.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package es.angelillo15.mast.bukkit.listener.staffmode; | ||
|
||
import com.google.inject.Inject; | ||
import com.nookure.mast.api.event.BukkitListener; | ||
import es.angelillo15.mast.api.IStaffPlayer; | ||
import es.angelillo15.mast.api.managers.StaffManager; | ||
import es.angelillo15.mast.bukkit.MAStaff; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.player.PlayerChangedWorldEvent; | ||
|
||
public class OnWorldChange implements BukkitListener<PlayerChangedWorldEvent> { | ||
@Inject | ||
private StaffManager staffManager; | ||
@Override | ||
@EventHandler | ||
public void handle(PlayerChangedWorldEvent event) { | ||
Player player = event.getPlayer(); | ||
IStaffPlayer staffPlayer = staffManager.getStaffPlayer(player); | ||
|
||
if (staffPlayer == null) return; | ||
if (!staffPlayer.isStaffMode()) return; | ||
|
||
Bukkit.getScheduler().runTaskLater(MAStaff.getPlugin(), () -> { | ||
player.setAllowFlight(true); | ||
}, 20L); | ||
} | ||
} |