From c769f98c8a639679f3d119924886a85aa20aade6 Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Sun, 25 Sep 2011 22:24:54 -0400 Subject: [PATCH] Added tnt yield config. Added location to radar. Changed /rd worldedit shortcut. TODO: Detect if worldedit is enabled first. --- .../StevenLawson/TotalFreedomMod/RadarData.java | 5 ++++- .../TotalFreedomMod/TotalFreedomMod.java | 15 +++++++-------- .../TotalFreedomModEntityListener.java | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/me/StevenLawson/TotalFreedomMod/RadarData.java b/src/me/StevenLawson/TotalFreedomMod/RadarData.java index 007371d..1d82265 100644 --- a/src/me/StevenLawson/TotalFreedomMod/RadarData.java +++ b/src/me/StevenLawson/TotalFreedomMod/RadarData.java @@ -1,17 +1,20 @@ package me.StevenLawson.TotalFreedomMod; import java.util.Comparator; +import org.bukkit.Location; import org.bukkit.entity.Player; public class RadarData implements Comparator { Player player; double distance; + Location location; - public RadarData(Player inplayer, double indistance) + public RadarData(Player inplayer, double indistance, Location inlocation) { this.player = inplayer; this.distance = indistance; + this.location = inlocation; } public RadarData() diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java index 47e6b56..c717d84 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java @@ -29,7 +29,7 @@ public class TotalFreedomMod extends JavaPlugin public Boolean allowExplosions = false; public Boolean allowLavaDamage = false; public Boolean allowFire = false; - public double explosiveRadius = 1.0; + public double explosiveRadius = 2.0; public final static String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command."; public final static String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!"; public final static String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!"; @@ -518,8 +518,7 @@ public class TotalFreedomMod extends JavaPlugin if (args[0].equalsIgnoreCase("on")) { this.allowExplosions = true; - //sender.sendMessage("Explosives are now enabled, radius set to " + explosiveRadius + " blocks."); - sender.sendMessage("Explosives are now enabled."); + sender.sendMessage("Explosives are now enabled, radius set to " + explosiveRadius + " blocks."); } else { @@ -606,7 +605,7 @@ public class TotalFreedomMod extends JavaPlugin { if (sender_world.equals(p.getWorld().getName()) && !p.getName().equals(sender.getName())) { - radar_data.add(new RadarData(p, sender_pos.distance(p.getLocation()))); + radar_data.add(new RadarData(p, sender_pos.distance(p.getLocation()), p.getLocation())); } } @@ -628,7 +627,7 @@ public class TotalFreedomMod extends JavaPlugin break; } - sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d", i.player.getName(), Math.round(i.distance))); + sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d blocks away @ ", i.player.getName(), Math.round(i.distance), formatLocation(i.location))); } return true; @@ -643,11 +642,11 @@ public class TotalFreedomMod extends JavaPlugin if (sender.isOp()) { - sender.sendMessage(ChatColor.GRAY + "Using WorldEdit to remove all entity drops."); + sender.sendMessage(ChatColor.GRAY + "Using WorldEdit to remove all dropped items, arrows, and TNT."); - Bukkit.getServer().dispatchCommand(sender, "remove arrows -1"); Bukkit.getServer().dispatchCommand(sender, "remove items -1"); - Bukkit.getServer().dispatchCommand(sender, "remove drops -1"); + Bukkit.getServer().dispatchCommand(sender, "remove arrows -1"); + Bukkit.getServer().dispatchCommand(sender, "remove tnt -1"); } else { diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModEntityListener.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModEntityListener.java index b919706..0eb8d12 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModEntityListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModEntityListener.java @@ -23,8 +23,8 @@ public class TotalFreedomModEntityListener extends EntityListener event.setCancelled(true); return; } - - //event.setYield((float)plugin.explosiveRadius); + + event.setYield((float)plugin.explosiveRadius); } @Override