Search in sources :

Example 1 with UnauthorizedClientActionException

use of io.xol.chunkstories.api.exceptions.UnauthorizedClientActionException in project chunkstories-api by Hugobros3.

the class EntityComponentController method setController.

public void setController(Controller controller) {
    // Checks we are entitled to do this
    if (!(entity.getWorld() instanceof WorldMaster))
        throw new UnauthorizedClientActionException("setController()");
    Controller formerController = this.controller;
    this.controller = controller;
    // Tell the new controller he his
    if (controller != null)
        pushComponent(controller);
    // Tell the former one he's no longer
    if (formerController != null && (controller == null || !controller.equals(formerController)))
        pushComponent(formerController);
}
Also used : UnauthorizedClientActionException(io.xol.chunkstories.api.exceptions.UnauthorizedClientActionException) Controller(io.xol.chunkstories.api.entity.Controller) WorldMaster(io.xol.chunkstories.api.world.WorldMaster)

Aggregations

Controller (io.xol.chunkstories.api.entity.Controller)1 UnauthorizedClientActionException (io.xol.chunkstories.api.exceptions.UnauthorizedClientActionException)1 WorldMaster (io.xol.chunkstories.api.world.WorldMaster)1