mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
[Core] Fix listener to actually use guest gamemode flag (#2231)
* Fix gamemode flag being used as guest gamemode flag * Remove redundant gamemode flag check
This commit is contained in:
parent
21f0d26c9d
commit
5eaea8a31b
1 changed files with 18 additions and 15 deletions
|
@ -87,28 +87,31 @@ public class PlotListener {
|
|||
player.setFlight(flyFlag.get());
|
||||
}
|
||||
}
|
||||
Optional<PlotGameMode> gamemodeFlag = plot.getFlag(Flags.GAMEMODE);
|
||||
if (gamemodeFlag.isPresent()) {
|
||||
if (player.getGameMode() != gamemodeFlag.get()) {
|
||||
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
|
||||
player.setGameMode(gamemodeFlag.get());
|
||||
} else {
|
||||
MainUtil.sendMessage(player,
|
||||
StringMan.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.getId(), "{gamemode}", gamemodeFlag.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Optional<PlotGameMode> guestGamemodeFlag = plot.getFlag(Flags.GUEST_GAMEMODE);
|
||||
if (gamemodeFlag.isPresent()) {
|
||||
if (player.getGameMode() != gamemodeFlag.get() && !plot.isAdded(player.getUUID())) {
|
||||
if (guestGamemodeFlag.isPresent() && !plot.isAdded(player.getUUID())) {
|
||||
if (player.getGameMode() != guestGamemodeFlag.get()) {
|
||||
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
|
||||
player.setGameMode(gamemodeFlag.get());
|
||||
player.setGameMode(guestGamemodeFlag.get());
|
||||
} else {
|
||||
MainUtil.sendMessage(player,
|
||||
StringMan.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.getId(), "{gamemode}", gamemodeFlag.get()));
|
||||
StringMan.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.getId(), "{gamemode}", guestGamemodeFlag.get()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Optional<PlotGameMode> gamemodeFlag = plot.getFlag(Flags.GAMEMODE);
|
||||
if (gamemodeFlag.isPresent()) {
|
||||
if (player.getGameMode() != gamemodeFlag.get()) {
|
||||
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
|
||||
player.setGameMode(gamemodeFlag.get());
|
||||
} else {
|
||||
MainUtil.sendMessage(player,
|
||||
StringMan.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.getId(), "{gamemode}", gamemodeFlag.get()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Optional<Long> timeFlag = plot.getFlag(Flags.TIME);
|
||||
if (timeFlag.isPresent()) {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue