Advertisement
Guest User

my Main.java

a guest
Jul 10th, 2021
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.60 KB | None | 0 0
  1. public class Main extends JavaPlugin{
  2.    
  3.          private Laser laser;
  4.  
  5.         @Override
  6.         public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  7.              if (cmd.getName().equalsIgnoreCase("Laserset")) {
  8.                  
  9.                  if(!(sender.hasPermission("GuardianLaser.set"))) {
  10.                      sender.sendMessage("You do not have permission to use this command (GuardianLaser.set)");
  11.                  } else {
  12.                      if(args.length != 8) {
  13.                          if(args.length < 8) sender.sendMessage("Not enough arguments. usage: /laserset x1 y1 z1 x2 y2 z2 world Duration(InTicks) ViewDistance");
  14.                          if (args.length > 9) sender.sendMessage("Too many arguments. usage: /laserset x1 y1 z1 x2 y2 z2 world Duration(InTicks) ViewDistance");
  15.                      } else {
  16.  
  17.                          Location loc1 = new Location(Bukkit.getWorld(args[6]), Double.parseDouble(args[0]),Double.parseDouble(args[1]),Double.parseDouble(args[2]));
  18.                          Location loc2 = new Location(Bukkit.getWorld(args[6]), Double.parseDouble(args[3]),Double.parseDouble(args[4]),Double.parseDouble(args[5]));
  19.                          
  20.                          try {
  21.                             this.laser = new Laser(loc1, loc2, Integer.parseInt(args[7]), Integer.parseInt(args[8]));
  22.                            
  23.                             this.laser.start(Main.this);
  24.                            
  25.                         } catch (ReflectiveOperationException e) {
  26.                             e.printStackTrace();
  27.                             sender.sendMessage("there was a ReflectiveOperationException!");
  28.                         }
  29.                      
  30.                      } return false;
  31.              }
  32.              
  33.                  
  34.              
  35.  
  36.              if (cmd.getName().equalsIgnoreCase("Laserstop")) {
  37.                  if(sender.hasPermission("GuardianLaser.stop")){
  38.                      this.laser.stop();
  39.                  }
  40.              }
  41.             return true;
  42.         }
  43.             return false;
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement