Examples of Cake


Examples of com.tommytony.war.structure.Cake

      if (!quiet) {
        this.broadcast("drop.flag.broadcast", player.getName(), victimTeam.getKind().getColor() + victimTeam.getName() + ChatColor.WHITE);
      }
    } else if (this.isCakeThief(player.getName())) {
      Cake cake = this.getCakeForThief(player.getName());

      this.removeCakeThief(player.getName());

      // Bring back cake
      cake.getVolume().resetBlocks();
      cake.addCakeBlocks();

      if (!quiet) {
        this.broadcast("drop.cake.broadcast", player.getName(), ChatColor.GREEN + cake.getName() + ChatColor.WHITE);
      }
    } else if (this.isBombThief(player.getName())) {
      Bomb bomb = this.getBombForThief(player.getName());

      this.removeBombThief(player.getName());
View Full Code Here

Examples of com.tommytony.war.structure.Cake

      return false;
    } else if (!this.isSenderAuthorOfZone(zone)) {
      return true;
    }

    Cake cake = zone.getCake(this.args[0]);
    if (cake != null) {
      cake.getVolume().resetBlocks();
      zone.getCakes().remove(cake);
      WarzoneYmlMapper.save(zone);
      this.msg("Cake " + cake.getName() + " removed.");
      War.war.log(this.getSender().getName() + " deleted cake " + cake.getName() + " in warzone " + zone.getName(), Level.INFO);
    } else {
      this.badMsg("No such cake.");
    }

    return true;
View Full Code Here

Examples of com.tommytony.war.structure.Cake

      return false;
    }

    if (zone.hasCake(this.args[0])) {
      // move the existing cake
      Cake cake = zone.getCake(this.args[0]);
      cake.getVolume().resetBlocks();
      cake.setLocation(player.getLocation());
      this.msg("Cake " + cake.getName() + " was moved.");
      War.war.log(this.getSender().getName() + " moved cake " + cake.getName() + " in warzone " + zone.getName(), Level.INFO);
    } else {
      // create a new cake
      Cake cake = new Cake(this.args[0], zone, player.getLocation());
      zone.getCakes().add(cake);
      this.msg("Cake " + cake.getName() + " created.");
      War.war.log(this.getSender().getName() + " created cake " + cake.getName() + " in warzone " + zone.getName(), Level.INFO);
    }

    WarzoneYmlMapper.save(zone);

    return true;
View Full Code Here

