use of me.totalfreedom.totalfreedommod.player.FPlayer in project TotalFreedomMod by TotalFreedom.
the class Command_mp44 method run.
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
if (!ConfigEntry.MP44_ENABLED.getBoolean()) {
msg("The mp44 is currently disabled.", ChatColor.GREEN);
return true;
}
if (args.length == 0) {
return false;
}
FPlayer playerdata = plugin.pl.getPlayer(playerSender);
if (args[0].equalsIgnoreCase("draw")) {
playerdata.armMP44();
msg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN);
msg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN);
playerSender.getEquipment().setItemInMainHand(new ItemStack(Material.SULPHUR, 1));
} else {
playerdata.disarmMP44();
sender.sendMessage(ChatColor.GREEN + "mp44 Disarmed.");
}
return true;
}
use of me.totalfreedom.totalfreedommod.player.FPlayer in project TotalFreedomMod by TotalFreedom.
the class Fuckoff method onPlayerMove.
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerMove(PlayerMoveEvent event) {
final Player fuckoffPlayer = event.getPlayer();
if (plugin.al.isAdmin(fuckoffPlayer)) {
return;
}
for (Player onlinePlayer : server.getOnlinePlayers()) {
final FPlayer fPlayer = plugin.pl.getPlayer(onlinePlayer);
if (!fPlayer.isFuckOff() || fuckoffPlayer.equals(onlinePlayer)) {
continue;
}
double fuckoffRange = fPlayer.getFuckoffRadius();
Location opLocation = onlinePlayer.getLocation();
Location foLocation = fuckoffPlayer.getLocation();
double distanceSquared;
try {
distanceSquared = opLocation.distanceSquared(foLocation);
} catch (IllegalArgumentException ex) {
continue;
}
if (distanceSquared < (fuckoffRange * fuckoffRange)) {
event.setTo(foLocation.clone().add(opLocation.subtract(foLocation).toVector().normalize().multiply(fuckoffRange * 1.1)));
break;
}
}
}
use of me.totalfreedom.totalfreedommod.player.FPlayer in project TotalFreedomMod by TotalFreedom.
the class AntiNuke method onBlockBreak.
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
if (!ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean()) {
return;
}
final Player player = event.getPlayer();
final Location location = event.getBlock().getLocation();
final FPlayer fPlayer = plugin.pl.getPlayer(player);
final Location playerLocation = player.getLocation();
final double nukeMonitorRange = ConfigEntry.NUKE_MONITOR_RANGE.getDouble();
boolean outOfRange = false;
if (!playerLocation.getWorld().equals(location.getWorld())) {
outOfRange = true;
} else if (playerLocation.distanceSquared(location) > (nukeMonitorRange * nukeMonitorRange)) {
outOfRange = true;
}
if (outOfRange) {
if (fPlayer.incrementAndGetFreecamDestroyCount() > ConfigEntry.FREECAM_TRIGGER_COUNT.getInteger()) {
FUtil.bcastMsg(player.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
plugin.ae.autoEject(player, "Freecam (extended range) block breaking is not permitted on this server.");
fPlayer.resetFreecamDestroyCount();
event.setCancelled(true);
return;
}
}
if (fPlayer.incrementAndGetBlockDestroyCount() > ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger()) {
FUtil.bcastMsg(player.getName() + " is breaking blocks too fast!", ChatColor.RED);
plugin.ae.autoEject(player, "You are breaking blocks too fast. Nukers are not permitted on this server.");
fPlayer.resetBlockDestroyCount();
event.setCancelled(true);
return;
}
}
use of me.totalfreedom.totalfreedommod.player.FPlayer in project TotalFreedomMod by TotalFreedom.
the class AntiSpam method onAsyncPlayerChat.
@EventHandler(priority = EventPriority.LOW)
public void onAsyncPlayerChat(AsyncPlayerChatEvent event) {
final Player player = event.getPlayer();
String message = event.getMessage().trim();
final FPlayer playerdata = plugin.pl.getPlayerSync(player);
// Check for spam
if (playerdata.incrementAndGetMsgCount() > MSG_PER_CYCLE) {
FSync.bcastMsg(player.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
FSync.autoEject(player, "Kicked for spamming chat.");
playerdata.resetMsgCount();
event.setCancelled(true);
return;
}
// Check for message repeat
if (playerdata.getLastMessage().equalsIgnoreCase(message)) {
FSync.playerMsg(player, "Please do not repeat messages.");
event.setCancelled(true);
return;
}
playerdata.setLastMessage(message);
}
use of me.totalfreedom.totalfreedommod.player.FPlayer in project TotalFreedomMod by TotalFreedom.
the class AntiSpam method cycle.
private void cycle() {
for (Player player : server.getOnlinePlayers()) {
final FPlayer playerdata = plugin.pl.getPlayer(player);
// TODO: Move each to their own section
playerdata.resetMsgCount();
playerdata.resetBlockDestroyCount();
playerdata.resetBlockPlaceCount();
}
}
Aggregations