Getting items from a block without the block moving from the map. ( is it possible ? )

Status
This thread has been locked.

KawaiiBuilder

Feedback score
0
Posts
18
Reactions
3
Resources
0
Hello. So i'm creating a custom adventure map. And i wanted to know if there is a plugin or something that allows a player to; example : punch a tree block after the animation of item brakes instead of item getting from the map to his inventory a copy of it goes to him and the block stays on the map.
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Badger

Software Developer
Supreme
Feedback score
22
Posts
2,366
Reactions
1,561
Resources
2
Hello. So i'm creating a custom adventure map. And i wanted to know if there is a plugin or something that allows a player to; example : punch a tree block after the animation of item brakes instead of item getting from the map to his inventory a copy of it goes to him and the block stays on the map.
So you basically want a plugin in which when someone breaks a block, the block isn't deleted from the world, but the player still gets the broken block in their inventory, correct? I could make this for you if you need? :)
 

Badger

Software Developer
Supreme
Feedback score
22
Posts
2,366
Reactions
1,561
Resources
2
If you are willing to share it then by all means.
Something like this:
PHP:
@EventHandler
public void onBlockBreak(BlockBreakEvent evt) {
if(!evt.getPlayer().hasPermission("Pluginname.NoBreak")) {
evt.setCancelled(true);
for(ItemStack stack : evt.getBlock().getDrops()) {
evt.getPlayer().getInventory().add(stack);
}
}
}
Didn't use my IDE for this, so some things may be mistyped, but nonetheless you should hopefully understand it.
 
Status
This thread has been locked.
Top