diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java index 14f1b8776..b30d5a74c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java @@ -215,7 +215,13 @@ public class BukkitPlayer extends PlotPlayer { public void kick(final String message) { player.kickPlayer(message); } - + + @Override public void stopSpectating() { + if (getGamemode() == PlotGamemode.SPECTATOR) { + player.setSpectatorTarget(null); + } + } + @Override public boolean isBanned() { return player.isBanned(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java index 7564075c4..709216de1 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Deny.java @@ -20,8 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import java.util.UUID; - import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Location; @@ -30,11 +28,14 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.PlotGamemode; import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.CommandDeclaration; +import java.util.UUID; + @CommandDeclaration(command = "deny", aliases = { "d", "ban" }, description = "Deny a user from a plot", usage = "/plot deny ", category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) public class Deny extends SubCommand { @@ -102,6 +103,9 @@ public class Deny extends SubCommand { if (pp.hasPermission("plots.admin.entry.denied")) { return; } + if (pp.getGamemode() == PlotGamemode.SPECTATOR) { + pp.stopSpectating(); + } pp.teleport(WorldUtil.IMP.getSpawn(pp.getLocation().getWorld())); MainUtil.sendMessage(pp, C.YOU_GOT_DENIED); } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/ConsolePlayer.java b/Core/src/main/java/com/intellectualcrafters/plot/object/ConsolePlayer.java index 0ca0822a5..f73ec7546 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/ConsolePlayer.java @@ -1,14 +1,14 @@ package com.intellectualcrafters.plot.object; -import java.util.HashMap; -import java.util.UUID; - import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.commands.RequiredType; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.util.PlotGamemode; import com.intellectualcrafters.plot.util.PlotWeather; +import java.util.HashMap; +import java.util.UUID; + public class ConsolePlayer extends PlotPlayer { private static ConsolePlayer instance; @@ -152,7 +152,9 @@ public class ConsolePlayer extends PlotPlayer { @Override public void kick(final String message) {} - + + @Override public void stopSpectating() {} + @Override public boolean isBanned() { return false; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java index 0519b1eaf..7a5a13d64 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java @@ -460,4 +460,6 @@ public abstract class PlotPlayer implements CommandCaller { public boolean hasPersistentMeta(String key) { return metaMap.containsKey(key); } + + public abstract void stopSpectating(); } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java b/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java index 9dc8935c2..c63198cdf 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java @@ -142,7 +142,6 @@ public class SpongePlayer extends PlotPlayer { @Override public void saveData() { - // TODO Auto-generated method stub throw new UnsupportedOperationException("NOT IMPLEMENTED YET"); } @@ -250,7 +249,11 @@ public class SpongePlayer extends PlotPlayer { public void kick(final String message) { player.kick(SpongeUtil.getText(message)); } - + + @Override public void stopSpectating() { + //Not Implemented + } + @Override public boolean isBanned() { BanService service = Sponge.getServiceManager().provide(BanService.class).get();