various bug fixes

This commit is contained in:
Vlammar 2021-02-11 00:29:18 +01:00
parent 202ae4ea93
commit 9abea9d315
5 changed files with 19 additions and 14 deletions

View File

@ -59,7 +59,7 @@ import org.bukkit.entity.Player;
@WithFlags({"confirm"})
public class DeleteCommand extends IoMCommand {
private static RawText deleteMsg(Class klass, Player sender, ImageMap map) {
private static RawText deleteMsg(Class klass, String playerName, ImageMap map) {
return new RawText(I.t("You are going to delete") + " ")
.then(map.getId())
.color(ChatColor.GOLD)
@ -68,7 +68,7 @@ public class DeleteCommand extends IoMCommand {
.then(I.t("[Confirm]"))
.color(ChatColor.GREEN)
.hover(new RawText(I.t("{red}This map will be deleted {bold}forever{red}!")))
.command(klass, sender.getName(), map.getId(), "--confirm")
.command(klass, playerName + ":" + "\"" + map.getId() + "\"", "--confirm")
.build();
}
@ -89,7 +89,6 @@ public class DeleteCommand extends IoMCommand {
final String playerName;
final String mapName;
final Player sender = playerSender();
info(sender, "" + arguments.size());
if (arguments.size() == 2 || arguments.size() == 3) {
if (!Permissions.DELETEOTHER.grantedTo(sender)) {
throwNotAuthorized();
@ -109,6 +108,7 @@ public class DeleteCommand extends IoMCommand {
warning(sender, I.t("The player {0} does not exist.", playerName));
return;
}
ImageMap map = MapManager.getMap(uuid, mapName);
if (map == null) {
@ -117,7 +117,7 @@ public class DeleteCommand extends IoMCommand {
}
if (!confirm) {
RawText msg = deleteMsg(getClass(), sender, map);
RawText msg = deleteMsg(getClass(), playerName, map);
RawMessage.send(sender, msg);
} else {
if (sender != null && sender.isOnline() && sender.getInventory() != null) {
@ -132,8 +132,6 @@ public class DeleteCommand extends IoMCommand {
warning(sender, I.t("This map does not exist."));
}
}
});

View File

@ -55,7 +55,7 @@ public class GetCommand extends IoMCommand {
protected void run() throws CommandException {
ArrayList<String> arguments = getArgs();
if (args.length > 1) {
if (arguments.size() > 2) {
throwInvalidArgument(I.t("Too many parameters!"));
return;
}

View File

@ -124,6 +124,10 @@ public class GiveCommand extends IoMCommand {
warning(sender, I.t("The player {0} does not exist.", playerName));
return;
}
if (Bukkit.getPlayer((uuid2)) == null || !Bukkit.getPlayer((uuid2)).isOnline()) {
warning(sender, I.t("The player {0} is not connected.", playerName));
return;
}
if (Bukkit.getPlayer((uuid2)) != null && Bukkit.getPlayer((uuid2)).isOnline()
&& map.give(Bukkit.getPlayer(uuid2))) {
info(I.t("The requested map was too big to fit in your inventory."));

View File

@ -10,5 +10,8 @@ list: Lists all the map you currently have.
listother: list all the map of another player.
explore: Opens a GUI to see and manage your maps.
exploreother: Opens a GUI to see and manage another player maps.
give: Give a specified player a map
rename: Rename an ImageOnMap
update: Update a specified ImageOnMap
migrate: Lauches the migration process from V2.7 to V3.x.
help : Use help for more information about a command.

View File

@ -24,11 +24,11 @@ permissions:
imageonmap.userender: true
imageonmap.new: true
imageonmap.list: true
imageonmap.listother: true
imageonmap.listother: false
imageonmap.get: true
imageonmap.getother: true
imageonmap.getother: false
imageonmap.explore: true
imageonmap.exploreother: true
imageonmap.exploreother: false
imageonmap.rename: true
imageonmap.removesplattermap: true
imageonmap.delete: true
@ -52,7 +52,7 @@ permissions:
imageonmap.listother:
description: "Allows you to list the images a player have rendered."
default: false
default: op
imageonmap.get:
description: "Allows you to get a new map among the ones you already rendered, and related commands (/maptool getremaining)."
@ -60,7 +60,7 @@ permissions:
imageonmap.getother:
description: "Allows you to get a new map among the ones a player have already rendered."
default: false
default: op
imageonmap.explore:
description: "Allows you to open a GUI with all your maps."
@ -68,7 +68,7 @@ permissions:
imageonmap.exploreother:
description: "Allows you to open a GUI with all of the player maps."
default: false
default: op
imageonmap.rename:
description: "Allows you to rename a map you rendered in the past."
@ -84,7 +84,7 @@ permissions:
imageonmap.deleteother:
description: "Allows you to delete a map a player rendered in the past."
default: false
default: op
imageonmap.removesplattermap:
description: "Allows you to remove a splatter map from a wall by sneaking and breaking a map."