2013-09-09 10:06:44 +02:00
|
|
|
package mineplex.hub.modules;
|
|
|
|
|
|
|
|
import org.bukkit.Effect;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.entity.ItemFrame;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
|
|
import org.bukkit.event.player.PlayerJoinEvent;
|
|
|
|
|
|
|
|
import mineplex.core.MiniPlugin;
|
|
|
|
import mineplex.core.map.Map;
|
|
|
|
import mineplex.core.common.Rank;
|
|
|
|
import mineplex.core.common.util.UtilGear;
|
|
|
|
import mineplex.hub.HubManager;
|
|
|
|
|
|
|
|
public class MapManager extends MiniPlugin
|
|
|
|
{
|
|
|
|
private HubManager Manager;
|
|
|
|
private Map Map;
|
|
|
|
|
2013-12-06 10:57:09 +01:00
|
|
|
public MapManager(HubManager manager)
|
2013-09-09 10:06:44 +02:00
|
|
|
{
|
|
|
|
super("Map Manager", manager.GetPlugin());
|
|
|
|
Map = new Map(manager.GetPlugin());
|
|
|
|
Manager = manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
//@EventHandler
|
|
|
|
public void PlayerJoin(PlayerJoinEvent event)
|
|
|
|
{
|
2013-09-23 22:30:40 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
Map.SetDefaultUrl("http://chivebox.com/img/mc/news.png");
|
|
|
|
event.getPlayer().setItemInHand(Map.GetMap());
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
System.out.println("[MapManager] Player Join exception");
|
|
|
|
throw ex;
|
|
|
|
}
|
2013-09-09 10:06:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
public void FrameInteract(PlayerInteractEntityEvent event)
|
|
|
|
{
|
|
|
|
if (!(event.getRightClicked() instanceof ItemFrame))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.OWNER))
|
|
|
|
{
|
|
|
|
event.setCancelled(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.DIAMOND_AXE))
|
|
|
|
return;
|
|
|
|
|
|
|
|
event.getRightClicked().getWorld().playEffect(event.getRightClicked().getLocation(), Effect.STEP_SOUND, 5);
|
|
|
|
event.getRightClicked().remove();
|
|
|
|
}
|
|
|
|
}
|