Пример #1
0
  @Override
  public List<String> getHelpMessages(TeamInfo team) {
    LinkedList<String> messages = new LinkedList<String>();

    String numText;
    switch (numTeams.getValue()) {
      case 2:
        numText = "two ";
        break;
      case 3:
        numText = "three ";
        break;
      case 4:
        numText = "four ";
        break;
      default:
        numText = Integer.toString(numTeams.getValue());
        break;
    }
    messages.add(
        "Players have been split into "
            + numText
            + "teams. Get farming!\nThe scoreboard shows what team each player is on.");
    messages.add(
        "The teams complete to deliver the most farm produce (plants, meat, eggs, wool and leather - no seeds) to a central depot.");
    messages.add(
        "At the end of " + dayLimit + " days, the team that has the highest score wins the game.");
    messages.add("You will respawn at your base when you die.");

    if (announceScores.isEnabled())
      messages.add("The current scores will be announced at the start of each day.");

    return messages;
  }
Пример #2
0
  @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
  public void entityDamaged(EntityDamageEvent event) {
    if (friendlyFire.isEnabled()) return;

    Player victim = (Player) event.getEntity();
    if (victim == null) return;

    Player attacker = Helper.getAttacker(event);
    if (attacker == null) return;

    if (getTeam(victim) == getTeam(attacker)) event.setCancelled(true);
  }
Пример #3
0
  private long getScoreForItem(Material type, int team) {
    if (!diminishingReturns.isEnabled()) return startingScoreForType;

    if (scoresForTypes.containsKey(type)) {
      long retVal = scoresForTypes.get(type);
      scoresForTypes.put(type, retVal - 1);
      return retVal;
    } else {
      scoresForTypes.put(type, startingScoreForType - 1);
      return startingScoreForType;
    }
  }