001/*
002 * Trident - A Multithreaded Server Alternative
003 * Copyright 2014 The TridentSDK Team
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *    http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package net.tridentsdk.plugin.cmd;
019
020import net.tridentsdk.Console;
021import net.tridentsdk.entity.living.Player;
022import net.tridentsdk.plugin.annotation.CommandDesc;
023
024/**
025 * Overriden by the command handler, annotated with {@link CommandDesc} to
026 * process executed commands
027 *
028 * @author The TridentSDK Team
029 * @since 0.3-alpha-DP
030 */
031public abstract class Command {
032    /**
033     * Called when this cmd is invoked by a player
034     *
035     * @param player    player executing the command
036     * @param arguments may be null
037     * @param alias     the alias of the command
038     */
039    public void handlePlayer(Player player, String arguments, String alias) {
040        // Method intentionally left blank
041    }
042
043    /**
044     * Called when this cmd is invoked by the console
045     *
046     * @param sender    the command sender
047     * @param arguments may be null
048     * @param alias     the alias for the command
049     */
050    public void handleConsole(Console sender, String arguments, String alias) {
051        // Method intentionally left blank
052    }
053
054    /**
055     * Called when this cmd is invoked by a player, console, or other sender
056     *
057     * @param sender    the command sender
058     * @param arguments may be null
059     * @param alias     the command alias
060     */
061    public void handle(CommandIssuer sender, String arguments, String alias) {
062        // Method intentionally left blank
063    }
064
065    /**
066     * Called if this cmd is overriden by another
067     */
068    public void notifyOverriden() {
069        // Method intentionally left blank
070    }
071}