From 17ffca41e783e8d5e0975fd63f0de7cff6e0c551 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 10 Jul 2008 13:19:52 +0000 Subject: [PATCH] Enforce the use of Game{Controller|Manager}Delegates where needed. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@654 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../threerings/parlor/game/client/GameController.java | 10 ++++++++++ .../com/threerings/parlor/game/server/GameManager.java | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/src/java/com/threerings/parlor/game/client/GameController.java b/src/java/com/threerings/parlor/game/client/GameController.java index 690467c3..a543e206 100644 --- a/src/java/com/threerings/parlor/game/client/GameController.java +++ b/src/java/com/threerings/parlor/game/client/GameController.java @@ -296,6 +296,16 @@ public abstract class GameController extends PlaceController }); } + @Override // from PlaceController + protected void ratifyDelegate (PlaceControllerDelegate delegate) + { + super.ratifyDelegate(delegate); + if (!(delegate instanceof GameControllerDelegate)) { + throw new IllegalArgumentException( + "Must provide GameController with GameControllerDelegate"); + } + } + /** A reference to the active parlor context. */ protected ParlorContext _ctx; diff --git a/src/java/com/threerings/parlor/game/server/GameManager.java b/src/java/com/threerings/parlor/game/server/GameManager.java index 51648a88..c1c66498 100644 --- a/src/java/com/threerings/parlor/game/server/GameManager.java +++ b/src/java/com/threerings/parlor/game/server/GameManager.java @@ -1283,6 +1283,15 @@ public class GameManager extends PlaceManager // nothing for now } + @Override // from PlaceManager + protected void ratifyDelegate (PlaceManagerDelegate delegate) + { + super.ratifyDelegate(delegate); + if (!(delegate instanceof GameManagerDelegate)) { + throw new IllegalArgumentException("Must provide GameManager with GameManagerDelegate"); + } + } + /** Listens for game state changes. */ protected AttributeChangeListener _stateListener = new AttributeChangeListener() { public void attributeChanged (AttributeChangedEvent event) {