Skip to content

Commit fe6dae9

Browse files
Fix/add some /trecipe viewing
1 parent 07d16a1 commit fe6dae9

File tree

4 files changed

+42
-21
lines changed

4 files changed

+42
-21
lines changed

src/main/java/me/eccentric_nz/TARDIS/commands/TARDISRecipeCommands.java

+25-15
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@
1616
*/
1717
package me.eccentric_nz.TARDIS.commands;
1818

19-
import java.util.*;
2019
import me.eccentric_nz.TARDIS.TARDIS;
2120
import me.eccentric_nz.TARDIS.blueprints.TARDISPermission;
2221
import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItem;
23-
import me.eccentric_nz.TARDIS.enumeration.Consoles;
24-
import me.eccentric_nz.TARDIS.enumeration.RecipeCategory;
25-
import me.eccentric_nz.TARDIS.enumeration.RecipeItem;
26-
import me.eccentric_nz.TARDIS.enumeration.Schematic;
27-
import me.eccentric_nz.TARDIS.enumeration.TardisModule;
22+
import me.eccentric_nz.TARDIS.enumeration.*;
2823
import me.eccentric_nz.TARDIS.messaging.TARDISRecipeLister;
2924
import me.eccentric_nz.TARDIS.recipes.TARDISRecipeCategoryInventory;
3025
import net.md_5.bungee.api.ChatColor;
@@ -38,12 +33,12 @@
3833
import org.bukkit.persistence.PersistentDataType;
3934
import org.jetbrains.annotations.NotNull;
4035

