mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-15 05:33:40 +00:00
[trunk] lightning <playername> from the console
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1336 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
d31466253f
commit
a61c1591e8
1 changed files with 18 additions and 11 deletions
|
@ -4,6 +4,7 @@ import com.earth2me.essentials.Essentials;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,32 +16,38 @@ public class Commandlightning extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
World world = user.getWorld();
|
User user = null;
|
||||||
if (args.length < 1)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
world.strikeLightning(user.getTargetBlock(null, 600).getLocation());
|
user = ess.getUser(((Player)sender));
|
||||||
|
}
|
||||||
|
if (args.length < 1 & user != null)
|
||||||
|
{
|
||||||
|
user.getWorld().strikeLightning(user.getTargetBlock(null, 600).getLocation());
|
||||||
|
user.charge(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.matchPlayer(args[0]).isEmpty())
|
if (server.matchPlayer(args[0]).isEmpty())
|
||||||
{
|
{
|
||||||
user.sendMessage("§cPlayer not found");
|
sender.sendMessage("§cPlayer not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player p : server.matchPlayer(args[0]))
|
for (Player p : server.matchPlayer(args[0]))
|
||||||
{
|
{
|
||||||
user.sendMessage("§7Smiting " + p.getDisplayName());
|
sender.sendMessage("§7Smiting " + p.getDisplayName());
|
||||||
world.strikeLightning(p.getLocation());
|
p.getWorld().strikeLightning(p.getLocation());
|
||||||
p.setHealth(p.getHealth() < 5 ? 0 : p.getHealth() - 5);
|
p.setHealth(p.getHealth() < 5 ? 0 : p.getHealth() - 5);
|
||||||
if (ess.getSettings().warnOnSmite())
|
if (ess.getSettings().warnOnSmite())
|
||||||
{
|
{
|
||||||
p.sendMessage("§7You have just been smited");
|
p.sendMessage("§7You have just been smited");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (user != null)
|
||||||
user.charge(this);
|
user.charge(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue