mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-21 14:03:54 +02:00
Fix /lightning <player> <damage> to actually deal the proper set damage (5 or 25% by default).
This commit is contained in:
@@ -23,19 +23,19 @@ public class Commandlightning extends EssentialsCommand
|
|||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
user = ess.getUser(((Player)sender));
|
user = ess.getUser(((Player)sender));
|
||||||
}
|
if ((args.length < 1 || user != null && !user.isAuthorized("essentials.lightning.others")))
|
||||||
if ((args.length < 1 || !user.isAuthorized("essentials.lightning.others")) & user != null)
|
|
||||||
{
|
{
|
||||||
user.getWorld().strikeLightning(user.getTargetBlock(null, 600).getLocation());
|
user.getWorld().strikeLightning(user.getTargetBlock(null, 600).getLocation());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (server.matchPlayer(args[0]).isEmpty())
|
if (server.matchPlayer(args[0]).isEmpty())
|
||||||
{
|
{
|
||||||
throw new Exception(_("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int power = 1;
|
int power = 5;
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -50,18 +50,12 @@ public class Commandlightning extends EssentialsCommand
|
|||||||
for (Player matchPlayer : server.matchPlayer(args[0]))
|
for (Player matchPlayer : server.matchPlayer(args[0]))
|
||||||
{
|
{
|
||||||
sender.sendMessage(_("lightningUse", matchPlayer.getDisplayName()));
|
sender.sendMessage(_("lightningUse", matchPlayer.getDisplayName()));
|
||||||
if (power <= 0)
|
|
||||||
{
|
final LightningStrike strike = matchPlayer.getWorld().strikeLightningEffect(matchPlayer.getLocation());
|
||||||
matchPlayer.getWorld().strikeLightningEffect(matchPlayer.getLocation());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LightningStrike strike = matchPlayer.getWorld().strikeLightning(matchPlayer.getLocation());
|
|
||||||
matchPlayer.damage(power - 1, strike);
|
|
||||||
}
|
|
||||||
if (!ess.getUser(matchPlayer).isGodModeEnabled())
|
if (!ess.getUser(matchPlayer).isGodModeEnabled())
|
||||||
{
|
{
|
||||||
matchPlayer.setHealth(matchPlayer.getHealth() < 5 ? 0 : matchPlayer.getHealth() - 5);
|
matchPlayer.damage(power, strike);
|
||||||
}
|
}
|
||||||
if (ess.getSettings().warnOnSmite())
|
if (ess.getSettings().warnOnSmite())
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user