Skip to content

Commit

Permalink
Merge pull request #6 from ecoron/1.2
Browse files Browse the repository at this point in the history
1.2
  • Loading branch information
Ronald Schmidt committed Jan 3, 2016
2 parents 73ec12a + 1015d25 commit 6e0c21d
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 10 deletions.
44 changes: 38 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# RankUp 1.1
# RankUp 1.2

A @PocketMine MCPE server plugin. Player gets a higher rank as reward for voting or
after some time playing on the server.
For mcpe 0.11.1 / 0.12.1 with api 1.12.0 / 1.13.0
A MCPE server plugin for servers running on ImagicalMine or PocketMine builds.
Player gets a higher rank as reward for voting or after some time playing on the server.
Player can also start/stop jobs.

RankUp requires PurePerms v1.1.11 or v1.1.12 on your server
For mcpe 0.12.1 / 0.13.1 with api 1.12.0 / 1.13.0

RankUp requires PurePerms v1.1.12 or higher on your server

##Download and Install

### [Download: RankUp.phar v1.0](https://s3-eu-west-1.amazonaws.com/devron/RankUp.phar)
### [Download: RankUp.phar v1.2](https://s3-eu-west-1.amazonaws.com/devron/RankUp_v12.phar)


and copy the file into your plugins folder.
Expand Down Expand Up @@ -47,6 +49,26 @@ status of other players
/tr check <playername>
```

###start / stop jobs

job list

```
/job list
```

start job

```
/job start <jobname>
```

stop job, player will reseted to his actual AutoRank Group

```
/job stop
```

##Configuration

```
Expand Down Expand Up @@ -100,6 +122,13 @@ Messages:
timer-rankis: "Rank is: ##rank##"
timer-timeplayed: "You have played ##timeplayed## minutes on this server.\n ##timetoplay## minutes until next rankup"
timer-timeplayer: "Has played ##timeplayed## minutes on this server"
job-list: "You can choose one of this jobs: ##joblist##"
job-choose: "Please choose one of the jobs: ##joblist##"
job-rank-low: "You can't choose this job, your rank is to low"
job-rank-error: "Upps there is an ERROR, try again later"
job-usage: "list jobs: /job list\nchoose job: /job start <jobname>"
job-no-stop: "You do not have a job to stop, use /job start <jobname> to start a job"
```

##Permissions
Expand All @@ -112,4 +141,7 @@ permissions:
timeranks.command:
description: "check time to play for next rank"
default: true
jobranks.command:
description: "list or choose jobranks"
default: true
```
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: RankUp
main: RankUp\MainRankUp
version: 1.1
version: 1.2
api: [1.12.0]

load: POSTWORLD
Expand All @@ -20,7 +20,7 @@ commands:
permission: timeranks.command
jobranks:
description: list/choose jobranks
usage: "/job [list/start] <jobrank>"
usage: "/job [list/start/stop] <jobrank>"
aliases: [job, jobranks, jr]
permission: jobranks.command
permissions:
Expand Down
3 changes: 2 additions & 1 deletion resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ AutoRanks:
#messages
Messages:
command-in-game: "Command must be used in-game."
error-fetching-vote: "[VoteRanks] Error fetching vote status! Try again later."
error-fetching-vote: "[RankUp] Error fetching vote status! Try again later."
no-permission: "You do not have permission to vote."
pureperms-loaded: "Successfully loaded with PurePerms"
pureperms-notfound: "Dependency PurePerms not found"
Expand All @@ -64,3 +64,4 @@ Messages:
job-rank-low: "You can't choose this job, your rank is to low"
job-rank-error: "Upps there is an ERROR, try again later"
job-usage: "list jobs: /job list\nchoose job: /job start <jobname>"
job-no-stop: "You do not have a job to stop, use /job start <jobname> to start a job"
28 changes: 27 additions & 1 deletion src/RankUp/RankUp.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,31 @@ public function jobRankUp(MainRankUp $plugin, Player $player, array $args) {
}
return str_replace("##joblist##", implode(', ', $jobNames), $this->config->getMessage("job-choose"));

break;
case "stop":
//stop works only if player has a jobrank
if(!in_array($userGroup, $jobNames)) {
return $this->config->getMessage("job-no-stop");
}
$timeplayed = $plugin->data->get(strtolower($player->getName()));
$ranks = $this->config->getRanks();
$newRank = false;
//search the origin rank
foreach($ranks as $rankName => $rankId) {
$timetoplay = $this->config->getAutoRankMinutes($rankName);
//player can switch back only to an AutoRank timetoplay must have a value
if(!empty($timetoplay) && $timeplayed >= $timetoplay){
$newRank = $rankName;
}
}
if($newRank !== false){
$pureRank = $this->getPureRank($newRank);
if ($pureRank != null) {
return $this->setRank($plugin, $player, $pureRank, $newRank);
}
}

return $this->config->getMessage("job-usage");
break;
default:
return $this->config->getMessage("job-usage");
Expand All @@ -147,7 +172,8 @@ public function getTimeToAutoRankUp($data, Player $player)
$newRankId = $oldRankId + 1;
$newRank = array_search($newRankId, $this->config->getRanks());
if($newRank !== false && $timeplayed < $this->config->getAutoRankMinutes($newRank)){
return $this->config->getAutoRankMinutes($newRank) - $timeplayed;
$timetoplay = $this->config->getAutoRankMinutes($newRank);
return (!empty($timetoplay)) ? ($timetoplay - $timeplayed) : 0;
}

return false;
Expand Down

0 comments on commit 6e0c21d

Please sign in to comment.