Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.06 KB | None | 0 0
  1. package com.streen.regions.cmds;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandExecutor;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8.  
  9. import com.streen.regions.Main;
  10.  
  11. public class Region implements CommandExecutor{
  12.  
  13.     @Override
  14.     public boolean onCommand(CommandSender sender, Command cmd, String lb, String[] args) {
  15.        
  16.         if(!(sender instanceof Player)) {
  17.             Bukkit.getConsoleSender().sendMessage("§2Você não pode executar esse comando!");
  18.         }
  19.         Player p = (Player)sender;
  20.        
  21.         if(lb.equalsIgnoreCase("sregion")) {
  22.            if(!p.hasPermission("streen.regions") {
  23.                p.sendMessage("§7 " + "\n" + " §cVocê não tem permissão para isso." + "\n" + "§ ");
  24.                return true;
  25.            }
  26.            if(args.length == 0) {
  27.               p.sendMessage("§2Use /sregion <set,info,delete>");
  28.            }else
  29.            if(args.length > 0){
  30.               if(args[0].equalsIgnoreCase("set")) {
  31.                    
  32.                  if (Main.loc1 == null) {
  33.                      p.sendMessage("§cLocalização 1 não setada!");
  34.                      return true;
  35.                  }
  36.                  if (Main.loc2 == null) {
  37.                      p.sendMessage("§cLocalização 2 não setada!");
  38.                      return true;
  39.                  }
  40.                  if(args.length == 1) { p.sendMessage("§cColoque um nome!"); }
  41.                     if(!(Main.regions.getConfig().contains("Regiões"))) {
  42.                          Main.regions.getConfig().createSection("Regiões");
  43.                     }
  44.                     Main.regions.getConfig().getConfigurationSection("Regiões").set(args[1], args[1]);
  45.                        
  46.                     Main.regions.saveConfig();
  47.                        
  48.                     p.sendMessage("foi setado mermão");
  49.                    
  50.                 }
  51.                 if(args[0].equalsIgnoreCase("info")) {
  52.                    
  53.                 }
  54.            }
  55.         }
  56.         return false;
  57.     }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement