fixed other bugs linked to #121

This commit is contained in:
Vlammar 2020-07-30 13:37:06 +02:00
parent 2c734d1cb5
commit a41ffaedee
3 changed files with 7 additions and 6 deletions

View File

@ -102,7 +102,7 @@ public class MapDetailGui extends ExplorerGui<Integer>
if (map instanceof SingleMap) if (map instanceof SingleMap)
{ {
return MapItemManager.createMapItem((SingleMap)map); return MapItemManager.createMapItem((SingleMap)map,true);
} }
else if (map instanceof PosterMap) else if (map instanceof PosterMap)
{ {

View File

@ -131,7 +131,7 @@ public class MapListGui extends ExplorerGui<ImageMap>
if (map instanceof SingleMap) if (map instanceof SingleMap)
{ {
return MapItemManager.createMapItem(map.getMapsIDs()[0], map.getName(), false); return MapItemManager.createMapItem(map.getMapsIDs()[0], map.getName(), false,true);
} }
else if (map instanceof PosterMap) else if (map instanceof PosterMap)
{ {

View File

@ -43,10 +43,10 @@ import fr.moribus.imageonmap.map.PosterMap;
import fr.moribus.imageonmap.map.SingleMap; import fr.moribus.imageonmap.map.SingleMap;
import fr.zcraft.zlib.components.i18n.I; import fr.zcraft.zlib.components.i18n.I;
import fr.zcraft.zlib.core.ZLib; import fr.zcraft.zlib.core.ZLib;
import fr.zcraft.zlib.tools.PluginLogger;
import fr.zcraft.zlib.tools.items.ItemStackBuilder; import fr.zcraft.zlib.tools.items.ItemStackBuilder;
import fr.zcraft.zlib.tools.items.ItemUtils; import fr.zcraft.zlib.tools.items.ItemUtils;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.ItemFrame; import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -190,7 +190,6 @@ public class MapItemManager implements Listener
meta.setMapId(mapID); meta.setMapId(mapID);
meta.setColor(isMapPart ? Color.LIME : Color.GREEN); meta.setColor(isMapPart ? Color.LIME : Color.GREEN);
mapItem.setItemMeta(meta); mapItem.setItemMeta(meta);
PluginLogger.info("color "+meta.getColor());
return mapItem; return mapItem;
} }
static public ItemStack createMapItem(int mapID, String text, boolean isMapPart) static public ItemStack createMapItem(int mapID, String text, boolean isMapPart)
@ -271,11 +270,13 @@ public class MapItemManager implements Listener
event.setCancelled(true); //In case of an error allow to cancel map placement event.setCancelled(true); //In case of an error allow to cancel map placement
return; return;
} }
frame.setRotation(Rotation.NONE.rotateCounterClockwise()); if(frame.getFacing()!= BlockFace.UP&&frame.getFacing()!= BlockFace.DOWN)
frame.setRotation(Rotation.NONE.rotateCounterClockwise());
} }
else else
{ {
frame.setRotation(Rotation.NONE.rotateCounterClockwise()); if(frame.getFacing()!= BlockFace.UP&&frame.getFacing()!= BlockFace.DOWN)
frame.setRotation(Rotation.NONE.rotateCounterClockwise());
// If the item has a display name, bot not one from an anvil by the player, we remove it // If the item has a display name, bot not one from an anvil by the player, we remove it
// If it is not displayed on hover on the wall. // If it is not displayed on hover on the wall.
if (mapItem.hasItemMeta() && mapItem.getItemMeta().hasDisplayName() && mapItem.getItemMeta().getDisplayName().startsWith("§6")) if (mapItem.hasItemMeta() && mapItem.getItemMeta().hasDisplayName() && mapItem.getItemMeta().getDisplayName().startsWith("§6"))