36+
import java.util.*;
37+
4138
/**
42-
* A Time Control Unit is a golden sphere about the size of a Cricket ball. It
43-
* is stored in the Secondary Control Room. All TARDISes have one of these
44-
* devices, which can be used to remotely control a TARDIS by broadcasting
45-
* Stattenheim signals that travel along the time contours in the Space/Time
46-
* Vortex.
39+
* A Time Control Unit is a golden sphere about the size of a Cricket ball. It is stored in the Secondary Control Room.
40+
* All TARDISes have one of these devices, which can be used to remotely control a TARDIS by broadcasting Stattenheim
41+
* signals that travel along the time contours in the Space/Time Vortex.
4742
*
4843
* @author eccentric_nz
4944
*/
@@ -58,7 +53,22 @@ public TARDISRecipeCommands(TARDIS plugin) {
5853
recipeItems.put("seed", "");
5954
recipeItems.put("tardis", "");
6055
for (RecipeItem recipeItem : RecipeItem.values()) {
61-
recipeItems.put(recipeItem.toTabCompletionString(), recipeItem.toRecipeString());
56+
if (recipeItem.getCategory() != RecipeCategory.UNCRAFTABLE && recipeItem.getCategory() != RecipeCategory.UNUSED) {
57+
recipeItems.put(recipeItem.toTabCompletionString(), recipeItem.toRecipeString());
58+
}
59+
}
60+
// remove recipes form modules that are not enabled
61+
if (!plugin.getConfig().getBoolean("modules.vortex_manipulator")) {
62+
recipeItems.remove("vortex-manipulator");
63+
}
64+
if (!plugin.getConfig().getBoolean("modules.sonic_blaster")) {
65+
recipeItems.remove("sonic-blaster");
66+
recipeItems.remove("blaster-battery");
67+
recipeItems.remove("landing-pad");
68+
}
69+
if (!plugin.getConfig().getBoolean("modules.weeping_angels")) {
70+
recipeItems.remove("judoon-ammunition");
71+
recipeItems.remove("k9");
6272
}
6373
// DELUXE, ELEVENTH, TWELFTH, ARS & REDSTONE schematics designed by Lord_Rahl and killeratnight at mcnovus.net
6474
t.put("ANCIENT", Material.SCULK); // ancient
@@ -129,7 +139,8 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
129139
player.openInventory(categories);
130140
return true;
131141
}
132-
if (!recipeItems.containsKey(args[0].toLowerCase(Locale.ENGLISH))) {
142+
String which = args[0].toLowerCase();
143+
if (!recipeItems.containsKey(which)) {
133144
if (args[0].equalsIgnoreCase("list_more")) {
134145
new TARDISRecipeLister(plugin, sender).listMore();
135146
} else {
@@ -149,9 +160,8 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
149160
showTARDISRecipe(player, args[1].toUpperCase(Locale.ENGLISH));
150161
return true;
151162
}
152-
String which = args[0].toLowerCase();
153163
switch (which) {
154-
case "bowl-of-custard", "jelly-baby", "biome-storage-disk", "player-storage-disk", "preset-storage-disk", "save-storage-disk", "schematic-wand", "admin-upgrade", "bio-scanner-upgrade", "redstone-upgrade", "diamond-upgrade", "emerald-upgrade", "painter-upgrade", "ignite-upgrade", "pickup-arrows-upgrade", "knockback-upgrade" -> {
164+
case "bowl-of-custard", "jelly-baby", "biome-storage-disk", "player-storage-disk", "preset-storage-disk", "save-storage-disk", "schematic-wand", "admin-upgrade", "bio-scanner-upgrade", "redstone-upgrade", "diamond-upgrade", "emerald-upgrade", "painter-upgrade", "ignite-upgrade", "pickup-arrows-upgrade", "knockback-upgrade", "brush-upgrade", "judoon-ammunition" -> {
155165
showShapelessRecipe(player, recipeItems.get(which));
156166
return true;
157167
}

src/main/java/me/eccentric_nz/TARDIS/commands/TARDISRecipeTabComplete.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@
1717
package me.eccentric_nz.TARDIS.commands;
1818

1919
import com.google.common.collect.ImmutableList;
20-
import java.util.HashSet;
21-
import java.util.List;
22-
import java.util.Set;
20+
import me.eccentric_nz.TARDIS.enumeration.RecipeCategory;
2321
import me.eccentric_nz.TARDIS.enumeration.RecipeItem;
2422
import org.bukkit.command.Command;
2523
import org.bukkit.command.CommandSender;
2624
import org.bukkit.command.TabCompleter;
2725
import org.jetbrains.annotations.NotNull;
2826

27+
import java.util.HashSet;
28+
import java.util.List;
29+
import java.util.Set;
30+
2931
/**
3032
* TabCompleter for /tardisrecipe command
3133
*/
@@ -42,7 +44,9 @@ public TARDISRecipeTabComplete() {
4244
ROOT_SUBS.add("seed");
4345
ROOT_SUBS.add("tardis");
4446
for (RecipeItem recipeItem : RecipeItem.values()) {
45-
ROOT_SUBS.add(recipeItem.toTabCompletionString());
47+
if (recipeItem.getCategory() != RecipeCategory.UNCRAFTABLE && recipeItem.getCategory() != RecipeCategory.UNUSED) {
48+
ROOT_SUBS.add(recipeItem.toTabCompletionString());
49+
}
4650
}
4751
}
4852

src/main/java/me/eccentric_nz/TARDIS/enumeration/RecipeItem.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public enum RecipeItem {
2525
AUTHORISED_CONTROL_DISK(10000001, RecipeCategory.STORAGE_DISKS),
2626
BIO_SCANNER_CIRCUIT(10001969, RecipeCategory.SONIC_CIRCUITS),
2727
BLANK_STORAGE_DISK(10000001, RecipeCategory.STORAGE_DISKS),
28-
BLASTER_BATTERY(10000002, RecipeCategory.MISC),
2928
BRUSH_CIRCUIT(10001987, RecipeCategory.SONIC_CIRCUITS),
3029
CUSTARD_CREAM(10000002, RecipeCategory.FOOD),
3130
DIAMOND_DISRUPTOR_CIRCUIT(10001971, RecipeCategory.SONIC_CIRCUITS),
@@ -95,7 +94,13 @@ public enum RecipeItem {
9594
RED_BOW_TIE(10000037, RecipeCategory.ACCESSORIES),
9695
BLACK_BOW_TIE(10000038),
9796
THREE_D_GLASSES(10000039, RecipeCategory.ACCESSORIES),
97+
// module recipes
9898
VORTEX_MANIPULATOR(10000002, RecipeCategory.ACCESSORIES),
99+
SONIC_BLASTER(10000002, RecipeCategory.ACCESSORIES),
100+
BLASTER_BATTERY(10000002, RecipeCategory.MISC),
101+
LANDING_PAD(10000001, RecipeCategory.ACCESSORIES),
102+
JUDOON_AMMUNITION(13, RecipeCategory.MISC),
103+
K9(1, RecipeCategory.MISC),
99104
// custom block recipes start here
100105
GROW(10001, RecipeCategory.CUSTOM_BLOCKS),
101106
BLUE_BOX(10001, RecipeCategory.CUSTOM_BLOCKS),

todo.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Current version `5.0.0`
44

5-
1. ?
5+
1. Add custom item model for Rust Plague Sword
6+
2. ?
67

78
## Next version `5.1.0`
89

@@ -35,6 +36,7 @@
3536
* Slimes -> Adipose
3637
* Husk -> Sycorax
3738
* Stray -> Scarecrows
39+
2. Rust Plague Sword
3840

3941
## Minecraft Bedrock Edition?
4042

0 commit comments

Comments
 (0)