Showing Dropping Anvil Something (Ignore)
This commit is contained in:
@@ -9,42 +9,42 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CmdNear extends FCommand {
|
||||
public CmdNear() {
|
||||
super();
|
||||
this.aliases.add("near");
|
||||
this.aliases.add("nearby");
|
||||
public CmdNear() {
|
||||
super();
|
||||
this.aliases.add("near");
|
||||
this.aliases.add("nearby");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.NEAR)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
.build();
|
||||
}
|
||||
this.requirements = new CommandRequirements.Builder(Permission.NEAR)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fnear.Enabled")) {
|
||||
context.msg(TL.COMMAND_NEAR_DISABLED_MSG);
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fnear.Enabled")) {
|
||||
context.msg(TL.COMMAND_NEAR_DISABLED_MSG);
|
||||
return;
|
||||
}
|
||||
|
||||
double range = FactionsPlugin.getInstance().getConfig().getInt("fnear.Radius");
|
||||
String format = TL.COMMAND_NEAR_FORMAT.toString();
|
||||
context.msg(TL.COMMAND_NEAR_USE_MSG);
|
||||
for (Entity e : context.player.getNearbyEntities(range, 255, range)) {
|
||||
if (e instanceof Player) {
|
||||
Player player = (((Player) e).getPlayer());
|
||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
||||
if (context.faction == fplayer.getFaction()) {
|
||||
double distance = context.player.getLocation().distance(player.getLocation());
|
||||
context.sendMessage(format.replace("{playername}", player.getDisplayName()).replace("{distance}", (int) distance + ""));
|
||||
}
|
||||
}
|
||||
double range = FactionsPlugin.getInstance().getConfig().getInt("fnear.Radius");
|
||||
String format = TL.COMMAND_NEAR_FORMAT.toString();
|
||||
context.msg(TL.COMMAND_NEAR_USE_MSG);
|
||||
for (Entity e : context.player.getNearbyEntities(range, 255, range)) {
|
||||
if (e instanceof Player) {
|
||||
Player player = (((Player) e).getPlayer());
|
||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
||||
if (context.faction == fplayer.getFaction()) {
|
||||
double distance = context.player.getLocation().distance(player.getLocation());
|
||||
context.sendMessage(format.replace("{playername}", player.getDisplayName()).replace("{distance}", (int) distance + ""));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_NEAR_DESCRIPTION;
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_NEAR_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user