3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

Only allow command blocks to be placed by op'd players

Dieser Commit ist enthalten in:
Thinkofdeath 2014-12-21 19:04:01 +00:00
Ursprung 53fc3cf74f
Commit dbdf6cacbf

Datei anzeigen

@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde//net/minecraft/server/PlayerInteractManager.java 2014-12-09 12:19:57.555618161 +0000 --- ../work/decompile-8eb82bde/net/minecraft/server/PlayerInteractManager.java 2014-12-21 19:03:39.124516788 +0000
+++ src/main/java/net/minecraft/server/PlayerInteractManager.java 2014-12-09 12:16:26.307622849 +0000 +++ src/main/java/net/minecraft/server/PlayerInteractManager.java 2014-12-21 19:03:39.128516787 +0000
@@ -1,5 +1,13 @@ @@ -1,5 +1,13 @@
package net.minecraft.server; package net.minecraft.server;
@ -216,7 +216,7 @@
if (this.gamemode == EnumGamemode.SPECTATOR) { if (this.gamemode == EnumGamemode.SPECTATOR) {
TileEntity tileentity = world.getTileEntity(blockposition); TileEntity tileentity = world.getTileEntity(blockposition);
@@ -312,6 +444,68 @@ @@ -312,6 +444,72 @@
return itemstack.placeItem(entityhuman, world, blockposition, enumdirection, f, f1, f2); return itemstack.placeItem(entityhuman, world, blockposition, enumdirection, f, f1, f2);
} }
} }
@ -229,7 +229,11 @@
+ if (this.gamemode == EnumGamemode.SPECTATOR) { + if (this.gamemode == EnumGamemode.SPECTATOR) {
+ TileEntity tileentity = world.getTileEntity(blockposition); + TileEntity tileentity = world.getTileEntity(blockposition);
+ cancelledBlock = !(tileentity instanceof ITileInventory || tileentity instanceof IInventory); + cancelledBlock = !(tileentity instanceof ITileInventory || tileentity instanceof IInventory);
+ } + }
+
+ if (!entityhuman.getBukkitEntity().isOp() && itemstack != null && Block.asBlock(itemstack.getItem()) instanceof BlockCommand) {
+ cancelledBlock = true;
+ }
+ +
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, blockposition, enumdirection, itemstack, cancelledBlock); + PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, blockposition, enumdirection, itemstack, cancelledBlock);
+ firedInteract = true; + firedInteract = true;