Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 08:10:09 +01:00
Fix sign and banner placement in paperpatch
Dieser Commit ist enthalten in:
Ursprung
63fc733c88
Commit
a5f5472853
@ -25,15 +25,16 @@ public class PaperPatch extends ViaBukkitListener {
|
|||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlace(BlockPlaceEvent e) {
|
public void onPlace(BlockPlaceEvent e) {
|
||||||
if (isOnPipe(e.getPlayer())) {
|
if (isOnPipe(e.getPlayer())) {
|
||||||
Location diff = e.getPlayer().getLocation().subtract(e.getBlock().getLocation().add(0.5D, 0, 0.5D));
|
Location location = e.getPlayer().getLocation();
|
||||||
|
Location diff = location.subtract(e.getBlock().getLocation().add(0.5D, 0, 0.5D));
|
||||||
Material block = e.getBlockPlaced().getType();
|
Material block = e.getBlockPlaced().getType();
|
||||||
if (!block.isSolid()) {
|
if (isPlacable(block)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.getPlayer().getLocation().getBlock().equals(e.getBlock())) {
|
if (location.getBlock().equals(e.getBlock())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
} else {
|
} else {
|
||||||
if (e.getPlayer().getLocation().getBlock().getRelative(BlockFace.UP).equals(e.getBlock())) {
|
if (location.getBlock().getRelative(BlockFace.UP).equals(e.getBlock())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
} else {
|
} else {
|
||||||
// Within radius of block
|
// Within radius of block
|
||||||
@ -55,4 +56,18 @@ public class PaperPatch extends ViaBukkitListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isPlacable(Material material) {
|
||||||
|
if (!material.isSolid()) return true;
|
||||||
|
// signs and banners
|
||||||
|
switch (material.getId()) {
|
||||||
|
case 63:
|
||||||
|
case 68:
|
||||||
|
case 176:
|
||||||
|
case 177:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren