Ir para conteúdo
  • 0

[Resolvido] Comandos


Guest Gabriel Alves

Pergunta

Guest Gabriel Alves
Postado

aulguem pode me ajudar 

queria saber como fazer para

/setwarp

 

e ae a pessoa vai para la qual e o codigo

12 respostass a esta questão

Posts Recomendados

Guest » MickCraft » xKizame »
Postado

Outro SrGames da vida

Postado

Você já tem algum código planejado?!!

Não fique esperando, tudo pronto na mão... Começa um código ae, que nós vamos lhe dando suporte.

Guest » MickCraft «
Postado

Um SrGames da vida -.- já faço pera..

Guest Healthay
Postado

Um SrGames da vida -.- já faço pera..

Você que é o SrGames O/o

Guest Gabriel Alves
Postado

Um SrGames da vida -.- já faço pera..

 SrGames ?

 

 

 

Você já tem algum código planejado?!!

Não fique esperando, tudo pronto na mão... Começa um código ae, que nós vamos lhe dando suporte.

 

kkk nao sei new comecar estou tentando com oque me derem por inquanto

 

Um SrGames da vida -.- já faço pera..

 

eita

Guest » MickCraft «
Postado

 SrGames ?

 

 

 

 

kkk nao sei new comecar estou tentando com oque me derem por inquanto

 

 

eita

Não so SrGames carai -.-

Postado

 SrGames ?

 

 

 

 

kkk nao sei new comecar estou tentando com oque me derem por inquanto

 

 

eita

Só você tirar a base deste vídeo: Vídeo.

Postado (editado)

Peguei do meu plugin na parte do Lobby, só substitui para o que quiser.

 

 

 

package com.DevNaghtrion.Comando.Set;

import java.io.File;
import java.io.IOException;

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.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;

import com.DevNaghtrion.Main;

  public class SetLobby
  implements CommandExecutor {

  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    Player p = (Player)sender;

    File warps = new File(Main.plugin.getDataFolder(), "Warps.yml");
    FileConfiguration wr = YamlConfiguration.loadConfiguration(warps);

    if (cmd.getName().equalsIgnoreCase("setlobby")) {
     if (sender instanceof Player) {
      if ((sender.hasPermission("np.setwarp"))  || (sender.isOp()) || (sender.hasPermission("np.admin"))) {
          wr.set("Lobby.World", p.getWorld().getName());
          wr.set("Lobby.X", Double.valueOf(p.getLocation().getX()));
          wr.set("Lobby.Y", Double.valueOf(p.getLocation().getY()));
          wr.set("Lobby.Z", Double.valueOf(p.getLocation().getZ()));
          wr.set("Lobby.Yaw", Float.valueOf(p.getLocation().getYaw()));
          wr.set("Lobby.Pitch", Float.valueOf(p.getLocation().getPitch()));
          try {
            wr.save(warps);
          }
          catch (IOException e) {
            e.printStackTrace();
          }
          
          p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.Set").replace("&", "§"));
      }
      else {
        p.sendMessage(Main.plugin.getConfig().getString("PlayerSemPermissao").replace("&", "§").replace("{player}", sender.getName()));
        }
      }
      else {
        sender.sendMessage(Main.plugin.getConfig().getString("Mensagens.ErroConsole").replace("&", "§"));
       }

    }

    if (cmd.getName().equalsIgnoreCase("lobby")) {

      if (sender instanceof Player) {

            if (wr.getString("Lobby") == null) {
              p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.NaoEncontrado").replace("&", "§"));
              return true;
            }

            World w = Bukkit.getWorld(wr.getString("Lobby.World"));
            double x = wr.getDouble("Lobby.X");
            double y = wr.getDouble("Lobby.Y");
            double z = wr.getDouble("Lobby.Z");
            float yaw = (float)wr.getDouble("Lobby.Yaw");
            float pitch = (float)wr.getDouble("Lobby.Pitch");
            Location l = new Location(w, x, y, z);
            l.setYaw(yaw);
            l.setPitch(pitch);
            p.teleport(l);
            p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.Teleportado").replace("&", "§"));
      }
      else {
        sender.sendMessage(Main.plugin.getConfig().getString("Mensagens.ErroConsole").replace("&", "§"));
      }
    }

    if (cmd.getName().equalsIgnoreCase("dellobby")) {
      if (sender instanceof Player) {
        if ((sender.hasPermission("np.delwarp"))  || (sender.isOp()) || (sender.hasPermission("np.del")) || (sender.hasPermission("np.admin"))) {

            if (wr.getString("Lobby") == null) {
              p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.NaoEncontrado").replace("&", "§"));
              return true;
            }

            wr.set("Lobby", null);
            try {
              wr.save(warps);
            }
            catch (IOException e) {
              e.printStackTrace();
            }

            p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.Del").replace("&", "§"));
        }
        else {
          p.sendMessage(Main.plugin.getConfig().getString("PlayerSemPermissao").replace("&", "§").replace("{player}", sender.getName()));
        }
      }
      else {
        sender.sendMessage(Main.plugin.getConfig().getString("Mensagens.ErroConsole").replace("&", "§"));
      }
    }
    return false;
  }
}

 

 

 

config:

 

 

 

