use of br.net.fabiozumbi12.RedProtect.Sponge.Region in project RedProtect by FabioZumbi12.
the class RPGlobalListener method onFrameBrake.
@EventHandler
public void onFrameBrake(HangingBreakEvent e) {
if (e.isCancelled()) {
return;
}
Location l = e.getEntity().getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
if (r != null) {
return;
}
if (e.getCause().toString().equals("EXPLOSION") || e.getCause().toString().equals("ENTITY")) {
if (!RPConfig.getGlobalFlagBool(l.getWorld().getName() + ".entity-block-damage")) {
e.setCancelled(true);
}
}
}
use of br.net.fabiozumbi12.RedProtect.Sponge.Region in project RedProtect by FabioZumbi12.
the class RPGlobalListener method PlayerPickup.
@EventHandler
public void PlayerPickup(PlayerPickupItemEvent e) {
Location l = e.getItem().getLocation();
Player p = e.getPlayer();
Region r = RedProtect.get().rm.getTopRegion(l);
if (r == null && !RPConfig.getGlobalFlagBool(p.getWorld().getName() + ".player-canpickup")) {
e.setCancelled(true);
}
}
use of br.net.fabiozumbi12.RedProtect.Sponge.Region in project RedProtect by FabioZumbi12.
the class RPGlobalListener method onBlockStartBurn.
@EventHandler
public void onBlockStartBurn(BlockIgniteEvent e) {
if (e.isCancelled()) {
return;
}
Block b = e.getBlock();
Block bignit = e.getIgnitingBlock();
if (b == null || bignit == null) {
return;
}
RedProtect.get().logger.debug("Is BlockIgniteEvent event from global-listener");
Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
if (r != null) {
return;
}
if ((bignit.getType().equals(Material.FIRE) || bignit.getType().name().contains("LAVA")) && !RPConfig.getGlobalFlagBool(b.getWorld().getName() + ".fire-spread")) {
e.setCancelled(true);
}
}
use of br.net.fabiozumbi12.RedProtect.Sponge.Region in project RedProtect by FabioZumbi12.
the class RPGlobalListener method onVehicleBreak.
@EventHandler
public void onVehicleBreak(VehicleDestroyEvent e) {
if (e.isCancelled()) {
return;
}
if (!(e.getAttacker() instanceof Player)) {
return;
}
Vehicle cart = e.getVehicle();
Player p = (Player) e.getAttacker();
Region r = RedProtect.get().rm.getTopRegion(cart.getLocation());
if (r != null) {
return;
}
if (!RPConfig.getGlobalFlagBool(p.getWorld().getName() + ".use-minecart") && !p.hasPermission("redprotect.bypass.world")) {
e.setCancelled(true);
}
}
use of br.net.fabiozumbi12.RedProtect.Sponge.Region in project RedProtect by FabioZumbi12.
the class RPMine18 method onInteractAS.
@EventHandler
public void onInteractAS(PlayerInteractEvent e) {
if (e.isCancelled() || e.getClickedBlock() == null) {
return;
}
if (RedProtect.get().version <= 180) {
return;
}
Player p = e.getPlayer();
Location l = e.getClickedBlock().getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
Material m = p.getItemInHand().getType();
if (RedProtect.get().version >= 190 && e.getItem() != null) {
m = e.getItem().getType();
}
if (m.equals(Material.ARMOR_STAND) || m.equals(Material.END_CRYSTAL)) {
if (r != null && !r.canBuild(p) && !r.canPlace(m)) {
e.setCancelled(true);
RPLang.sendMessage(p, "blocklistener.region.cantbuild");
}
}
}
Aggregations