Search in sources :

Example 11 with FPlayer

use of me.totalfreedom.totalfreedommod.player.FPlayer 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 12 with FPlayer

use of me.totalfreedom.totalfreedommod.player.FPlayer 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 13 with FPlayer

use of me.totalfreedom.totalfreedommod.player.FPlayer 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 14 with FPlayer

use of me.totalfreedom.totalfreedommod.player.FPlayer 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)

Example 15 with FPlayer

use of me.totalfreedom.totalfreedommod.player.FPlayer in project TotalFreedomMod by TotalFreedom.

the class Cager method onBreakBlock.

@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBreakBlock(BlockBreakEvent event) {
    Player player = event.getPlayer();
    if (player == null || plugin.al.isAdmin(player)) {
        return;
    }
    FPlayer fPlayer = plugin.pl.getPlayer(event.getPlayer());
    CageData cage = fPlayer.getCageData();
    if (cage.isCaged()) {
        event.setCancelled(true);
    }
}
Also used : FPlayer(me.totalfreedom.totalfreedommod.player.FPlayer) FPlayer(me.totalfreedom.totalfreedommod.player.FPlayer) Player(org.bukkit.entity.Player) EventHandler(org.bukkit.event.EventHandler)

Aggregations

FPlayer (me.totalfreedom.totalfreedommod.player.FPlayer)31 Player (org.bukkit.entity.Player)20 EventHandler (org.bukkit.event.EventHandler)15 Location (org.bukkit.Location)6 Vector (org.bukkit.util.Vector)3 ItemStack (org.bukkit.inventory.ItemStack)2 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Admin (me.totalfreedom.totalfreedommod.admin.Admin)1 Material (org.bukkit.Material)1 Sound (org.bukkit.Sound)1 Block (org.bukkit.block.Block)1 Command (org.bukkit.command.Command)1 EntityType (org.bukkit.entity.EntityType)1 LivingEntity (org.bukkit.entity.LivingEntity)1 TNTPrimed (org.bukkit.entity.TNTPrimed)1 PotionEffect (org.bukkit.potion.PotionEffect)1