TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_sit.java

35 lines
1.3 KiB
Java
Raw Normal View History

2020-07-16 04:06:58 +00:00
package me.totalfreedom.totalfreedommod.command;
import java.util.ArrayList;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Sit at the current place you are at.", usage = "/<command>")
public class Command_sit extends FreedomCommand
{
public static List<ArmorStand> STANDS = new ArrayList<>();
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
{
if (args.length != 0)
{
return false;
}
ArmorStand stand = (ArmorStand)playerSender.getWorld().spawnEntity(playerSender.getLocation().clone().subtract(0.0, 1.7, 0.0), EntityType.ARMOR_STAND);
2020-07-16 04:06:58 +00:00
stand.setGravity(false);
stand.setAI(false);
stand.setVisible(false);
stand.setInvulnerable(true);
stand.addPassenger(playerSender);
STANDS.add(stand);
msg("You are now sitting.");
return true;
}
}