diff --git a/README.md b/README.md
index 6882b01..4bb4ff1 100644
--- a/README.md
+++ b/README.md
@@ -14,3 +14,6 @@ It will provide a foundation for a tutorials system which can be used throughout
## Credits
#### WorldEdit
+
+## Versions
+Native to minecraft 1.18.2, tested on 1.20.1
diff --git a/pom.xml b/pom.xml
index ebdc365..cffca28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.bteuk
TeachingTutorials
- 1.1.0-Beta6
+ 1.1.0-Beta6.1
jar
TeachingTutorials
diff --git a/src/main/java/teachingtutorials/guis/AdminMenu.java b/src/main/java/teachingtutorials/guis/AdminMenu.java
index 9cf847c..1e9d954 100644
--- a/src/main/java/teachingtutorials/guis/AdminMenu.java
+++ b/src/main/java/teachingtutorials/guis/AdminMenu.java
@@ -30,18 +30,18 @@ public AdminMenu(TeachingTutorials plugin, User user)
private void createGui()
{
ItemStack setCompulsory = Utils.createItem(Material.IRON_DOOR, 1,
- Component.text("Set Compulsory Tutorial", NamedTextColor.GREEN),
- Component.text("Admins only", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Set Compulsory Tutorial"),
+ TutorialGUIUtils.optionLore("Admins only"));
ItemStack myTutorials = Utils.createItem(Material.BOOKSHELF, 1,
- Component.text("My Tutorials", NamedTextColor.GREEN),
- Component.text("View the tutorials you have created", NamedTextColor.DARK_GREEN),
- Component.text("Add locations", NamedTextColor.DARK_GREEN),
- Component.text("Set a tutorial as in use or not in use", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("My Tutorials"),
+ TutorialGUIUtils.optionLore("- View the tutorials you have created"),
+ TutorialGUIUtils.optionLore("- Add locations"),
+ TutorialGUIUtils.optionLore("- Set a tutorial as in use or not in use"));
ItemStack createTutorial = Utils.createItem(Material.WRITABLE_BOOK, 1,
- Component.text("Create Tutorial", NamedTextColor.GREEN),
- Component.text("Create a new tutorial in game (coming soon)", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Create a new Tutorial"),
+ TutorialGUIUtils.optionLore("Create a new tutorial in game (coming soon)"));
int iSlotMyTutorials;
@@ -96,7 +96,7 @@ public void leftClick(User u) {
});
setItem(27 - 1, Utils.createItem(Material.SPRUCE_DOOR, 1,
- Component.text("Back to main menu", NamedTextColor.GREEN, TextDecoration.BOLD)),
+ TutorialGUIUtils.backButton("Back to main menu")),
new guiAction() {
@Override
public void rightClick(User u) {
diff --git a/src/main/java/teachingtutorials/guis/CompulsoryTutorialMenu.java b/src/main/java/teachingtutorials/guis/CompulsoryTutorialMenu.java
index 740ea07..825e20e 100644
--- a/src/main/java/teachingtutorials/guis/CompulsoryTutorialMenu.java
+++ b/src/main/java/teachingtutorials/guis/CompulsoryTutorialMenu.java
@@ -68,12 +68,14 @@ private static Inventory getGUI (Tutorial[] tutorials)
//Indicates that the creator has no tutorials if they don't own any
if (iTutorials == 0)
{
- ItemStack noTutorials = Utils.createItem(Material.BARRIER, 1, Component.text("There are no in-use tutorials on the system", NamedTextColor.GREEN));
+ ItemStack noTutorials = Utils.createItem(Material.BARRIER, 1,
+ TutorialGUIUtils.optionTitle("There are no in-use tutorials on the system"));
inventory.setItem(5-1, noTutorials);
}
//Adds back button
- ItemStack back = Utils.createItem(Material.SPRUCE_DOOR, 1, Component.text("Back to creator menu", NamedTextColor.GREEN, TextDecoration.BOLD));
+ ItemStack back = Utils.createItem(Material.SPRUCE_DOOR, 1,
+ TutorialGUIUtils.backButton("Back to creator menu"));
inventory.setItem((iRows * 9)-1, back);
//Inv slot 0 = the first one
@@ -84,14 +86,14 @@ private static Inventory getGUI (Tutorial[] tutorials)
if (tutorials[i].bCompulsory)
{
tutorial = Utils.createItem(compulsoryBlock, 1,
- Component.text(tutorials[i].szTutorialName, NamedTextColor.GREEN, TextDecoration.BOLD),
- Component.text(Bukkit.getPlayer(tutorials[i].uuidAuthor).getName(), NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle(tutorials[i].szTutorialName).decoration(TextDecoration.BOLD, true),
+ TutorialGUIUtils.optionLore(Bukkit.getPlayer(tutorials[i].uuidAuthor).getName()));
}
else
{
tutorial = Utils.createItem(nonCompulsoryBlock, 1,
- Component.text(tutorials[i].szTutorialName, NamedTextColor.GREEN),
- Component.text(Bukkit.getPlayer(tutorials[i].uuidAuthor).getName(), NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle(tutorials[i].szTutorialName),
+ TutorialGUIUtils.optionLore(Bukkit.getPlayer(tutorials[i].uuidAuthor).getName()));
}
inventory.setItem(i, tutorial);
}
diff --git a/src/main/java/teachingtutorials/guis/CreatorTutorialsMenu.java b/src/main/java/teachingtutorials/guis/CreatorTutorialsMenu.java
index d44823a..c133187 100644
--- a/src/main/java/teachingtutorials/guis/CreatorTutorialsMenu.java
+++ b/src/main/java/teachingtutorials/guis/CreatorTutorialsMenu.java
@@ -82,12 +82,12 @@ private static Inventory getGUI (Tutorial[] allTutorials)
//Indicates that the creator has no tutorials if they don't own any
if (allTutorials.length == 0)
{
- ItemStack noTutorials = Utils.createItem(Material.BARRIER, 1, Component.text("You have no tutorials", NamedTextColor.GREEN));
+ ItemStack noTutorials = Utils.createItem(Material.BARRIER, 1, TutorialGUIUtils.optionTitle("You have no tutorials"));
inventory.setItem(5-1, noTutorials);
}
//Adds back button
- ItemStack back = Utils.createItem(Material.SPRUCE_DOOR, 1, Component.text("Back to creator menu", NamedTextColor.GREEN, TextDecoration.BOLD));
+ ItemStack back = Utils.createItem(Material.SPRUCE_DOOR, 1, TutorialGUIUtils.backButton("Back to creator menu"));
inventory.setItem((iRows * 9)-1, back);
//Creates the menu options
@@ -97,14 +97,14 @@ private static Inventory getGUI (Tutorial[] allTutorials)
//Sets tutorial name bold for tutorials in use
if (allTutorials[i].bInUse)
tutorial = Utils.createItem(Material.WRITTEN_BOOK, 1,
- Component.text(allTutorials[i].szTutorialName, NamedTextColor.GREEN, TextDecoration.BOLD),
- Component.text("In Use - Left click to remove from use", NamedTextColor.DARK_GREEN),
- Component.text("Right click to add a new location", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle(allTutorials[i].szTutorialName).decoration(TextDecoration.BOLD, true),
+ TutorialGUIUtils.optionLore("In Use - Left click to remove from use"),
+ TutorialGUIUtils.optionLore("Right click to add a new location"));
else
tutorial = Utils.createItem(Material.BOOK, 1,
- Component.text(allTutorials[i].szTutorialName, NamedTextColor.GREEN),
- Component.text("Not in Use - Left click to set in use", NamedTextColor.DARK_GREEN),
- Component.text("Right click to add a new location", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle(allTutorials[i].szTutorialName),
+ TutorialGUIUtils.optionLore("Not in Use - Left click to set in use"),
+ TutorialGUIUtils.optionLore("Right click to add a new location"));
inventory.setItem(i, tutorial);
}
diff --git a/src/main/java/teachingtutorials/guis/LibraryMenu.java b/src/main/java/teachingtutorials/guis/LibraryMenu.java
index ac209c1..24ed27d 100644
--- a/src/main/java/teachingtutorials/guis/LibraryMenu.java
+++ b/src/main/java/teachingtutorials/guis/LibraryMenu.java
@@ -71,7 +71,9 @@ private static Inventory getGUI (Tutorial[] tutorials)
//Indicates that there are no tutorials in the system
if (iTutorials == 0)
{
- ItemStack noTutorials = Utils.createItem(Material.BARRIER, 1, Component.text("There are no tutorials available to play currently", NamedTextColor.GREEN));
+ ItemStack noTutorials = Utils.createItem(Material.BARRIER, 1,
+ TutorialGUIUtils.optionTitle("There are no tutorials available to play currently"),
+ TutorialGUIUtils.optionLore("Ask a server admin to get some created"));
inventory.setItem(5-1, noTutorials);
}
@@ -80,13 +82,13 @@ private static Inventory getGUI (Tutorial[] tutorials)
for (i = 0 ; i < iTutorials ; i++)
{
tutorial = Utils.createItem(Material.KNOWLEDGE_BOOK, 1,
- Component.text(tutorials[i].szTutorialName, NamedTextColor.GREEN, TextDecoration.BOLD),
- Component.text("Tutor: " +Bukkit.getOfflinePlayer(tutorials[i].uuidAuthor).getName(), NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle(tutorials[i].szTutorialName).decoration(TextDecoration.BOLD, true),
+ TutorialGUIUtils.optionLore("Tutor - " +Bukkit.getOfflinePlayer(tutorials[i].uuidAuthor).getName()));
inventory.setItem(i, tutorial);
}
//Adds back button
- ItemStack back = Utils.createItem(Material.SPRUCE_DOOR, 1, Component.text("Back to main menu", NamedTextColor.GREEN, TextDecoration.BOLD));
+ ItemStack back = Utils.createItem(Material.SPRUCE_DOOR, 1, TutorialGUIUtils.backButton("Back to main menu"));
inventory.setItem((iRows * 9) - 1, back);
//Inv slot 0 = the first one
diff --git a/src/main/java/teachingtutorials/guis/MainMenu.java b/src/main/java/teachingtutorials/guis/MainMenu.java
index a555197..f09dc19 100644
--- a/src/main/java/teachingtutorials/guis/MainMenu.java
+++ b/src/main/java/teachingtutorials/guis/MainMenu.java
@@ -35,30 +35,32 @@ private void createGui()
FileConfiguration config = TeachingTutorials.getInstance().getConfig();
boolean bCompulsoryTutorialEnabled = config.getBoolean("Compulsory_Tutorial");
- //Continue learning menu button
+ //'Continue' menu button
ItemStack continueLearning_CompulsoryComplete;
if (user.bInLesson)
continueLearning_CompulsoryComplete = Utils.createItem(Material.WRITABLE_BOOK, 1,
- Component.text("Continue learning", NamedTextColor.GREEN),
- Component.text("Continue your lesson", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Continue lesson"),
+ TutorialGUIUtils.optionLore("Continue your lesson"));
else
continueLearning_CompulsoryComplete = Utils.createItem(Material.WRITABLE_BOOK, 1,
- Component.text("Continue learning", NamedTextColor.GREEN),
- Component.text("Start another tutorial", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Start a new Tutorial"),
+ TutorialGUIUtils.optionLore("Finds a tutorial for you"));
//Tutorial library
ItemStack tutorialLibrary = Utils.createItem(Material.BOOKSHELF, 1,
- Component.text("Tutorial Library", NamedTextColor.GREEN),
- Component.text("Browse all of our available tutorials", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Tutorial Library"),
+ TutorialGUIUtils.optionLore("Browse all of our available tutorials"));
- //The system has the compulsory tutorial feature enabled
+ //Checks the system has the compulsory tutorial feature enabled
if (bCompulsoryTutorialEnabled)
{
if (user.bHasCompletedCompulsory)
{
//Restart compulsory tutorial
ItemStack restartCompulsory = Utils.createItem(Material.ENCHANTED_BOOK, 1,
- Component.text("Restart Compulsory Tutorial", NamedTextColor.GREEN));
+ TutorialGUIUtils.optionTitle("Restart the Starter Tutorial"),
+ TutorialGUIUtils.optionLore("If you are already in a tutorial,"),
+ TutorialGUIUtils.optionLore("it will resume that."));
super.setItem(11 - 1, restartCompulsory, new guiAction() {
@Override
public void rightClick(User u)
@@ -110,14 +112,14 @@ public void leftClick(User u)
if (user.bInLesson)
{
continue_CompulsoryNotComplete = Utils.createItem(Material.BOOK, 1,
- Component.text("Continue Compulsory Tutorial", NamedTextColor.GREEN),
- Component.text("Gain the applicant rank", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Continue the Starter Tutorial"),
+ TutorialGUIUtils.optionLore("Gain the applicant rank"));
}
else
{
continue_CompulsoryNotComplete = Utils.createItem(Material.BOOK, 1,
- Component.text("Start Compulsory Tutorial", NamedTextColor.GREEN),
- Component.text("Gain the applicant rank", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Begin the Starter Tutorial"),
+ TutorialGUIUtils.optionLore("Gain the applicant rank"));
}
super.setItem(14 - 1, continue_CompulsoryNotComplete, new guiAction() {
@Override
@@ -171,7 +173,7 @@ public void leftClick(User u) {
{
//Admin and creator menu
super.setItem(19 - 1, Utils.createItem(Material.LECTERN, 1,
- Component.text("Creator Menu", NamedTextColor.GREEN)), new guiAction() {
+ TutorialGUIUtils.optionTitle("Creator Menu")), new guiAction() {
@Override
public void rightClick(User u) {
leftClick(u);
diff --git a/src/main/java/teachingtutorials/guis/TutorialGUIUtils.java b/src/main/java/teachingtutorials/guis/TutorialGUIUtils.java
new file mode 100644
index 0000000..484ee46
--- /dev/null
+++ b/src/main/java/teachingtutorials/guis/TutorialGUIUtils.java
@@ -0,0 +1,29 @@
+package teachingtutorials.guis;
+
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.TextComponent;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.TextDecoration;
+
+/**
+ * Utils for Tutorial Menus
+ */
+public class TutorialGUIUtils
+{
+ public static TextComponent backButton(String szText)
+ {
+ return Component.text(szText, NamedTextColor.GREEN)
+ .decoration(TextDecoration.ITALIC, false)
+ .decoration(TextDecoration.BOLD, true);
+ }
+
+ public static TextComponent optionTitle(String szText)
+ {
+ return Component.text(szText, NamedTextColor.GREEN).decoration(TextDecoration.ITALIC, false);
+ }
+
+ public static TextComponent optionLore(String szText)
+ {
+ return Component.text(szText, NamedTextColor.DARK_GREEN).decoration(TextDecoration.ITALIC, false);
+ }
+}
diff --git a/src/main/java/teachingtutorials/guis/locationcreatemenus/StepEditorMenu.java b/src/main/java/teachingtutorials/guis/locationcreatemenus/StepEditorMenu.java
index df780b3..df453ff 100644
--- a/src/main/java/teachingtutorials/guis/locationcreatemenus/StepEditorMenu.java
+++ b/src/main/java/teachingtutorials/guis/locationcreatemenus/StepEditorMenu.java
@@ -10,6 +10,7 @@
import org.bukkit.inventory.ItemStack;
import teachingtutorials.TeachingTutorials;
import teachingtutorials.guis.Gui;
+import teachingtutorials.guis.TutorialGUIUtils;
import teachingtutorials.listeners.TextEditorBookListener;
import teachingtutorials.tutorials.LocationStep;
import teachingtutorials.tutorials.Step;
@@ -49,15 +50,15 @@ public StepEditorMenu(TeachingTutorials plugin, User user, Step step, LocationSt
public void setItems()
{
ItemStack setStartLocation = Utils.createItem(Material.COMPASS, 1,
- Component.text("Set the step's start location", NamedTextColor.GREEN),
- Component.text("Set the start location to your current position and direction", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Set the step's start location"),
+ TutorialGUIUtils.optionLore("Set the start location to your current position and direction"));
ItemStack teleportToStart = Utils.createItem(Material.VILLAGER_SPAWN_EGG, 1,
- Component.text("Teleport back to the start location", NamedTextColor.GREEN));
+ TutorialGUIUtils.optionTitle("Teleport back to the start location"));
ItemStack videoLink = Utils.createItem(Material.PAINTING, 1,
- Component.text("Set the video tutorial link if one exists", NamedTextColor.GREEN),
- Component.text("This is specific to each location of the tutorial", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Set the video tutorial link if one exists"),
+ TutorialGUIUtils.optionLore("This is specific to each location of the tutorial"));
boolean bIsHologramNeeded = step.getInstructionDisplayType().equals(Display.DisplayType.hologram);
if (bIsHologramNeeded)
@@ -77,7 +78,7 @@ public void leftClick(User u) {
//Set instructions
ItemStack instructions = Utils.createItem(Material.WRITABLE_BOOK, 1,
- Component.text("Set the instructions", NamedTextColor.GREEN));
+ TutorialGUIUtils.optionTitle("Set the instructions"));
setItem(12, instructions, new guiAction() {
@Override
@@ -104,8 +105,8 @@ public void leftClick(User u) {
//Set hologram coordinates to player's current location
ItemStack hologramLocation = Utils.createItem(Material.FILLED_MAP, 1,
- Component.text("Set the instructions hologram location", NamedTextColor.GREEN),
- Component.text("Set the instructions hologram to your current position", NamedTextColor.DARK_GREEN));
+ TutorialGUIUtils.optionTitle("Set the instructions hologram location"),
+ TutorialGUIUtils.optionLore("Set the instructions hologram to your current position"));
setItem(14, hologramLocation, new guiAction() {
@Override