mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-24 03:25:24 +01:00
Add bypass handling to the gamemode flag
Set a player's previous gamemode when exiting a gamemode region to the server's default gamemode if there is not a previous gamemode already set
This commit is contained in:
parent
25280c9fa9
commit
0fed35a80f
@ -206,10 +206,12 @@ public void onPlayerMove(PlayerMoveEvent event) {
|
||||
+ regionList);
|
||||
}
|
||||
|
||||
if (gameMode != null) {
|
||||
if (!hasBypass && gameMode != null) {
|
||||
if (player.getGameMode() != gameMode) {
|
||||
state.lastGameMode = player.getGameMode();
|
||||
player.setGameMode(gameMode);
|
||||
} else if (state.lastGameMode == null) {
|
||||
state.lastGameMode = player.getServer().getDefaultGameMode();
|
||||
}
|
||||
} else {
|
||||
if (state.lastGameMode != null) {
|
||||
@ -237,7 +239,7 @@ public void onPlayerMove(PlayerMoveEvent event) {
|
||||
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
WorldConfiguration wcfg = plugin.getGlobalStateManager().get(player.getWorld());
|
||||
if (wcfg.useRegions) {
|
||||
if (wcfg.useRegions && !plugin.getGlobalRegionManager().hasBypass(player, player.getWorld())) {
|
||||
GameMode gameMode = plugin.getGlobalRegionManager().get(player.getWorld())
|
||||
.getApplicableRegions(player.getLocation()).getFlag(DefaultFlag.GAME_MODE);
|
||||
if (plugin.getFlagStateManager().getState(player).lastGameMode != null
|
||||
|
Loading…
Reference in New Issue
Block a user