diff --git a/.gitignore b/.gitignore index d63443c..663489b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,14 @@ target *.class *.js~ *.js# +*.md# +*.md~ +*.mdt~ +*.mdt# *.iml +*.#* *.idea .DS_Store build.local.properties +/src/main/javascript/lib/.#tabcomplete.js +/src/main/javascript/plugins/.#example-1.js diff --git a/docs/API-Reference.md b/docs/API-Reference.md index 4caef0f..39a4715 100644 --- a/docs/API-Reference.md +++ b/docs/API-Reference.md @@ -2356,7 +2356,11 @@ Allows in-game operators to easily spawn creatures at current location. /jsp spawn sheep /jsp spawn wolf -See for a list of possible entities (creatures) which can be spawned. +This command supports TAB completion so to see a list of possible +entitities, type `/jsp spawn ' at the in-game command prompt, then +press TAB. Visit + +for a list of possible entities (creatures) which can be spawned. ## alias Plugin @@ -2659,8 +2663,7 @@ is displayed in a side-bar along the right edge of of the screen. * Once you leave the game, your score is reset to zero. - * You can disconnect from the server and your score will be saved for - the next time you join. + * When you disconnect from the server, your score will be reset to zero. ### Gameplay Mechanics diff --git a/src/docs/templates/ypgpm.mdt b/src/docs/templates/ypgpm.mdt index bc04520..46a04f8 100644 --- a/src/docs/templates/ypgpm.mdt +++ b/src/docs/templates/ypgpm.mdt @@ -36,7 +36,9 @@ Install ScriptCraft on your computer... 3. [Download the latest version of the ScriptCraft Mod][sc-plugin]. Then copy the ScriptCraft.jar file to the `craftbukkit/plugins` folder (This folder won't be created until you run Bukkit for the first time (see previous step). -4. In the CraftBukkit command window type `op {your_username}` and hit +4. Start up the craftbukkit server again (see [instructions for starting the server][bii]). + +5. In the CraftBukkit command window type `op {your_username}` and hit enter, replacing {your_username} with your own minecraft username. This will give you `operator` access meaning you can perform more commands than are normally available in Minecraft. You should @@ -44,8 +46,6 @@ Install ScriptCraft on your computer... for the server) permanently by editing the craftbukkit/ops.txt file and adding your username (one username per line). -5. Start up the craftbukkit server again (see [instructions for starting the server][bii]). - 6. In the CraftBukkit command window type `js 1 + 1` and hit enter. You should see `> 2` . ... Congratulations! You just installed your own Minecraft Server with diff --git a/src/main/javascript/modules/minigames/scoreboard.js b/src/main/javascript/modules/minigames/scoreboard.js new file mode 100644 index 0000000..20d8628 --- /dev/null +++ b/src/main/javascript/modules/minigames/scoreboard.js @@ -0,0 +1,45 @@ +/* + The scoreboard is a simple wrapper around the Bukkit Scoreboard API. + It's only concerned with display of scores, not maintaining them - that's the game's job. +*/ +module.exports = function(options){ + var temp = {}; + var ccScoreboard; + var DisplaySlot = org.bukkit.scoreboard.DisplaySlot; + + return { + start: function(){ + var objective, slot; + ccScoreboard = server.scoreboardManager.getNewScoreboard(); + for (objective in options){ + var ccObj = ccScoreboard.registerNewObjective(objective,'dummy'); + for (slot in options[objective]){ + ccObj.displaySlot = DisplaySlot[slot]; + ccObj.displayName = options[objective][slot]; + } + } + }, + stop: function(){ + var objective, slot; + for (objective in options){ + ccScoreboard.getObjective(objective).unregister(); + for (slot in options[objective]){ + ccScoreboard.clearSlot(DisplaySlot[slot]); + } + } + }, + update: function(objective,player,score){ + if (player.scoreboard && player.scoreboard != ccScoreboard) + { + temp[player.name] = player.scoreboard; + player.scoreboard = ccScoreboard; + } + ccScoreboard.getObjective(objective).getScore(player).score = score; + }, + restore: function(player){ + // offlineplayers don't have a scoreboard + if (player.scoreboard) + player.scoreboard = temp[player.name]; + } + }; +}; diff --git a/src/main/javascript/plugins/minigames/cow-clicker.js b/src/main/javascript/plugins/minigames/cow-clicker.js index 4abb5ef..16615ae 100644 --- a/src/main/javascript/plugins/minigames/cow-clicker.js +++ b/src/main/javascript/plugins/minigames/cow-clicker.js @@ -19,8 +19,7 @@ is displayed in a side-bar along the right edge of of the screen. * Once you leave the game, your score is reset to zero. - * You can disconnect from the server and your score will be saved for - the next time you join. + * When you disconnect from the server, your score will be reset to zero. ### Gameplay Mechanics @@ -47,52 +46,7 @@ var store = {}; var scoreboardConfig = { cowclicker: {SIDEBAR: 'Cows Clicked'} }; - -/* - The scoreboard is a simple wrapper around the Bukkit Scoreboard API. - It's only concerned with display of scores, not maintaining them - that's the game's job. -*/ -var scoreboard = (function(options){ - var temp = {}; - var ccScoreboard; - var DisplaySlot = org.bukkit.scoreboard.DisplaySlot; - - return { - start: function(){ - var objective, slot; - ccScoreboard = server.scoreboardManager.getNewScoreboard(); - for (objective in options){ - var ccObj = ccScoreboard.registerNewObjective(objective,'dummy'); - for (slot in options[objective]){ - ccObj.displaySlot = DisplaySlot[slot]; - ccObj.displayName = options[objective][slot]; - } - } - }, - stop: function(){ - var objective, slot; - for (objective in options){ - ccScoreboard.getObjective(objective).unregister(); - for (slot in options[objective]){ - ccScoreboard.clearSlot(DisplaySlot[slot]); - } - } - }, - update: function(objective,player,score){ - if (player.scoreboard && player.scoreboard != ccScoreboard) - { - temp[player.name] = player.scoreboard; - player.scoreboard = ccScoreboard; - } - ccScoreboard.getObjective(objective).getScore(player).score = score; - }, - restore: function(player){ - // offlineplayers don't have a scoreboard - if (player.scoreboard) - player.scoreboard = temp[player.name]; - } - }; -}(scoreboardConfig)); +var scoreboard = require('minigames/scoreboard')(scoreboardConfig); var _onPlayerInteract = function(listener, event){ var player = event.player;