More minor fixes.

* NEW: GUIs are now translated according to the player's locale.
* BUG: Fix some usage parameters.
* BUG: Fix Map initialisation on startup if the map is invalid.
* BUG: PosterMap: remove a debugging message.
* BUG: Fix the command error message for the french locale.
This commit is contained in:
Adrien Prokopowicz 2016-07-08 04:45:08 +02:00
parent 225c76de7c
commit a730aab1f1
8 changed files with 46 additions and 48 deletions

View File

@ -28,7 +28,7 @@ import org.bukkit.ChatColor;
import java.util.List;
@CommandInfo (name = "delete", usageParameters = "[tool name]")
@CommandInfo (name = "delete", usageParameters = "[map name]")
public class DeleteConfirmCommand extends IoMCommand
{
@Override

View File

@ -99,7 +99,7 @@ public class ConfirmDeleteMapGui extends ActionGui
protected void onUpdate()
{
/// The title of the map deletion GUI. {0}: map name.
setTitle(I.t("{0} » {black}Confirm deletion", mapToDelete.getName()));
setTitle(I.t(getPlayerLocale(), "{0} » {black}Confirm deletion", mapToDelete.getName()));
setSize(6 * 9);
@ -107,13 +107,13 @@ public class ConfirmDeleteMapGui extends ActionGui
action("", 13, new ItemStackBuilder(Material.EMPTY_MAP)
/// The title of the map deletion item
.title(I.t("{red}You're about to destroy this map..."))
.title(I.t(getPlayerLocale(), "{red}You're about to destroy this map..."))
/// The end, in the lore, of a title starting with You're about to destroy this map....
.lore(I.t("{red}...{italic}forever{red}."))
.lore(I.t(getPlayerLocale(), "{red}...{italic}forever{red}."))
.loreLine()
.lore(I.t("{gray}Name: {white}{0}",mapToDelete.getName()))
.lore(I.t("{gray}Map ID: {white}{0}", mapToDelete.getId()))
.lore(I.t("{gray}Maps inside: {white}{0}", mapToDelete.getMapsIDs().length))
.lore(I.t(getPlayerLocale(), "{gray}Name: {white}{0}",mapToDelete.getName()))
.lore(I.t(getPlayerLocale(), "{gray}Map ID: {white}{0}", mapToDelete.getId()))
.lore(I.t(getPlayerLocale(), "{gray}Maps inside: {white}{0}", mapToDelete.getMapsIDs().length))
.hideAttributes()
);

View File

@ -51,11 +51,11 @@ public class MapDetailGui extends ExplorerGui<Short>
partMaterial = Material.EMPTY_MAP;
return new ItemStackBuilder(partMaterial)
.title(I.t("{green}Map part"))
.lore(I.t("{gray}Column: {white}{0}", y + 1))
.lore(I.t("{gray}Row: {white}{0}", x + 1))
.title(I.t(getPlayerLocale(), "{green}Map part"))
.lore(I.t(getPlayerLocale(), "{gray}Column: {white}{0}", y + 1))
.lore(I.t(getPlayerLocale(), "{gray}Row: {white}{0}", x + 1))
.loreLine()
.lore(I.t("{gray}» {white}Click{gray} to get only this part"))
.lore(I.t(getPlayerLocale(), "{gray}» {white}Click{gray} to get only this part"))
.item();
}
@ -68,10 +68,10 @@ public class MapDetailGui extends ExplorerGui<Short>
partMaterial = Material.EMPTY_MAP;
return new ItemStackBuilder(partMaterial)
.title(I.t("{green}Map part"))
.lore(I.t("{gray}Part: {white}{0}", index + 1))
.title(I.t(getPlayerLocale(), "{green}Map part"))
.lore(I.t(getPlayerLocale(), "{gray}Part: {white}{0}", index + 1))
.loreLine()
.lore(I.t("{gray}» {white}Click{gray} to get only this part"))
.lore(I.t(getPlayerLocale(), "{gray}» {white}Click{gray} to get only this part"))
.item();
}
@ -111,7 +111,7 @@ public class MapDetailGui extends ExplorerGui<Short>
protected void onUpdate()
{
/// Title of the map details GUI
setTitle(I.t("Your maps » {black}{0}", map.getName()));
setTitle(I.t(getPlayerLocale(), "Your maps » {black}{0}", map.getName()));
setKeepHorizontalScrollingSpace(true);
if(map instanceof PosterMap)
@ -133,15 +133,15 @@ public class MapDetailGui extends ExplorerGui<Short>
action("rename", getSize() - 7, new ItemStackBuilder(Material.BOOK_AND_QUILL)
.title(I.t("{blue}Rename this image"))
.longLore(I.t("{gray}Click here to rename this image; this is used for your own organization."))
.title(I.t(getPlayerLocale(), "{blue}Rename this image"))
.longLore(I.t(getPlayerLocale(), "{gray}Click here to rename this image; this is used for your own organization."))
);
action("delete", getSize() - 6, new ItemStackBuilder(Material.BARRIER)
.title("{red}Delete this image")
.longLore(I.t("{gray}Deletes this map {white}forever{gray}. This action cannot be undone!"))
.title(I.t(getPlayerLocale(), "{red}Delete this image"))
.longLore(I.t(getPlayerLocale(), "{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."))
.longLore(I.t(getPlayerLocale(), "{gray}You will be asked to confirm your choice if you click here."))
);
@ -153,8 +153,8 @@ public class MapDetailGui extends ExplorerGui<Short>
backSlot++;
action("back", backSlot, new ItemStackBuilder(Material.EMERALD)
.title(I.t("{green}« Back"))
.lore(I.t("{gray}Go back to the list."))
.title(I.t(getPlayerLocale(), "{green}« Back"))
.lore(I.t(getPlayerLocale(), "{gray}Go back to the list."))
);
}
@ -169,12 +169,12 @@ public class MapDetailGui extends ExplorerGui<Short>
{
if (newName == null || newName.isEmpty())
{
getPlayer().sendMessage(I.t("{ce}Map names can't be empty."));
I.sendT(getPlayer(), "{ce}Map names can't be empty.");
return;
}
map.rename(newName);
getPlayer().sendMessage(I.t("{cs}Map successfully renamed."));
I.sendT(getPlayer(), "{cs}Map successfully renamed.");
}
}, map.getName(), this);
}

