the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 68 lines 1.4 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.scores.h" 3#include "net.minecraft.world.scores.criteria.h" 4#include "Score.h" 5 6Score::Score(Scoreboard *scoreboard, Objective *objective, const wstring &owner) 7{ 8 this->scoreboard = scoreboard; 9 this->objective = objective; 10 this->owner = owner; 11 count = 0; 12} 13 14void Score::add(int count) 15{ 16 //if (objective.getCriteria().isReadOnly()) throw new IllegalStateException("Cannot modify read-only score"); 17 setScore(getScore() + count); 18} 19 20void Score::remove(int count) 21{ 22 //if (objective.getCriteria().isReadOnly()) throw new IllegalStateException("Cannot modify read-only score"); 23 setScore(getScore() - count); 24} 25 26void Score::increment() 27{ 28 //if (objective.getCriteria().isReadOnly()) throw new IllegalStateException("Cannot modify read-only score"); 29 add(1); 30} 31 32void Score::decrement() 33{ 34 //if (objective.getCriteria().isReadOnly()) throw new IllegalStateException("Cannot modify read-only score"); 35 remove(1); 36} 37 38int Score::getScore() 39{ 40 return count; 41} 42 43void Score::setScore(int score) 44{ 45 int old = count; 46 count = score; 47 if (old != score) getScoreboard()->onScoreChanged(this); 48} 49 50Objective *Score::getObjective() 51{ 52 return objective; 53} 54 55wstring Score::getOwner() 56{ 57 return owner; 58} 59 60Scoreboard *Score::getScoreboard() 61{ 62 return scoreboard; 63} 64 65void Score::updateFor(vector<shared_ptr<Player> > *players) 66{ 67 setScore(objective->getCriteria()->getScoreModifier(players)); 68}