mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2025-02-13 10:01:25 +01:00
fixed the render issue for the left map
This commit is contained in:
parent
7eb646f1a1
commit
b73b5a1f15
2
pom.xml
2
pom.xml
@ -93,7 +93,7 @@
|
||||
<dependency>
|
||||
<groupId>fr.zcraft</groupId>
|
||||
<artifactId>quartzlib</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
|
@ -104,7 +104,7 @@ public class DeleteCommand extends IoMCommand {
|
||||
}
|
||||
|
||||
//TODO passer en static
|
||||
ImageOnMap.getPlugin().getCommandWorker().OfflineNameFetch(playerName, uuid -> {
|
||||
ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(playerName, uuid -> {
|
||||
if (uuid == null) {
|
||||
info(sender, I.t("The player {0} does not exist.", playerName));
|
||||
return;
|
||||
|
@ -75,7 +75,7 @@ public class ExploreCommand extends IoMCommand {
|
||||
}
|
||||
|
||||
//TODO passer en static
|
||||
ImageOnMap.getPlugin().getCommandWorker().OfflineNameFetch(playerName, uuid -> {
|
||||
ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(playerName, uuid -> {
|
||||
if (uuid == null) {
|
||||
info(sender, I.t("The player {0} does not exist.", playerName));
|
||||
return;
|
||||
|
@ -100,7 +100,7 @@ public class GetCommand extends IoMCommand {
|
||||
}
|
||||
|
||||
//TODO passer en static
|
||||
ImageOnMap.getPlugin().getCommandWorker().OfflineNameFetch(playerName, uuid -> {
|
||||
ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(playerName, uuid -> {
|
||||
if (uuid == null) {
|
||||
info(sender, I.t("The player {0} does not exist.", playerName));
|
||||
return;
|
||||
|
@ -93,7 +93,7 @@ public class GiveCommand extends IoMCommand {
|
||||
}
|
||||
|
||||
//TODO passer en static
|
||||
ImageOnMap.getPlugin().getCommandWorker().OfflineNameFetch(from, uuid -> {
|
||||
ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(from, uuid -> {
|
||||
if (uuid == null) {
|
||||
info(sender, I.t("The player {0} does not exist.", from));
|
||||
return;
|
||||
|
@ -79,7 +79,7 @@ public class ListCommand extends IoMCommand {
|
||||
final Player sender = playerSender();
|
||||
|
||||
//TODO passer en static
|
||||
ImageOnMap.getPlugin().getCommandWorker().OfflineNameFetch(playerName, uuid -> {
|
||||
ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(playerName, uuid -> {
|
||||
List<ImageMap> mapList = MapManager.getMapList(uuid);
|
||||
if (uuid == null) {
|
||||
info(sender, I.t("Player {} not found.", playerName));
|
||||
|
@ -146,7 +146,7 @@ public class UpdateCommand extends IoMCommand {
|
||||
|
||||
|
||||
//TODO passer en static
|
||||
ImageOnMap.getPlugin().getCommandWorker().OfflineNameFetch(playerName, uuid -> {
|
||||
ImageOnMap.getPlugin().getCommandWorker().offlineNameFetch(playerName, uuid -> {
|
||||
if (uuid == null) {
|
||||
info(sender, I.t("The player {0} does not exist.", playerName));
|
||||
return;
|
||||
|
@ -46,7 +46,7 @@ import fr.zcraft.quartzlib.components.gui.Gui;
|
||||
import fr.zcraft.quartzlib.components.gui.GuiAction;
|
||||
import fr.zcraft.quartzlib.components.gui.PromptGui;
|
||||
import fr.zcraft.quartzlib.components.i18n.I;
|
||||
import fr.zcraft.quartzlib.tools.Callback;
|
||||
import fr.zcraft.quartzlib.tools.PluginLogger;
|
||||
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.bukkit.Material;
|
||||
@ -60,6 +60,8 @@ public class MapDetailGui extends ExplorerGui<Integer> {
|
||||
private String name;
|
||||
|
||||
public MapDetailGui(ImageMap map, OfflinePlayer p, String name) {
|
||||
super();
|
||||
PluginLogger.info("MapdetailGUI constructor");
|
||||
this.map = map;
|
||||
this.offplayer = p;
|
||||
this.name = name;
|
||||
@ -207,9 +209,7 @@ public class MapDetailGui extends ExplorerGui<Integer> {
|
||||
return;
|
||||
}
|
||||
|
||||
PromptGui.prompt(getPlayer(), new Callback<String>() {
|
||||
@Override
|
||||
public void call(String newName) {
|
||||
PromptGui.prompt(getPlayer(), newName -> {
|
||||
if (!Permissions.RENAME.grantedTo(getPlayer())) {
|
||||
I.sendT(getPlayer(), "{ce}You are no longer allowed to do that.");
|
||||
return;
|
||||
@ -222,7 +222,6 @@ public class MapDetailGui extends ExplorerGui<Integer> {
|
||||
|
||||
map.rename(newName);
|
||||
I.sendT(getPlayer(), "{cs}Map successfully renamed.");
|
||||
}
|
||||
}, map.getName(), this);
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ import fr.moribus.imageonmap.ui.SplatterMapManager;
|
||||
import fr.zcraft.quartzlib.components.gui.ExplorerGui;
|
||||
import fr.zcraft.quartzlib.components.gui.Gui;
|
||||
import fr.zcraft.quartzlib.components.i18n.I;
|
||||
import fr.zcraft.quartzlib.tools.PluginLogger;
|
||||
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
@ -60,11 +61,13 @@ public class MapListGui extends ExplorerGui<ImageMap> {
|
||||
private String name;
|
||||
|
||||
public MapListGui(OfflinePlayer sender) {
|
||||
PluginLogger.info("MaplistGUI constructor");
|
||||
this.offplayer = sender;
|
||||
this.name = sender.getName();
|
||||
}
|
||||
|
||||
public MapListGui(OfflinePlayer p, String name) {
|
||||
PluginLogger.info("MaplistGUI constructor");
|
||||
this.offplayer = p;
|
||||
this.name = name;
|
||||
}
|
||||
@ -136,6 +139,10 @@ public class MapListGui extends ExplorerGui<ImageMap> {
|
||||
Gui.open(getPlayer(), new MapDetailGui(data, getPlayer(), name), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClose() {
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getPickedUpItem(ImageMap map) {
|
||||
@ -164,7 +171,7 @@ public class MapListGui extends ExplorerGui<ImageMap> {
|
||||
protected void onUpdate() {
|
||||
ImageMap[] maps = MapManager.getMaps(offplayer.getUniqueId());
|
||||
setData(maps);
|
||||
|
||||
PluginLogger.info("on update MaplistGUI");
|
||||
/// The maps list GUI title
|
||||
//Equal if the person who send the command is the owner of the mapList
|
||||
if (offplayer.getUniqueId().equals(getPlayer().getUniqueId())) {
|
||||
|
@ -43,8 +43,10 @@ import fr.moribus.imageonmap.map.PosterMap;
|
||||
import fr.moribus.imageonmap.map.SingleMap;
|
||||
import fr.zcraft.quartzlib.components.i18n.I;
|
||||
import fr.zcraft.quartzlib.core.QuartzLib;
|
||||
import fr.zcraft.quartzlib.tools.PluginLogger;
|
||||
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
|
||||
import fr.zcraft.quartzlib.tools.items.ItemUtils;
|
||||
import fr.zcraft.quartzlib.tools.runners.RunTask;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.HashMap;
|
||||
import java.util.Queue;
|
||||
@ -206,6 +208,7 @@ public class MapItemManager implements Listener {
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns the item to place to display the (col;row) part of the given poster.
|
||||
*
|
||||
@ -249,8 +252,10 @@ public class MapItemManager implements Listener {
|
||||
if (!MapManager.managesMap(mapItem)) {
|
||||
return;
|
||||
}
|
||||
|
||||
frame.setItem(new ItemStack(Material.AIR));
|
||||
PluginLogger.info("map iom placed");
|
||||
if (SplatterMapManager.hasSplatterAttributes(mapItem)) {
|
||||
|
||||
if (!SplatterMapManager.placeSplatterMap(frame, player, event)) {
|
||||
event.setCancelled(true); //In case of an error allow to cancel map placement
|
||||
return;
|
||||
@ -258,6 +263,8 @@ public class MapItemManager implements Listener {
|
||||
if (frame.getFacing() != BlockFace.UP && frame.getFacing() != BlockFace.DOWN) {
|
||||
frame.setRotation(Rotation.NONE.rotateCounterClockwise());
|
||||
}
|
||||
|
||||
PluginLogger.info("splatter map");
|
||||
} else {
|
||||
if (frame.getFacing() != BlockFace.UP && frame.getFacing() != BlockFace.DOWN) {
|
||||
frame.setRotation(Rotation.NONE.rotateCounterClockwise());
|
||||
@ -266,16 +273,26 @@ public class MapItemManager implements Listener {
|
||||
// If it is not displayed on hover on the wall.
|
||||
if (mapItem.hasItemMeta() && mapItem.getItemMeta().hasDisplayName()
|
||||
&& mapItem.getItemMeta().getDisplayName().startsWith("§6")) {
|
||||
|
||||
//runtask
|
||||
//TODO utiliser run task.later pour essayer de regler le pb d'itemframe bas gauche sans carte
|
||||
final ItemStack frameItem = mapItem.clone();
|
||||
final ItemMeta meta = frameItem.getItemMeta();
|
||||
|
||||
meta.setDisplayName(null);
|
||||
frameItem.setItemMeta(meta);
|
||||
|
||||
PluginLogger.info("test1");
|
||||
RunTask.later(() -> {
|
||||
frame.setItem(frameItem);
|
||||
frame.setRotation(Rotation.NONE);
|
||||
}, 5L);
|
||||
|
||||
} else {
|
||||
PluginLogger.info("test2");
|
||||
frame.setRotation(Rotation.NONE);
|
||||
RunTask.later(() -> {
|
||||
frame.setItem(mapItem);
|
||||
}, 5L);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ import fr.zcraft.quartzlib.components.nbt.NBTList;
|
||||
import fr.zcraft.quartzlib.tools.PluginLogger;
|
||||
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
|
||||
import fr.zcraft.quartzlib.tools.reflection.NMSException;
|
||||
import fr.zcraft.quartzlib.tools.runners.RunTask;
|
||||
import fr.zcraft.quartzlib.tools.text.MessageSender;
|
||||
import fr.zcraft.quartzlib.tools.world.FlatLocation;
|
||||
import fr.zcraft.quartzlib.tools.world.WorldUtils;
|
||||
@ -121,9 +122,7 @@ public abstract class SplatterMapManager {
|
||||
* prettier).
|
||||
*
|
||||
* @param itemStack The item stack to mark as a splatter map.
|
||||
* @return The modified item stack. The instance may be different if the passed item stack is not
|
||||
a craft item stack; that's why the instance is returned.
|
||||
*
|
||||
* @return The modified item stack. The instance may be different if the passed item stack is not a craft itemstack.
|
||||
*/
|
||||
public static ItemStack addSplatterAttribute(final ItemStack itemStack) {
|
||||
try {
|
||||
@ -248,7 +247,11 @@ public abstract class SplatterMapManager {
|
||||
}
|
||||
//Rotation management relative to player rotation the default position is North,
|
||||
// when on ceiling we flipped the rotation
|
||||
frame.setItem(new ItemStackBuilder(Material.FILLED_MAP).nbt(ImmutableMap.of("map", id)).craftItem());
|
||||
RunTask.later(() -> {
|
||||
frame.setItem(
|
||||
new ItemStackBuilder(Material.FILLED_MAP).nbt(ImmutableMap.of("map", id)).craftItem());
|
||||
}, 5L);
|
||||
|
||||
if (i == 0) {
|
||||
//First map need to be rotate one time CounterClockwise
|
||||
rot = rot.rotateCounterClockwise();
|
||||
@ -304,7 +307,12 @@ public abstract class SplatterMapManager {
|
||||
for (ItemFrame frame : wall.frames) {
|
||||
|
||||
int id = poster.getMapIdAtReverseY(i);
|
||||
frame.setItem(new ItemStackBuilder(Material.FILLED_MAP).nbt(ImmutableMap.of("map", id)).craftItem());
|
||||
|
||||
RunTask.later(() -> {
|
||||
frame.setItem(
|
||||
new ItemStackBuilder(Material.FILLED_MAP).nbt(ImmutableMap.of("map", id)).craftItem());
|
||||
}, 5L);
|
||||
|
||||
|
||||
//Force reset of rotation
|
||||
frame.setRotation(Rotation.NONE);
|
||||
|
Loading…
Reference in New Issue
Block a user