Commits
md_5 authored 4165cd8f453
1 + | From d5793cdcf604bb4dd5cefad489b50551d34fbd6f Mon Sep 17 00:00:00 2001 |
2 + | From: md_5 <git@md-5.net> |
3 + | Date: Mon, 25 Feb 2019 19:26:56 +1100 |
4 + | Subject: [PATCH] Add creative mode NBT permissions |
5 + | |
6 + | |
7 + | diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java |
8 + | index 85d364b8f..f27d565e1 100644 |
9 + | --- a/src/main/java/net/minecraft/server/ItemBlock.java |
10 + | +++ b/src/main/java/net/minecraft/server/ItemBlock.java |
11 + | |
12 + | TileEntity tileentity = world.getTileEntity(blockposition); |
13 + | |
14 + | if (tileentity != null) { |
15 + | - if (!world.isClientSide && tileentity.isFilteredNBT() && (entityhuman == null || !entityhuman.isCreativeAndOp())) { |
16 + | + if (!world.isClientSide && tileentity.isFilteredNBT() && (entityhuman == null || !(entityhuman.isCreativeAndOp() || (entityhuman.abilities.canInstantlyBuild && entityhuman.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission |
17 + | return false; |
18 + | } |
19 + | |
20 + | diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java |
21 + | index 55b4d57af..9c1aedb28 100644 |
22 + | --- a/src/main/java/net/minecraft/server/PlayerConnection.java |
23 + | +++ b/src/main/java/net/minecraft/server/PlayerConnection.java |
24 + | |
25 + | ItemStack itemstack = packetplayinsetcreativeslot.getItemStack(); |
26 + | NBTTagCompound nbttagcompound = itemstack.b("BlockEntityTag"); |
27 + | |
28 + | - if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z")) { |
29 + | + if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot |
30 + | BlockPosition blockposition = new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")); |
31 + | TileEntity tileentity = this.player.world.getTileEntity(blockposition); |
32 + | |
33 + | diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java |
34 + | index c54d3efd6..04d9a7fe0 100644 |
35 + | --- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java |
36 + | +++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java |
37 + | |
38 + | public static void registerCorePermissions() { |
39 + | Permission parent = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all vanilla utilities and commands"); |
40 + | CommandPermissions.registerPermissions(parent); |
41 + | + // Spigot start |
42 + | + DefaultPermissions.registerPermission(ROOT + ".nbt.place", "Gives the user the ability to place restricted blocks with NBT in creative", PermissionDefault.OP, parent); |
43 + | + DefaultPermissions.registerPermission(ROOT + ".nbt.copy", "Gives the user the ability to copy NBT in creative", PermissionDefault.TRUE, parent); |
44 + | + // Spigot end |
45 + | parent.recalculatePermissibles(); |
46 + | } |
47 + | } |
48 + | -- |
49 + | 2.19.1 |
50 + | |