Examples of com.tommytony.war.structure.Cake

            }
            int cakeX = warzoneRootSection.getInt(cakePrefix + "x");
            int cakeY = warzoneRootSection.getInt(cakePrefix + "y");
            int cakeZ = warzoneRootSection.getInt(cakePrefix + "z");
            int cakeYaw = warzoneRootSection.getInt(cakePrefix + "yaw");
            Cake cake = new Cake(cakeName, warzone, new Location(world, cakeX, cakeY, cakeZ, cakeYaw, 0));
            warzone.getCakes().add(cake);
          }
        }
      }
     
      // teams (maybe no teams)
      if (warzoneRootSection.contains("team.names")) {
        List<String> teamsNames = warzoneRootSection.getStringList("team.names");
        for (String teamName : teamsNames) {
          // team info
          String teamInfoPrefix = "team." + teamName + ".info.";
          if (!warzoneRootSection.contains(teamInfoPrefix + "spawn.x")) {
            // try lowercase instead - supports custom team names
            teamInfoPrefix = "team." + teamName.toLowerCase() + ".info.";
          }
          List<Location> teamSpawns = new ArrayList<Location>();
          if (warzoneRootSection.contains(teamInfoPrefix + "spawn")) {
            int teamX = warzoneRootSection.getInt(teamInfoPrefix + "spawn.x");
            int teamY = warzoneRootSection.getInt(teamInfoPrefix + "spawn.y");
            int teamZ = warzoneRootSection.getInt(teamInfoPrefix + "spawn.z");
            int teamYaw = warzoneRootSection.getInt(teamInfoPrefix + "spawn.yaw");
            Location teamLocation = new Location(world, teamX, teamY, teamZ, teamYaw, 0);
            teamSpawns.add(teamLocation);
            File original = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + name + "/volume-" + teamName + ".dat");
            File modified = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + name + "/volume-" + teamName + teamSpawns.indexOf(teamLocation) + ".dat");
            File originalSql = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + name + "/volume-" + teamName + ".sl3");
            File modifiedSql = new File(War.war.getDataFolder().getPath() + "/dat/warzone-" + name + "/volume-" + teamName + teamSpawns.indexOf(teamLocation) + ".sl3");
            try {
              original.renameTo(modified);
            } catch (Exception ignored) {
            }
            try {
              originalSql.renameTo(modifiedSql);
            } catch (Exception ignored) {
            }
          }
          if (warzoneRootSection.contains(teamInfoPrefix + "spawns")) {
            for (Map<?, ?> map : warzoneRootSection.getMapList(teamInfoPrefix + "spawns")) {
              int teamX = (Integer) map.get("x");
              int teamY = (Integer) map.get("y");
              int teamZ = (Integer) map.get("z");
              int teamYaw = (Integer) map.get("yaw");
              Location teamLocation = new Location(world, teamX, teamY, teamZ, teamYaw, 0);
              teamSpawns.add(teamLocation);
            }
          }
 
          Team team = new Team(teamName, TeamKind.teamKindFromString(teamName), teamSpawns, warzone);
          warzone.getTeams().add(team);
         
          if (warzoneRootSection.contains(teamInfoPrefix + "flag")) {
            int flagX = warzoneRootSection.getInt(teamInfoPrefix + "flag.x");
            int flagY = warzoneRootSection.getInt(teamInfoPrefix + "flag.y");
            int flagZ = warzoneRootSection.getInt(teamInfoPrefix + "flag.z");
            int flagYaw = warzoneRootSection.getInt(teamInfoPrefix + "flag.yaw");
            Location flagLocation = new Location(world, flagX, flagY, flagZ, flagYaw, 0);
            team.setTeamFlag(flagLocation);
          }
         
          String teamConfigPrefix = "team." + teamName + ".config";
          if (warzoneRootSection.contains(teamConfigPrefix)) {
            // team specific config
            ConfigurationSection teamConfigSection = warzoneRootSection.getConfigurationSection(teamConfigPrefix);
            team.getTeamConfig().loadFrom(teamConfigSection);
          } else if (warzoneRootSection.contains(teamConfigPrefix.toLowerCase())) {
            // try lowercase instead
            ConfigurationSection teamConfigSection = warzoneRootSection.getConfigurationSection(teamConfigPrefix.toLowerCase());
            team.getTeamConfig().loadFrom(teamConfigSection);
          }
         
          // LIFEPOOL INITIALIZATION HERE
          team.setRemainingLives(team.getTeamConfig().resolveInt(TeamConfig.LIFEPOOL));
         
          String teamLoadoutPrefix = "team." + teamName + ".loadout";
          if (warzoneRootSection.contains(teamLoadoutPrefix)) {
            // team specific loadouts
            ConfigurationSection loadoutsSection = warzoneRootSection.getConfigurationSection(teamLoadoutPrefix);
            team.getInventories().setLoadouts(LoadoutYmlMapper.fromConfigToLoadouts(loadoutsSection, new HashMap<String, HashMap<Integer, ItemStack>>()));
          } else if (warzoneRootSection.contains(teamLoadoutPrefix.toLowerCase())) {
            // try lowercase instead
            ConfigurationSection loadoutsSection = warzoneRootSection.getConfigurationSection(teamLoadoutPrefix.toLowerCase());
            team.getInventories().setLoadouts(LoadoutYmlMapper.fromConfigToLoadouts(loadoutsSection, new HashMap<String, HashMap<Integer, ItemStack>>()));
          }
         
          String teamRewardPrefix = "team." + teamName + ".reward";
          if (warzoneRootSection.contains(teamRewardPrefix)) {
            // team specific reward
            ConfigurationSection rewardsSection = warzoneRootSection.getConfigurationSection(teamRewardPrefix);
            HashMap<Integer, ItemStack> reward = new HashMap<Integer, ItemStack>();
            LoadoutYmlMapper.fromConfigToLoadout(rewardsSection, reward, "default");
            warzone.getDefaultInventories().setReward(reward);
          } else if (warzoneRootSection.contains(teamRewardPrefix.toLowerCase())) {
            // try lowercase instead
            ConfigurationSection rewardsSection = warzoneRootSection.getConfigurationSection(teamRewardPrefix.toLowerCase());
            HashMap<Integer, ItemStack> reward = new HashMap<Integer, ItemStack>();
            LoadoutYmlMapper.fromConfigToLoadout(rewardsSection, reward, "default");
            warzone.getDefaultInventories().setReward(reward);
          }
        }
      }
      Connection connection = null;
      try {
        connection = ZoneVolumeMapper.getZoneConnection(warzone.getVolume(), warzone.getName(), warzone.getWorld());
      } catch (SQLException e) {
        War.war.getLogger().log(Level.WARNING, "Failed to load warzone structures volume", e);
      }
      // monument blocks
      for (Monument monument : warzone.getMonuments()) {
        try {
          monument.setVolume(warzone.loadStructure(monument.getName(), connection));
        } catch (SQLException e) {
          War.war.getLogger().log(Level.WARNING, "Failed to load warzone structures volume", e);
        }
      }
     
      // bomb blocks
      for (Bomb bomb : warzone.getBombs()) {
        try {
          bomb.setVolume(warzone.loadStructure("bomb-" + bomb.getName(), connection));
        } catch (SQLException e) {
          War.war.getLogger().log(Level.WARNING, "Failed to load warzone structures volume", e);
        }
      }
     
      // cake blocks
      for (Cake cake : warzone.getCakes()) {
        try {
          cake.setVolume(warzone.loadStructure("cake-" + cake.getName(), connection));
        } catch (SQLException e) {
          War.war.getLogger().log(Level.WARNING, "Failed to load warzone structures volume", e);
        }
      }
     
