mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2024-11-13 05:44:04 +01:00
fixed the GUI bug
This commit is contained in:
parent
b73b5a1f15
commit
2c65367cca
@ -46,8 +46,8 @@ 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.PluginLogger;
|
|
||||||
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
|
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
|
||||||
|
import fr.zcraft.quartzlib.tools.runners.RunTask;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -61,7 +61,6 @@ public class MapDetailGui extends ExplorerGui<Integer> {
|
|||||||
|
|
||||||
public MapDetailGui(ImageMap map, OfflinePlayer p, String name) {
|
public MapDetailGui(ImageMap map, OfflinePlayer p, String name) {
|
||||||
super();
|
super();
|
||||||
PluginLogger.info("MapdetailGUI constructor");
|
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.offplayer = p;
|
this.offplayer = p;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -219,10 +218,22 @@ public class MapDetailGui extends ExplorerGui<Integer> {
|
|||||||
I.sendT(getPlayer(), "{ce}Map names can't be empty.");
|
I.sendT(getPlayer(), "{ce}Map names can't be empty.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (newName.equals(map.getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
map.rename(newName);
|
map.rename(newName);
|
||||||
I.sendT(getPlayer(), "{cs}Map successfully renamed.");
|
I.sendT(getPlayer(), "{cs}Map successfully renamed.");
|
||||||
|
|
||||||
|
if (getParent() != null) {
|
||||||
|
RunTask.later(() -> Gui.open(getPlayer(), this), 1L);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
close();
|
||||||
|
}
|
||||||
}, map.getName(), this);
|
}, map.getName(), this);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GuiAction("delete")
|
@GuiAction("delete")
|
||||||
|
@ -47,7 +47,6 @@ 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;
|
||||||
@ -61,13 +60,11 @@ 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;
|
||||||
}
|
}
|
||||||
@ -171,7 +168,6 @@ 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,7 +43,6 @@ 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 fr.zcraft.quartzlib.tools.runners.RunTask;
|
||||||
@ -253,7 +252,6 @@ public class MapItemManager implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
frame.setItem(new ItemStack(Material.AIR));
|
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)) {
|
||||||
@ -261,13 +259,13 @@ public class MapItemManager implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
frame.setRotation(Rotation.NONE);
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
// 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.
|
||||||
@ -280,14 +278,12 @@ public class MapItemManager implements Listener {
|
|||||||
|
|
||||||
meta.setDisplayName(null);
|
meta.setDisplayName(null);
|
||||||
frameItem.setItemMeta(meta);
|
frameItem.setItemMeta(meta);
|
||||||
PluginLogger.info("test1");
|
|
||||||
RunTask.later(() -> {
|
RunTask.later(() -> {
|
||||||
frame.setItem(frameItem);
|
frame.setItem(frameItem);
|
||||||
frame.setRotation(Rotation.NONE);
|
frame.setRotation(Rotation.NONE);
|
||||||
}, 5L);
|
}, 5L);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PluginLogger.info("test2");
|
|
||||||
frame.setRotation(Rotation.NONE);
|
frame.setRotation(Rotation.NONE);
|
||||||
RunTask.later(() -> {
|
RunTask.later(() -> {
|
||||||
frame.setItem(mapItem);
|
frame.setItem(mapItem);
|
||||||
|
Loading…
Reference in New Issue
Block a user