Fixed part of the issues, still splattermap and renaming from GUI to fix
This commit is contained in:
parent
094905324e
commit
c1f793d50a
2
pom.xml
2
pom.xml
|
@ -39,7 +39,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>fr.moribus</groupId>
|
<groupId>fr.moribus</groupId>
|
||||||
<artifactId>ImageOnMap</artifactId>
|
<artifactId>ImageOnMap</artifactId>
|
||||||
<version>4.1.2</version>
|
<version>4.2.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class NewCommand extends IoMCommand {
|
||||||
}
|
}
|
||||||
scaling = resizeMode();
|
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"));
|
throwInvalidArgument(I.t("You need to specify a valid size. e.g. resize 4 5"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +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.PluginLogger;
|
||||||
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
|
import fr.zcraft.quartzlib.tools.items.ItemStackBuilder;
|
||||||
import fr.zcraft.quartzlib.tools.runners.RunTask;
|
import fr.zcraft.quartzlib.tools.runners.RunTask;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
@ -208,32 +209,35 @@ public class MapDetailGui extends ExplorerGui<Integer> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PromptGui.prompt(getPlayer(), newName -> {
|
try {
|
||||||
if (!Permissions.RENAME.grantedTo(getPlayer())) {
|
PromptGui.prompt(getPlayer(), 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()) {
|
if (newName == null || newName.isEmpty()) {
|
||||||
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())) {
|
if (newName.equals(map.getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
map.rename(newName);
|
map.rename(newName);
|
||||||
I.sendT(getPlayer(), "{cs}Map successfully renamed.");
|
I.sendT(getPlayer(), "{cs}Map successfully renamed.");
|
||||||
|
|
||||||
if (getParent() != null) {
|
if (getParent() != null) {
|
||||||
RunTask.later(() -> Gui.open(getPlayer(), this), 1L);
|
RunTask.later(() -> Gui.open(getPlayer(), this), 1L);
|
||||||
|
|
||||||
} else {
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
}, map.getName(), this);
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}, map.getName(), this);
|
||||||
|
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
PluginLogger.info("error while renaming");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GuiAction("delete")
|
@GuiAction("delete")
|
||||||
|
|
|
@ -137,6 +137,7 @@ public abstract class SplatterMapManager {
|
||||||
* @return True if the attribute was detected.
|
* @return True if the attribute was detected.
|
||||||
*/
|
*/
|
||||||
public static boolean hasSplatterAttributes(ItemStack itemStack) {
|
public static boolean hasSplatterAttributes(ItemStack itemStack) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final NBTCompound nbt = NBT.fromItemStack(itemStack);
|
final NBTCompound nbt = NBT.fromItemStack(itemStack);
|
||||||
if (!nbt.containsKey("Enchantments")) {
|
if (!nbt.containsKey("Enchantments")) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: ImageOnMap
|
name: ImageOnMap
|
||||||
main: fr.moribus.imageonmap.ImageOnMap
|
main: fr.moribus.imageonmap.ImageOnMap
|
||||||
version: "4.1.2"
|
version: "4.2.0"
|
||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue