Files
CustomNPC-Plus/src/main/java/noppes/npcs/items/ItemScripted.java
T

36 lines
1.3 KiB
Java
Raw Normal View History

2022-05-11 01:10:31 -05:00
package noppes.npcs.items;
2025-03-08 17:52:39 -05:00
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
2022-05-11 01:10:31 -05:00
import net.minecraft.entity.player.EntityPlayer;
2025-03-08 17:52:39 -05:00
import net.minecraft.entity.player.EntityPlayerMP;
2022-05-11 01:10:31 -05:00
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import noppes.npcs.CustomItems;
import noppes.npcs.CustomNpcs;
2024-02-19 19:14:51 -05:00
import noppes.npcs.CustomNpcsPermissions;
2025-03-08 17:52:39 -05:00
import noppes.npcs.NoppesUtilServer;
2023-01-07 00:21:08 -05:00
import noppes.npcs.config.ConfigScript;
2022-05-11 01:10:31 -05:00
import noppes.npcs.constants.EnumGuiType;
public class ItemScripted extends ItemCustomizable {
2025-02-13 18:20:01 -06:00
2022-05-11 01:10:31 -05:00
public ItemScripted() {
maxStackSize = 1;
setCreativeTab(CustomItems.tab);
CustomNpcs.proxy.registerItem(this);
setHasSubtypes(true);
}
2025-03-12 20:12:01 -04:00
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (!world.isRemote) {
if (player.isSneaking() && player.capabilities.isCreativeMode) {
if (!ConfigScript.canScript(player, CustomNpcsPermissions.TOOL_SCRIPTED_ITEM)) {
2025-03-08 17:52:39 -05:00
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "availability.permission");
} else {
NoppesUtilServer.sendOpenGui(player, EnumGuiType.ScriptItem, null, 0, 0, 0);
}
2022-07-07 16:22:50 -05:00
}
2022-05-11 01:10:31 -05:00
}
2025-02-13 18:20:01 -06:00
return super.onItemRightClick(stack, world, player);
2022-05-11 01:10:31 -05:00
}
}