Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/main/java/dev/espi/protectionstones/ListenerClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,18 @@ private boolean playerBreakProtection(Player p, PSRegion r) {

// return protection stone if no drop option is off
if (blockOptions != null && !blockOptions.noDrop) {
if (!p.getInventory().addItem(blockOptions.createItem()).isEmpty()) {
// method will return not empty if item couldn't be added
if (ProtectionStones.getInstance().getConfigOptions().dropItemWhenInventoryFull) {
PSL.msg(p, PSL.NO_ROOM_DROPPING_ON_FLOOR.msg());
p.getWorld().dropItem(r.getProtectBlock().getLocation(), blockOptions.createItem());
} else {
PSL.msg(p, PSL.NO_ROOM_IN_INVENTORY.msg());
return false;
if(blockOptions.dropAsItem){
p.getWorld().dropItem(r.getProtectBlock().getLocation(), blockOptions.createItem());
}else {
if (!p.getInventory().addItem(blockOptions.createItem()).isEmpty()) {
// method will return not empty if item couldn't be added
if (ProtectionStones.getInstance().getConfigOptions().dropItemWhenInventoryFull) {
PSL.msg(p, PSL.NO_ROOM_DROPPING_ON_FLOOR.msg());
p.getWorld().dropItem(r.getProtectBlock().getLocation(), blockOptions.createItem());
} else {
PSL.msg(p, PSL.NO_ROOM_IN_INVENTORY.msg());
return false;
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/dev/espi/protectionstones/PSProtectBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public class PSProtectBlock {
public boolean autoMerge;
@Path("behaviour.no_drop")
public boolean noDrop;
@Path("behaviour.drop_as_item")
public boolean dropAsItem;
@Path("behaviour.prevent_piston_push")
public boolean preventPistonPush;
@Path("behaviour.prevent_explode")
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/block1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ placing_bypasses_wg_passthrough = true

# Disable returning the block when removed/unclaimed?
no_drop = false
# Determines whether the block should drop as an item. Default: false. false = instantly added to the inventory.
drop_as_item = false

# Prevents piston pushing of the block. Recommended to keep as true.
prevent_piston_push = true
Expand Down