Region

Discussion in 'Plugin Development' started by NoSpanMan, Oct 9, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    NoSpanMan

    I have:
    Code:
      Location p1 = new Location(w1, x1, y1, z1);
       Location p2 = new Location(w2, x2, y2, z2);
       Location p3 = new Location(w3, x3, y3, z3);
    
      public Boolean hasBeenCaptured1 = false;
       public Boolean hasBeenCaptured2 = false;
       public Boolean hasBeenCaptured3 = false;
    
      public void getCapture1() {
         w1 = Bukkit.getServer().getWorld(getConfig().getString("cp1.world"));
         x1 = getConfig().getInt("cp1.x");
         y1 = getConfig().getInt("cp1.y");
         z1 = getConfig().getInt("cp1.z");
       }
       
       public void getCapture2() {
         w2 = Bukkit.getServer().getWorld(getConfig().getString("cp2.world"));
         x2 = getConfig().getInt("cp2.x");
         y2 = getConfig().getInt("cp2.y");
         z2 = getConfig().getInt("cp2.z");
       }
       
       public void getCapture3(){
         w3 = Bukkit.getServer().getWorld(getConfig().getString("cp3.world"));
         x3 = getConfig().getInt("cp3.x");
         y3 = getConfig().getInt("cp3.y");
         z3 = getConfig().getInt("cp3.z");
       }
    
      @EventHandler(priority = EventPriority.MONITOR)
       public void onPlayerMove(PlayerMoveEvent event) {
       Player player = event.getPlayer();
       if (player.getLocation().equals(p1)) {
         if (inDevs.contains(player)) {
           if (hasBeenCaptured2 == false && hasBeenCaptured3 == false) {
           // timer start
           Bukkit.broadcastMessage(DB + player + " is capturing point 1!");
             if (captureTime1 == 0) {
             Bukkit.broadcastMessage(DB + player + " has captured point 1!");
             hasBeenCaptured1 = true;
             }
               if (p1 != player.getLocation()) {
                 //stop timer
               Bukkit.broadcastMessage(DB + player + " Isn't capturing anymore!");
               }
             } else {
             player.sendMessage(DB + "You need to capture point 1!");
             }
           } else {
           player.sendMessage(DB + "This is your own point!");
           }
         }
       }
    
    But in my config:
    Code:
    cp1:
      world: Server
      x: 75.30000001192093
      y: 63.0
      z: 253.69999998807907
    cp2:
      world: Server
      x: 68.28811554516818
      y: 64.0
      z: 251.9286617786259
    cp3:
      world: Server
      x: 64.10648724892854
      y: 64.0
      z: 250.2027717303012
    
    So when i can't get good in the right block because its ,253902375093469340793405 ........... But how can i make that he takes a region of 3 blocks?
     
  2. Offline

    RoboticPlayer

    An integer is a whole number.
     
  3. Offline

    NoSpanMan

    @henderry2019 But how can i make it in a region of 4 blocks?
     
Thread Status:
Not open for further replies.

Share This Page