@@ -21,23 +21,12 @@ or <http://docs.visualillusionsent.net/CanaryLib/1.0.0/net/canarymod/api/entity/
21
21
for a list of possible entities (creatures) which can be spawned.
22
22
23
23
***/
24
- var entities = [ ] ,
25
- entityType = null ,
26
- entitytypes ,
27
- t ;
28
- if ( __plugin . bukkit ) {
29
- entityType = org . bukkit . entity . EntityType ;
24
+ var entities = require ( 'entities' ) ,
25
+ spawn = require ( 'spawn' ) ;
26
+ var entityNames = [ ] ;
27
+ for ( var name in entities ) {
28
+ entityNames . push ( name ) ;
30
29
}
31
- if ( __plugin . canary ) {
32
- entityType = Packages . net . canarymod . api . entity . EntityType ;
33
- }
34
- entitytypes = entityType . values ( ) ;
35
- for ( t in entitytypes ) {
36
- if ( entitytypes [ t ] && entitytypes [ t ] . ordinal ) {
37
- entities . push ( entitytypes [ t ] . name ( ) ) ;
38
- }
39
- }
40
-
41
30
command ( 'spawn' , function ( parameters , sender ) {
42
31
if ( ! isOp ( sender ) ) {
43
32
echo ( sender , 'Only operators can perform this command' ) ;
@@ -48,14 +37,6 @@ command('spawn', function (parameters, sender) {
48
37
echo ( sender , 'You have no location. This command only works in-game.' ) ;
49
38
return ;
50
39
}
51
- var world = location . world || sender . world ,
52
- type = ( '' + parameters [ 0 ] ) . toUpperCase ( ) ;
53
- if ( __plugin . bukkit ) {
54
- world . spawnEntity ( location , entityType [ type ] ) ;
55
- }
56
- if ( __plugin . canary ) {
57
- var Canary = Packages . net . canarymod . Canary ,
58
- entity = Canary . factory ( ) . entityFactory . newEntity ( entityType [ type ] , location ) ;
59
- entity . spawn ( ) ;
60
- }
61
- } , entities ) ;
40
+ var name = ( '' + parameters [ 0 ] ) . toUpperCase ( ) ;
41
+ spawn ( name , sender . location ) ;
42
+ } , entityNames ) ;
0 commit comments