Improved help files and used flags instead of double commands.

* NEW: improved help files, by adding missing helps and fixing display of others.
* NEW: there is now only one deletion command with a --confirm flag, leading to a less-confusing help for players.
* BUG: removed a very old Workers API test (from before zLib!). I feel a little sorry for him but eh, that's the rules.
* BUG: fixed untranlated title in the map details GUI.
This commit is contained in:
Amaury Carrade 2017-03-12 20:05:32 +01:00
parent 8fd31f298e
commit b9259280dd
No known key found for this signature in database
GPG Key ID: 73235214BDBB8752
14 changed files with 120 additions and 140 deletions

View File

@ -18,8 +18,7 @@
package fr.moribus.imageonmap;
import fr.moribus.imageonmap.commands.maptool.DeleteConfirmCommand;
import fr.moribus.imageonmap.commands.maptool.DeleteNoConfirmCommand;
import fr.moribus.imageonmap.commands.maptool.DeleteCommand;
import fr.moribus.imageonmap.commands.maptool.ExploreCommand;
import fr.moribus.imageonmap.commands.maptool.GetCommand;
import fr.moribus.imageonmap.commands.maptool.GetRemainingCommand;
@ -104,8 +103,7 @@ public final class ImageOnMap extends ZPlugin
NewCommand.class,
ListCommand.class,
GetCommand.class,
DeleteConfirmCommand.class,
DeleteNoConfirmCommand.class,
DeleteCommand.class,
GetRemainingCommand.class,
ExploreCommand.class,
MigrateCommand.class

View File

@ -24,31 +24,54 @@ import fr.moribus.imageonmap.map.MapManager;
import fr.moribus.imageonmap.map.MapManagerException;
import fr.zcraft.zlib.components.commands.CommandException;
import fr.zcraft.zlib.components.commands.CommandInfo;
import fr.zcraft.zlib.components.commands.WithFlags;
import fr.zcraft.zlib.components.i18n.I;
import fr.zcraft.zlib.components.rawtext.RawText;
import fr.zcraft.zlib.tools.PluginLogger;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.List;
@CommandInfo (name = "delete-noconfirm", usageParameters = "[map name]")
public class DeleteNoConfirmCommand extends IoMCommand
@CommandInfo (name = "delete", usageParameters = "<map name> [--confirm]")
@WithFlags ({"confirm"})
public class DeleteCommand extends IoMCommand
{
@Override
protected void run() throws CommandException
{
Player player = playerSender();
ImageMap map = getMapFromArgs();
MapManager.clear(player.getInventory(), map);
try
if (!hasFlag("confirm"))
{
MapManager.deleteMap(map);
info(I.t("Map successfully deleted."));
RawText msg = new RawText(I.t("You are going to delete") + " ")
.then(map.getId())
.color(ChatColor.GOLD)
.then(". " + I.t("Are you sure ? "))
.color(ChatColor.WHITE)
.then(I.t("[Confirm]"))
.color(ChatColor.GREEN)
.hover(new RawText(I.t("{red}This map will be deleted {bold}forever{red}!")))
.command(getClass(), map.getId(), "--confirm")
.build();
send(msg);
}
catch (MapManagerException ex)
else
{
PluginLogger.warning("A non-existent map was requested to be deleted", ex);
warning(I.t("This map does not exist."));
Player player = playerSender();
MapManager.clear(player.getInventory(), map);
try
{
MapManager.deleteMap(map);
info(I.t("Map successfully deleted."));
}
catch (MapManagerException ex)
{
PluginLogger.warning("A non-existent map was requested to be deleted", ex);
warning(I.t("This map does not exist."));
}
}
}
@ -57,6 +80,7 @@ public class DeleteNoConfirmCommand extends IoMCommand
{
if(args.length == 1)
return getMatchingMapNames(playerSender(), args[0]);
return null;
}
}

View File

