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.meta;
019
020import javax.annotation.concurrent.NotThreadSafe;
021
022/**
023 * This even occurs when the player hovers the mouse over the chat message
024 *
025 * @author The TridentSDK Team
026 * @since 0.3-alpha-DP
027 */
028@NotThreadSafe
029public class HoverEvent {
030    private HoverAction action;
031    private String value;
032
033    /**
034     * Sets the action associated with the player hovers over the chat
035     *
036     * @param action the action to occur
037     * @return the instance of the event
038     */
039    public HoverEvent action(HoverAction action) {
040        this.action = action;
041
042        return this;
043    }
044
045    /**
046     * Sets the value associated with the player hovers over the chat
047     *
048     * @param value the action to occur
049     * @return the instance of the event
050     */
051    public HoverEvent value(String value) {
052        this.value = value;
053
054        return this;
055    }
056
057    /**
058     * Gets the action that occurs when the player hovers over the chat
059     *
060     * @return the action that occurs when the chat is hovered
061     */
062    public HoverAction action() {
063        return action;
064    }
065
066    /**
067     * Gets the value of the event player hovers over the chat
068     *
069     * @return the value of the event that occurs when the chat is hovered
070     */
071    public String value() {
072        return value;
073    }
074
075    /**
076     * An action that occurs when the player hovers over the chat message
077     *
078     * @author The TridentSDK Team
079     * @since 0.3-alpha-DP
080     */
081    public enum HoverAction {
082        SHOW_TEXT,
083        SHOW_ACHIEVEMENT,
084        SHOW_ITEM;
085
086        @Override
087        public String toString() {
088            return super.toString().toLowerCase();
089        }
090    }
091}