Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Misat11 committed Jan 11, 2017
1 parent 827de91 commit 8973c42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/misat11/za/listener/JoinListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/misat11/za/listener/onTeleportListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()));
Expand Down

0 comments on commit 8973c42

Please sign in to comment.