10
10
import org .bukkit .entity .*;
11
11
12
12
//Todo: Fix this up
13
+ //Todo: now overlaps some functions of killall, which should be deprecated and removed once all functions are covered
13
14
public class Commandremove extends EssentialsCommand
14
15
{
15
16
public Commandremove ()
@@ -60,7 +61,6 @@ protected void run(final Server server, final User user, final String commandLab
60
61
throw new NotEnoughArgumentsException (ee ); //TODO: translate and list types
61
62
}
62
63
}
63
-
64
64
removeEntities (user .getSource (), world , toRemove , radius );
65
65
}
66
66
@@ -110,6 +110,7 @@ private void removeEntities(final CommandSource sender, final World world, final
110
110
continue ;
111
111
}
112
112
}
113
+ //TODO: this would probably be better as a case statement instead of all the ifs
113
114
if (toRemove == ToRemove .DROPS )
114
115
{
115
116
if (e instanceof Item )
@@ -174,6 +175,51 @@ else if (toRemove == ToRemove.ENDERCRYSTALS)
174
175
removed ++;
175
176
}
176
177
}
178
+ else if (toRemove == ToRemove .AMBIENT )
179
+ {
180
+ if (e instanceof Flying )
181
+ {
182
+ e .remove ();
183
+ removed ++;
184
+ }
185
+ }
186
+ else if (toRemove == ToRemove .HOSTILE || toRemove == ToRemove .MONSTERS )
187
+ {
188
+ if (e instanceof Monster || e instanceof ComplexLivingEntity || e instanceof Flying || e instanceof Slime )
189
+ {
190
+ e .remove ();
191
+ removed ++;
192
+ }
193
+ }
194
+ else if (toRemove == ToRemove .PASSIVE || toRemove == ToRemove .ANIMALS )
195
+ {
196
+ if (e instanceof Animals || e instanceof NPC || e instanceof Snowman || e instanceof WaterMob )
197
+ {
198
+ e .remove ();
199
+ removed ++;
200
+ }
201
+ }
202
+ else if (toRemove == ToRemove .MOBS )
203
+ {
204
+ if (e instanceof Animals || e instanceof NPC || e instanceof Snowman || e instanceof WaterMob
205
+ || e instanceof Monster || e instanceof ComplexLivingEntity || e instanceof Flying || e instanceof Slime )
206
+ {
207
+ e .remove ();
208
+ removed ++;
209
+ }
210
+ }
211
+ else if (toRemove == ToRemove .ENTITIES )
212
+ {
213
+ if (e instanceof Entity )
214
+ {
215
+ if (e instanceof HumanEntity )
216
+ {
217
+ continue ;
218
+ }
219
+ e .remove ();
220
+ removed ++;
221
+ }
222
+ }
177
223
}
178
224
}
179
225
sender .sendMessage (_ ("removed" , removed ));
@@ -189,6 +235,13 @@ private enum ToRemove
189
235
XP ,
190
236
PAINTINGS ,
191
237
ITEMFRAMES ,
192
- ENDERCRYSTALS
238
+ ENDERCRYSTALS ,
239
+ HOSTILE ,
240
+ MONSTERS ,
241
+ PASSIVE ,
242
+ ANIMALS ,
243
+ AMBIENT ,
244
+ MOBS ,
245
+ ENTITIES
193
246
}
194
247
}
0 commit comments