Package me.vudu.Conflict.util

Examples of me.vudu.Conflict.util.BlockLocation


                                    // drunter
        // wenn einer davon die untere H�lfte einer T�r ist
        if (a.getTypeId() == 64 || b.getTypeId() == 64 || a.getTypeId() == 71 || b.getTypeId() == 71) {

          SpoutPlayer p = (SpoutPlayer) event.getPlayer();
          BlockLocation aLoc = new BlockLocation(a.getLocation());
          BlockLocation bLoc = new BlockLocation(b.getLocation());

          for (BlockLocation bl : ConflictPlugin.doorsRed) {
            if (bl.equals(aLoc) || bl.equals(bLoc)) { // doors is red
              if (ConflictPlugin.playerIsInTeam(p).equals("red")) {
                p.sendMessage("Herzlich willkommen");
View Full Code Here


    }

    // T�r
    if (event.getBlock().getTypeId() == 64 || event.getBlock().getTypeId() == 71) {
      if (ConflictPlugin.playerIsInTeam((SpoutPlayer) event.getPlayer()).equals("red")) {
        ConflictPlugin.doorsRed.add(new BlockLocation(event.getBlock().getLocation()));
      }
      if (ConflictPlugin.playerIsInTeam((SpoutPlayer) event.getPlayer()).equals("blue")) {
        ConflictPlugin.doorsBlue.add(new BlockLocation(event.getBlock().getLocation()));
      }
    }

    // Kohle, Gold, Eisen, Diamant Ore Bl�cke k�nnen nicht gebaut werden
    if (event.getBlock().getTypeId() == 14 || event.getBlock().getTypeId() == 15
View Full Code Here

  @EventHandler(priority = EventPriority.HIGH)
  public void CheckBlockBreak(BlockBreakEvent event) {

    // T�r
    if (event.getBlock().getTypeId() == 64 || event.getBlock().getTypeId() == 71) {
      ConflictPlugin.doorsRed.remove(new BlockLocation(event.getBlock().getLocation()));
      ConflictPlugin.doorsBlue.remove(new BlockLocation(event.getBlock().getLocation()));
    }

    // DamageTower
    if (event.getBlock().getTypeId() == 113) {
      // Checken auf welcher basis
      if (ConflictPlugin.isOnBase(new BlockLocation(event.getBlock().getLocation())) == "red") {
        ConflictPlugin.damageTowerRed--;
      }
      if (ConflictPlugin.isOnBase(new BlockLocation(event.getBlock().getLocation())) == "blue") {
        ConflictPlugin.damageTowerBlue--;
      }
    }

    // Defense Tower
    if (event.getBlock().getTypeId() == 114) {
      // Checken auf welcher basis
      if (ConflictPlugin.isOnBase(new BlockLocation(event.getBlock().getLocation())) == "red") {
        ConflictPlugin.defenseTowerRed--;
      }
      if (ConflictPlugin.isOnBase(new BlockLocation(event.getBlock().getLocation())) == "blue") {
        ConflictPlugin.defenseTowerBlue--;
      }
    }

    // Radar Tower
    if (event.getBlock().getTypeId() == 121) {
      // Checken auf welcher basis
      if (ConflictPlugin.isOnBase(new BlockLocation(event.getBlock().getLocation())) == "red") {
        ConflictPlugin.radarTowerRed--;
      }
      if (ConflictPlugin.isOnBase(new BlockLocation(event.getBlock().getLocation())) == "blue") {
        ConflictPlugin.radarTowerBlue--;
      }
    }

    // baseBlock
    if (!ConflictPlugin.allowDestroyBaseBlock) {
      // BaseBLock -> ignorieren
      if (event.getBlock() instanceof SpoutBlock && event.getBlock().getTypeId() == 112) {
        event.setCancelled(true);
      }
    }

    // Artefakt zerst�ren
    if (!ConflictPlugin.allowDestroyBaseBlock) {
      // Artefakt zerst�rt
      if (event.getBlock() instanceof SpoutBlock && event.getBlock().getTypeId() == ConflictPlugin.ARTIFACTBLOCKID) {
        Block below = event.getBlock().getWorld()
            .getBlockAt(event.getBlock().getX(), event.getBlock().getY() - 1, event.getBlock().getZ());

        if (ConflictPlugin.baseBlocksRed.contains(new BlockLocation(below.getLocation()))) {

          ConflictPlugin.artRed--;
        } else {

          ConflictPlugin.artBlue--;
        }
        ConflictPlugin.setArtLabel(ConflictPlugin.artRed, ConflictPlugin.artBlue);

        ArrayList<BlockLocation> temp = new ArrayList<BlockLocation>();
        for (BlockLocation bl : ConflictPlugin.is5Locations.keySet()) {
          if (bl.equals(new BlockLocation(event.getBlock().getLocation()))) {

            int r = generator.nextInt(9);
           
            if (r == 9) {
              r = generator.nextInt(9); // falls Diamant, dann nochmal
View Full Code Here

    if (redwin) {
      Bukkit.getServer().broadcastMessage("Team RED Wins!!!");
      for (SpoutPlayer p : ConflictPlugin.players) {
        p.sendNotification("SIEG!", "Team ROT gewinnt!", Material.CAKE, (short) 0, 10000);
      }
      BlockLocation exp = null;
      for (BlockLocation loc : ConflictPlugin.baseBlocksBlue) {
        block.getWorld().getBlockAt(loc.getX(), loc.getY(), loc.getZ()).setTypeId(3);
        exp = loc;
      }
      try {
        block.getWorld().createExplosion(
            block.getWorld().getBlockAt(exp.getX(), exp.getY(), exp.getZ()).getLocation(),
            ConflictPlugin.explosionRange);
      } catch (NullPointerException e) { //keine Basis da
      }

    }
    if (bluewin) {
      Bukkit.getServer().broadcastMessage("Team BLUE Wins!!!");
      for (SpoutPlayer p : ConflictPlugin.players) {
        p.sendNotification("SIEG!", "Team BLAU gewinnt!", Material.CAKE, (short) 0, 10000);
      }
      BlockLocation exp = null;
      for (BlockLocation loc : ConflictPlugin.baseBlocksRed) {
        block.getWorld().getBlockAt(loc.getX(), loc.getY(), loc.getZ()).setTypeId(3);
        exp = loc;
      }
      try {
        block.getWorld().createExplosion(
            block.getWorld().getBlockAt(exp.getX(), exp.getY(), exp.getZ()).getLocation(),
            ConflictPlugin.explosionRange);
      } catch (NullPointerException e) {
      }
    }
  }
View Full Code Here

      int y = Bukkit.getServer().getWorlds().get(0)
          .getHighestBlockYAt(x - ConflictPlugin.virusDistance, z - ConflictPlugin.virusDistance);
      Block b = Bukkit.getServer().getWorlds().get(0)
          .getBlockAt(x - ConflictPlugin.virusDistance, y - 1, z - ConflictPlugin.virusDistance);
      SpoutManager.getMaterialManager().overrideBlock(b, virusBlock);
      addContaminated(new BlockLocation(world.getName(), x - ConflictPlugin.virusDistance, y - 1, z
          - ConflictPlugin.virusDistance), world);

      y = Bukkit.getServer().getWorlds().get(0)
          .getHighestBlockYAt(x + ConflictPlugin.virusDistance, z + ConflictPlugin.virusDistance);
      b = Bukkit.getServer().getWorlds().get(0)
          .getBlockAt(x + ConflictPlugin.virusDistance, y - 1, z + ConflictPlugin.virusDistance);
      SpoutManager.getMaterialManager().overrideBlock(b, virusBlock);
      addContaminated(new BlockLocation(world.getName(), x + ConflictPlugin.virusDistance, y - 1, z
          + ConflictPlugin.virusDistance), world);

      y = Bukkit.getServer().getWorlds().get(0)
          .getHighestBlockYAt(x + ConflictPlugin.virusDistance, z - ConflictPlugin.virusDistance);
      b = Bukkit.getServer().getWorlds().get(0)
          .getBlockAt(x + ConflictPlugin.virusDistance, y - 1, z - ConflictPlugin.virusDistance);
      SpoutManager.getMaterialManager().overrideBlock(b, virusBlock);
      addContaminated(new BlockLocation(world.getName(), x + ConflictPlugin.virusDistance, y - 1, z
          - ConflictPlugin.virusDistance), world);

      y = Bukkit.getServer().getWorlds().get(0)
          .getHighestBlockYAt(x - ConflictPlugin.virusDistance, z + ConflictPlugin.virusDistance);
      b = Bukkit.getServer().getWorlds().get(0)
          .getBlockAt(x - ConflictPlugin.virusDistance, y - 1, z + ConflictPlugin.virusDistance);
      SpoutManager.getMaterialManager().overrideBlock(b, virusBlock);
      addContaminated(new BlockLocation(world.getName(), x - ConflictPlugin.virusDistance, y - 1, z
          + ConflictPlugin.virusDistance), world);

    }
    virusPlaced = true;
  }
View Full Code Here

   * @param bl
   * @param world
   */
  private static void addContaminated(BlockLocation bl, World world) {

    ConflictPlugin.contaminated.add(new BlockLocation(world.getName(), bl.getX() + 1, bl.getY(), bl.getZ()));
    ConflictPlugin.contaminated.add(new BlockLocation(world.getName(), bl.getX() - 1, bl.getY(), bl.getZ()));
    ConflictPlugin.contaminated.add(new BlockLocation(world.getName(), bl.getX(), bl.getY(), bl.getZ() - 1));
    ConflictPlugin.contaminated.add(new BlockLocation(world.getName(), bl.getX(), bl.getY(), bl.getZ() + 1));

    ConflictPlugin.contaminated.add(new BlockLocation(world.getName(), bl.getX(), bl.getY() - 1, bl.getZ()));

  }
View Full Code Here

  public static String isOnBase(BlockLocation bl) {

   
    if (null != ConflictPlugin.redBase) {

      BlockLocation redbase = ConflictPlugin.redBase;
      BlockLocation bl0 = new BlockLocation(redbase);
      bl0.setY(bl0.getY() + 1);
      Bukkit.getLogger().log(Level.INFO, bl0.toString());
      BlockLocation bl1 = new BlockLocation(bl0);
      bl1.setX(bl1.getX() - 1);
      BlockLocation bl2 = new BlockLocation(bl0);
      bl2.setX(bl2.getX() + 1);
      BlockLocation bl3 = new BlockLocation(bl0);
      bl3.setZ(bl3.getZ() - 1);
      BlockLocation bl4 = new BlockLocation(bl0);
      bl4.setZ(bl4.getZ() + 1);

      if (bl.equals(bl0) || bl.equals(bl1) || bl.equals(bl2) || bl.equals(bl3) || bl.equals(bl4)) {
        Bukkit.getLogger().log(Level.INFO, "red");
        return "red";
      }
    }

    if (null != ConflictPlugin.blueBase) {
      BlockLocation bluebase = ConflictPlugin.blueBase;
      BlockLocation bl0 = new BlockLocation(bluebase);
      bl0.setY(bl0.getY() + 1);
      Bukkit.getLogger().log(Level.INFO, bl0.toString());
      BlockLocation bl1 = new BlockLocation(bl0);
      bl1.setX(bl1.getX() - 1);
      BlockLocation bl2 = new BlockLocation(bl0);
      bl2.setX(bl2.getX() + 1);
      BlockLocation bl3 = new BlockLocation(bl0);
      bl3.setZ(bl3.getZ() - 1);
      BlockLocation bl4 = new BlockLocation(bl0);
      bl4.setZ(bl4.getZ() + 1);

      if (bl.equals(bl0) || bl.equals(bl1) || bl.equals(bl2) || bl.equals(bl3) || bl.equals(bl4)) {
        Bukkit.getLogger().log(Level.INFO, "blue");
        return "blue";
      }
View Full Code Here

             SpoutManager.getMaterialManager().overrideBlock(world.getBlockAt(x+1,y,z), ConflictPlugin.baseBlockRed);
             SpoutManager.getMaterialManager().overrideBlock(world.getBlockAt(x,y,z-1), ConflictPlugin.baseBlockRed);
             SpoutManager.getMaterialManager().overrideBlock(world.getBlockAt(x,y,z+1), ConflictPlugin.baseBlockRed);
            
             //alle 5 BlockPositionen global speichern
             ConflictPlugin.baseBlocksRed.add(new BlockLocation(world.getName(),x, y, z));
             ConflictPlugin.baseBlocksRed.add(new BlockLocation(world.getName(),x-1, y, z));
             ConflictPlugin.baseBlocksRed.add(new BlockLocation(world.getName(),x+1, y, z));
             ConflictPlugin.baseBlocksRed.add(new BlockLocation(world.getName(),x, y, z-1));
             ConflictPlugin.baseBlocksRed.add(new BlockLocation(world.getName(),x, y, z+1));
            
             //red Base Platzieren
             ConflictPlugin.redBase = new BlockLocation(world.toString(),x,y,z);
             this.plugin.setBaseLocationLabelRed();
           
          
              Bukkit.getServer().broadcastMessage("Team RED established their base at "+Integer.toString(x)+"|"+Integer.toString(y)+"|"+Integer.toString(z));
             for(SpoutPlayer p : ConflictPlugin.players){
          p.sendNotification("Basis errichtet", "RED base at "+Integer.toString(x)+"|"+Integer.toString(y)+"|"+Integer.toString(z), Material.SPONGE, (short)0, 10000)
        }
          
              //Blau
       } else{
       
           SpoutManager.getMaterialManager().overrideBlock(world.getBlockAt(x-1,y,z), ConflictPlugin.baseBlockBlue);
             SpoutManager.getMaterialManager().overrideBlock(world.getBlockAt(x+1,y,z), ConflictPlugin.baseBlockBlue);
             SpoutManager.getMaterialManager().overrideBlock(world.getBlockAt(x,y,z-1), ConflictPlugin.baseBlockBlue);
             SpoutManager.getMaterialManager().overrideBlock(world.getBlockAt(x,y,z+1), ConflictPlugin.baseBlockBlue);
             ConflictPlugin.baseBlocksBlue.add(new BlockLocation(world.getName(),x, y, z));
             ConflictPlugin.baseBlocksBlue.add(new BlockLocation(world.getName(),x-1, y, z));
             ConflictPlugin.baseBlocksBlue.add(new BlockLocation(world.getName(),x+1, y, z));
             ConflictPlugin.baseBlocksBlue.add(new BlockLocation(world.getName(),x, y, z-1));
             ConflictPlugin.baseBlocksBlue.add(new BlockLocation(world.getName(),x, y, z+1));
           
             ConflictPlugin.blueBase = new BlockLocation(world.getName(),x,y,z);
             this.plugin.setBaseLocationLabelBlue();
           Bukkit.getServer().broadcastMessage("Team BLUE established their base at "+Integer.toString(x)+"|"+Integer.toString(y)+"|"+Integer.toString(z));
           for(SpoutPlayer p : ConflictPlugin.players){
            p.sendNotification("Basis errichtet", "BLUE base at "+Integer.toString(x)+"|"+Integer.toString(y)+"|"+Integer.toString(z), Material.SPONGE, (short)0, 10000)
          }
View Full Code Here

    ArrayList<BlockLocation> temp = new ArrayList<BlockLocation>();
   
    int numContam = ConflictPlugin.contaminated.size();
   
     
        BlockLocation blo = null;
        Block b = null;
        int r=0;
       
        for(int i=0; i<Math.min(250, numContam); i++){
          r = generator.nextInt(10);
          if(r<=4){
            blo = ConflictPlugin.contaminated.get(i);
            b = plugin.getServer().getWorlds().get(0).getBlockAt(blo.getX(), blo.getY(), blo.getZ());
            SpoutManager.getMaterialManager().overrideBlock(b, ConflictPlugin.virusBlock);
            temp.add(blo)
          }
           
        }
     
        
       
     
   
   
   
//    for(BlockLocation bl: ConflictPlugin.contaminated){
//      Block b = plugin.getServer().getWorlds().get(0).getBlockAt(bl.getX(), bl.getY(), bl.getZ());
//      int r = generator.nextInt(9);
//      if(r<=4){
//         SpoutManager.getMaterialManager().overrideBlock(b, ConflictPlugin.virusBlock);
//         temp.add(bl);
//      }
//    }
    if(null!= ConflictPlugin.blueBase){
     
   
    for(BlockLocation bl: temp){
     
      Location l2 = new Location(plugin.getServer().getWorlds().get(0), ConflictPlugin.blueBase.getX(), ConflictPlugin.blueBase.getY(), ConflictPlugin.blueBase.getZ());
     
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()+1, bl.getZ()).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()+1, bl.getZ()).getLocation());
           BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getName(),  bl.getX()+1, plugin.getServer().getWorlds().get(0).getHighestBlockYAt(bl.getX()+1, bl.getZ())-1, bl.getZ());
           Location l = new Location(plugin.getServer().getWorlds().get(0), bl.getX(), bl.getY(), bl.getZ());
           if(!ConflictPlugin.contaminated.contains(bl2) && l.distance(l2)<1.5*ConflictPlugin.virusDistance)
           ConflictPlugin.contaminated.add(bl2);  
         }
        
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()-1, bl.getZ()).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()-1, bl.getZ()).getLocation());
           BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getName(),  bl.getX()-1, plugin.getServer().getWorlds().get(0).getHighestBlockYAt(bl.getX()-1, bl.getZ())-1, bl.getZ());
           Location l = new Location(plugin.getServer().getWorlds().get(0), bl.getX(), bl.getY(), bl.getZ());
           if(!ConflictPlugin.contaminated.contains(bl2) && l.distance(l2)<1.5* ConflictPlugin.virusDistance)
           ConflictPlugin.contaminated.add(bl2);  
         }
        
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()+1).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()+1).getLocation());
           BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getName(),  bl.getX(), plugin.getServer().getWorlds().get(0).getHighestBlockYAt(bl.getX(), bl.getZ()+1)-1, bl.getZ()+1);
           Location l = new Location(plugin.getServer().getWorlds().get(0), bl.getX(), bl.getY(), bl.getZ());          
           if(!ConflictPlugin.contaminated.contains(bl2&& l.distance(l2)< 1.5*ConflictPlugin.virusDistance)
           ConflictPlugin.contaminated.add(bl2);  
         }
        
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()-1).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()-1).getLocation());
           BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getName(),  bl.getX(), plugin.getServer().getWorlds().get(0).getHighestBlockYAt(bl.getX(), bl.getZ()-1)-1, bl.getZ()-1);
           Location l = new Location(plugin.getServer().getWorlds().get(0), bl.getX(), bl.getY(), bl.getZ());
           if(!ConflictPlugin.contaminated.contains(bl2&& l.distance(l2)< 1.5*ConflictPlugin.virusDistance)
           ConflictPlugin.contaminated.add(bl2);  
         }
        
         //Block darunter
         if(bl.getY()>1){
           BlockLocation bl2 = new BlockLocation(bl.getWorld(), bl.getX(), bl.getY()-1, bl.getZ());
         
           if(!ConflictPlugin.contaminated.contains(bl2))
           ConflictPlugin.contaminated.add(bl2)
         }
         
View Full Code Here

     /**
      * wird aufgereufen, wenn Bl�cke nicht von einem Spieler gestezt werden (automatisch)
      * setzt den Timestamp (wird f�r Wachstum gebraucht) beim Platzieren
      */
      public void onBlockPlace(World world, int x, int y, int z) {
        BlockLocation bll = new BlockLocation(world.getName(),x,y,z);  
        Long overflow = ConflictPlugin.timestampOverflows.get(bll);
       
       
        overflow = (overflow == null) ? 0 : overflow;
        initTimestamp(world.getBlockAt(x, y, z), System.currentTimeMillis()-overflow);
       
        ConflictPlugin.timestampOverflows.remove(bll);
       
        if(null!= this.dontPlace){
          BlockLocation bl = new BlockLocation(world.getName(),x,y,z);
          if(this.dontPlace.equals(bl)){
            SpoutItemStack temp = new SpoutItemStack(new SpoutItemStack(37, 0, (short) 0));
            if(this.stage==1){
              temp = new SpoutItemStack(ConflictPlugin.art_1_5);
            }
View Full Code Here

TOP

Related Classes of me.vudu.Conflict.util.BlockLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.