mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Misc
This commit is contained in:
parent
f84f10a7ad
commit
45cc2e8c47
@ -48,19 +48,16 @@ public class Command_expel extends TFM_Command
|
||||
}
|
||||
|
||||
Location sender_pos = sender_p.getLocation();
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : sender_pos.getWorld().getPlayers())
|
||||
{
|
||||
if (!p.equals(sender_p))
|
||||
{
|
||||
Location target_pos = p.getLocation();
|
||||
if (target_pos.getWorld().equals(sender_pos.getWorld()))
|
||||
if (target_pos.distance(sender_pos) < radius)
|
||||
{
|
||||
if (target_pos.distance(sender_pos) < radius)
|
||||
{
|
||||
sender.sendMessage("Pushing " + p.getName());
|
||||
Vector expel_direction = target_pos.subtract(sender_pos).toVector().normalize();
|
||||
p.setVelocity(expel_direction.multiply(strength));
|
||||
}
|
||||
sender.sendMessage("Pushing " + p.getName());
|
||||
Vector expel_direction = target_pos.subtract(sender_pos).toVector().normalize();
|
||||
p.setVelocity(expel_direction.multiply(strength));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,23 +24,27 @@ public class Command_radar extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
Player sender_player = Bukkit.getPlayerExact(sender.getName());
|
||||
Location sender_pos = sender_player.getLocation();
|
||||
String sender_world = sender_player.getWorld().getName();
|
||||
Location sender_pos = sender_p.getLocation();
|
||||
|
||||
List<TFM_RadarData> radar_data = new ArrayList<TFM_RadarData>();
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
for (Player p : sender_pos.getWorld().getPlayers())
|
||||
{
|
||||
if (sender_world.equals(p.getWorld().getName()) && !p.getName().equals(sender.getName()))
|
||||
if (!p.equals(sender_p))
|
||||
{
|
||||
radar_data.add(new TFM_RadarData(p, sender_pos.distance(p.getLocation()), p.getLocation()));
|
||||
}
|
||||
}
|
||||
|
||||
if (radar_data.isEmpty())
|
||||
{
|
||||
sender.sendMessage(ChatColor.YELLOW + "You are the only player in this world. (Forever alone...)");
|
||||
return true;
|
||||
}
|
||||
|
||||
Collections.sort(radar_data, new TFM_RadarData());
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW + "People nearby in " + sender_world + ":");
|
||||
sender.sendMessage(ChatColor.YELLOW + "People nearby in " + sender_pos.getWorld().getName() + ":");
|
||||
|
||||
int countmax = 5;
|
||||
if (args.length == 1)
|
||||
@ -54,18 +58,17 @@ public class Command_radar extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (TFM_RadarData i : radar_data)
|
||||
{
|
||||
if (count++ > countmax)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.YELLOW + String.format("%s - %d, Disguised: %s",
|
||||
i.player.getName(),
|
||||
Math.round(i.distance),
|
||||
MobDisguiseAPI.isDisguised(i.player) ? "Yes" : "No"));
|
||||
|
||||
if (--countmax <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -5,6 +5,7 @@ import java.util.regex.Pattern;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -114,7 +115,17 @@ public class TFM_PlayerListener extends PlayerListener
|
||||
{
|
||||
Location target_pos = p.getLocation().add(0, 1, 0);
|
||||
|
||||
if (target_pos.distance(playerdata.getCagePos()) > 2.5)
|
||||
boolean out_of_cage = false;
|
||||
if (!target_pos.getWorld().equals(playerdata.getCagePos().getWorld()))
|
||||
{
|
||||
out_of_cage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
out_of_cage = target_pos.distance(playerdata.getCagePos()) > 2.5;
|
||||
}
|
||||
|
||||
if (out_of_cage)
|
||||
{
|
||||
playerdata.setCaged(true, target_pos, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER), playerdata.getCageMaterial(TFM_UserInfo.CageLayer.OUTER));
|
||||
playerdata.regenerateHistory();
|
||||
@ -146,6 +157,7 @@ public class TFM_PlayerListener extends PlayerListener
|
||||
{
|
||||
p.setOp(false);
|
||||
p.kickPlayer("No Spamming");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("tempban %s 1m", p.getName()));
|
||||
TFM_Util.tfm_broadcastMessage(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
|
||||
playerdata.resetMsgCount();
|
||||
|
||||
|
@ -10,11 +10,11 @@ public class TFM_RadarData implements Comparator<TFM_RadarData>
|
||||
public double distance;
|
||||
public Location location;
|
||||
|
||||
public TFM_RadarData(Player inplayer, double indistance, Location inlocation)
|
||||
public TFM_RadarData(Player player, double distance, Location location)
|
||||
{
|
||||
this.player = inplayer;
|
||||
this.distance = indistance;
|
||||
this.location = inlocation;
|
||||
this.player = player;
|
||||
this.distance = distance;
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public TFM_RadarData()
|
||||
|
Loading…
Reference in New Issue
Block a user