Skip to content

Commit

Permalink
Merge pull request #8 from ecoron/1.3
Browse files Browse the repository at this point in the history
1.3
  • Loading branch information
Ronald Schmidt committed Jan 23, 2016
2 parents 6e0c21d + a4170d5 commit 9a41d57
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RankUp 1.2
# RankUp 1.3

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.
Expand All @@ -10,7 +10,7 @@ RankUp requires PurePerms v1.1.12 or higher on your server

##Download and Install

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


and copy the file into your plugins folder.
Expand Down Expand Up @@ -88,6 +88,23 @@ Ranks:
rank3: 3
rank4: 4
rank5: 5
job1: 6
job2: 7
job3: 8
Admin: 20
Owner: 50
OP: 100
JobRanks:
job1: 5
job2: 5
job3: 5
# the fallback rank if a player stop the job, for cases where players
# reached a rank by voting but dint reached the required time in autoranks
JobStopFallback:
id: 5
title: "rank5"
VoteRanks:
Guest: 1
Expand Down Expand Up @@ -128,7 +145,6 @@ Messages:
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 Down
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: RankUp
main: RankUp\MainRankUp
version: 1.2
version: 1.3
api: [1.12.0]

load: POSTWORLD
author: ecoron,LittleRon
author: ecoron
description: rankup a player as vote reward, or after time playing on server
website: https://github.com/ecoron/RankUp
commands:
Expand Down
6 changes: 6 additions & 0 deletions resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ JobRanks:
job2: 5
job3: 5

# the fallbackrank if a player stop the job, for cases where players
# reached a rank by voting but dint reached the required time in autoranks
JobStopFallback:
id: 5
title: "rank5"

VoteRanks:
Guest: 1
rank2: 2
Expand Down
8 changes: 8 additions & 0 deletions src/RankUp/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Config {

private $jobRanks;

private $jobStopFallback;

private $ranks;

private $voteRanks;
Expand All @@ -24,6 +26,7 @@ function __construct($configFile)
$this->ranks = $config["Ranks"];
$this->autoRanks = $config["AutoRanks"];
$this->jobRanks = $config["JobRanks"];
$this->jobStopFallback = $config["JobStopFallback"];
$this->voteRanks = $config["VoteRanks"];
$this->messages = $config["Messages"];
}
Expand All @@ -48,6 +51,11 @@ public function getJobRanks()
return $this->jobRanks;
}

public function getJobStopFallback($key)
{
return $this->jobStopFallback[$key];
}

public function getVoteRanks()
{
return $this->voteRanks;
Expand Down
7 changes: 6 additions & 1 deletion src/RankUp/RankUp.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ public function jobRankUp(MainRankUp $plugin, Player $player, array $args) {
$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;
//check if the rank is higher then the fallback
if($rankId >= $this->config->getJobStopFallback('id')) {
$newRank = $rankName;
} else {
$newRank = $this->config->getJobStopFallback('title');
}
}
}
if($newRank !== false){
Expand Down

0 comments on commit 9a41d57

Please sign in to comment.