change help to book instead of text
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
package nl.interestingcorner.coordinates.commands;
|
package nl.interestingcorner.coordinates.commands;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
|
||||||
import nl.interestingcorner.core.MinecraftColor;
|
import nl.interestingcorner.core.MinecraftColor;
|
||||||
|
|
||||||
@@ -10,18 +13,53 @@ public class HelpCommandHandler implements CoordinatesCommandHandler {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handleCommand(CommandSender sender, String[] args) {
|
public boolean handleCommand(CommandSender sender, String[] args) {
|
||||||
if (sender instanceof Player player) {
|
if (sender instanceof Player player) {
|
||||||
player.sendMessage(MinecraftColor.LIGHT_PURPLE.toColorCode() + "IC-Coords plugin commands:");
|
// Send the help book to the player
|
||||||
player.sendMessage(MinecraftColor.AQUA.toColorCode() + "/ic-coords map" + MinecraftColor.WHITE.toColorCode() + " - Get a special map that you can use to teleport between coordinates");
|
ItemStack helpBook = new ItemStack(Material.WRITTEN_BOOK);
|
||||||
player.sendMessage(MinecraftColor.AQUA.toColorCode() + "/ic-coords get [world]" + MinecraftColor.WHITE.toColorCode() + " - Show all coordinates. Add a world name to filter by world.");
|
BookMeta meta = (BookMeta) helpBook.getItemMeta();
|
||||||
player.sendMessage(MinecraftColor.AQUA.toColorCode() + "/ic-coords add <name> <description> [color]" + MinecraftColor.WHITE.toColorCode() + " - Add a new coordinate at you current location with a name, description, and color. If no color is specified, the color will be white");
|
meta.setTitle("IC-Coords User Manual");
|
||||||
player.sendMessage(MinecraftColor.AQUA.toColorCode() + "/ic-coords remove" + MinecraftColor.WHITE.toColorCode() + " - Remove a coordinate. This will show a GUI with all coordinates and you can click on one to remove it.");
|
meta.setAuthor("Sem");
|
||||||
player.sendMessage(MinecraftColor.AQUA.toColorCode() + "/ic-coords help" + MinecraftColor.WHITE.toColorCode() + " - Show this help message");
|
|
||||||
|
|
||||||
|
// Table of contents
|
||||||
|
String toc = "IC-Coords Plugin Commands\n\n" +
|
||||||
|
"1. Map\n" +
|
||||||
|
"2. Get\n" +
|
||||||
|
"3. Add\n" +
|
||||||
|
"4. Remove\n" +
|
||||||
|
"5. Help\n\n" +
|
||||||
|
"Use the next pages for details.";
|
||||||
|
|
||||||
|
// Command explanations
|
||||||
|
String pageMap = MinecraftColor.LIGHT_PURPLE.toColorCode() + "1. Map\n\n" +
|
||||||
|
MinecraftColor.DARK_BLUE.toColorCode() + "/ic-coords " + MinecraftColor.GOLD.toColorCode() + "map\n" +
|
||||||
|
MinecraftColor.BLACK.toColorCode() + "Get a special map that you can use to teleport between coordinates. Click on each coordinate to teleport to it.";
|
||||||
|
|
||||||
|
String pageGet = MinecraftColor.LIGHT_PURPLE.toColorCode() + "2. Get\n\n" +
|
||||||
|
MinecraftColor.DARK_BLUE.toColorCode() + "/ic-coords " + MinecraftColor.GOLD.toColorCode() + "get [world]\n" +
|
||||||
|
MinecraftColor.BLACK.toColorCode() + "Show all coordinates. Add a world name to filter by world.\n" +
|
||||||
|
MinecraftColor.DARK_GREEN.toColorCode() + "Example: /ic-coords get world_nether";
|
||||||
|
|
||||||
|
String pageAdd = MinecraftColor.LIGHT_PURPLE.toColorCode() + "3. Add\n\n" +
|
||||||
|
MinecraftColor.DARK_BLUE.toColorCode() + "/ic-coords " + MinecraftColor.GOLD.toColorCode() + "add <name> <description> [color]\n" +
|
||||||
|
MinecraftColor.BLACK.toColorCode() + "Add a new coordinate at your current location with a name, description, and color.\n" +
|
||||||
|
"If no color is specified, the color will be white.\n" +
|
||||||
|
MinecraftColor.DARK_GREEN.toColorCode() + "Example: /ic-coords add Home \"My base\" red";
|
||||||
|
|
||||||
|
String pageRemove = MinecraftColor.LIGHT_PURPLE.toColorCode() + "4. Remove\n\n" +
|
||||||
|
MinecraftColor.DARK_BLUE.toColorCode() + "/ic-coords " + MinecraftColor.GOLD.toColorCode() + "remove\n" +
|
||||||
|
MinecraftColor.BLACK.toColorCode() + "Remove a coordinate. This will show a GUI with all coordinates and you can click on one to remove it.";
|
||||||
|
|
||||||
|
String pageHelp = MinecraftColor.LIGHT_PURPLE.toColorCode() + "5. Help\n\n" +
|
||||||
|
MinecraftColor.DARK_BLUE.toColorCode() + "/ic-coords " + MinecraftColor.GOLD.toColorCode() + "help\n" +
|
||||||
|
MinecraftColor.BLACK.toColorCode() + "Get this User Manual for the plugin";
|
||||||
|
|
||||||
|
meta.setPages(toc, pageMap, pageGet, pageAdd, pageRemove, pageHelp);
|
||||||
|
helpBook.setItemMeta(meta);
|
||||||
|
player.getInventory().addItem(helpBook);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("This command can only be used by a player.");
|
sender.sendMessage("This command can only be used by a player.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user