View File

@ -41,7 +41,7 @@ public class MapListGui extends ExplorerGui<ImageMap>
if (map instanceof SingleMap)
{
/// Displayed subtitle description of a single map on the list GUI
mapDescription = I.t("{white}Single map");
mapDescription = I.t(getPlayerLocale(), "{white}Single map");
}
else
{
@ -49,25 +49,25 @@ public class MapListGui extends ExplorerGui<ImageMap>
if(poster.hasColumnData())
{
/// Displayed subtitle description of a poster map on the list GUI (columns × rows in english)
mapDescription = I.t("{white}Poster map ({0} × {1})", poster.getColumnCount(), poster.getRowCount());
mapDescription = I.t(getPlayerLocale(), "{white}Poster map ({0} × {1})", poster.getColumnCount(), poster.getRowCount());
}
else
{
/// Displayed subtitle description of a poster map without column data on the list GUI
mapDescription = I.t("{white}Poster map ({0} parts)", poster.getMapCount());
mapDescription = I.t(getPlayerLocale(), "{white}Poster map ({0} parts)", poster.getMapCount());
}
}
return new ItemStackBuilder(Material.MAP)
/// Displayed title of a map on the list GUI
.title(I.t("{green}{bold}{0}", map.getName()))
.title(I.t(getPlayerLocale(), "{green}{bold}{0}", map.getName()))
.lore(mapDescription)
.loreLine()
/// Map ID displayed in the tooltip of a map on the list GUI
.lore(I.t("{gray}Map ID: {0}", map.getId()))
.lore(I.t(getPlayerLocale(), "{gray}Map ID: {0}", map.getId()))
.loreLine()
.lore(I.t("{gray}» {white}Left-click{gray} to get this map"))
.lore(I.t("{gray}» {white}Right-click{gray} for details and options"))
.lore(I.t(getPlayerLocale(), "{gray}» {white}Left-click{gray} to get this map"))
.lore(I.t(getPlayerLocale(), "{gray}» {white}Right-click{gray} for details and options"))
.item();
}
@ -76,8 +76,8 @@ public class MapListGui extends ExplorerGui<ImageMap>
protected ItemStack getEmptyViewItem()
{
return new ItemStackBuilder(Material.BARRIER)
.title(I.t("{red}You don't have any map."))
.longLore(I.t("{gray}Get started by creating a new one using {white}/tomap <URL> [resize]{gray}!"))
.title(I.t(getPlayerLocale(), "{red}You don't have any map."))
.longLore(I.t(getPlayerLocale(), "{gray}Get started by creating a new one using {white}/tomap <URL> [resize]{gray}!"))
.item();
}
@ -115,7 +115,7 @@ public class MapListGui extends ExplorerGui<ImageMap>
ImageMap[] maps = MapManager.getMaps(getPlayer().getUniqueId());
setData(maps);
/// The maps list GUI title
setTitle(I.t("{black}Your maps {reset}({0})", maps.length));
setTitle(I.t(getPlayerLocale(), "{black}Your maps {reset}({0})", maps.length));
setKeepHorizontalScrollingSpace(true);
@ -144,24 +144,24 @@ public class MapListGui extends ExplorerGui<ImageMap>
double percentageUsed = mapPartLeft < 0 ? 0 : ((double) mapPartCount) / ((double) (mapPartCount + mapPartLeft)) * 100;
ItemStackBuilder statistics = new ItemStackBuilder(Material.ENCHANTED_BOOK)
.title(I.t("{blue}Usage statistics"))
.title(I.t(getPlayerLocale(), "{blue}Usage statistics"))
.loreLine()
.lore(I.tn("{white}{0}{gray} image rendered", "{white}{0}{gray} images rendered", imagesCount))
.lore(I.tn("{white}{0}{gray} Minecraft map used", "{white}{0}{gray} Minecraft maps used", mapPartCount));
.lore(I.tn(getPlayerLocale(), "{white}{0}{gray} image rendered", "{white}{0}{gray} images rendered", imagesCount))
.lore(I.tn(getPlayerLocale(), "{white}{0}{gray} Minecraft map used", "{white}{0}{gray} Minecraft maps used", mapPartCount));
if(mapPartLeft >= 0)
{
statistics
.lore("", I.t("{blue}Minecraft maps limits"), "")
.lore("", I.t(getPlayerLocale(), "{blue}Minecraft maps limits"), "")
.lore(mapGlobalLimit == 0
? I.t("{gray}Server-wide limit: {white}unlimited")
: I.t("{gray}Server-wide limit: {white}{0}", mapGlobalLimit))
? I.t(getPlayerLocale(), "{gray}Server-wide limit: {white}unlimited")
: I.t(getPlayerLocale(), "{gray}Server-wide limit: {white}{0}", mapGlobalLimit))
.lore(mapPersonalLimit == 0
? I.t("{gray}Per-player limit: {white}unlimited")
: I.t("{gray}Per-player limit: {white}{0}", mapPersonalLimit))
? I.t(getPlayerLocale(), "{gray}Per-player limit: {white}unlimited")
: I.t(getPlayerLocale(), "{gray}Per-player limit: {white}{0}", mapPersonalLimit))
.loreLine()
.lore(I.t("{white}{0} %{gray} of your quota used", (int) Math.rint(percentageUsed)))
.lore(I.tn("{white}{0}{gray} map left", "{white}{0}{gray} maps left", mapPartLeft));
.lore(I.t(getPlayerLocale(), "{white}{0} %{gray} of your quota used", (int) Math.rint(percentageUsed)))
.lore(I.tn(getPlayerLocale(), "{white}{0}{gray} map left", "{white}{0}{gray} maps left", mapPartLeft));
}
statistics.hideAttributes();

