@@ -21,23 +21,12 @@ or <http://docs.visualillusionsent.net/CanaryLib/1.0.0/net/canarymod/api/entity/
2121for a list of possible entities (creatures) which can be spawned.
2222
2323***/
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 ) ;
3029}
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-
4130command ( 'spawn' , function ( parameters , sender ) {
4231 if ( ! isOp ( sender ) ) {
4332 echo ( sender , 'Only operators can perform this command' ) ;
@@ -48,14 +37,6 @@ command('spawn', function (parameters, sender) {
4837 echo ( sender , 'You have no location. This command only works in-game.' ) ;
4938 return ;
5039 }
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