mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 02:55:26 +00:00
CustomNpcs:
-Added ScriptOpsOnly config, which controls if only ops can see and edit scripts. -Added ScriptDevs config, a list of the UUIDs of players who should be able to see and edit scripts. If left empty and ScriptOpsOnly is false, everyone can see and edit scripts with a scripter. IPlayer: -Added isScriptDev() function to check if the player can see and edit scripts.
This commit is contained in:
1 parent
5fdef1cd0c
commit
22e01bba1f
6 files changed
+72
-26
No files matched your search
@@ -13,6 +13,8 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
@@ -60,12 +62,16 @@ public class ItemScripted extends Item implements ItemRenderInterface {
|
||||
return super.setUnlocalizedName(name);
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer entityPlayer)
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if(entityPlayer.isSneaking() && entityPlayer.capabilities.isCreativeMode) {
|
||||
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptItem, entityPlayer);
|
||||
if(player.isSneaking() && player.capabilities.isCreativeMode) {
|
||||
if(!CustomNpcs.isScriptDev(player)){
|
||||
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
|
||||
} else {
|
||||
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptItem, player);
|
||||
}
|
||||
}
|
||||
entityPlayer.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user