View File

@ -106,6 +106,7 @@ public class MapInitEvent implements Listener
static protected void initMap(MapView map)
{
if(map == null) return;
if(Renderer.isHandled(map)) return;
File imageFile = ImageOnMap.getPlugin().getImageFile(map.getId());

View File

@ -140,7 +140,6 @@ public class PosterMap extends ImageMap
{
int x = index % (columnCount);
int y = index / (columnCount);
System.out.println(x + " : " + (rowCount - y - 1) + " (" + index);
return getMapIdAt(x, rowCount - y - 1);
}

View File

@ -87,8 +87,6 @@ public class PosterWall
{
for(int x = 0; x < map.getColumnCount(); ++x)
{
//Location newLocation = WorldUtils.addToLocation(topLeftLocation, x, -y, facing);
//System.out.println("Checking : " + loc);
int mapIndex = map.getIndexAt(x, y);
ItemFrame frame = getMapFrameAt(loc, map);
if(frame != null) frames[mapIndex] = frame;

View File

@ -20,7 +20,7 @@ msgstr ""
#: src/main/java/fr/moribus/imageonmap/commands/IoMCommand.java:40
msgid "You need to give a map name."
msgstr "Vous devez donner un nom à la carte."
msgstr "Vous devez donner le nom d'une carte."
#: src/main/java/fr/moribus/imageonmap/commands/IoMCommand.java:57
#: src/main/java/fr/moribus/imageonmap/commands/maptool/DeleteNoConfirmCommand.java:51