@ -1,61 +0,0 @@
/*
* Copyright (C) 2013 Moribus
* Copyright (C) 2015 ProkopyL <prokopylmc@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.moribus.imageonmap.commands.maptool;
import fr.moribus.imageonmap.commands.IoMCommand;
import fr.moribus.imageonmap.map.ImageMap;
import fr.zcraft.zlib.components.commands.CommandException;
import fr.zcraft.zlib.components.commands.CommandInfo;
import fr.zcraft.zlib.components.i18n.I;
import fr.zcraft.zlib.components.rawtext.RawText;
import org.bukkit.ChatColor;
import java.util.List;
@CommandInfo (name = "delete", usageParameters = "[tool name]")
public class DeleteConfirmCommand extends IoMCommand
{
@Override
protected void run() throws CommandException
{
ImageMap map = getMapFromArgs();
RawText msg = new RawText(I.t("You are going to delete") + " ")
.then(map.getId())
.color(ChatColor.GOLD)
.then(". " + I.t("Are you sure ? "))
.color(ChatColor.WHITE)
.then(I.t("[Confirm]"))
.color(ChatColor.GREEN)
.hover(new RawText(I.t("{red}This map will be deleted {bold}forever{red}!")))
.command(DeleteNoConfirmCommand.class, map.getId())
.build();
send(msg);
}
@Override
protected List<String> complete() throws CommandException
{
if(args.length == 1)
return getMatchingMapNames(playerSender(), args[0]);
return null;
}
}

View File

@ -102,7 +102,7 @@ public class MapDetailGui extends ExplorerGui
);
action("delete", getSize() - 6, new ItemStackBuilder(Material.BARRIER)
.title("{red}Delete this image")
.title(I.t("{red}Delete this image"))
.longLore(I.t("{gray}Deletes this map {white}forever{gray}. This action cannot be undone!"))
.loreLine()
.longLore(I.t("{gray}You will be asked to confirm your choice if you click here."))
@ -118,7 +118,7 @@ public class MapDetailGui extends ExplorerGui
action("back", backSlot, new ItemStackBuilder(Material.EMERALD)
.title(I.t("{green}« Back"))
.lore(I.t("{gray}Go back to the list."))
.lore(I.t("{gray}Go back to the list."))
);
}

View File

@ -42,19 +42,6 @@ import java.util.concurrent.Future;
@WorkerAttributes (name = "Image Renderer", queriesMainThread = true)
public class ImageRendererExecutor extends Worker
{
static public void Test(WorkerCallback callback)
{
submitQuery(new WorkerRunnable<Void>()
{
@Override
public Void run() throws Throwable
{
Thread.sleep(5000);
return null;
}
}, callback);
}
static public void Render(final URL url, final boolean scaling, final UUID playerUUID, WorkerCallback<ImageMap> callback)
{
submitQuery(new WorkerRunnable<ImageMap>()
@ -70,7 +57,7 @@ public class ImageRendererExecutor extends Worker
final int httpCode = httpConnection.getResponseCode();
if((httpCode / 100) != 2)
{
throw new IOException(I.t("HTTP error : {0} {1}", httpCode, httpConnection.getResponseMessage()));
throw new IOException(I.t("HTTP error: {0} {1}", httpCode, httpConnection.getResponseMessage()));
}
}
final InputStream stream = connection.getInputStream();

View File

@ -5,4 +5,6 @@ delete-noconfirm: Deletes a map. Deletion is permanent and made without confirma
get: Gives you a map.
getremaining: Gives you the remaining maps that could not fit in your inventory
list: Lists all the map you currently have.
explore: Opens a GUI to see and manage your maps.
migrate: Lauches the migration process from V2.7 to V3.x.
help : Use help for more information about a command.

View File

@ -1,4 +0,0 @@
Deletes a map, and removes all parts and copies from your inventory.
§cWARNING: §r THERE WILL BE NO CONFIRMATION. MAP DELETION IS §lPERMANENT§r.
[map name] : The name of the map you want to delete.

View File

@ -1,5 +1,8 @@
Deletes a map, and removes all parts and copies from your inventory.
As deletion is permanent, a confirmation message will be shown
to the sending player.
Deletes a map, and removes all parts and copies
from your inventory. As deletion is permanent,
a confirmation message will be shown to the player.
[map name] : The name of the map you want to delete.
§6<map name> §rThe name of the map you want to delete.
§6--confirm §rDeletes directly. §cWARNING§r - THERE WILL BE
NO CONFIRMATION. MAP DELETION IS §lPERMANENT§r.

View File

@ -0,0 +1,8 @@
Opens a GUI to list and manage your maps.
From there, you can:
- list all the maps you rendered on this server;
- get copies of maps you rendered;
- get parts of posters in case of need;
- delete or rename your maps (organization!);
- see your statistics (maps rendered, left...).

View File

@ -1,3 +1,3 @@
Gives you a map, by putting it directly in your inventory.
<map name> : The name of the map you want to get.
§6<map name> §rThe name of the map you want to get.

View File

@ -1,5 +1,7 @@
Gives you the remaining maps that could not fit in your inventory.
Gives you the remaining maps that could not fit in
your inventory.
If you requested a multi-part (poster) map, and all the parts can't fit in
your inventory, then only first ones are given to you, and the remaining
ones are saved. You can then use this command to retreive them.
If you requested a multi-part (poster) map, and all
the parts can't fit in your inventory, then only first
ones are given to you, and the remaining ones are saved.
You can then use this command to retrieve them.

View File

@ -1,36 +1,48 @@
Migrates the Map database to the new V3.x format, that uses UUIDs
instead of player names to designate players (among other improvements).
Migration runs in a separate thread, therefore its progress can only be
Migrates the Map database to the new V3.x format,
that uses UUIDs instead of player names to designate
players (among other improvements). Migration runs in
a separate thread, therefore its progress can only be
watched from the server console.
The migration will run the following steps :
- Checking if there are files to migrate. If not, the migration stops.
- Checking if there are backups from a previous migration.
If there are, the migration stops.
- Loading the old map and poster data to memory.
- Backing up old files and new files, to the backups_pre-v3 and
backups_post-v3 subdirectories respectively.
Backup's integrity are chacked using file size and SHA1 checksum.
If integrity could not be proved, the migration stops.
- Retreiving the UUIDs of the players from Mojang's servers.
- Checking if some UUIDs could not be retreived.
If there are, this means some of your players may have changed names
before the migration started. The plugin will therefore try to retreive
them specifying a time, back when usernames could not be changed.
If some names could still not be matched to their UUIDs, then these are
probably non-paid accounts.
If no UUID has been retreived at all, the migration stops.
§c--- From this step, changes to disk will be made, and you will have to use§r
§c--- backups if you want to revert back from before the migration started.§r
- Merging the old map data with the new one, if there is any
(which can be the case if your player started to use newer
versions of ImageOnMap before the migration started).
- Saving all this merged map data to disk.
- Removing the old map data from their former files, leaving only the data
that could not be migrated due to usernames that could not be matched to
their UUIDs.
Original data is still present in the appropriate backup directory,
just in case.
The migration will run the following steps.
Note that this plugin will NEVER delete nor overwrite any backup directory.
Moving or deleting these backups is left to the administrator's responsibility.
- Checking if there are files to migrate. If not, the
migration stops.
- Checking if there are backups from a previous
migration. If there are, the migration stops.
- Loading the old map and poster data to memory.
- Backing up old files and new files, to the
§7backups_pre-v3§r and §7backups_post-v3§r sub-
directories respectively. Backup's integrity are
checked using file size and SHA1 checksum. If
integrity could not be proved, the migration stops.
- Retrieving the UUIDs of the players from Mojang's
servers.
- Checking if some UUIDs could not be retrieved.
If there are, this means some of your players may
have changed names before the migration started.
The plugin will therefore try to retrieve them
specifying a time, back when usernames could not
be changed. If some names could still not be matched
to their UUIDs, then these are probably non-paid
accounts. If no UUID has been retrieved at all,
the migration stops.
§c--- From this step, changes to disk will be made,§r
§c--- and you will have to use backups if you want to§r
§c--- revert back from before the migration started.§r
- Merging the old map data with the new one, if there
is any (which can be the case if your player started
to use newer versions of ImageOnMap before the
migration started).
- Saving all this merged map data to disk.
- Removing the old map data from their former files,
leaving only the data that could not be migrated
due to usernames that could not be matched to their
UUIDs. Original data is still present in the
appropriate backup directory, just in case.
Note that this plugin will NEVER delete nor overwrite
any backup directory. Moving or deleting these backups
is left to the administrator's responsibility.

View File

@ -1 +1,6 @@
Creates a new ImageOnMap.
Creates a new ImageOnMap.
The URL must point to an image.
If resize is appended, the image will be fit into
one map only. Else, multiple maps will be used as
needed.

View File

@ -188,6 +188,10 @@ msgstr ""
"{gray}Cliquez ici pour renommer cette image ; ceci ne sert qu'à votre "
"organisation personnelle."
#: src/main/java/fr/moribus/imageonmap/gui/MapDetailGui.java:105
msgid "{red}Delete this image"
msgstr "{red}Supprimer cette image"
#: src/main/java/fr/moribus/imageonmap/gui/MapDetailGui.java:106
msgid ""
"{gray}Deletes this map {white}forever{gray}. This action cannot be undone!"
@ -308,7 +312,7 @@ msgstr[1] "{white}{0}{gray} cartes restantes"
#: src/main/java/fr/moribus/imageonmap/image/ImageRendererExecutor.java:73
#, java-format
msgid "HTTP error : {0} {1}"
msgid "HTTP error: {0} {1}"
msgstr "Erreur HTTP : {0} {1}"
#: src/main/java/fr/moribus/imageonmap/image/ImageRendererExecutor.java:79