View Full Code Here

Examples of com.tommytony.war.structure.Cake

          // detect audacious thieves
          War.war.badMsg(player, "zone.stealextra.cake");
        } else if (warzone.isFlagThief(player.getName()) || warzone.isBombThief(player.getName())) {
          War.war.badMsg(player, "zone.stealextra.other");
        } else {
          Cake cake = warzone.getCakeForBlock(block);
          // player just broke the cake block: cancel to avoid drop, give player the block, set block to air
          ItemStack cakeBlock = new ItemStack(Material.CAKE);
          cakeBlock.setDurability((short)8);
          player.getInventory().clear();
          player.getInventory().addItem(cakeBlock);
          warzone.addCakeThief(cake, player.getName());
          block.setType(Material.AIR);
          for (Team t : warzone.getTeams()) {
            t.teamcast("zone.steal.cake.broadcast", team.getKind().getColor() + player.getName() + ChatColor.WHITE, ChatColor.GREEN + cake.getName() + ChatColor.WHITE);
            if (War.war.isSpoutServer()) {
              for (Player p : t.getPlayers()) {
                SpoutPlayer sp = SpoutManager.getPlayer(p);
                if (sp.isSpoutCraftEnabled()) {
                          sp.sendNotification(
                              SpoutDisplayer.cleanForNotification(team.getKind().getColor() + player.getName() + ChatColor.YELLOW + " has "),
                              SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "cake " + ChatColor.GREEN + cake.getName() + ChatColor.YELLOW + "!"),
                              Material.CAKE,
                              (short)0,
                              5000);
                }
              }
            }
            t.teamcast("zone.steal.cake.prevent", team.getKind().getColor() + player.getName() + ChatColor.WHITE);
          }
          War.war.msg(player, "zone.steal.cake.notice", cake.getName());
        }
        event.setCancelled(true);
        return;
      } else if (!warzone.isMonumentCenterBlock(block)) {
        War.war.badMsg(player, "build.denied.location");
View Full Code Here

Examples of com.tommytony.war.structure.Cake

            }
          }
         
          // Don't let someone alone make points off cakes
          if (hasOpponent) {
            Cake cake = playerWarzone.getCakeForThief(player.getName());
           
            if (playerWarzone.isReinitializing()) {
              // Battle already ended or interrupted
              playerWarzone.respawnPlayer(event, playerTeam, player);
            } else {
              // All good - proceed with scoring
              // Woot! Cake effect: 1 pt + full lifepool
              playerTeam.addPoint();
              playerTeam.setRemainingLives(playerTeam.getTeamConfig().resolveInt(TeamConfig.LIFEPOOL));
             
              // Notify everyone
              for (Team t : playerWarzone.getTeams()) {
                if (War.war.isSpoutServer()) {
                  for (Player p : t.getPlayers()) {
                    SpoutPlayer sp = SpoutManager.getPlayer(p);
                    if (sp.isSpoutCraftEnabled()) {
                              sp.sendNotification(
                                  SpoutDisplayer.cleanForNotification(playerTeam.getKind().getColor() + player.getName() + ChatColor.YELLOW + " captured"),
                                  SpoutDisplayer.cleanForNotification(ChatColor.YELLOW + "cake " + ChatColor.GREEN + cake.getName() + ChatColor.YELLOW + "!"),
                                  playerTeam.getKind().getMaterial(),
                                  playerTeam.getKind().getData(),
                                  10000);
                    }
                  }
                }
                t.teamcast("zone.cake.broadcast", playerTeam.getKind().getColor() + player.getName() + ChatColor.WHITE,
                    ChatColor.GREEN + cake.getName() + ChatColor.WHITE, playerTeam.getName());
              }
             
              // Detect win conditions
              if (playerTeam.getPoints() >= playerTeam.getTeamConfig().resolveInt(TeamConfig.MAXSCORE)) {
                if (playerWarzone.hasPlayerState(player.getName())) {
                  playerWarzone.restorePlayerState(player);
                }
                playerWarzone.handleScoreCapReached(playerTeam.getName());
                event.setTo(playerWarzone.getTeleport());
              } else {
                // just added a point
               
                // bring back cake
                cake.getVolume().resetBlocks();
                cake.addCakeBlocks();
               
                playerWarzone.respawnPlayer(event, playerTeam, player);
                playerTeam.resetSign();
                playerWarzone.getLobby().resetTeamGateSign(playerTeam);
              }
View Full Code Here

Examples of org.mvel2.tests.core.res.Cake

    List list = new LinkedList();
    list.add("Apple");
    list.add("Peach");
    list.add("Icing");

    Cake cake = new Cake();

    MVEL.setProperty(cake, "ingredients", list);

    assertTrue(cake.getIngredients().contains("Apple"));
    assertTrue(cake.getIngredients().contains("Peach"));
    assertTrue(cake.getIngredients().contains("Icing"));
  }
View Full Code Here

Examples of org.mvel2.tests.core.res.Cake

    List list = new LinkedList();
    list.add("Apple");
    list.add("Peach");
    list.add("Icing");

    Cake cake = new Cake();

    MVEL.setProperty(cake, "ingredients", list);

    assertTrue(cake.getIngredients().contains("Apple"));
    assertTrue(cake.getIngredients().contains("Peach"));
    assertTrue(cake.getIngredients().contains("Icing"));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.