package com.awesomeman.xtrapunish.punish;

import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.spec.CommandExecutor;
import org.spongepowered.api.entity.living.player.Player;

/**
 * Spawns tnt that will instantly explode on the player's location.
 */
public class PlayerExplode implements CommandExecutor {
    
    public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
        Player player = args.<Player>getOne("player").get();
        return CommandResult.success();
    }
}

@@ -36,16 +36,44 @@
 unish;%0A%0A
+import java.util.Optional;%0A%0A
 import o
@@ -380,327 +380,1053 @@
 ity.
-living.player.Player;%0A%0A/**%0A * Spawns tnt that will instantly explode on the player's location.%0A */%0Apublic class PlayerExplode implements CommandExecutor %7B%0A    %0A    public CommandResult execute(CommandSource src, CommandContext args) throws CommandException %7B%0A        Player player = args.%3CPlayer%3EgetOne(%22player%22).get();
+Entity;%0Aimport org.spongepowered.api.entity.EntityTypes;%0Aimport org.spongepowered.api.entity.explosive.PrimedTNT;%0Aimport org.spongepowered.api.entity.living.player.Player;%0Aimport org.spongepowered.api.event.cause.Cause;%0Aimport org.spongepowered.api.event.cause.NamedCause;%0Aimport org.spongepowered.api.world.extent.Extent;%0A%0A/**%0A * Spawns tnt that will instantly explode on the player's location.%0A */%0Apublic class PlayerExplode implements CommandExecutor %7B%0A    %0A    public CommandResult execute(CommandSource src, CommandContext args) throws CommandException %7B%0A        Player player = args.%3CPlayer%3EgetOne(%22player%22).get();%0A        Extent extent = player.getLocation().getExtent();%0A        Optional%3CEntity%3E optional = extent.createEntity(EntityTypes.PRIMED_TNT, player.getLocation().getPosition());%0A        if(optional.isPresent()) %7B%0A            PrimedTNT tnt = (PrimedTNT) optional.get();%0A            // Temporary, update when spawncause is in api and impl%0A            extent.spawnEntity(tnt, Cause.of(NamedCause.of(%22Explosion%22, this)));%0A        %7D
 %0A   

Implement PlayerExplode