Easier claim management on water.
If in water, shovel and stick ignore water. Otherwise they treat water is a solid block. Should make creating claims on water and resizing claims when the corner to be moved is beneath water much easier.
This commit is contained in:
parent
f62a412932
commit
5d5584241b
|
|
@ -1387,6 +1387,7 @@ public abstract class DataStore
|
||||||
this.addDefault(defaults, Messages.BookDisabledChestClaims, " On this server, placing a chest will NOT claim land for you.", null);
|
this.addDefault(defaults, Messages.BookDisabledChestClaims, " On this server, placing a chest will NOT claim land for you.", null);
|
||||||
this.addDefault(defaults, Messages.BookUsefulCommands, "Useful Commands:", null);
|
this.addDefault(defaults, Messages.BookUsefulCommands, "Useful Commands:", null);
|
||||||
this.addDefault(defaults, Messages.NoProfanity, "Please moderate your language.", null);
|
this.addDefault(defaults, Messages.NoProfanity, "Please moderate your language.", null);
|
||||||
|
this.addDefault(defaults, Messages.IsIgnoringYou, "That player is ignoring you.", null);
|
||||||
|
|
||||||
//load the config file
|
//load the config file
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
||||||
|
|
|
||||||
|
|
@ -2671,14 +2671,19 @@ class PlayerEventHandler implements Listener
|
||||||
|
|
||||||
static Block getTargetBlock(Player player, int maxDistance) throws IllegalStateException
|
static Block getTargetBlock(Player player, int maxDistance) throws IllegalStateException
|
||||||
{
|
{
|
||||||
BlockIterator iterator = new BlockIterator(player.getLocation(), player.getEyeHeight(), maxDistance);
|
Location eye = player.getEyeLocation();
|
||||||
|
Material eyeMaterial = eye.getBlock().getType();
|
||||||
|
boolean passThroughWater = (eyeMaterial == Material.WATER || eyeMaterial == Material.STATIONARY_WATER);
|
||||||
|
BlockIterator iterator = new BlockIterator(player.getLocation(), player.getEyeHeight(), maxDistance);
|
||||||
Block result = player.getLocation().getBlock().getRelative(BlockFace.UP);
|
Block result = player.getLocation().getBlock().getRelative(BlockFace.UP);
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
result = iterator.next();
|
result = iterator.next();
|
||||||
if(result.getType() != Material.AIR &&
|
Material type = result.getType();
|
||||||
result.getType() != Material.STATIONARY_WATER &&
|
if(type != Material.AIR &&
|
||||||
result.getType() != Material.LONG_GRASS) return result;
|
(!passThroughWater || type != Material.STATIONARY_WATER) &&
|
||||||
|
(!passThroughWater || type != Material.WATER) &&
|
||||||
|
type != Material.LONG_GRASS) return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user