blob: 4e19053fb164db2ed726b5d08ed629ef6fbab43a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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);
}
}
}
}
}
}
|