mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
parent
fab821742d
commit
ad2ebaddc9
@ -7,7 +7,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
import org.bukkit.block.Hopper;
|
||||
import org.bukkit.block.Skull;
|
||||
@ -161,13 +160,12 @@ public class ItemListener implements Listener {
|
||||
final Player p = e.getPlayer();
|
||||
ItemStack item = e.getItem();
|
||||
|
||||
// water place under head bug fix
|
||||
if (e != null && e.getPlayer() != null && e.getParentEvent().getAction() != null && e.getParentEvent().getAction() == Action.RIGHT_CLICK_BLOCK && e.getParentEvent().getBlockFace() != null && e.getPlayer().getInventory() != null && e.getPlayer().getInventory().getItemInMainHand() != null && e.getPlayer().getInventory().getItemInMainHand().getType() == Material.WATER_BUCKET) {
|
||||
Location clicked = e.getClickedBlock().getLocation();
|
||||
BlockFace f = e.getParentEvent().getBlockFace();
|
||||
Location water = new Location(clicked.getWorld(), clicked.getX() + f.getModX(), clicked.getY() + f.getModY(), clicked.getZ() + f.getModZ());
|
||||
if (e.getPlayer().getLocation().getWorld().getBlockAt(water) != null && e.getPlayer().getLocation().getWorld().getBlockAt(water).getType() == Material.PLAYER_HEAD) {
|
||||
// Fix for placing water on head
|
||||
if (e.getParentEvent().getAction() == Action.RIGHT_CLICK_BLOCK && item != null && item.getType() == Material.WATER_BUCKET) {
|
||||
Location water = e.getClickedBlock().getRelative(e.getParentEvent().getBlockFace()).getLocation();
|
||||
if ((p.getWorld().getBlockAt(water).getType() == Material.PLAYER_HEAD || p.getWorld().getBlockAt(water).getType() == Material.PLAYER_WALL_HEAD) && BlockStorage.hasBlockInfo(water)) {
|
||||
e.setCancelled(true);
|
||||
p.getWorld().getBlockAt(water).getState().update(true, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user