Removed underscore from source (it's downloaded) and fixed spawn plugin.

This commit is contained in:
walterhiggins 2014-01-29 23:11:40 +00:00
parent 7ab34980e4
commit 621245adac
4 changed files with 32 additions and 1327 deletions

View file

@ -17,12 +17,14 @@
<mkdir dir="${build}"/> <mkdir dir="${build}"/>
<available file="${minecraft.dir}" property="minecraft.present"/> <available file="${minecraft.dir}" property="minecraft.present"/>
<available file="${dist}/js/modules/underscore.js" property="underscore.present"/>
</target> </target>
<target name="test" depends="package" description="Perform unit tests"> <target name="test" depends="package" description="Perform unit tests">
</target> </target>
<target name="server-setup" depends="init" description="Downloads the latest bukkit dev jar" <target name="server-setup" depends="init" description="Downloads the latest bukkit dev jar"
unless="minecraft.present"> unless="minecraft.present">
<mkdir dir="${minecraft.dir}" /> <mkdir dir="${minecraft.dir}" />
@ -131,26 +133,39 @@ Walter Higgins
<target name="zip_js" depends="zip_lib, zip_modules, zip_plugins"> <target name="zip_js" depends="zip_lib, zip_modules, zip_plugins">
</target> </target>
<target name="zip_lib" depends="init"> <target name="copy_js" depends="init">
<copy todir="${dist}/js">
<fileset dir="src/main/js"/>
</copy>
</target>
<target name="zip_lib" depends="copy_js">
<delete file="${build}/lib.zip"/> <delete file="${build}/lib.zip"/>
<zip destfile="${build}/lib.zip" <zip destfile="${build}/lib.zip"
basedir="./src/main/js" basedir="${dist}/js"
excludes="modules/**, plugins/**,"> excludes="modules/**, plugins/**,">
</zip> </zip>
</target> </target>
<target name="zip_modules" depends="init"> <target name="get_underscore" depends="copy_js" unless="underscore.present">
<!-- download underscore -->
<get src="http://underscorejs.org/underscore.js"
verbose="true"
dest="${dist}/js/modules/underscore.js"/>
</target>
<target name="zip_modules" depends="copy_js, get_underscore">
<delete file="${build}/modules.zip"/> <delete file="${build}/modules.zip"/>
<zip destfile="${build}/modules.zip" <zip destfile="${build}/modules.zip"
basedir="./src/main/js" basedir="${dist}/js"
excludes="lib/**, plugins/**,"> excludes="lib/**, plugins/**,">
</zip> </zip>
</target> </target>
<target name="zip_plugins" depends="init"> <target name="zip_plugins" depends="copy_js">
<delete file="${build}/plugins.zip"/> <delete file="${build}/plugins.zip"/>
<zip destfile="${build}/plugins.zip" <zip destfile="${build}/plugins.zip"
basedir="./src/main/js" basedir="${dist}/js"
excludes="lib/**, modules/**"> excludes="lib/**, modules/**">
</zip> </zip>
</target> </target>
@ -169,6 +184,7 @@ Walter Higgins
<mkdir dir="${dist}/${DSTAMP}" /> <mkdir dir="${dist}/${DSTAMP}" />
<jar jarfile="${dist}/${DSTAMP}/scriptcraft.jar" basedir="${build}"/> <jar jarfile="${dist}/${DSTAMP}/scriptcraft.jar" basedir="${build}"/>
<copy file="${dist}/${DSTAMP}/scriptcraft.jar" tofile="${dist}/scriptcraft.jar"/>
</target> </target>
<target name="clean" description="clean up" > <target name="clean" description="clean up" >

View file

@ -1,4 +0,0 @@
{
name: 'underscore',
main: './underscore.js'
}

File diff suppressed because it is too large Load diff

View file

@ -19,9 +19,12 @@ for a list of possible entities (creatures) which can be spawned.
var entities = [], var entities = [],
EntityType = org.bukkit.entity.EntityType; EntityType = org.bukkit.entity.EntityType;
for ( var t in EntityType ) { var MaterialEnum = Packages.MaterialEnum;
if ( EntityType[t] && EntityType[t].ordinal ) {
entities.push(t); var entitytypes = EntityType.values();
for ( var t in entitytypes ) {
if ( entitytypes[t] && entitytypes[t].ordinal ) {
entities.push(entitytypes[t].name());
} }
} }
command( 'spawn', function( parameters, sender ) { command( 'spawn', function( parameters, sender ) {
@ -30,6 +33,10 @@ command( 'spawn', function( parameters, sender ) {
return; return;
} }
var location = sender.location; var location = sender.location;
if ( !location ) {
sender.sendMessage( 'You have no location. This command only works in-game.' );
return;
}
var world = location.world; var world = location.world;
var type = ('' + parameters[0]).toUpperCase(); var type = ('' + parameters[0]).toUpperCase();
world.spawnEntity( location, EntityType[type] ); world.spawnEntity( location, EntityType[type] );