Added a message if scooping obsidian into lava fails due to nearby obsidian blocks

Improved messages related to obsidian scooping
This commit is contained in:
Florian CUNY 2020-02-12 20:31:06 +01:00
parent f383c196a5
commit f04a4fb522
2 changed files with 15 additions and 14 deletions

View File

@ -44,15 +44,12 @@ public class ObsidianScoopingListener extends FlagListener {
if (getIslands().userIsOnIsland(user.getWorld(), user)) {
// Look around to see if this is a lone obsidian block
Block b = e.getClickedBlock();
for (Block testBlock : getBlocksAround(b)) {
if (testBlock.getType().equals(Material.OBSIDIAN)) {
// Do nothing special
return false;
}
if (getBlocksAround(b).stream().anyMatch(block -> block.getType().equals(Material.OBSIDIAN))) {
user.sendMessage("protection.flags.OBSIDIAN_SCOOPING.obsidian-nearby");
return false;
}
user.sendMessage("general.tips.changing-obsidian-to-lava");
user.sendMessage("protection.flags.OBSIDIAN_SCOOPING.scooping");
if (e.getItem().getAmount() == 1) {
// Needs some special handling when there is only 1 bucket in the stack
e.getItem().setType(Material.LAVA_BUCKET);
@ -64,7 +61,6 @@ public class ObsidianScoopingListener extends FlagListener {
e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ITEM_BUCKET_FILL_LAVA, 1F, 1F);
e.getClickedBlock().setType(Material.AIR);
e.setCancelled(true);
return true;
}

View File

@ -34,8 +34,6 @@ general:
wrong-world: "&c You are not in the right world to do that!"
you-must-wait: "&c You must wait [number]s before you can do that command again."
must-be-positive-number: "&c [number] is not a valid positive number."
tips:
changing-obsidian-to-lava: "Changing obsidian back into lava. Be careful!"
worlds:
overworld: "Overworld"
nether: "Nether"
@ -1007,11 +1005,18 @@ protection:
hint: "Noteblock interaction disabled"
OBSIDIAN_SCOOPING:
name: "Obsidian scooping"
description: |
&a Toggle scooping
&a Allow obsidian to be scooped up
description: |-
&a Allow players to scoop up obsidian
&a with an empty bucket back into lava.
&a Protects newbies. Reduces resets.
&a This helps the newbies that failed to
&a build their cobblestone generator.
&a Note: obsidian cannot be scooped up
&a if there are other obsidian blocks
&a within a 2-block radius.
scooping: "&a Changing obsidian back into lava. Be careful next time!"
obsidian-nearby: "&c There are obsidian blocks nearby, you cannot scoop up this block into lava."
OFFLINE_GROWTH:
description: |-
&a When disabled, plants