mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +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)
|
public function viewAchievements($cmd, $params, $issuer, $alias)
|
||||||
{
|
{
|
||||||
if(!($issuer instanceof Player) && !isset($params[0])){
|
if(!isset($params[0])){
|
||||||
return "Please enter a nickname.";
|
if(!($issuer instanceof Player)){
|
||||||
} else{
|
return "Please enter a nickname.";
|
||||||
if(! ($issuer instanceof Player) || (isset($params[0]) && $this->server->api->ban->isOp($issuer->username))){
|
}else{
|
||||||
$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{
|
|
||||||
$data = $issuer->achievements;
|
$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){
|
if($data instanceof Config){
|
||||||
$achs = $data->get("achievements");
|
$achs = $data->get("achievements");
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue