1.13 update
Mostly changes with Material.java
This commit is contained in:
@@ -10,16 +10,13 @@ import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -45,9 +42,9 @@ public class EngineExploit extends Engine
|
||||
|
||||
// thanks to ObGenBlocker and WorldGuard for this method
|
||||
Block block = event.getToBlock();
|
||||
int source = event.getBlock().getTypeId();
|
||||
int target = block.getTypeId();
|
||||
if ((target == 55 || target == 132) && (source == 0 || source == 10 || source == 11))
|
||||
Material source = event.getBlock().getType();
|
||||
Material target = block.getType();
|
||||
if ((target == Material.REDSTONE_WIRE || target == Material.TRIPWIRE) && (source == Material.AIR || source == Material.LAVA))
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
@@ -70,8 +67,8 @@ public class EngineExploit extends Engine
|
||||
// blocks who occupy less than 1 block width or length wise need to be handled differently
|
||||
Material mat = event.getTo().getBlock().getType();
|
||||
if (
|
||||
((mat == Material.THIN_GLASS || mat == Material.IRON_FENCE) && clippingThrough(target, from, 0.65))
|
||||
|| ((mat == Material.FENCE || mat == Material.NETHER_FENCE) && clippingThrough(target, from, 0.45))
|
||||
((mat == Material.GLASS_PANE || mat == Material.IRON_BARS) && clippingThrough(target, from, 0.65))
|
||||
|| ((MUtil.list(Material.ACACIA_FENCE, Material.BIRCH_FENCE, Material.DARK_OAK_FENCE, Material.JUNGLE_FENCE, Material.NETHER_BRICK_FENCE, Material.OAK_FENCE, Material.SPRUCE_FENCE).contains(mat)) && clippingThrough(target, from, 0.45))
|
||||
)
|
||||
{
|
||||
event.setTo(from);
|
||||
@@ -95,42 +92,6 @@ public class EngineExploit extends Engine
|
||||
|| (target.getZ() > from.getZ() && (target.getZ() - from.getZ() < thickness))
|
||||
);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// TNT WATERLOG
|
||||
// -------------------------------------------- //
|
||||
// TNT in water/lava doesn't normally destroy any surrounding blocks, which is usually desired behavior.
|
||||
// But this optional change below provides workaround for waterwalling providing perfect protection,
|
||||
// and makes cheap (non-obsidian) TNT cannons require minor maintenance between shots.
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void tntWaterlog(EntityExplodeEvent event)
|
||||
{
|
||||
if (!MConf.get().handleExploitTNTWaterlog) return;
|
||||
if (!(event.getEntity() instanceof TNTPrimed)) return;
|
||||
|
||||
Block center = event.getLocation().getBlock();
|
||||
if (!center.isLiquid()) return;
|
||||
|
||||
// a single surrounding block in all 6 directions is broken if the material is weak enough
|
||||
List<Block> targets = new ArrayList<>();
|
||||
targets.add(center.getRelative(0, 0, 1));
|
||||
targets.add(center.getRelative(0, 0, -1));
|
||||
targets.add(center.getRelative(0, 1, 0));
|
||||
targets.add(center.getRelative(0, -1, 0));
|
||||
targets.add(center.getRelative(1, 0, 0));
|
||||
targets.add(center.getRelative(-1, 0, 0));
|
||||
for (Block target : targets)
|
||||
{
|
||||
int id = target.getTypeId();
|
||||
// ignore air, bedrock, water, lava, obsidian, enchanting table, etc.... too bad we can't get a blast resistance value through Bukkit yet
|
||||
if (id != 0 && (id < 7 || id > 11) && id != 49 && id != 90 && id != 116 && id != 119 && id != 120 && id != 130)
|
||||
{
|
||||
target.breakNaturally();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// NETHER PORTAL TRAP
|
||||
@@ -240,7 +201,7 @@ public class EngineExploit extends Engine
|
||||
{
|
||||
for (int z = -(NETHER_TRAP_RADIUS_CHECK); z <= NETHER_TRAP_RADIUS_CHECK; z ++)
|
||||
{
|
||||
if (from.getRelative(x, y, z).getType() == Material.PORTAL) ret.add(from.getRelative(x, y, z));
|
||||
if (from.getRelative(x, y, z).getType() == Material.NETHER_PORTAL) ret.add(from.getRelative(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user