Skip to content

Commit

Permalink
Added /seexp command
Browse files Browse the repository at this point in the history
  • Loading branch information
KriskotooBG authored Aug 17, 2019
1 parent 2a6203c commit d50083b
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions src/kriskotooBG/XPMaster/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function onCommand(CommandSender $sender, Command $command, string $label
return true;
}
}
else if(!is_numeric($args[0]) && is_numeric($args[1]) && isset($args[1]) && !empty($args[1])){
else if(!is_numeric($args[0]) && isset($args[1]) && !empty($args[1]) && is_numeric($args[1])){
$target = $this->getServer()->getPlayer($args[0]);

if($target instanceof Player){
Expand Down Expand Up @@ -80,6 +80,31 @@ public function onCommand(CommandSender $sender, Command $command, string $label
}
break;

case "seexp":
if(isset($args[0]) && !empty($args[0])){
if($sender->hasPermission("xp.seePlayerXP")){
$target = $this->getServer()->getPlayer($args[0]);

if($target instanceof Player){
$sender->sendMessage(TF::GREEN . $args[0] . "'s XP level is: " . $target->getXpLevel());
return true;
}
else{
$sender->sendMessage(TF::RED . "Did not find an online player with a name of " . $args[0]);
return true;
}
}
else{
$sender->sendMessage(TF::RED . "You do not have permission to use that command.");
return true;
}
}
else{
$sender->sendMessage(TF::GOLD . "Ussage: /seexp <player>");
return true;
}
break;

case "addxp":
if(isset($args[0]) && !empty($args[0])){
if(is_numeric($args[0])){
Expand Down Expand Up @@ -111,7 +136,7 @@ public function onCommand(CommandSender $sender, Command $command, string $label
return true;
}
}
else if(!is_numeric($args[0]) && is_numeric($args[1]) && isset($args[1]) && !empty($args[1])){
else if(!is_numeric($args[0]) && isset($args[1]) && !empty($args[1]) && is_numeric($args[1])){
$target = $this->getServer()->getPlayer($args[0]);

if($target instanceof Player){
Expand Down Expand Up @@ -144,12 +169,12 @@ public function onCommand(CommandSender $sender, Command $command, string $label
}
}
else{
$sender->sendMessage(TF::GOLD . "Ussage: /xp <(Optional)player> <level>");
$sender->sendMessage(TF::GOLD . "Ussage: /addxp <(Optional)player> <level>");
return true;
}
}
else{
$sender->sendMessage(TF::GOLD . "Ussage: /xp <(Optional)player> <level>");
$sender->sendMessage(TF::GOLD . "Ussage: /addxp <(Optional)player> <level>");
return true;
}
break;
Expand Down Expand Up @@ -185,7 +210,7 @@ public function onCommand(CommandSender $sender, Command $command, string $label
return true;
}
}
else if(!is_numeric($args[0]) && is_numeric($args[1]) && isset($args[1]) && !empty($args[1])){
else if(!is_numeric($args[0]) && isset($args[1]) && !empty($args[1]) && is_numeric($args[1])){
$target = $this->getServer()->getPlayer($args[0]);

if($target instanceof Player){
Expand Down Expand Up @@ -218,12 +243,12 @@ public function onCommand(CommandSender $sender, Command $command, string $label
}
}
else{
$sender->sendMessage(TF::GOLD . "Ussage: /xp <(Optional)player> <level>");
$sender->sendMessage(TF::GOLD . "Ussage: /remxp <(Optional)player> <level>");
return true;
}
}
else{
$sender->sendMessage(TF::GOLD . "Ussage: /xp <(Optional)player> <level>");
$sender->sendMessage(TF::GOLD . "Ussage: /remxp <(Optional)player> <level>");
return true;
}
break;
Expand Down

0 comments on commit d50083b

Please sign in to comment.