mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Add files via upload
This commit is contained in:
parent
212b367c3c
commit
e1ac92b784
@ -0,0 +1,55 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import java.text.DecimalFormat;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DropMonitor extends FreedomService
|
||||
{
|
||||
|
||||
DecimalFormat df;
|
||||
|
||||
public DropMonitor(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
this.df = new DecimalFormat("#");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
public String GetMaterial(final int id)
|
||||
{
|
||||
return String.valueOf(Material.getMaterial(id));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerItemDrop(final PlayerDropItemEvent event)
|
||||
{
|
||||
if (plugin.al.isAdmin(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
final int dropeditem = event.getItemDrop().getItemStack().getTypeId();
|
||||
final Location loc = event.getPlayer().getLocation();
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isAdmin(player) && plugin.pl.getPlayer(player).DropMonitorEnabled())
|
||||
{
|
||||
FUtil.playerMsg(player, event.getPlayer().getName() + " dropped " + event.getItemDrop().getItemStack().getAmount() + " " + this.GetMaterial(dropeditem) + " at [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
public class EditBlocker extends FreedomService
|
||||
{
|
||||
|
||||
public EditBlocker(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void BlockPlaceEvent(BlockPlaceEvent event)
|
||||
{
|
||||
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
||||
if (!fPlayer.isEditBlock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.al.isAdminSync(event.getPlayer()))
|
||||
{
|
||||
fPlayer.setEditBlocked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
FSync.playerMsg(event.getPlayer(), ChatColor.RED + "Your ability to place blocks has been disabled!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void BlockBreakEvent(BlockBreakEvent event)
|
||||
{
|
||||
FPlayer fPlayer = plugin.pl.getPlayerSync(event.getPlayer());
|
||||
if (!fPlayer.isEditBlock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.al.isAdminSync(event.getPlayer()))
|
||||
{
|
||||
fPlayer.setEditBlocked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
FSync.playerMsg(event.getPlayer(), ChatColor.RED + "Your ability to destroy blocks has been disabled!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.entity.LingeringPotionSplashEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.PotionSplashEvent;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
public class PotionMonitorer extends FreedomService
|
||||
{
|
||||
|
||||
DecimalFormat df;
|
||||
|
||||
public PotionMonitorer(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
this.df = new DecimalFormat("#");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
public String GetMaterial(final int id)
|
||||
{
|
||||
return String.valueOf(Material.getMaterial(id));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void LingeringPotionSplashEvent(LingeringPotionSplashEvent event)
|
||||
{
|
||||
ProjectileSource source = event.getEntity().getShooter();
|
||||
|
||||
if (!(source instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Player player = (Player) source;
|
||||
|
||||
if (plugin.al.isAdmin((Player) event.getEntity().getShooter()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
final int dropeditem = event.getEntity().getItem().getTypeId();
|
||||
final Location loc = player.getLocation();
|
||||
|
||||
for (Player player2 : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isAdmin(player2) && plugin.pl.getPlayer(player2).PotionMonitorEnabled())
|
||||
{
|
||||
FUtil.playerMsg(player2, player.getName() + " Splashed " + event.getEntity().getItem().getAmount() + " " + this.GetMaterial(dropeditem) + " at [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void PotionSplashEvent(PotionSplashEvent event)
|
||||
{
|
||||
ProjectileSource source = event.getEntity().getShooter();
|
||||
|
||||
if (!(source instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Player player = (Player) source;
|
||||
|
||||
if (plugin.al.isAdmin((Player) event.getEntity().getShooter()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
final int dropeditem = event.getPotion().getItem().getTypeId();
|
||||
final Location loc = player.getLocation();
|
||||
|
||||
for (Player player2 : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isAdmin(player2) && plugin.pl.getPlayer(player2).PotionMonitorEnabled())
|
||||
{
|
||||
FUtil.playerMsg(player2, player.getName() + " Splashed " + event.getPotion().getItem().getAmount() + " " + this.GetMaterial(dropeditem) + " at [" + this.df.format(loc.getX()) + ", " + this.df.format(loc.getY()) + ", " + this.df.format(loc.getZ()) + "] at the world '" + loc.getWorld().getName() + "'.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
public class PvPBlocker extends FreedomService
|
||||
{
|
||||
|
||||
public PvPBlocker(TotalFreedomMod plugin)
|
||||
{
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void EntityDamageByEntityEvent(EntityDamageByEntityEvent event)
|
||||
{
|
||||
Entity damager = event.getDamager();
|
||||
FPlayer fPlayer = null;
|
||||
if (damager instanceof Player)
|
||||
{
|
||||
fPlayer = plugin.pl.getPlayerSync((Player) damager);
|
||||
}
|
||||
|
||||
if (damager instanceof Projectile)
|
||||
{
|
||||
ProjectileSource ps = ((Projectile) damager).getShooter();
|
||||
if (ps instanceof Player)
|
||||
{
|
||||
fPlayer = plugin.pl.getPlayerSync((Player) ps);
|
||||
}
|
||||
}
|
||||
|
||||
if (fPlayer == null || !fPlayer.isPVPBlock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.al.isAdminSync(event.getDamager()))
|
||||
{
|
||||
fPlayer.setPVPBlock(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) damager;
|
||||
event.setCancelled(true);
|
||||
FSync.playerMsg(player, ChatColor.RED + "You have been disallowed from PvPing!");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user