Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.byGinoGames44.Comandos;
- import java.io.File;
- import java.io.IOException;
- import me.byGinoGames44.MultiSets;
- import net.md_5.bungee.api.ChatColor;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- import org.bukkit.World;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.InvalidConfigurationException;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.entity.Player;
- import static org.spigotmc.SpigotConfig.config;
- public class spawn implements CommandExecutor {
- public spawn(MultiSets main) {
- File configyml = new File("plugins/MultiSets", "config.yml");
- FileConfiguration config = org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(configyml);
- }
- /**
- *
- * @param spawn
- * @param cmd
- * @param label
- * @param args
- * @return
- */
- @Override
- public boolean onCommand(CommandSender spawn, Command cmd, String label, String[] args) {
- if (cmd.getName().equalsIgnoreCase("spawn"))
- {
- if (!spawn.hasPermission("ms.user"))
- {
- Player p = (Player)spawn;
- p.sendMessage(ChatColor.GREEN + "No tienes permiso para ejecutar este comando!");
- }
- if (spawn.hasPermission("ms.user"))
- {
- Player p = (Player)spawn;
- World w = Bukkit.getServer().getWorld(config.getString("world"));
- double x = config.getDouble("x");
- double y = config.getDouble("y");
- double z = config.getDouble("z");
- Location Spawn = new Location(w, x, y, z);
- Spawn.setPitch((float)config.getDouble("pitch"));
- Spawn.setYaw((float)config.getDouble("yaw"));
- p.teleport(Spawn);
- p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString("&2Te as teletransportado al Spawn")));
- File configyml = null;
- try {
- config.save(configyml);
- } catch (IOException e) {
- }
- try {
- config.load(configyml);
- } catch (IOException e) {
- } catch (InvalidConfigurationException e) {
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement