-
Notifications
You must be signed in to change notification settings - Fork 0
/
PickaxeEffects.php
202 lines (194 loc) · 6.21 KB
/
PickaxeEffects.php
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?php
/*
__PocketMine Plugin__
name=PickaxeEffects
description=adds effects to the pickaxe
version=1
author=Swagboy 47
class=WhatEever
apiversion=11,12
*/
class WhatEever implements Plugin{
private $api;
private $pickaxe = true;
private $kind = 278;
private $effect = 1;
private $explosion = 3;
public function __construct(ServerAPI $api, $server = false){
$this->api = $api;
}
public function init(){
$this->api->console->register("Pickaxe", "pickaxe commands", array($this, "commandHandler"));
$this->api->event("player.block.touch", array($this, "pickaxe"));
$this->api->addHandler("entity.health.change", array($this, "damage"));
}
public function commandHandler($cmd, $params, $issuer){
switch(strtolower($cmd)){
case "Pickaxe":
if($params[0] == "enable"){
if($this->pickaxe === true){
$issuer->sendChat("[Pickaxe] Pickaxe is already enabled!");
}
if($this->pickaxe === false){
$issuer->sendChat("[Pickaxe] Pickaxe is enabled!");
$this->pickaxe = true;
}
}
if($params[0] == "disable"){
if($this->pickaxe === false){
$issuer->sendChat("[Pickaxe] Pickaxe is already disabled!");
}
if($this->pickaxe === true){
$issuer->sendChat("[Pickaxe] Pickaxe is now disabled!");
$this->pickaxe = false;
}
}
if($params[0] === "kind"){
if($params[1] === "diamond"){
if($this->kind === 278){
$issuer->sendChat("[Pickaxe] Pickaxe is already set diamond!");
}
if($this->kind === 257){
$issuer->sendChat("[Pickaxe] Pickaxe is set to diamond");
$this->kind = 278;
}
if($this->kind === 270){
$issuer->sendChat("[Pickaxe] Pickaxe is set to diamond");
$this->kind = 278;
}
if($this->kind === 274){
$issuer->sendChat("[Pickaxe] Pickaxe is set to diamond");
$this->kind = 278;
}
if($this->kind === 285){
$issuer->sendChat("[Pickaxe] Pickaxe is set to diamond");
$this->kind = 278;
}
}
if($params[1] === "iron"){
if($this->kind === 257){
$issuer->sendChat("[Pickaxe] Pickaxe is already set iron!");
}
if($this->kind === 278){
$issuer->sendChat("[Pickaxe] Pickaxe is set to iron!");
$this->kind = 257;
}
if($this->kind === 270){
$issuer->sendChat("[Pickaxe] Pickaxe is set to iron!");
$this->kind = 257;
}
if($this->kind === 274){
$issuer->sendChat("[Pickaxe] Pickaxe is set to iron!");
$this->kind = 257;
}
if($this->kind === 285){
$issuer->sendChat("[Pickaxe] Pickaxe is set to iron!");
$this->kind = 257;
}
}
if($params[1] == "gold"){
if($this->kind === 285){
$issuer->sendChat("[Pickaxe] Pickaxe is already set gold!");
}
if($this->kind === 257){
$issuer->sendChat("[Pickaxe] Pickaxe is set to gold!");
$this->kind = 285;
}
if($this->kind === 270){
$issuer->sendChat("[Pickaxe] Pickaxe is set to gold!");
$this->kind = 285;
}
if($this->kind === 274){
$issuer->sendChat("[Pickaxe] Pickaxe is set to gold!");
$this->kind = 285;
}
if($this->kind === 278){
$issuer->sendChat("[Pickaxe] Pickaxe is set to gold!");
$this->kind = 285;
}
}
if($params[1] == "wood"){
if($this->kind === 270){
$issuer->sendChat("[Pickaxe] Pickaxe is already set wood!");
}
if($this->kind === 285){
$issuer->sendChat("[Pickaxe] Pickaxe is set to wood!");
$this->kind = 270;
}
if($this->kind === 278){
$issuer->sendChat("[Pickaxe] Pickaxe is set to wood!");
$this->kind = 270;
}
if($this->kind === 274){
$issuer->sendChat("[Pickaxe] Pickaxe is set to wood!");
$this->kind = 270;
}
if($this->kind === 285){
$issuer->sendChat("[Pickaxe] Pickaxe is set to wood!");
$this->kind = 270;
}
}
if($params[1] == "stone"){
if($this->kind === 274){
$issuer->sendChat("[Pickaxe] Pickaxe is already set wood!");
}
if($this->kind === 278){
$issuer->sendChat("[Pickaxe] Pickaxe is set to wood!");
$this->kind = 274;
}
if($this->kind === 257){
$issuer->sendChat("[Pickaxe] Pickaxe is set to wood!");
$this->kind = 274;
}
if($this->kind === 270){
$issuer->sendChat("[Pickaxe] Pickaxe is set to wood!");
$this->kind = 274;
}
if($this->kind === 285){
$issuer->sendChat("[Pickaxe] Pickaxe is set to wood!");
$this->kind = 274;
}
}
}
if($params[0] === "effect"){
if($params[1] === "explosion"){
if($this->effect === 1){
$issuer->sendChat("[Pickaxe] Pickaxe effect is already set to explosion!");
}
if($this->effect === 2){
$issuer->sendChat("[Pickaxe] Pickaxe effect is set to explosion!");
$this->effect === 1;
}
}
if($params[1] === "smelt"){
if($this->effect === 1){
$issuer->sendChat("[Pickaxe] Pickaxe effect is already set to smelt!");
}
if($this->effect === 2){
$issuer->sendChat("[Pickaxe] Pickaxe effect is set to smelt!");
$this->effect === smelting;
}
}
}
if($params[0] === "explosion"){
$this->explosion === $params[1];
$issuer->sendChat("[Pickaxe]explosion size" . $params[1]);
}
}
}
public function pickaxe($data, $event){
if($this->pickaxe === true and $this->effect === 2 and $this->kind === $data["item"]->getID()){
(new Explosion($data["target"], $this->explosion))->explode();
}
}
public function damage($data, $event){
if($data["entity"]->class === ENTITY_PLAYER){
$player = $data["entity"]->player;
if($data["cause"] === "explosion"){
return false;
}
}
}
public function __destruct(){
}
}