diff --git a/src/main/java/misat11/za/listener/JoinListener.java b/src/main/java/misat11/za/listener/JoinListener.java index 0258a96..7151f42 100644 --- a/src/main/java/misat11/za/listener/JoinListener.java +++ b/src/main/java/misat11/za/listener/JoinListener.java @@ -5,6 +5,7 @@ import java.util.Calendar; import org.bukkit.Bukkit; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.event.EventHandler; @@ -20,6 +21,7 @@ public void onPlayerJoin(PlayerJoinEvent event) { if (Main.instance.getConfig().getBoolean("enabled") == true) { World zaworld = Bukkit.getWorld(Main.instance.getConfig().getString("world")); if (event.getPlayer().getWorld() == zaworld) { + event.getPlayer().setGameMode(GameMode.ADVENTURE); Bukkit.broadcastMessage(Main.instance.getConfig().getString("message_prefix") + " " + Main.instance .getConfig().getString("message_join").replace("%name%", event.getPlayer().getDisplayName())); int x = Main.instance.getConfig().getInt("spawn_x"); diff --git a/src/main/java/misat11/za/listener/onTeleportListener.java b/src/main/java/misat11/za/listener/onTeleportListener.java index 36368ca..9672fa5 100644 --- a/src/main/java/misat11/za/listener/onTeleportListener.java +++ b/src/main/java/misat11/za/listener/onTeleportListener.java @@ -5,6 +5,7 @@ import java.util.Calendar; import org.bukkit.Bukkit; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.event.EventHandler; @@ -20,6 +21,7 @@ public void onPlayerWorldChange(PlayerChangedWorldEvent event) { World zaworld = Bukkit.getWorld(Main.instance.getConfig().getString("world")); if (event.getFrom() != zaworld) { if (event.getPlayer().getWorld() == zaworld) { + event.getPlayer().setGameMode(GameMode.ADVENTURE); Bukkit.broadcastMessage( Main.instance.getConfig().getString("message_prefix") + " " + Main.instance.getConfig() .getString("message_join").replace("%name%", event.getPlayer().getDisplayName()));