Search in sources :

Example 31 with EventHandler

use of org.bukkit.event.EventHandler in project TotalFreedomMod by TotalFreedom.

the class Muter method onAsyncPlayerChatEvent.

@EventHandler(priority = EventPriority.LOW)
public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent event) {
    FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
    if (!fPlayer.isMuted()) {
        return;
    }
    if (plugin.al.isAdminSync(event.getPlayer())) {
        fPlayer.setMuted(false);
        return;
    }
    FSync.playerMsg(event.getPlayer(), ChatColor.RED + "You are muted, STFU! - You will be unmuted in 5 minutes.");
    event.setCancelled(true);
}
Also used : FPlayer(me.totalfreedom.totalfreedommod.player.FPlayer) EventHandler(org.bukkit.event.EventHandler)

Example 32 with EventHandler

use of org.bukkit.event.EventHandler in project TotalFreedomMod by TotalFreedom.

the class WorldEditListener method onLimitChanged.

@EventHandler
public void onLimitChanged(LimitChangedEvent event) {
    final Player player = event.getPlayer();
    if (plugin.al.isAdmin(player)) {
        return;
    }
    if (!event.getPlayer().equals(event.getTarget())) {
        player.sendMessage(ChatColor.RED + "Only admins can change the limit for other players!");
        event.setCancelled(true);
    }
    if (event.getLimit() < 0 || event.getLimit() > 10000) {
        player.setOp(false);
        FUtil.bcastMsg(event.getPlayer().getName() + " tried to set their WorldEdit limit to " + event.getLimit() + " and has been de-opped", ChatColor.RED);
        event.setCancelled(true);
        player.sendMessage(ChatColor.RED + "You cannot set your limit higher than 10000 or to -1!");
    }
}
Also used : Player(org.bukkit.entity.Player) EventHandler(org.bukkit.event.EventHandler)

Example 33 with EventHandler

use of org.bukkit.event.EventHandler in project TotalFreedomMod by TotalFreedom.

the class Cager method onPlayerJoin.

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerJoin(PlayerJoinEvent event) {
    FPlayer player = plugin.pl.getPlayer(event.getPlayer());
    CageData cage = player.getCageData();
    if (cage.isCaged()) {
        cage.playerJoin();
    }
}
Also used : FPlayer(me.totalfreedom.totalfreedommod.player.FPlayer) EventHandler(org.bukkit.event.EventHandler)

Example 34 with EventHandler

use of org.bukkit.event.EventHandler in project TotalFreedomMod by TotalFreedom.

the class Cager method onPlayerQuit.

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event) {
    FPlayer player = plugin.pl.getPlayer(event.getPlayer());
    CageData cage = player.getCageData();
    if (cage.isCaged()) {
        cage.playerQuit();
    }
}
Also used : FPlayer(me.totalfreedom.totalfreedommod.player.FPlayer) EventHandler(org.bukkit.event.EventHandler)

Example 35 with EventHandler

use of org.bukkit.event.EventHandler in project TotalFreedomMod by TotalFreedom.

the class AntiNuke method onBlockPlace.

@EventHandler(priority = EventPriority.HIGH)
public void onBlockPlace(BlockPlaceEvent event) {
    if (!ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean()) {
        return;
    }
    Player player = event.getPlayer();
    Location blockLocation = event.getBlock().getLocation();
    FPlayer fPlayer = plugin.pl.getPlayer(player);
    Location playerLocation = player.getLocation();
    double nukeMonitorRange = ConfigEntry.NUKE_MONITOR_RANGE.getDouble();
    boolean outOfRange = false;
    if (!playerLocation.getWorld().equals(blockLocation.getWorld())) {
        outOfRange = true;
    } else if (playerLocation.distanceSquared(blockLocation) > (nukeMonitorRange * nukeMonitorRange)) {
        outOfRange = true;
    }
    if (outOfRange) {
        if (fPlayer.incrementAndGetFreecamPlaceCount() > ConfigEntry.FREECAM_TRIGGER_COUNT.getInteger()) {
            FUtil.bcastMsg(player.getName() + " has been flagged for possible freecam building.", ChatColor.RED);
            plugin.ae.autoEject(player, "Freecam (extended range) block building is not permitted on this server.");
            fPlayer.resetFreecamPlaceCount();
            event.setCancelled(true);
            return;
        }
    }
    if (fPlayer.incrementAndGetBlockPlaceCount() > ConfigEntry.NUKE_MONITOR_COUNT_PLACE.getInteger()) {
        FUtil.bcastMsg(player.getName() + " is placing blocks too fast!", ChatColor.RED);
        plugin.ae.autoEject(player, "You are placing blocks too fast.");
        fPlayer.resetBlockPlaceCount();
        event.setCancelled(true);
    }
}
Also used : FPlayer(me.totalfreedom.totalfreedommod.player.FPlayer) FPlayer(me.totalfreedom.totalfreedommod.player.FPlayer) Player(org.bukkit.entity.Player) Location(org.bukkit.Location) EventHandler(org.bukkit.event.EventHandler)

Aggregations

EventHandler (org.bukkit.event.EventHandler)532 Player (org.bukkit.entity.Player)185 Entity (org.bukkit.entity.Entity)70 net.aufdemrand.denizen.objects.dEntity (net.aufdemrand.denizen.objects.dEntity)67 net.aufdemrand.denizen.objects.dLocation (net.aufdemrand.denizen.objects.dLocation)62 Block (org.bukkit.block.Block)62 ItemStack (org.bukkit.inventory.ItemStack)55 Location (org.bukkit.Location)54 Island (com.wasteofplastic.acidisland.Island)42 Element (net.aufdemrand.denizencore.objects.Element)38 LivingEntity (org.bukkit.entity.LivingEntity)37 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)31 Minigame (au.com.mineauz.minigames.minigame.Minigame)29 net.aufdemrand.denizen.objects.dItem (net.aufdemrand.denizen.objects.dItem)29 net.aufdemrand.denizencore.objects.dList (net.aufdemrand.denizencore.objects.dList)28 Projectile (org.bukkit.entity.Projectile)26 MyPetPlayer (de.Keyle.MyPet.api.player.MyPetPlayer)23 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)22 NotRegisteredException (com.palmergames.bukkit.towny.exceptions.NotRegisteredException)18 ArrayList (java.util.ArrayList)18