Examples of ArrestWarrant


Examples of games.stendhal.server.entity.mapstuff.office.ArrestWarrant

import marauroa.common.game.RPObject;

public class ArrestWarrantTransformer implements Transformer {

  public RPObject transform(final RPObject object) {
    return new ArrestWarrant(object);
  }
View Full Code Here

Examples of games.stendhal.server.entity.mapstuff.office.ArrestWarrant

    final Player criminal = SingletonRepository.getRuleProcessor().getPlayer(
            criminalName);

    arrestWarrants.removeByName(criminalName);
    final ArrestWarrant arrestWarrant = new ArrestWarrant(criminalName, policeman, minutes, reason);

    policeman.sendPrivateText("You have jailed " + criminalName
      + " for " + minutes + " minutes. Reason: " + reason + ".");
    SingletonRepository.getRuleProcessor().sendMessageToSupporters("JailKeeper",
      policeman.getName() + " jailed " + criminalName
      + " for " + minutes + " minutes. Reason: " + reason
      + ".");

    if (criminal == null) {
      final String text = "Player " + criminalName + " is not online, but the arrest warrant has been recorded anyway.";
      policeman.sendPrivateText(text);
      LOGGER.debug(text);
    } else {
      arrestWarrant.setStarted();
      imprison(criminal, policeman, minutes);
      criminal.sendPrivateText("You have been jailed for " + minutes
          + " minutes. Reason: " + reason + ".");
    }
    arrestWarrants.add(arrestWarrant);
View Full Code Here

Examples of games.stendhal.server.entity.mapstuff.office.ArrestWarrant

    // 5 seconds.
    SingletonRepository.getTurnNotifier().notifyInSeconds(5, new TurnListener() {
      public void onTurnReached(final int currentTurn) {
        final String name = player.getName();

        final ArrestWarrant arrestWarrant = arrestWarrants.getByName(name);
        if (arrestWarrant == null) {
          return;
        }

        if (removeVeryOldWarrants(arrestWarrant)) {
          return;
        }

        final long timestamp = arrestWarrant.getTimestamp();
        player.sendPrivateText("You have been jailed "
          + " for " + arrestWarrant.getMinutes()
          + " minutes on " + String.format("%tF", timestamp)
          + ". Reason: " + arrestWarrant.getReason() + ".");

        handleEscapeMessages(arrestWarrant);
        imprison(player, player, arrestWarrant.getMinutes());
      }

      public boolean removeVeryOldWarrants(final ArrestWarrant arrestWarrant) {
        final long timestamp = arrestWarrant.getTimestamp();
        if (timestamp + 30 * MathHelper.MILLISECONDS_IN_ONE_DAY < System.currentTimeMillis()) {
          arrestWarrants.removeByName(arrestWarrant.getCriminal());
          return true;
        }

        return false;
      }
     

      public void handleEscapeMessages(final ArrestWarrant arrestWarrant) {
        if (arrestWarrant.isStarted()) {
          // Notify player that his sentences is starting again because he tried to escape by logging out
          player.sendPrivateText("Although you already spent some "
              + "time in jail, your sentence has been restarted "
              + "because of your failed escape attempt.");
        } else {
          // Jail player who was offline at the time /jail was issued.
          arrestWarrant.setStarted();
        }
      }
    });
  }
View Full Code Here

Examples of games.stendhal.server.entity.mapstuff.office.ArrestWarrant

  protected void perform(final Player player, final RPAction action) {
    final Jail jail = SingletonRepository.getJail();
    final String playerName = action.get(TARGET);
   
    if (playerName != null) {
      final ArrestWarrant warrant = jail.getWarrant(playerName);
     
      if (warrant != null) {
        player.sendPrivateText(warrant.getCriminal() + ": "
            + warrant.getMinutes() + " Minutes because: "
            + warrant.getReason());
      } else {
        player.sendPrivateText(playerName + " is not in jail");
      }
    } else {
      player.sendPrivateText(jail.listJailed());
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.