ClickEvent .java

net.minecraft.event.ClickEvent (class): members: getValueByCanonicalName, shouldAllowInChat, getCanonicalName, allowedInChat, canonicalName, nameMapping.

net.minecraft.eventclass125 linescommon3.2 KB

API Surface (8)

ClickEvent.Action getAction()
String getValue()
boolean equals(Object p_equals_1_)
String toString()
int hashCode()
boolean shouldAllowInChat()
String getCanonicalName()
ClickEvent.Action getValueByCanonicalName(String canonicalNameIn)

Fields & Constants (6)

nameMapping
action
value
i
allowedInChat
canonicalName

String literals (8)

"ClickEvent{action="
", value=\'"
"open_url"
"open_file"
"run_command"
"twitch_user_info"
"suggest_command"
"change_page"

Same Package (1)

Full Source

ClickEvent.java125 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.event;
2
3
import com.google.common.collect.Maps;
4
import java.util.Map;
5
6
public class ClickEvent
7
{
8
    private final ClickEvent.Action action;
9
    private final String value;
10
11
    public ClickEvent(ClickEvent.Action theAction, String theValue)
12
    {
13
        this.action = theAction;
14
        this.value = theValue;
15
    }
16
17
    /**
18
     * Gets the action to perform when this event is raised.
19
     */
20
    public ClickEvent.Action getAction()
21
    {
22
        return this.action;
23
    }
24
25
    /**
26
     * Gets the value to perform the action on when this event is raised.  For example, if the action is "open URL",
27
     * this would be the URL to open.
28
     */
29
    public String getValue()
30
    {
31
        return this.value;
32
    }
33
34
    public boolean equals(Object p_equals_1_)
35
    {
36
        if (this == p_equals_1_)
37
        {
38
            return true;
39
        }
40
        else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass())
41
        {
42
            ClickEvent clickevent = (ClickEvent)p_equals_1_;
43
44
            if (this.action != clickevent.action)
45
            {
46
                return false;
47
            }
48
            else
49
            {
50
                if (this.value != null)
51
                {
52
                    if (!this.value.equals(clickevent.value))
53
                    {
54
                        return false;
55
                    }
56
                }
57
                else if (clickevent.value != null)
58
                {
59
                    return false;
60
                }
61
62
                return true;
63
            }
64
        }
65
        else
66
        {
67
            return false;
68
        }
69
    }
70
71
    public String toString()
72
    {
73
        return "ClickEvent{action=" + this.action + ", value=\'" + this.value + '\'' + '}';
74
    }
75
76
    public int hashCode()
77
    {
78
        int i = this.action.hashCode();
79
        i = 31 * i + (this.value != null ? this.value.hashCode() : 0);
80
        return i;
81
    }
82
83
    public static enum Action
84
    {
85
        OPEN_URL("open_url", true),
86
        OPEN_FILE("open_file", false),
87
        RUN_COMMAND("run_command", true),
88
        TWITCH_USER_INFO("twitch_user_info", false),
89
        SUGGEST_COMMAND("suggest_command", true),
90
        CHANGE_PAGE("change_page", true);
91
92
        private static final Map<String, ClickEvent.Action> nameMapping = Maps.<String, ClickEvent.Action>newHashMap();
93
        private final boolean allowedInChat;
94
        private final String canonicalName;
95
96
        private Action(String canonicalNameIn, boolean allowedInChatIn)
97
        {
98
            this.canonicalName = canonicalNameIn;
99
            this.allowedInChat = allowedInChatIn;
100
        }
101
102
        public boolean shouldAllowInChat()
103
        {
104
            return this.allowedInChat;
105
        }
106
107
        public String getCanonicalName()
108
        {
109
            return this.canonicalName;
110
        }
111
112
        public static ClickEvent.Action getValueByCanonicalName(String canonicalNameIn)
113
        {
114
            return (ClickEvent.Action)nameMapping.get(canonicalNameIn);
115
        }
116
117
        static {
118
            for (ClickEvent.Action clickevent$action : values())
119
            {
120
                nameMapping.put(clickevent$action.getCanonicalName(), clickevent$action);
121
            }
122
        }
123
    }
124
}
125

Deobfuscated MCP 1.8.9 source of ClickEvent from Marcelektro/MavenMCP-1.8.9 (net/minecraft/event/ClickEvent.java), stored verbatim.