aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/BlockWrongSlayer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/Danker/features/BlockWrongSlayer.java')
-rw-r--r--src/main/java/me/Danker/features/BlockWrongSlayer.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/BlockWrongSlayer.java b/src/main/java/me/Danker/features/BlockWrongSlayer.java
new file mode 100644
index 0000000..4e19053
--- /dev/null
+++ b/src/main/java/me/Danker/features/BlockWrongSlayer.java
@@ -0,0 +1,42 @@
+package me.Danker.features;
+
+import me.Danker.DankersSkyblockMod;
+import me.Danker.events.ChestSlotClickedEvent;
+import net.minecraft.client.Minecraft;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ChatComponentText;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+public class BlockWrongSlayer {
+
+ public static String onlySlayerName = "";
+ public static String onlySlayerNumber = "";
+
+ @SubscribeEvent
+ public void onSlotClick(ChestSlotClickedEvent event) {
+ String inventoryName = event.inventoryName;
+ ItemStack item = event.item;
+ if (!onlySlayerName.equals("") && item != null) {
+ if (inventoryName.equals("Slayer")) {
+ if (!item.getDisplayName().contains("Revenant Horror") && !item.getDisplayName().contains("Tarantula Broodfather") && !item.getDisplayName().contains("Sven Packmaster"))
+ return;
+ if (!item.getDisplayName().contains(onlySlayerName)) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Danker's Skyblock Mod has stopped you from starting this quest (Set to " + onlySlayerName + " " + onlySlayerNumber + ")"));
+ Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, (float) 0.5);
+ event.setCanceled(true);
+ }
+ } else if (inventoryName.equals("Revenant Horror") || inventoryName.equals("Tarantula Broodfather") || inventoryName.equals("Sven Packmaster") || inventoryName.equals("Voidgloom Seraph")) {
+ if (item.getDisplayName().contains("Revenant Horror") || item.getDisplayName().contains("Tarantula Broodfather") || item.getDisplayName().contains("Sven Packmaster") || item.getDisplayName().contains("Voidgloom Seraph")) {
+ // Only check number as they passed the above check
+ String slayerNumber = item.getDisplayName().substring(item.getDisplayName().lastIndexOf(" ") + 1);
+ if (!slayerNumber.equals(onlySlayerNumber)) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Danker's Skyblock Mod has stopped you from starting this quest (Set to " + onlySlayerName + " " + onlySlayerNumber + ")"));
+ Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, (float) 0.5);
+ event.setCanceled(true);
+ }
+ }
+ }
+ }
+ }
+
+}