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);
}
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!");
}
}
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();
}
}
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();
}
}
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);
}
}
Aggregations