updated young persons template and refactored minigame scoreboard.
This commit is contained in:
parent
839f3d10f2
commit
7f1e5e637e
5 changed files with 63 additions and 54 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -2,7 +2,14 @@ target
|
||||||
*.class
|
*.class
|
||||||
*.js~
|
*.js~
|
||||||
*.js#
|
*.js#
|
||||||
|
*.md#
|
||||||
|
*.md~
|
||||||
|
*.mdt~
|
||||||
|
*.mdt#
|
||||||
*.iml
|
*.iml
|
||||||
|
*.#*
|
||||||
*.idea
|
*.idea
|
||||||
.DS_Store
|
.DS_Store
|
||||||
build.local.properties
|
build.local.properties
|
||||||
|
/src/main/javascript/lib/.#tabcomplete.js
|
||||||
|
/src/main/javascript/plugins/.#example-1.js
|
||||||
|
|
|
@ -2356,7 +2356,11 @@ Allows in-game operators to easily spawn creatures at current location.
|
||||||
/jsp spawn sheep
|
/jsp spawn sheep
|
||||||
/jsp spawn wolf
|
/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
|
## 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.
|
* Once you leave the game, your score is reset to zero.
|
||||||
|
|
||||||
* You can disconnect from the server and your score will be saved for
|
* When you disconnect from the server, your score will be reset to zero.
|
||||||
the next time you join.
|
|
||||||
|
|
||||||
### Gameplay Mechanics
|
### Gameplay Mechanics
|
||||||
|
|
||||||
|
|
6
src/docs/templates/ypgpm.mdt
vendored
6
src/docs/templates/ypgpm.mdt
vendored
|
@ -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
|
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).
|
`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
|
enter, replacing {your_username} with your own minecraft
|
||||||
username. This will give you `operator` access meaning you can perform
|
username. This will give you `operator` access meaning you can perform
|
||||||
more commands than are normally available in Minecraft. You should
|
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
|
for the server) permanently by editing the craftbukkit/ops.txt file
|
||||||
and adding your username (one username per line).
|
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` .
|
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
|
... Congratulations! You just installed your own Minecraft Server with
|
||||||
|
|
45
src/main/javascript/modules/minigames/scoreboard.js
Normal file
45
src/main/javascript/modules/minigames/scoreboard.js
Normal 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];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -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.
|
* Once you leave the game, your score is reset to zero.
|
||||||
|
|
||||||
* You can disconnect from the server and your score will be saved for
|
* When you disconnect from the server, your score will be reset to zero.
|
||||||
the next time you join.
|
|
||||||
|
|
||||||
### Gameplay Mechanics
|
### Gameplay Mechanics
|
||||||
|
|
||||||
|
@ -47,52 +46,7 @@ var store = {};
|
||||||
var scoreboardConfig = {
|
var scoreboardConfig = {
|
||||||
cowclicker: {SIDEBAR: 'Cows Clicked'}
|
cowclicker: {SIDEBAR: 'Cows Clicked'}
|
||||||
};
|
};
|
||||||
|
var scoreboard = require('minigames/scoreboard')(scoreboardConfig);
|
||||||
/*
|
|
||||||
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 _onPlayerInteract = function(listener, event){
|
var _onPlayerInteract = function(listener, event){
|
||||||
var player = event.player;
|
var player = event.player;
|
||||||
|
|
Reference in a new issue