Added compatibility for Spigot's 1.8 CraftBukkit builds.

This commit is contained in:
SydMontague 2015-01-08 20:55:32 +01:00
parent 6b32d60a73
commit bce3907086
2 changed files with 16 additions and 5 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.craftlancer.imagemaps</groupId> <groupId>de.craftlancer.imagemaps</groupId>
<artifactId>ImageMaps</artifactId> <artifactId>ImageMaps</artifactId>
<version>0.5.0-SNAPSHOT</version> <version>0.4.1</version>
<name>ImageMaps</name> <name>ImageMaps</name>
<description>Draw Images on maps!</description> <description>Draw Images on maps!</description>
<properties> <properties>

View File

@ -155,11 +155,22 @@ public class ImageMaps extends JavaPlugin implements Listener
} }
private void setItemFrame(Block bb, BufferedImage image, BlockFace face, int x, int y, PlacingCacheEntry cache) private void setItemFrame(Block bb, BufferedImage image, BlockFace face, int x, int y, PlacingCacheEntry cache)
{
ItemFrame i;
String cbPackage = getServer().getClass().getPackage().getName();
String version = cbPackage.substring(cbPackage.lastIndexOf('.') + 1);
if (version.startsWith("v1_8"))
{
i = bb.getWorld().spawn(bb.getLocation(), ItemFrame.class);
i.setFacingDirection(face, false);
}
else
{ {
bb.setType(Material.AIR); bb.setType(Material.AIR);
ItemFrame i = bb.getWorld().spawn(bb.getRelative(face.getOppositeFace()).getLocation(), ItemFrame.class); i = bb.getWorld().spawn(bb.getRelative(face.getOppositeFace()).getLocation(), ItemFrame.class);
i.teleport(bb.getLocation()); i.teleport(bb.getLocation());
i.setFacingDirection(face, true); i.setFacingDirection(face, true);
}
ItemStack item = getMapItem(cache.getImage(), x, y, image); ItemStack item = getMapItem(cache.getImage(), x, y, image);
i.setItem(item); i.setItem(item);