Added code to send messages when player enter a gate. (Issue #15)

This commit is contained in:
Tobias Ottenweller 2013-02-26 12:47:38 +01:00
parent 08906f6004
commit 5b1ac6e8f7

View File

@ -2,6 +2,7 @@ package de.craftinc.gates.listeners;
import java.util.logging.Level; import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
@ -37,6 +38,7 @@ public class PluginPlayerListener implements Listener
// Check for permission // Check for permission
if (!hasPermission(event.getPlayer(), gateAtLocation)) { if (!hasPermission(event.getPlayer(), gateAtLocation)) {
event.getPlayer().sendMessage(ChatColor.RED + "Sorry, you are not allowed to use this gate!");
return; return;
} }
@ -58,6 +60,8 @@ public class PluginPlayerListener implements Listener
event.getPlayer().teleport(teleportToLocation); event.getPlayer().teleport(teleportToLocation);
event.setTo(teleportToLocation); event.setTo(teleportToLocation);
event.getPlayer().sendMessage(ChatColor.DARK_AQUA + "Thank you for traveling with Craft Inc. Gates.");
} }
@ -66,7 +70,7 @@ public class PluginPlayerListener implements Listener
World w = b.getWorld(); World w = b.getWorld();
Chunk c = b.getChunk(); Chunk c = b.getChunk();
if ( ! w.isChunkLoaded(c) ) if (!w.isChunkLoaded(c))
{ {
Plugin.log(Level.FINE, "Loading chunk: " + c.toString() + " on: " + w.toString()); Plugin.log(Level.FINE, "Loading chunk: " + c.toString() + " on: " + w.toString());
w.loadChunk(c); w.loadChunk(c);