Skip to content

Commit bda6fb5

Browse files
authored
Merge pull request #2 from suppergerrie2/double-disable-fix
Fix survival inventory being copied into buildmode
2 parents 8493518 + 3f3d3bc commit bda6fb5

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/main/kotlin/com/kruthers/gamemode4core/commands/UnwatchCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class UnwatchCommand(val plugin: Gamemode4Core): CommandExecutor {
2020

2121
if (playerData.getBoolean("mode.watching")) {
2222

23-
Watching.disable(plugin, player, playerData)
23+
Watching.disable(plugin, player, playerData, true)
2424

2525
} else {
2626
player.sendMessage("${ChatColor.RED}You must be watching someone to be able to unwatch")

src/main/kotlin/com/kruthers/gamemode4core/commands/WatchConfirmCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class WatchConfirmCommand(val plugin: Gamemode4Core): CommandExecutor {
2929

3030
if (target == null) {
3131
player.sendMessage("${ChatColor.RED}Unable to locate target, exiting watch mode")
32-
Watching.disable(plugin, player, playerData)
32+
Watching.disable(plugin, player, playerData, true)
3333
} else {
3434
if (target.isOnline) {
3535
target.player?.let { player.teleport(it.location) }

src/main/kotlin/com/kruthers/gamemode4core/events/PlayerConnectionEvents.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class PlayerConnectionEvents(val plugin: Gamemode4Core): Listener {
152152
val target: OfflinePlayer? = playerData.getString("storage.watching.target")?.let { Bukkit.getOfflinePlayer(UUID.fromString(it)) }
153153

154154
if (target == null) {
155-
Watching.disable(plugin, player, playerData)
155+
Watching.disable(plugin, player, playerData, true)
156156
} else {
157157
player.sendMessage(getMessage(plugin, "watch.join").replace("{target}",target.name?:"null"))
158158
Gamemode4Core.watchingPlayers[player] = target.uniqueId

src/main/kotlin/com/kruthers/gamemode4core/modes/ModMode.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ModMode {
7878
var playerData: YamlConfiguration = pd
7979
//disabling watching
8080
if (playerData.getBoolean("mode.watching")){
81-
playerData = Watching.disable(plugin, player, playerData)
81+
playerData = Watching.disable(plugin, player, playerData, false)
8282
}
8383

8484
// save mode inventory

src/main/kotlin/com/kruthers/gamemode4core/modes/Watching.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Watching {
4949

5050
}
5151

52-
fun disable(plugin: Gamemode4Core, player: Player, pd: YamlConfiguration): YamlConfiguration {
52+
fun disable(plugin: Gamemode4Core, player: Player, pd: YamlConfiguration, disableModMode: Boolean): YamlConfiguration {
5353
var playerData: YamlConfiguration = pd;
5454
//set watching to false
5555
playerData.set("mode.watching",false);
@@ -70,7 +70,7 @@ class Watching {
7070
Gamemode4Core.watchingPlayers.remove(player)
7171

7272
//check if they only entered mod mode to use watch mode
73-
if (playerData.getBoolean("storage.watching.watchEntrance")) {
73+
if (disableModMode && playerData.getBoolean("storage.watching.watchEntrance")) {
7474
playerData = ModMode.disable(plugin,player,playerData)
7575
}
7676

0 commit comments

Comments
 (0)