Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public void execute(Listener l, Event event) {
// not vanished:
// metadata
p.removeMetadata("vanished", plugin);
// clear vanish-granted flight that may persist in player data after relog
plugin.getVisibilityChanger().resetVanishFlight(p);
}
// not necessarily vanished:
// recreate files msg
Expand All @@ -94,4 +96,4 @@ public void run() {
plugin.logException(er);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void execute(Listener l, Event event) {
|| plugin.getSettings().getBoolean("VanishStateFeatures.CheckPermissionOnQuit")
&& !CommandAction.VANISH_SELF.checkPermission(p, plugin)) {
plugin.getVanishStateMgr().setVanishedState(p.getUniqueId(), p.getName(), false, null);
plugin.getVisibilityChanger().resetVanishFlight(p);
// check if it should handle the quit msg
if (!config.getBoolean("MessageOptions.ReappearOnQuitHideLeaveMsg"))
noMsg = true;
Expand All @@ -64,4 +65,4 @@ public void execute(Listener l, Event event) {
plugin.logException(er);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,7 @@ public void showPlayer(final Player player, final String showerName, boolean sil
else
plugin.sendMessage(player, "OnReappearCausedByOtherPlayer", player, showerName);
// fly
// remove fly if not spectator or creative and no perm
if (config.getBoolean("InvisibilityFeatures.Fly.DisableOnReappear")
&& !player.hasPermission("sv.keepfly")
&& (player.getGameMode() == GameMode.SURVIVAL
|| player.getGameMode() == GameMode.ADVENTURE)
&& config.getBoolean("InvisibilityFeatures.Fly.Enable")) {
player.setAllowFlight(false);
}
resetVanishFlight(player);
// call post event
PostPlayerShowEvent e2 = new PostPlayerShowEvent(player, silent);
plugin.getServer().getPluginManager().callEvent(e2);
Expand All @@ -156,7 +149,21 @@ public void showPlayer(final Player player, final String showerName, boolean sil
}
}

/**
* Removes vanish-granted flight from a player who is no longer invisible.
*/
public void resetVanishFlight(Player player) {
if (config.getBoolean("InvisibilityFeatures.Fly.DisableOnReappear")
&& !player.hasPermission("sv.keepfly")
&& (player.getGameMode() == GameMode.SURVIVAL
|| player.getGameMode() == GameMode.ADVENTURE)
&& config.getBoolean("InvisibilityFeatures.Fly.Enable")) {
player.setAllowFlight(false);
player.setFlying(false);
}
}

public PlayerHider getHider() {
return hider;
}
}
}