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