Bukkit and CanaryMod links corrected. jslint.
The bukkit link was broken, btw.
This commit is contained in:
parent
051ccc0c6d
commit
baac1cbe3f
1 changed files with 31 additions and 22 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
'use strict';
|
||||||
|
/*global Packages, __plugin, command, echo, isOp, org */
|
||||||
|
/*jslint nomen: true, indent: 2 */
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
## Spawn Plugin
|
## Spawn Plugin
|
||||||
|
|
||||||
|
@ -12,19 +15,24 @@ Allows in-game operators to easily spawn creatures at current location.
|
||||||
This command supports TAB completion so to see a list of possible
|
This command supports TAB completion so to see a list of possible
|
||||||
entitities, type `/jsp spawn ' at the in-game command prompt, then
|
entitities, type `/jsp spawn ' at the in-game command prompt, then
|
||||||
press TAB. Visit
|
press TAB. Visit
|
||||||
<http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/EntityType.html>
|
<https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/EntityType.html> (CanaryMod)
|
||||||
|
or <http://docs.visualillusionsent.net/CanaryLib/1.0.0/net/canarymod/api/entity/EntityType.html> (Bukkit)
|
||||||
|
|
||||||
for a list of possible entities (creatures) which can be spawned.
|
for a list of possible entities (creatures) which can be spawned.
|
||||||
|
|
||||||
***/
|
***/
|
||||||
var entities = [];
|
var entities = [],
|
||||||
var entityType = null;
|
entityType = null,
|
||||||
if (__plugin.canary){
|
entitytypes,
|
||||||
entityType = Packages.net.canarymod.api.entity.EntityType;
|
t;
|
||||||
}else {
|
if (__plugin.bukkit) {
|
||||||
entityType = org.bukkit.entity.EntityType;
|
entityType = org.bukkit.entity.EntityType;
|
||||||
}
|
}
|
||||||
var entitytypes = entityType.values();
|
if (__plugin.canary) {
|
||||||
for ( var t in entitytypes ) {
|
entityType = Packages.net.canarymod.api.entity.EntityType;
|
||||||
|
}
|
||||||
|
entitytypes = entityType.values();
|
||||||
|
for (t in entitytypes) {
|
||||||
if (entitytypes[t] && entitytypes[t].ordinal) {
|
if (entitytypes[t] && entitytypes[t].ordinal) {
|
||||||
entities.push(entitytypes[t].name());
|
entities.push(entitytypes[t].name());
|
||||||
}
|
}
|
||||||
|
@ -40,13 +48,14 @@ command( 'spawn', function( parameters, sender ) {
|
||||||
echo(sender, 'You have no location. This command only works in-game.');
|
echo(sender, 'You have no location. This command only works in-game.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var world = location.world || sender.world;
|
var world = location.world || sender.world,
|
||||||
var type = ('' + parameters[0]).toUpperCase();
|
type = ('' + parameters[0]).toUpperCase();
|
||||||
if (__plugin.bukkit) {
|
if (__plugin.bukkit) {
|
||||||
world.spawnEntity(location, entityType[type]);
|
world.spawnEntity(location, entityType[type]);
|
||||||
} else {
|
}
|
||||||
var Canary = Packages.net.canarymod.Canary;
|
if (__plugin.canary) {
|
||||||
var entity = Canary.factory().entityFactory.newEntity(entityType[type], location);
|
var Canary = Packages.net.canarymod.Canary,
|
||||||
|
entity = Canary.factory().entityFactory.newEntity(entityType[type], location);
|
||||||
entity.spawn();
|
entity.spawn();
|
||||||
}
|
}
|
||||||
}, entities);
|
}, entities);
|
||||||
|
|
Reference in a new issue