mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2024-11-29 05:26:18 +01:00
Merge branch 'indev' of github.com:zDevelopers/ImageOnMap into feature-i18n
Conflicts: src/main/java/fr/moribus/imageonmap/commands/maptool/ListCommand.java
This commit is contained in:
commit
cd3aeb8cab
@ -21,9 +21,16 @@ package fr.moribus.imageonmap.commands.maptool;
|
||||
import fr.moribus.imageonmap.commands.IoMCommand;
|
||||
import fr.moribus.imageonmap.map.ImageMap;
|
||||
import fr.moribus.imageonmap.map.MapManager;
|
||||
import fr.moribus.imageonmap.map.PosterMap;
|
||||
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 fr.zcraft.zlib.components.rawtext.RawTextPart;
|
||||
import fr.zcraft.zlib.tools.items.ItemStackBuilder;
|
||||
import fr.zcraft.zlib.tools.text.RawMessage;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
@ -43,13 +50,35 @@ public class ListCommand extends IoMCommand
|
||||
return;
|
||||
}
|
||||
|
||||
info(I.tn("{0} map found.", "{0} maps found.", mapList.size()));
|
||||
|
||||
String sMapList = mapList.get(0).getId();
|
||||
info(I.tn("{white}{bold}{0} map found.", "{white}{bold}{0} maps found.", mapList.size()));
|
||||
|
||||
RawTextPart rawText = new RawText("");
|
||||
rawText = addMap(rawText, mapList.get(0));
|
||||
|
||||
for(int i = 1, c = mapList.size(); i < c; i++)
|
||||
{
|
||||
sMapList += "§7,§r" + mapList.get(i).getId();
|
||||
rawText = rawText.then(", ").color(ChatColor.GRAY);
|
||||
rawText = addMap(rawText, mapList.get(i));
|
||||
}
|
||||
player.sendMessage(sMapList);
|
||||
|
||||
RawMessage.send(player, rawText.build());
|
||||
}
|
||||
|
||||
private RawTextPart<?> addMap(RawTextPart<?> rawText, ImageMap map)
|
||||
{
|
||||
final String size = map.getType() == ImageMap.Type.SINGLE ? "1 × 1" : ((PosterMap) map).getColumnCount() + " × " + ((PosterMap) map).getRowCount();
|
||||
|
||||
return rawText
|
||||
.then(map.getId())
|
||||
.color(ChatColor.WHITE)
|
||||
.command(GetCommand.class, map.getId())
|
||||
.hover(new ItemStackBuilder(Material.MAP)
|
||||
.title(ChatColor.GREEN + "" + ChatColor.BOLD + map.getName())
|
||||
.lore(ChatColor.GRAY + map.getId() + ", " + size)
|
||||
.lore("")
|
||||
.lore(I.t("{white}Click{gray} to get this map"))
|
||||
.hideAttributes()
|
||||
.item()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user