mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-02 20:11:44 +00:00
Try to unify player matching for hidden users:
kill, lightning and ptime still need cleanup
This commit is contained in:
parent
1d6ac42311
commit
8f6c61fa99
13 changed files with 119 additions and 81 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.util.List;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -28,7 +29,8 @@ public class Commandkill extends EssentialsCommand
|
|||
throw new NotEnoughArgumentsException("You need to specify a player to kill.");
|
||||
}
|
||||
|
||||
for (Player matchPlayer : server.matchPlayer(args[0]))
|
||||
final List<Player> matchedPlayers = server.matchPlayer(args[0]);
|
||||
for (Player matchPlayer : matchedPlayers)
|
||||
{
|
||||
final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE);
|
||||
server.getPluginManager().callEvent(ede);
|
||||
|
@ -36,9 +38,8 @@ public class Commandkill extends EssentialsCommand
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
matchPlayer.damage(Short.MAX_VALUE);
|
||||
|
||||
|
||||
if (matchPlayer.getHealth() > 0)
|
||||
{
|
||||
matchPlayer.setHealth(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue