generated from Slimefun/Addon-Template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0424fc
commit d2d14cd
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/me/gallowsdove/foxymachines/commands/KillallCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package me.gallowsdove.foxymachines.commands; | ||
|
||
import io.github.mooy1.infinitylib.commands.AbstractCommand; | ||
import me.gallowsdove.foxymachines.abstracts.CustomMob; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.LivingEntity; | ||
import org.bukkit.entity.Player; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.List; | ||
|
||
public class KillallCommand extends AbstractCommand { | ||
public KillallCommand() { | ||
super("killall", "Kills all Custom Mobs from FoxyMachines.", "foxymachines.admin"); | ||
} | ||
|
||
@Override | ||
public void onExecute(@Nonnull CommandSender commandSender, @Nonnull String[] strings) { | ||
if (!(commandSender instanceof Player) || strings.length != 1) { | ||
return; | ||
} | ||
|
||
Player p = (Player) commandSender; | ||
|
||
for (LivingEntity entity : p.getWorld().getLivingEntities()) { | ||
CustomMob mob = CustomMob.getByEntity(entity); | ||
if (mob != null) { | ||
entity.remove(); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onTab(@Nonnull CommandSender commandSender, @Nonnull String[] strings, @Nonnull List<String> list) { } | ||
} |