fixed the GUI bug

This commit is contained in:
Vlammar 2020-12-27 02:24:47 +01:00
parent b73b5a1f15
commit 2c65367cca
3 changed files with 16 additions and 13 deletions

View File

@ -46,8 +46,8 @@ 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.PluginLogger;
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
import fr.zcraft.quartzlib.tools.runners.RunTask;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
@ -61,7 +61,6 @@ public class MapDetailGui extends ExplorerGui<Integer> {
public MapDetailGui(ImageMap map, OfflinePlayer p, String name) {
super();
PluginLogger.info("MapdetailGUI constructor");
this.map = map;
this.offplayer = p;
this.name = name;
@ -219,10 +218,22 @@ public class MapDetailGui extends ExplorerGui<Integer> {
I.sendT(getPlayer(), "{ce}Map names can't be empty.");
return;
}
if (newName.equals(map.getName())) {
return;
}
map.rename(newName);
I.sendT(getPlayer(), "{cs}Map successfully renamed.");
if (getParent() != null) {
RunTask.later(() -> Gui.open(getPlayer(), this), 1L);
} else {
close();
}
}, map.getName(), this);
}
@GuiAction("delete")

View File

@ -47,7 +47,6 @@ 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;
@ -61,13 +60,11 @@ 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;
}
@ -171,7 +168,6 @@ 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())) {

View File

@ -43,7 +43,6 @@ 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;
@ -253,7 +252,6 @@ public class MapItemManager implements Listener {
return;
}
frame.setItem(new ItemStack(Material.AIR));
PluginLogger.info("map iom placed");
if (SplatterMapManager.hasSplatterAttributes(mapItem)) {
if (!SplatterMapManager.placeSplatterMap(frame, player, event)) {
@ -261,13 +259,13 @@ public class MapItemManager implements Listener {
return;
}
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 {
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 it is not displayed on hover on the wall.
@ -280,14 +278,12 @@ public class MapItemManager implements Listener {
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);