aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/BlockWrongSlayer.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2022-08-15 20:40:34 -0400
committerGitHub <noreply@github.com>2022-08-15 20:40:34 -0400
commit3aa11b859a2a22be30a5035f7273e1a604a4dde4 (patch)
tree8f428b29a6b56cc9d010b0441bf41b6b78373548 /src/main/java/me/Danker/features/BlockWrongSlayer.java
parent33710ac6d9f57fa59e8dfb19a81b053346f1b097 (diff)
parentdaceea1e42371c295c36f80b3246601a6ffb2cc5 (diff)
downloadSkyblockMod-1.8.7.tar.gz
SkyblockMod-1.8.7.tar.bz2
SkyblockMod-1.8.7.zip
Merge pull request #124 from bowser0000/developmentHEADv1.8.7master
1.8.7
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);
+ }
+ }
+ }
+ }
+ }
+
+}