mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
/ach rewrite
This commit is contained in:
parent
2349477bad
commit
1bd28a2b6d
1 changed files with 11 additions and 13 deletions
|
|
@ -159,23 +159,21 @@ class AchievementAPI{
|
|||
|
||||
public function viewAchievements($cmd, $params, $issuer, $alias)
|
||||
{
|
||||
if(!($issuer instanceof Player) && !isset($params[0])){
|
||||
return "Please enter a nickname.";
|
||||
} else{
|
||||
if(! ($issuer instanceof Player) || (isset($params[0]) && $this->server->api->ban->isOp($issuer->username))){
|
||||
$player = $this->server->api->player->get($params[0]);
|
||||
if($player instanceof Player){
|
||||
$data = $player->data;
|
||||
} else{
|
||||
$data = $this->server->api->player->getOffline(trim($params[0]), false);
|
||||
}
|
||||
} else{
|
||||
if(!isset($params[0])){
|
||||
if(!($issuer instanceof Player)){
|
||||
return "Please enter a nickname.";
|
||||
}else{
|
||||
$data = $issuer->achievements;
|
||||
}
|
||||
}else if(!($issuer instanceof Player) || $this->server->api->ban->isOp($issuer->iusername)){
|
||||
$player = $this->server->api->player->get($params[0]);
|
||||
$data = $player instanceof Player ? $player->data : $this->server->api->player->getOffline(trim($params[0]), false);
|
||||
}
|
||||
if($data === false){
|
||||
return "Player {$params[0]} is not found.";
|
||||
|
||||
if(!$data){
|
||||
return "Player is not found.";
|
||||
}
|
||||
|
||||
if($data instanceof Config){
|
||||
$achs = $data->get("achievements");
|
||||
}else{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue