Search in sources :

Example 21 with Region

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);
        }
    }
}
Also used : Region(br.net.fabiozumbi12.RedProtect.Bukkit.Region) Location(org.bukkit.Location) EventHandler(org.bukkit.event.EventHandler)

Example 22 with Region

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);
    }
}
Also used : Player(org.bukkit.entity.Player) Region(br.net.fabiozumbi12.RedProtect.Bukkit.Region) Location(org.bukkit.Location) EventHandler(org.bukkit.event.EventHandler)

Example 23 with Region

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);
    }
}
Also used : Block(org.bukkit.block.Block) Region(br.net.fabiozumbi12.RedProtect.Bukkit.Region) EventHandler(org.bukkit.event.EventHandler)

Example 24 with Region

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);
    }
}
Also used : Vehicle(org.bukkit.entity.Vehicle) Player(org.bukkit.entity.Player) Region(br.net.fabiozumbi12.RedProtect.Bukkit.Region) EventHandler(org.bukkit.event.EventHandler)

Example 25 with Region

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");
        }
    }
}
Also used : Region(br.net.fabiozumbi12.RedProtect.Bukkit.Region) Material(org.bukkit.Material) Location(org.bukkit.Location) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Region (br.net.fabiozumbi12.RedProtect.Bukkit.Region)113 EventHandler (org.bukkit.event.EventHandler)92 Player (org.bukkit.entity.Player)69 Region (br.net.fabiozumbi12.RedProtect.Sponge.Region)47 Listener (org.spongepowered.api.event.Listener)46 Location (org.bukkit.Location)43 World (org.spongepowered.api.world.World)30 Block (org.bukkit.block.Block)26 MyPetPlayer (de.Keyle.MyPet.api.player.MyPetPlayer)20 PvPlayer (me.NoChance.PvPManager.PvPlayer)20 Entity (org.bukkit.entity.Entity)20 BlockSnapshot (org.spongepowered.api.block.BlockSnapshot)19 Entity (org.spongepowered.api.entity.Entity)19 LivingEntity (org.bukkit.entity.LivingEntity)16 Player (org.spongepowered.api.entity.living.player.Player)16 World (org.bukkit.World)10 Monster (org.bukkit.entity.Monster)10 Material (org.bukkit.Material)9 ClanPlayer (net.sacredlabyrinth.phaed.simpleclans.ClanPlayer)8 OfflinePlayer (org.bukkit.OfflinePlayer)8