# TourneyManager (vilya 1.3 API)
Date: 2011-04-06

## com.threerings.parlor.tourney.server
Class TourneyManager

    java.lang.Object
      com.threerings.parlor.tourney.server.TourneyManager

All Implemented Interfaces:
  TourneyCodes, TourneyProvider, com.threerings.presents.data.InvocationCodes, com.threerings.presents.server.InvocationProvider

    public abstract class TourneyManager

extends Object
implements TourneyProvider, TourneyCodes

Controls a running tourney.

Field Summary

Fields inherited from interface com.threerings.parlor.tourney.data.TourneyCodes
`ALREADY_IN_PROGRESS, ALREADY_IN_TOURNEY, CANCELLED, FAILED_ENTRY_FEE, HAS_PLAYERS, NOT_IN_TOURNEY, TOO_LATE, TOO_LATE_LEAVE`

Fields inherited from interface com.threerings.presents.data.InvocationCodes
`ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR`

Constructor Summary
`TourneyManager()`

Method Summary
`void` `cancel(com.threerings.presents.data.ClientObject caller, com.threerings.presents.client.InvocationService.ConfirmListener listener)` Handles a `TourneyService.cancel(com.threerings.presents.client.InvocationService.ConfirmListener)` request.
`void` `cancelTourney(String cause)` Cancel the tourney, return entry fees to all participants.
`int` `init(TourneyConfig config, Comparable<?> key)` Initializes this tourney manager and prepares it for operation.
`boolean` `isFinished()` Returns true if the tourney is finished.
`boolean` `isPaused()` Returns true if the tourney is paused.
`boolean` `isPending()` Returns true if the tourney is pending.
`boolean` `isRunning()` Returns true if the tourney is running.
`void` `join(com.threerings.presents.data.ClientObject caller, com.threerings.presents.client.InvocationService.ConfirmListener listener)` Handles a `TourneyService.join(com.threerings.presents.client.InvocationService.ConfirmListener)` request.
`void` `leave(com.threerings.presents.data.ClientObject caller, com.threerings.presents.client.InvocationService.ConfirmListener listener)` Handles a `TourneyService.leave(com.threerings.presents.client.InvocationService.ConfirmListener)` request.
`abstract void` `notifyAllParticipants(String msg)`
`boolean` `shouldStart(long now)` Returns true if it is time or past time the tourney starts.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TourneyManager

    public TourneyManager()

Method Detail

### init

    public int init(TourneyConfig config,
                    Comparable<?> key)

  Initializes this tourney manager and prepares it for operation.

  Returns:
    the oid of this manager's tourney object.

### cancel

    public void cancel(com.threerings.presents.data.ClientObject caller,
                       com.threerings.presents.client.InvocationService.ConfirmListener listener)
                throws com.threerings.presents.server.InvocationException

  Description copied from interface: `TourneyProvider`
  Handles a `TourneyService.cancel(com.threerings.presents.client.InvocationService.ConfirmListener)` request.

  Specified by:
    `cancel` in interface `TourneyProvider`
  Throws:
    `com.threerings.presents.server.InvocationException`

### join

    public void join(com.threerings.presents.data.ClientObject caller,
                     com.threerings.presents.client.InvocationService.ConfirmListener listener)
              throws com.threerings.presents.server.InvocationException

  Description copied from interface: `TourneyProvider`
  Handles a `TourneyService.join(com.threerings.presents.client.InvocationService.ConfirmListener)` request.

  Specified by:
    `join` in interface `TourneyProvider`
  Throws:
    `com.threerings.presents.server.InvocationException`

### leave

    public void leave(com.threerings.presents.data.ClientObject caller,
                      com.threerings.presents.client.InvocationService.ConfirmListener listener)
               throws com.threerings.presents.server.InvocationException

  Description copied from interface: `TourneyProvider`
  Handles a `TourneyService.leave(com.threerings.presents.client.InvocationService.ConfirmListener)` request.

  Specified by:
    `leave` in interface `TourneyProvider`
  Throws:
    `com.threerings.presents.server.InvocationException`

### cancelTourney

    public void cancelTourney(String cause)

  Cancel the tourney, return entry fees to all participants.

### isFinished

    public boolean isFinished()

  Returns true if the tourney is finished.

### isPending

    public boolean isPending()

  Returns true if the tourney is pending.

### isRunning

    public boolean isRunning()

  Returns true if the tourney is running.

### isPaused

    public boolean isPaused()

  Returns true if the tourney is paused.

### shouldStart

    public boolean shouldStart(long now)

  Returns true if it is time or past time the tourney starts.

### notifyAllParticipants

    public abstract void notifyAllParticipants(String msg)

Copyright © 2011. All Rights Reserved.