fixes issue #304
This commit is contained in:
parent
b330f06ea4
commit
9f7cdaab08
4 changed files with 486 additions and 12 deletions
|
@ -496,10 +496,12 @@ Walter Higgins
|
|||
* [How to Play](#how-to-play)
|
||||
* [Rules](#rules)
|
||||
* [Gameplay Mechanics](#gameplay-mechanics)
|
||||
* [Items module](#items-module)
|
||||
* [Items module (SpigotMC version)](#items-module-spigotmc-version)
|
||||
* [Usage](#usage-13)
|
||||
* [Entities module](#entities-module)
|
||||
* [Items module (CanaryMod version)](#items-module-canarymod-version)
|
||||
* [Usage](#usage-14)
|
||||
* [Entities module](#entities-module)
|
||||
* [Usage](#usage-15)
|
||||
|
||||
## Modules in Scriptcraft
|
||||
|
||||
|
@ -6285,7 +6287,445 @@ your own mini-game...
|
|||
[bukscore]: http://jd.bukkit.org/beta/apidocs/org/bukkit/scoreboard/package-summary.html
|
||||
|
||||
|
||||
## Items module
|
||||
## Items module (SpigotMC version)
|
||||
The Items module provides a suite of functions - one for each possible item.
|
||||
See https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html for a list of possible items
|
||||
|
||||
### Usage
|
||||
|
||||
items.book(); // returns org.bukkit.Material.BOOK
|
||||
items.book(2); // returns a new org.bukkit.Material object with an amount 2 (2 books)
|
||||
items.book( itemType ); // compares itemType parameter to org.bukkit.Material.BOOK or an Item of type book
|
||||
|
||||
The following functions are provided:
|
||||
|
||||
* acaciaDoor()
|
||||
* acaciaDoorItem()
|
||||
* acaciaFence()
|
||||
* acaciaFenceGate()
|
||||
* acaciaStairs()
|
||||
* activatorRail()
|
||||
* air()
|
||||
* anvil()
|
||||
* apple()
|
||||
* armorStand()
|
||||
* arrow()
|
||||
* bakedPotato()
|
||||
* banner()
|
||||
* barrier()
|
||||
* beacon()
|
||||
* bed()
|
||||
* bedBlock()
|
||||
* bedrock()
|
||||
* beetroot()
|
||||
* beetrootBlock()
|
||||
* beetrootSeeds()
|
||||
* beetrootSoup()
|
||||
* birchDoor()
|
||||
* birchDoorItem()
|
||||
* birchFence()
|
||||
* birchFenceGate()
|
||||
* birchWoodStairs()
|
||||
* blazePowder()
|
||||
* blazeRod()
|
||||
* boat()
|
||||
* boatAcacia()
|
||||
* boatBirch()
|
||||
* boatDarkOak()
|
||||
* boatJungle()
|
||||
* boatSpruce()
|
||||
* bone()
|
||||
* boneBlock()
|
||||
* book()
|
||||
* bookAndQuill()
|
||||
* bookshelf()
|
||||
* bow()
|
||||
* bowl()
|
||||
* bread()
|
||||
* brewingStand()
|
||||
* brewingStandItem()
|
||||
* brick()
|
||||
* brickStairs()
|
||||
* brownMushroom()
|
||||
* bucket()
|
||||
* burningFurnace()
|
||||
* cactus()
|
||||
* cake()
|
||||
* cakeBlock()
|
||||
* carpet()
|
||||
* carrot()
|
||||
* carrotItem()
|
||||
* carrotStick()
|
||||
* cauldron()
|
||||
* cauldronItem()
|
||||
* chainmailBoots()
|
||||
* chainmailChestplate()
|
||||
* chainmailHelmet()
|
||||
* chainmailLeggings()
|
||||
* chest()
|
||||
* chorusFlower()
|
||||
* chorusFruit()
|
||||
* chorusFruitPopped()
|
||||
* chorusPlant()
|
||||
* clay()
|
||||
* clayBall()
|
||||
* clayBrick()
|
||||
* coal()
|
||||
* coalBlock()
|
||||
* coalOre()
|
||||
* cobbleWall()
|
||||
* cobblestone()
|
||||
* cobblestoneStairs()
|
||||
* cocoa()
|
||||
* command()
|
||||
* commandChain()
|
||||
* commandMinecart()
|
||||
* commandRepeating()
|
||||
* compass()
|
||||
* cookedBeef()
|
||||
* cookedChicken()
|
||||
* cookedFish()
|
||||
* cookedMutton()
|
||||
* cookedRabbit()
|
||||
* cookie()
|
||||
* crops()
|
||||
* darkOakDoor()
|
||||
* darkOakDoorItem()
|
||||
* darkOakFence()
|
||||
* darkOakFenceGate()
|
||||
* darkOakStairs()
|
||||
* daylightDetector()
|
||||
* daylightDetectorInverted()
|
||||
* deadBush()
|
||||
* detectorRail()
|
||||
* diamond()
|
||||
* diamondAxe()
|
||||
* diamondBarding()
|
||||
* diamondBlock()
|
||||
* diamondBoots()
|
||||
* diamondChestplate()
|
||||
* diamondHelmet()
|
||||
* diamondHoe()
|
||||
* diamondLeggings()
|
||||
* diamondOre()
|
||||
* diamondPickaxe()
|
||||
* diamondSpade()
|
||||
* diamondSword()
|
||||
* diode()
|
||||
* diodeBlockOff()
|
||||
* diodeBlockOn()
|
||||
* dirt()
|
||||
* dispenser()
|
||||
* doublePlant()
|
||||
* doubleStep()
|
||||
* doubleStoneSlab2()
|
||||
* dragonEgg()
|
||||
* dragonsBreath()
|
||||
* dropper()
|
||||
* egg()
|
||||
* elytra()
|
||||
* emerald()
|
||||
* emeraldBlock()
|
||||
* emeraldOre()
|
||||
* emptyMap()
|
||||
* enchantedBook()
|
||||
* enchantmentTable()
|
||||
* endBricks()
|
||||
* endCrystal()
|
||||
* endGateway()
|
||||
* endRod()
|
||||
* enderChest()
|
||||
* enderPearl()
|
||||
* enderPortal()
|
||||
* enderPortalFrame()
|
||||
* enderStone()
|
||||
* expBottle()
|
||||
* explosiveMinecart()
|
||||
* eyeOfEnder()
|
||||
* feather()
|
||||
* fence()
|
||||
* fenceGate()
|
||||
* fermentedSpiderEye()
|
||||
* fire()
|
||||
* fireball()
|
||||
* firework()
|
||||
* fireworkCharge()
|
||||
* fishingRod()
|
||||
* flint()
|
||||
* flintAndSteel()
|
||||
* flowerPot()
|
||||
* flowerPotItem()
|
||||
* frostedIce()
|
||||
* furnace()
|
||||
* ghastTear()
|
||||
* glass()
|
||||
* glassBottle()
|
||||
* glowingRedstoneOre()
|
||||
* glowstone()
|
||||
* glowstoneDust()
|
||||
* goldAxe()
|
||||
* goldBarding()
|
||||
* goldBlock()
|
||||
* goldBoots()
|
||||
* goldChestplate()
|
||||
* goldHelmet()
|
||||
* goldHoe()
|
||||
* goldIngot()
|
||||
* goldLeggings()
|
||||
* goldNugget()
|
||||
* goldOre()
|
||||
* goldPickaxe()
|
||||
* goldPlate()
|
||||
* goldRecord()
|
||||
* goldSpade()
|
||||
* goldSword()
|
||||
* goldenApple()
|
||||
* goldenCarrot()
|
||||
* grass()
|
||||
* grassPath()
|
||||
* gravel()
|
||||
* greenRecord()
|
||||
* grilledPork()
|
||||
* hardClay()
|
||||
* hayBlock()
|
||||
* hopper()
|
||||
* hopperMinecart()
|
||||
* hugeMushroom1()
|
||||
* hugeMushroom2()
|
||||
* ice()
|
||||
* inkSack()
|
||||
* ironAxe()
|
||||
* ironBarding()
|
||||
* ironBlock()
|
||||
* ironBoots()
|
||||
* ironChestplate()
|
||||
* ironDoor()
|
||||
* ironDoorBlock()
|
||||
* ironFence()
|
||||
* ironHelmet()
|
||||
* ironHoe()
|
||||
* ironIngot()
|
||||
* ironLeggings()
|
||||
* ironOre()
|
||||
* ironPickaxe()
|
||||
* ironPlate()
|
||||
* ironSpade()
|
||||
* ironSword()
|
||||
* ironTrapdoor()
|
||||
* itemFrame()
|
||||
* jackOLantern()
|
||||
* jukebox()
|
||||
* jungleDoor()
|
||||
* jungleDoorItem()
|
||||
* jungleFence()
|
||||
* jungleFenceGate()
|
||||
* jungleWoodStairs()
|
||||
* ladder()
|
||||
* lapisBlock()
|
||||
* lapisOre()
|
||||
* lava()
|
||||
* lavaBucket()
|
||||
* leash()
|
||||
* leather()
|
||||
* leatherBoots()
|
||||
* leatherChestplate()
|
||||
* leatherHelmet()
|
||||
* leatherLeggings()
|
||||
* leaves()
|
||||
* leaves2()
|
||||
* lever()
|
||||
* lingeringPotion()
|
||||
* log()
|
||||
* log2()
|
||||
* longGrass()
|
||||
* magma()
|
||||
* magmaCream()
|
||||
* map()
|
||||
* melon()
|
||||
* melonBlock()
|
||||
* melonSeeds()
|
||||
* melonStem()
|
||||
* milkBucket()
|
||||
* minecart()
|
||||
* mobSpawner()
|
||||
* monsterEgg()
|
||||
* monsterEggs()
|
||||
* mossyCobblestone()
|
||||
* mushroomSoup()
|
||||
* mutton()
|
||||
* mycel()
|
||||
* nameTag()
|
||||
* netherBrick()
|
||||
* netherBrickItem()
|
||||
* netherBrickStairs()
|
||||
* netherFence()
|
||||
* netherStalk()
|
||||
* netherStar()
|
||||
* netherWartBlock()
|
||||
* netherWarts()
|
||||
* netherrack()
|
||||
* noteBlock()
|
||||
* obsidian()
|
||||
* packedIce()
|
||||
* painting()
|
||||
* paper()
|
||||
* pistonBase()
|
||||
* pistonExtension()
|
||||
* pistonMovingPiece()
|
||||
* pistonStickyBase()
|
||||
* poisonousPotato()
|
||||
* pork()
|
||||
* portal()
|
||||
* potato()
|
||||
* potatoItem()
|
||||
* potion()
|
||||
* poweredMinecart()
|
||||
* poweredRail()
|
||||
* prismarine()
|
||||
* prismarineCrystals()
|
||||
* prismarineShard()
|
||||
* pumpkin()
|
||||
* pumpkinPie()
|
||||
* pumpkinSeeds()
|
||||
* pumpkinStem()
|
||||
* purpurBlock()
|
||||
* purpurDoubleSlab()
|
||||
* purpurPillar()
|
||||
* purpurSlab()
|
||||
* purpurStairs()
|
||||
* quartz()
|
||||
* quartzBlock()
|
||||
* quartzOre()
|
||||
* quartzStairs()
|
||||
* rabbit()
|
||||
* rabbitFoot()
|
||||
* rabbitHide()
|
||||
* rabbitStew()
|
||||
* rails()
|
||||
* rawBeef()
|
||||
* rawChicken()
|
||||
* rawFish()
|
||||
* record10()
|
||||
* record11()
|
||||
* record12()
|
||||
* record3()
|
||||
* record4()
|
||||
* record5()
|
||||
* record6()
|
||||
* record7()
|
||||
* record8()
|
||||
* record9()
|
||||
* redMushroom()
|
||||
* redNetherBrick()
|
||||
* redRose()
|
||||
* redSandstone()
|
||||
* redSandstoneStairs()
|
||||
* redstone()
|
||||
* redstoneBlock()
|
||||
* redstoneComparator()
|
||||
* redstoneComparatorOff()
|
||||
* redstoneComparatorOn()
|
||||
* redstoneLampOff()
|
||||
* redstoneLampOn()
|
||||
* redstoneOre()
|
||||
* redstoneTorchOff()
|
||||
* redstoneTorchOn()
|
||||
* redstoneWire()
|
||||
* rottenFlesh()
|
||||
* saddle()
|
||||
* sand()
|
||||
* sandstone()
|
||||
* sandstoneStairs()
|
||||
* sapling()
|
||||
* seaLantern()
|
||||
* seeds()
|
||||
* shears()
|
||||
* shield()
|
||||
* sign()
|
||||
* signPost()
|
||||
* skull()
|
||||
* skullItem()
|
||||
* slimeBall()
|
||||
* slimeBlock()
|
||||
* smoothBrick()
|
||||
* smoothStairs()
|
||||
* snow()
|
||||
* snowBall()
|
||||
* snowBlock()
|
||||
* soil()
|
||||
* soulSand()
|
||||
* speckledMelon()
|
||||
* spectralArrow()
|
||||
* spiderEye()
|
||||
* splashPotion()
|
||||
* sponge()
|
||||
* spruceDoor()
|
||||
* spruceDoorItem()
|
||||
* spruceFence()
|
||||
* spruceFenceGate()
|
||||
* spruceWoodStairs()
|
||||
* stainedClay()
|
||||
* stainedGlass()
|
||||
* stainedGlassPane()
|
||||
* standingBanner()
|
||||
* stationaryLava()
|
||||
* stationaryWater()
|
||||
* step()
|
||||
* stick()
|
||||
* stone()
|
||||
* stoneAxe()
|
||||
* stoneButton()
|
||||
* stoneHoe()
|
||||
* stonePickaxe()
|
||||
* stonePlate()
|
||||
* stoneSlab2()
|
||||
* stoneSpade()
|
||||
* stoneSword()
|
||||
* storageMinecart()
|
||||
* string()
|
||||
* structureBlock()
|
||||
* structureVoid()
|
||||
* sugar()
|
||||
* sugarCane()
|
||||
* sugarCaneBlock()
|
||||
* sulphur()
|
||||
* thinGlass()
|
||||
* tippedArrow()
|
||||
* tnt()
|
||||
* torch()
|
||||
* trapDoor()
|
||||
* trappedChest()
|
||||
* tripwire()
|
||||
* tripwireHook()
|
||||
* vine()
|
||||
* wallBanner()
|
||||
* wallSign()
|
||||
* watch()
|
||||
* water()
|
||||
* waterBucket()
|
||||
* waterLily()
|
||||
* web()
|
||||
* wheat()
|
||||
* wood()
|
||||
* woodAxe()
|
||||
* woodButton()
|
||||
* woodDoor()
|
||||
* woodDoubleStep()
|
||||
* woodHoe()
|
||||
* woodPickaxe()
|
||||
* woodPlate()
|
||||
* woodSpade()
|
||||
* woodStairs()
|
||||
* woodStep()
|
||||
* woodSword()
|
||||
* woodenDoor()
|
||||
* wool()
|
||||
* workbench()
|
||||
* writtenBook()
|
||||
* yellowFlower()
|
||||
|
||||
|
||||
## Items module (CanaryMod version)
|
||||
The Items module provides a suite of functions - one for each possible item.
|
||||
See https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/inventory/ItemType.html for a list of possible items
|
||||
|
||||
|
@ -6836,7 +7276,7 @@ The Entities module provides a suite of functions - one for each possible entity
|
|||
|
||||
### Usage
|
||||
|
||||
entities.zombie(); // returns a canaryMod/Bukkit EntityType.ZOMBIE enum value
|
||||
entities.zombie(); // returns a SpigotMC/CanaryMod EntityType.ZOMBIE enum value
|
||||
entities.zombie( mob ); // compares the entity's type to a zombie, returns true if mob type is zombie, false otherwise
|
||||
entities.player( self ); // at the in-game prompt this should return true (compares self to a player entity type)
|
||||
entities.rabbit( self ); // at the in-game prompt this should return false (compares self to a rabbit entity type)
|
||||
|
|
|
@ -11,7 +11,7 @@ public class jscript
|
|||
java.io.File file = new java.io.File(args[0]);
|
||||
engine.put("engine",engine);
|
||||
engine.put("args",args);
|
||||
engine.put("itemTypeClass",ItemType.class);
|
||||
engine.put("cmItemTypeClass",ItemType.class);
|
||||
FileReader fr = new java.io.FileReader(file);
|
||||
engine.eval(fr);
|
||||
fr.close();
|
||||
|
|
|
@ -10,7 +10,7 @@ var content = [
|
|||
'',
|
||||
'### Usage',
|
||||
'',
|
||||
' entities.zombie(); // returns a canaryMod/Bukkit EntityType.ZOMBIE enum value',
|
||||
' entities.zombie(); // returns a SpigotMC/CanaryMod EntityType.ZOMBIE enum value',
|
||||
' entities.zombie( mob ); // compares the entity\'s type to a zombie, returns true if mob type is zombie, false otherwise',
|
||||
' entities.player( self ); // at the in-game prompt this should return true (compares self to a player entity type)',
|
||||
' entities.rabbit( self ); // at the in-game prompt this should return false (compares self to a rabbit entity type)',
|
||||
|
|
|
@ -5,7 +5,39 @@ var out = java.lang.System.out,
|
|||
entry = null;
|
||||
var content = [
|
||||
'',
|
||||
'## Items module',
|
||||
'## Items module (SpigotMC version)',
|
||||
'The Items module provides a suite of functions - one for each possible item.',
|
||||
'See https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html for a list of possible items',
|
||||
'',
|
||||
'### Usage',
|
||||
'',
|
||||
' items.book(); // returns org.bukkit.Material.BOOK',
|
||||
' items.book(2); // returns a new org.bukkit.Material object with an amount 2 (2 books)',
|
||||
' items.book( itemType ); // compares itemType parameter to org.bukkit.Material.BOOK or an Item of type book',
|
||||
'',
|
||||
'The following functions are provided:',
|
||||
''
|
||||
];
|
||||
|
||||
var enumVals = [], t, i, name;
|
||||
var types = org.bukkit.Material.values();
|
||||
for (t in types) {
|
||||
if (types[t] && types[t].ordinal) {
|
||||
name = ('' + types[t].name()).toLowerCase();
|
||||
name = name.replace(/(_.)/g,function(a){ return a.replace(/_/,'').toUpperCase(); });
|
||||
enumVals.push(' * ' + name + '()');
|
||||
}
|
||||
}
|
||||
enumVals.sort();
|
||||
content = content.concat(enumVals);
|
||||
content.push('');
|
||||
for (i = 0; i< content.length; i++){
|
||||
out.println(content[i]);
|
||||
}
|
||||
|
||||
content = [
|
||||
'',
|
||||
'## Items module (CanaryMod version)',
|
||||
'The Items module provides a suite of functions - one for each possible item.',
|
||||
'See https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/api/inventory/ItemType.html for a list of possible items',
|
||||
'',
|
||||
|
@ -20,16 +52,18 @@ var content = [
|
|||
];
|
||||
|
||||
//var ItemType = java.lang.Class.forName('net.canarymod.api.inventory.ItemType');
|
||||
var materials = itemTypeClass.getDeclaredFields();
|
||||
var materials = cmItemTypeClass.getDeclaredFields();
|
||||
|
||||
var enumVals = [];
|
||||
for (var i = 0;i < materials.length; i++ ){
|
||||
enumVals = [];
|
||||
for ( i = 0;i < materials.length; i++ ){
|
||||
|
||||
if (materials[i].type != itemTypeClass) {
|
||||
if (materials[i].type != cmItemTypeClass) {
|
||||
continue;
|
||||
}
|
||||
var materialField = materials[i];
|
||||
var name = (''+materialField.name).replace(/^(.)/,function(a){ return a.toLowerCase() });
|
||||
name = (''+materialField.name).replace(/^(.)/,function(a){
|
||||
return a.toLowerCase() ;
|
||||
});
|
||||
enumVals.push(' * ' + name + '()');
|
||||
}
|
||||
enumVals.sort();
|
||||
|
|
Reference in a new issue