Package games.stendhal.server.core.rp.group

Examples of games.stendhal.server.core.rp.group.Group


      player.sendPrivateText(targetPlayer.getName() + " has a closed mind, and is seeking solitude from all but close friends");
      return;
    }

    // check if the target player is already in a group
    Group group = SingletonRepository.getGroupManager().getGroup(targetPlayer.getName());
    if (group != null) {
      player.sendPrivateText(NotificationType.ERROR, targetPlayer.getName() + " is already in a group.");
      return;
    }

    // get group, create it, if it does not exist
    SingletonRepository.getGroupManager().createGroup(player.getName());
    group = SingletonRepository.getGroupManager().getGroup(player.getName());

    // check leader
    if (!group.hasLeader(player.getName())) {
      player.sendPrivateText(NotificationType.ERROR, "Only the group leader may invite people.");
      return;
    }

    // check if there is space left in the group
    if (group.isFull()) {
      player.sendPrivateText(NotificationType.ERROR, "Your group is already full.");
      return;
    }

    // invite
    group.invite(player, targetPlayer);
    player.sendPrivateText("You have invited " + targetPlayer.getName() + " to join your group.");
  }
View Full Code Here


   * @param player Player who wants to join a group
   * @param targetPlayer leader of the group
   */
  private void join(Player player, Player targetPlayer) {
    // check if the player is already in a group
    Group group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (group != null) {
      player.sendPrivateText(NotificationType.ERROR, "You are already in a group.");
      return;
    }

    // check if the target player is in a group and that this group has invited the player
    group = SingletonRepository.getGroupManager().getGroup(targetPlayer.getName());
    if ((group == null) || !group.hasBeenInvited(player.getName())) {
      player.sendPrivateText(NotificationType.ERROR, "You have not been invited into this group or the invite expired.");
      return;
    }

    // check if there is space left in the group
    if (group.isFull()) {
      player.sendPrivateText(NotificationType.ERROR, "The group is already full.");
      return;
    }

    group.addMember(player.getName());
  }
View Full Code Here

   * @param targetPlayer new leader
   */
  private void leader(Player player, Player targetPlayer) {

    // check if the player is in a group
    Group group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (group == null) {
      player.sendPrivateText(NotificationType.ERROR, "You are not a member of a group.");
      return;
    }

    // check leader
    group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (!group.hasLeader(player.getName())) {
      player.sendPrivateText(NotificationType.ERROR, "Only the group leader may define a new leader.");
      return;
    }

    // check if the target player is a member of this group
    if (!group.hasMember(targetPlayer.getName())) {
      player.sendPrivateText(NotificationType.ERROR, targetPlayer.getName() + " is not a member of your group.");
      return;
    }

    // set leader
    group.setLeader(targetPlayer.getName());
  }
View Full Code Here

   * @param lootmode new lootmode
   */
  private void lootmode(Player player, String lootmode) {

    // check if the player is already in a group
    Group group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (group == null) {
      player.sendPrivateText(NotificationType.ERROR, "You are not a member of a group.");
      return;
    }

    // check leader
    group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (!group.hasLeader(player.getName())) {
      player.sendPrivateText(NotificationType.ERROR, "Only the group leader may change the lootmode.");
      return;
    }

    // check if the loot mode is valid
    if ((lootmode == null) || (!lootmode.equals("single") && !lootmode.equals("shared"))) {
      player.sendPrivateText(NotificationType.ERROR, "Valid loot modes are \"single\" and \"shared\".");
      return;
    }

    // set leader
    group.setLootmode(lootmode);
  }
View Full Code Here

   * leave the group
   *
   * @param player player who wants to leave
   */
  private void part(Player player) {
    Group group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (group == null) {
      player.sendPrivateText(NotificationType.ERROR, "You are not a member of a group.");
      return;
    }

    group.removeMember(player.getName());
  }
View Full Code Here

   * status report about the group
   *
   * @param player player who wants a status report
   */
  private void status(Player player) {
    Group group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (group == null) {
      // Send an empty event if the player is not a group member, and let
      // the client sort out that it was not about parting from a group.
      player.addEvent(new GroupChangeEvent());
      return;
    }

    group.sendGroupChangeEvent(player);
  }
View Full Code Here

      part(player);
      return;
    }

    // check in group
    Group group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (group == null) {
      player.sendPrivateText(NotificationType.ERROR, "You are not a member of a group.");
      return;
    }

    // check leader
    if (!group.hasLeader(player.getName())) {
      player.sendPrivateText(NotificationType.ERROR, "Only the group leader may kick members.");
      return;
    }

    // is the target player a member of this group?
    if (!group.hasMember(targetPlayer)) {
      player.sendPrivateText(NotificationType.ERROR, targetPlayer + " is not a member of your group.");
      return;
    }

    // tell the members of the kick and remove the target player
    group.sendGroupMessage("Group", targetPlayer + " was kicked by " + player.getName());
    group.removeMember(targetPlayer);
  }
View Full Code Here

      player.sendPrivateText("The strong anti telepathy aura prevents you from getting through. Use /support <text> to contact an admin!");
      return;
    }

    // is the player in a group?
    Group group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (group == null) {
      player.sendPrivateText(NotificationType.ERROR, "You are not in a group");
      return;
    }

    if (validateAction(action)) {
      group.sendGroupMessage(player.getName(), action.get(TEXT));
    }
  }
View Full Code Here

    if (corpseOwner == null || corpseOwner.equals(player.getName()) || get("class").equals("player")) {
      return true;
    }

    // okay, now check the group rules
    Group group = SingletonRepository.getGroupManager().getGroup(player.getName());
    if (group != null) {
      if (group.getLootmode().equals("shared") && group.hasMember(corpseOwner)) {
        return true;
      }
    }

    return false;
View Full Code Here

TOP

Related Classes of games.stendhal.server.core.rp.group.Group

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.