Fixed part of the issues, still splattermap and renaming from GUI to fix

This commit is contained in:
Vlammar 2021-09-03 00:26:27 +02:00
parent 094905324e
commit c1f793d50a
5 changed files with 29 additions and 24 deletions

View File

@ -39,7 +39,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.moribus</groupId>
<artifactId>ImageOnMap</artifactId>
<version>4.1.2</version>
<version>4.2.0</version>
<packaging>jar</packaging>
<properties>

View File

@ -121,7 +121,7 @@ public class NewCommand extends IoMCommand {
}
scaling = resizeMode();
}
if (width == 0 || height == 0) {
if (width < 0 || height < 0) {
throwInvalidArgument(I.t("You need to specify a valid size. e.g. resize 4 5"));
return;
}

View File

@ -46,6 +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.PluginLogger;
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
import fr.zcraft.quartzlib.tools.runners.RunTask;
import org.apache.commons.lang.ArrayUtils;
@ -208,32 +209,35 @@ public class MapDetailGui extends ExplorerGui<Integer> {
return;
}
PromptGui.prompt(getPlayer(), newName -> {
if (!Permissions.RENAME.grantedTo(getPlayer())) {
I.sendT(getPlayer(), "{ce}You are no longer allowed to do that.");
return;
}
try {
PromptGui.prompt(getPlayer(), newName -> {
if (!Permissions.RENAME.grantedTo(getPlayer())) {
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;
}
if (newName.equals(map.getName())) {
return;
}
if (newName == null || newName.isEmpty()) {
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.");
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);
if (getParent() != null) {
RunTask.later(() -> Gui.open(getPlayer(), this), 1L);
} else {
close();
}
}, map.getName(), this);
} catch (IllegalStateException e) {
PluginLogger.info("error while renaming");
}
}
@GuiAction("delete")

View File

@ -137,6 +137,7 @@ public abstract class SplatterMapManager {
* @return True if the attribute was detected.
*/
public static boolean hasSplatterAttributes(ItemStack itemStack) {
try {
final NBTCompound nbt = NBT.fromItemStack(itemStack);
if (!nbt.containsKey("Enchantments")) {

View File

@ -1,6 +1,6 @@
name: ImageOnMap
main: fr.moribus.imageonmap.ImageOnMap
version: "4.1.2"
version: "4.2.0"
api-version: "1.13"