updated young persons template and refactored minigame scoreboard.

This commit is contained in:
walterhiggins 2014-01-12 12:06:30 +00:00
parent 839f3d10f2
commit 7f1e5e637e
5 changed files with 63 additions and 54 deletions

7
.gitignore vendored
View File

@ -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

View File

@ -2356,7 +2356,11 @@ Allows in-game operators to easily spawn creatures at current location.
/jsp spawn sheep
/jsp spawn wolf
See <http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/EntityType.html> 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
<http://jd.bukkit.org/beta/apidocs/org/bukkit/entity/EntityType.html>
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

View File

@ -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

View File

@ -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];
}
};
};

View File

@ -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;