mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-01-03 22:37:41 +01:00
The Spawn command will now spawn at the location you are looking at.
This commit is contained in:
parent
a362804bde
commit
af10fcb026
@ -4,6 +4,9 @@ import com.songoda.core.commands.AbstractCommand;
|
|||||||
import com.songoda.ultimatestacker.UltimateStacker;
|
import com.songoda.ultimatestacker.UltimateStacker;
|
||||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||||
import com.songoda.ultimatestacker.utils.Methods;
|
import com.songoda.ultimatestacker.utils.Methods;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -12,6 +15,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +34,7 @@ public class CommandSpawn extends AbstractCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||||
Player p = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (args.length < 2) return ReturnType.SYNTAX_ERROR;
|
if (args.length < 2) return ReturnType.SYNTAX_ERROR;
|
||||||
|
|
||||||
@ -52,9 +56,11 @@ public class CommandSpawn extends AbstractCommand {
|
|||||||
}
|
}
|
||||||
sender.sendMessage(Methods.formatText("&6" + list));
|
sender.sendMessage(Methods.formatText("&6" + list));
|
||||||
} else {
|
} else {
|
||||||
Entity entity = p.getWorld().spawnEntity(p.getLocation(), type);
|
LivingEntity entity = (LivingEntity)player.getWorld().spawnEntity(player.getTargetBlock((Set<Material>)null, 200).getLocation(), type);
|
||||||
EntityStack stack = instance.getEntityStackManager().addStack(entity.getUniqueId(), (Methods.isInt(args[1])) ? Integer.parseInt(args[1]) : 1);
|
EntityStack stack = instance.getEntityStackManager().addStack(entity);
|
||||||
instance.getStackingTask().attemptSplit(stack, (LivingEntity) entity);
|
stack.createDuplicates(((Methods.isInt(args[1])) ? Integer.parseInt(args[1]) : 1) - 1);
|
||||||
|
stack.updateStack();
|
||||||
|
instance.getStackingTask().attemptSplit(stack, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ReturnType.SUCCESS;
|
return ReturnType.SUCCESS;
|
||||||
|
Loading…
Reference in New Issue
Block a user