mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-28 05:25:20 +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);
|
+ regionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameMode != null) {
|
if (!hasBypass && gameMode != null) {
|
||||||
if (player.getGameMode() != gameMode) {
|
if (player.getGameMode() != gameMode) {
|
||||||
state.lastGameMode = player.getGameMode();
|
state.lastGameMode = player.getGameMode();
|
||||||
player.setGameMode(gameMode);
|
player.setGameMode(gameMode);
|
||||||
|
} else if (state.lastGameMode == null) {
|
||||||
|
state.lastGameMode = player.getServer().getDefaultGameMode();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (state.lastGameMode != null) {
|
if (state.lastGameMode != null) {
|
||||||
@ -237,7 +239,7 @@ public void onPlayerMove(PlayerMoveEvent event) {
|
|||||||
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
|
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
WorldConfiguration wcfg = plugin.getGlobalStateManager().get(player.getWorld());
|
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())
|
GameMode gameMode = plugin.getGlobalRegionManager().get(player.getWorld())
|
||||||
.getApplicableRegions(player.getLocation()).getFlag(DefaultFlag.GAME_MODE);
|
.getApplicableRegions(player.getLocation()).getFlag(DefaultFlag.GAME_MODE);
|
||||||
if (plugin.getFlagStateManager().getState(player).lastGameMode != null
|
if (plugin.getFlagStateManager().getState(player).lastGameMode != null
|
||||||
|
Loading…
Reference in New Issue
Block a user