Search in sources :

Example 11 with RPEntityListener

use of br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPEntityListener in project RedProtect by FabioZumbi12.

the class RPEntityListener method onPlayerFrostWalk.

@EventHandler
public void onPlayerFrostWalk(EntityBlockFormEvent e) {
    if (e.getEntity() instanceof Player) {
        return;
    }
    RedProtect.get().logger.debug("RPEntityListener - EntityBlockFormEvent canceled? " + e.isCancelled());
    Region r = RedProtect.get().rm.getTopRegion(e.getBlock().getLocation());
    if (r != null && !r.canIceForm()) {
        e.setCancelled(true);
    }
}
Also used : Player(org.bukkit.entity.Player) Region(br.net.fabiozumbi12.RedProtect.Bukkit.Region) EventHandler(org.bukkit.event.EventHandler)

Example 12 with RPEntityListener

use of br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPEntityListener in project RedProtect by FabioZumbi12.

the class RedProtect method onServerStart.

@Listener
public void onServerStart(GameStartedServerEvent event) {
    try {
        String v = Sponge.getGame().getPlatform().getContainer(Component.API).getVersion().get();
        instance = this;
        if (v.startsWith("5") || v.startsWith("6")) {
            pvhelp = (RPVHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.RPVHelper56").newInstance();
        }
        if (v.startsWith("7")) {
            pvhelp = (RPVHelper) Class.forName("br.net.fabiozumbi12.RedProtect.Sponge.RPVHelper7").newInstance();
        }
        initVars();
        OnlineMode = serv.getOnlineMode();
        cmdService.register(container, new RPCommands(), Arrays.asList("redprotect", "rp", "regionp", "regp"));
        game.getEventManager().registerListeners(container, new RPGlobalListener());
        game.getEventManager().registerListeners(container, new RPBlockListener());
        game.getEventManager().registerListeners(container, new RPPlayerListener());
        game.getEventManager().registerListeners(container, new RPEntityListener());
        game.getEventManager().registerListeners(container, new RPWorldListener());
        game.getEventManager().registerListeners(container, new RPMine18());
        game.getEventManager().registerListeners(container, new RPAddProtection());
        loadRegions();
        logger.info("Loading API...");
        this.rpAPI = new RedProtectAPI();
        logger.info("API Loaded!");
        logger.clear("&4 _   _  _  &c _   _   _  _ _  _  _ _ _  __");
        logger.clear("&4|_| |_ | \\ &c|_| |_| | |  |  |_ |   |    / ");
        logger.clear("&4| \\ |_ |_/ &c|   | \\ |_|  |  |_ |_  |   /");
        logger.clear("&a¯ Redprotect " + container.getVersion().get() + " enabled");
        logger.clear("");
    } catch (Exception e) {
        e.printStackTrace();
        logger.severe("Error enabling RedProtect, plugin will shut down.");
    }
}
Also used : RPBlockListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPBlockListener) RPPlayerListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPPlayerListener) RPWorldListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPWorldListener) RPEntityListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPEntityListener) RedProtectAPI(br.net.fabiozumbi12.RedProtect.Sponge.API.RedProtectAPI) RPGlobalListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPGlobalListener) RPAddProtection(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPAddProtection) RPMine18(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPMine18) RPCommands(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPCommands) RPGlobalListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPGlobalListener) RPWorldListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPWorldListener) RPEntityListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPEntityListener) RPBlockListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPBlockListener) RPPlayerListener(br.net.fabiozumbi12.RedProtect.Sponge.listeners.RPPlayerListener) Listener(org.spongepowered.api.event.Listener)

Aggregations

Listener (org.spongepowered.api.event.Listener)6 Region (br.net.fabiozumbi12.RedProtect.Bukkit.Region)5 Region (br.net.fabiozumbi12.RedProtect.Sponge.Region)5 EventHandler (org.bukkit.event.EventHandler)5 Entity (org.bukkit.entity.Entity)4 LivingEntity (org.bukkit.entity.LivingEntity)4 Player (org.bukkit.entity.Player)4 Entity (org.spongepowered.api.entity.Entity)4 Monster (org.spongepowered.api.entity.living.monster.Monster)3 Animals (org.bukkit.entity.Animals)2 Golem (org.bukkit.entity.Golem)2 Monster (org.bukkit.entity.Monster)2 Villager (org.bukkit.entity.Villager)2 Ambient (org.spongepowered.api.entity.living.Ambient)2 Animal (org.spongepowered.api.entity.living.animal.Animal)2 Golem (org.spongepowered.api.entity.living.golem.Golem)2 Player (org.spongepowered.api.entity.living.player.Player)2 World (org.spongepowered.api.world.World)2 RedProtectAPI (br.net.fabiozumbi12.RedProtect.Bukkit.API.RedProtectAPI)1 MPListener (br.net.fabiozumbi12.RedProtect.Bukkit.hooks.MPListener)1