-
Notifications
You must be signed in to change notification settings - Fork 2
/
Event.h
102 lines (102 loc) · 3.1 KB
/
Event.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#pragma once
#include <string>
#include <unordered_map>
using std::string;
using std::unordered_map;
enum class Event {
onConsoleInput,
onConsoleOutput,
onSelectForm,
onUseItem,
onPlaceBlock,
onDestroyBlock,
onOpenChest,
onOpenBarrel,
onCloseChest,
onCloseBarrel,
onContainerChange,
onChangeDimension,
onMobDie,
onMobHurt,
onRespawn,
onChat,
onInputText,
onCommandBlockUpdate,
onInputCommand,
onCommandBlockPerform,
onPlyaerJoin,
onPlyaerLeft,
onPlayerAttack,
onLevelExplode,
onSetArmor,
onFallBlockTransform,
onUseRespawnAnchorBlock,
onScoreChanged,
onMove,
onPistonPush
};
static Event toEvent(const string& s) {
const static unordered_map<string, Event> events{
{u8"后台输入",Event::onConsoleInput},
{u8"后台输出",Event::onConsoleOutput},
{u8"选择表单",Event::onSelectForm},
{u8"使用物品",Event::onUseItem},
{u8"放置方块",Event::onPlaceBlock},
{u8"破坏方块",Event::onDestroyBlock},
{u8"打开箱子",Event::onOpenChest},
{u8"打开木桶",Event::onOpenBarrel},
{u8"关闭箱子",Event::onCloseChest},
{u8"关闭木桶",Event::onCloseBarrel},
{u8"放入取出",Event::onContainerChange},
{u8"切换维度",Event::onChangeDimension},
{u8"生物死亡",Event::onMobDie},
{u8"生物受伤",Event::onMobHurt},
{u8"玩家重生",Event::onRespawn},
{u8"聊天消息",Event::onChat},
{u8"输入文本",Event::onInputText},
{u8"更新命令方块",Event::onCommandBlockUpdate},
{u8"输入指令",Event::onInputCommand},
{u8"命令方块执行",Event::onCommandBlockPerform},
{u8"加入游戏",Event::onPlyaerJoin},
{u8"离开游戏",Event::onPlyaerLeft},
{u8"玩家攻击",Event::onPlayerAttack},
{u8"世界爆炸",Event::onLevelExplode},
{u8"玩家穿戴",Event::onSetArmor},
{u8"耕地破坏",Event::onFallBlockTransform},
{u8"使用重生锚",Event::onUseRespawnAnchorBlock},
{u8"计分板改变",Event::onScoreChanged},
{u8"玩家移动",Event::onMove},
{u8"活塞推动",Event::onPistonPush},
{u8"onConsoleInput",Event::onConsoleInput},
{u8"onConsoleOutput",Event::onConsoleOutput},
{u8"onSelectForm",Event::onSelectForm},
{u8"onUseItem",Event::onUseItem},
{u8"onPlaceBlock",Event::onPlaceBlock},
{u8"onDestroyBlock",Event::onDestroyBlock},
{u8"onOpenChest",Event::onOpenChest},
{u8"onOpenBarrel",Event::onOpenBarrel},
{u8"onCloseChest",Event::onCloseChest},
{u8"onCloseBarrel",Event::onCloseBarrel},
{u8"onContainerChange",Event::onContainerChange},
{u8"onChangeDimension",Event::onChangeDimension},
{u8"onMobDie",Event::onMobDie},
{u8"onMobHurt",Event::onMobHurt},
{u8"onRespawn",Event::onRespawn},
{u8"onChat",Event::onChat},
{u8"onInputText",Event::onInputText},
{u8"onCommandBlockUpdate",Event::onCommandBlockUpdate},
{u8"onInputCommand",Event::onInputCommand},
{u8"onCommandBlockPerform",Event::onCommandBlockPerform},
{u8"onPlyaerJoin",Event::onPlyaerJoin},
{u8"onPlyaerLeft",Event::onPlyaerLeft},
{u8"onPlayerAttack",Event::onPlayerAttack},
{u8"onLevelExplode",Event::onLevelExplode},
{u8"onSetArmor",Event::onSetArmor},
{u8"onFallBlockTransform",Event::onFallBlockTransform},
{u8"onUseRespawnAnchorBlock",Event::onUseRespawnAnchorBlock},
{u8"onScoreChanged",Event::onScoreChanged},
{u8"onMove",Event::onMove},
{u8"onPistonPush",Event::onPistonPush}
};
return events.at(s);
}