Warps:
  Lobby:
    Set: '&2Você setou o local do Lobby'
    Del: '&4Você deletou o local do Lobby'
    Teleportado: '&6Você foi teleportado para o Lobby'
    NaoEncontrado: '&cNão foi possivel encontrar o Lobby. Contate um Staffer.'

######

Mensagens:
  #Mensagem que aparece no console quando nao e possivel executar um comando.
  #Nao utilize acentuacao para o console.
  ErroConsole: '&4O Console nao pode executar este comando!'

#######

PlayerSemPermissao: '&b{player} &4Você nao tem Permissão para usar este comando!' 

 

 

 

Like ou Resolvido? 

 

@Edit 

Quote

 

aulguem pode me ajudar 

queria saber como fazer para

/setwarp

 

e ae a pessoa vai para la qual e o codigo

 
Editado por Mr Naghtrion
Guest Gabriel Alves
Postado

Peguei do meu plugin na parte do Lobby, só substitui para o que quiser.

 

 

 

package com.DevNaghtrion.Comando.Set;

import java.io.File;
import java.io.IOException;

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.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;

import com.DevNaghtrion.Main;

  public class SetLobby
  implements CommandExecutor {

  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    Player p = (Player)sender;

    File warps = new File(Main.plugin.getDataFolder(), "Warps.yml");
    FileConfiguration wr = YamlConfiguration.loadConfiguration(warps);

    if (cmd.getName().equalsIgnoreCase("setlobby")) {
     if (sender instanceof Player) {
      if ((sender.hasPermission("np.setwarp"))  || (sender.isOp()) || (sender.hasPermission("np.admin"))) {
          wr.set("Lobby.World", p.getWorld().getName());
          wr.set("Lobby.X", Double.valueOf(p.getLocation().getX()));
          wr.set("Lobby.Y", Double.valueOf(p.getLocation().getY()));
          wr.set("Lobby.Z", Double.valueOf(p.getLocation().getZ()));
          wr.set("Lobby.Yaw", Float.valueOf(p.getLocation().getYaw()));
          wr.set("Lobby.Pitch", Float.valueOf(p.getLocation().getPitch()));
          try {
            wr.save(warps);
          }
          catch (IOException e) {
            e.printStackTrace();
          }
          
          p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.Set").replace("&", "§"));
      }
      else {
        p.sendMessage(Main.plugin.getConfig().getString("PlayerSemPermissao").replace("&", "§").replace("{player}", sender.getName()));
        }
      }
      else {
        sender.sendMessage(Main.plugin.getConfig().getString("Mensagens.ErroConsole").replace("&", "§"));
       }

    }

    if (cmd.getName().equalsIgnoreCase("lobby")) {

      if (sender instanceof Player) {

            if (wr.getString("Lobby") == null) {
              p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.NaoEncontrado").replace("&", "§"));
              return true;
            }

            World w = Bukkit.getWorld(wr.getString("Lobby.World"));
            double x = wr.getDouble("Lobby.X");
            double y = wr.getDouble("Lobby.Y");
            double z = wr.getDouble("Lobby.Z");
            float yaw = (float)wr.getDouble("Lobby.Yaw");
            float pitch = (float)wr.getDouble("Lobby.Pitch");
            Location l = new Location(w, x, y, z);
            l.setYaw(yaw);
            l.setPitch(pitch);
            p.teleport(l);
            p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.Teleportado").replace("&", "§"));
      }
      else {
        sender.sendMessage(Main.plugin.getConfig().getString("Mensagens.ErroConsole").replace("&", "§"));
      }
    }

    if (cmd.getName().equalsIgnoreCase("dellobby")) {
      if (sender instanceof Player) {
        if ((sender.hasPermission("np.delwarp"))  || (sender.isOp()) || (sender.hasPermission("np.del")) || (sender.hasPermission("np.admin"))) {

            if (wr.getString("Lobby") == null) {
              p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.NaoEncontrado").replace("&", "§"));
              return true;
            }

            wr.set("Lobby", null);
            try {
              wr.save(warps);
            }
            catch (IOException e) {
              e.printStackTrace();
            }

            p.sendMessage(Main.plugin.getConfig().getString("Warps.Lobby.Del").replace("&", "§"));
        }
        else {
          p.sendMessage(Main.plugin.getConfig().getString("PlayerSemPermissao").replace("&", "§").replace("{player}", sender.getName()));
        }
      }
      else {
        sender.sendMessage(Main.plugin.getConfig().getString("Mensagens.ErroConsole").replace("&", "§"));
      }
    }
    return false;
  }
}

 

 

 

config:

 

 

 

Warps:
  Lobby:
    Set: '&2Você setou o local do Lobby'
    Del: '&4Você deletou o local do Lobby'
    Teleportado: '&6Você foi teleportado para o Lobby'
    NaoEncontrado: '&cNão foi possivel encontrar o Lobby. Contate um Staffer.'

######

Mensagens:
  #Mensagem que aparece no console quando nao e possivel executar um comando.
  #Nao utilize acentuacao para o console.
  ErroConsole: '&4O Console nao pode executar este comando!'

#######

PlayerSemPermissao: '&b{player} &4Você nao tem Permissão para usar este comando!' 

 

 

 

Like ou Resolvido? 

 

@Edit 

Quote

 

eu ja tinha conseguido mais oque vale e a intencao =)

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...