package com.endercrest.voidspawn.modes;

import com.endercrest.voidspawn.ConfigManager;
import com.endercrest.voidspawn.VoidSpawn;
import org.bukkit.entity.Player;

public class Command implements SubMode {

    @Override
    public boolean onActivate(Player player, String worldName){
        player.setFallDistance(0);
        String commandString = ConfigManager.getInstance().getString(worldName + ".command");
        String[] commands = commandString.split(";");
        boolean success = true;
        for(String command : commands){
            boolean b = player.performCommand(command.trim());
            if(!b)
                success = false;
        }
        if(!success){
            player.sendMessage(VoidSpawn.colorize(VoidSpawn.prefix + "&cContact Admin. Command failed."));
        }
        return success;
    }

    @Override
    public boolean onSet(String[] args, String worldName, Player p){
        ConfigManager.getInstance().setMode(worldName, args[1]);
        return true;
    }

    @Override
    public String getHelp(){
        return "&6Command &f- Uses configurable command(s) to send player to spawn";
    }
}
@@ -124,16 +124,42 @@
 dSpawn;%0A
+import org.bukkit.Bukkit;%0A
 import o
@@ -183,16 +183,16 @@
 Player;%0A
-
 %0Apublic 
@@ -576,17 +576,445 @@
     
-boolean b
+command = command.replace(%22$%7Bplayername%7D%22, player.getName());%0A            boolean status;%0A%0A            String%5B%5D perms = command.split(%22:%22, 2);%0A            //Check if cmd needs to be ran as OP/Console%0A            if(perms.length %3E 1 && perms%5B0%5D.equalsIgnoreCase(%22op%22))%7B%0A                String cmd = perms%5B1%5D;%0A                status = Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd.trim());%0A            %7Delse%7B%0A                status
  = p
@@ -1067,13 +1067,33 @@
     
-if(!b
+%7D%0A%0A            if(!status
 )%0A  

Add playername variable