Update Main.php

This commit is contained in:
TheAMDGuy 2020-05-18 16:25:00 +02:00 committed by GitHub
parent 6ba88d3706
commit 4a1cf6230e

View file

@ -21,125 +21,99 @@ class Main extends PluginBase{
public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool
{ {
switch ($command->getName()){ if ($sender instanceof Player){
case "day": switch ($command->getName()){
if ($sender->hasPermission("dan.day")) { case "day":
if ($sender instanceof Player){ if ($sender->hasPermission("dan.day")) {
$level = $sender->getLevel(); $level = $sender->getLevel();
$level->setTime(0); $level->setTime(0);
$sender->sendMessage(TextFormat::GREEN.$this->config["succesday"]); $sender->sendMessage(TextFormat::GREEN.$this->config["succesday"]);
return true; return true;
} else { } else {
$sender->sendMessage(TextFormat::DARK_RED.$this->config["ingameonly"]); $sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]);
return true; return true;
} }
} else { case "night":
$sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]); if ($sender->hasPermission("dan.night")){
return true; $level = $sender->getLevel();
} $level->setTime(14000);
case "night": $sender->sendMessage(TextFormat::GREEN.$this->config["succesnight"]);
if ($sender->hasPermission("dan.night")){ return true;
if ($sender instanceof Player){ } else {
$level = $sender->getLevel(); $sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]);
$level->setTime(14000); return true;
$sender->sendMessage(TextFormat::GREEN.$this->config["succesnight"]); }
return true; case "set":
} else { if ($sender->hasPermission("dan.set")){
$sender->sendMessage(TextFormat::DARK_RED.$this->config["ingameonly"]); $level = $sender->getLevel();
return true; $level->setTime(18000);
} $sender->sendMessage(TextFormat::GREEN.$this->config["successet"]);
} else { return true;
$sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]); } else {
return true; $sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]);
} return true;
case "set": }
if ($sender->hasPermission("dan.set")){ case "rise":
if ($sender instanceof Player){ if ($sender->hasPermission("dan.rise")){
$level = $sender->getLevel(); $level = $sender->getLevel();
$level->setTime(18000); $level->setTime(23000);
$sender->sendMessage(TextFormat::GREEN.$this->config["successet"]); $sender->sendMessage(TextFormat::GREEN.$this->config["succesrise"]);
return true; return true;
} else { } else {
$sender->sendMessage(TextFormat::DARK_RED.$this->config["ingameonly"]); $sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]);
return true; return true;
} }
} else { case "midday":
$sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]); if ($sender->hasPermission("dan.midday")){
return true; $level = $sender->getLevel();
} $level->setTime(6000);
case "rise": $sender->sendMessage(TextFormat::GREEN.$this->config["succesmidday"]);
if ($sender->hasPermission("dan.rise")){ return true;
if ($sender instanceof Player){ } else {
$level = $sender->getLevel(); $sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]);
$level->setTime(23000); return true;
$sender->sendMessage(TextFormat::GREEN.$this->config["succesrise"]); }
return true; case "midnight":
} else { if ($sender->hasPermission("dan.midnight")){
$sender->sendMessage(TextFormat::DARK_RED.$this->config["ingameonly"]); $level = $sender->getLevel();
return true; $level->setTime(18000);
} $sender->sendMessage(TextFormat::GREEN.$this->config["succesmidnight"]);
} else { return true;
$sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]); } else {
return true; $sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]);
} return true;
case "midday": }
if ($sender->hasPermission("dan.midday")){ case "dayandnight":
if ($sender instanceof Player){ if ($sender->hasPermission("dan.info")){
$level = $sender->getLevel(); $sender->sendMessage(TextFormat::AQUA.$this->config["avaiable"]);
$level->setTime(6000); if ($sender->hasPermission("dan.day")){
$sender->sendMessage(TextFormat::GREEN.$this->config["succesmidday"]); $sender->sendMessage(TextFormat::GREEN.$this->config["daycommandav"]);
return true; }
} else { if ($sender->hasPermission("dan.night")){
$sender->sendMessage(TextFormat::DARK_RED.$this->config["ingameonly"]); $sender->sendMessage(TextFormat::GREEN.$this->config["nightcommandav"]);
return true; }
} if ($sender->hasPermission("dan.set")){
} else { $sender->sendMessage(TextFormat::GREEN.$this->config["setcommandav"]);
$sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]); }
return true; if ($sender->hasPermission("dan.rise")){
} $sender->sendMessage(TextFormat::GREEN.$this->config["risecommandav"]);
case "midnight": }
if ($sender->hasPermission("dan.midnight")){ if ($sender->hasPermission("dan.midday")){
if ($sender instanceof Player){ $sender->sendMessage(TextFormat::GREEN.$this->config["middaycommandav"]);
$level = $sender->getLevel(); }
$level->setTime(18000); if ($sender->hasPermission("dan.midnight")){
$sender->sendMessage(TextFormat::GREEN.$this->config["succesmidnight"]); $sender->sendMessage(TextFormat::GREEN.$this->config["midnightcommandav"]);
return true; }
} else { return true;
$sender->sendMessage(TextFormat::DARK_RED.$this->config["ingameonly"]); } else {
return true; $sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]);
} return true;
} else { }
$sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]);
return true;
}
case "dayandnight":
if ($sender->hasPermission("dan.info")){
$sender->sendMessage(TextFormat::AQUA.$this->config["avaiable"]);
if ($sender->hasPermission("dan.day")){
$sender->sendMessage(TextFormat::GREEN.$this->config["daycommandav"]);
}
if ($sender->hasPermission("dan.night")){
$sender->sendMessage(TextFormat::GREEN.$this->config["nightcommandav"]);
}
if ($sender->hasPermission("dan.set")){
$sender->sendMessage(TextFormat::GREEN.$this->config["setcommandav"]);
}
if ($sender->hasPermission("dan.rise")){
$sender->sendMessage(TextFormat::GREEN.$this->config["risecommandav"]);
}
if ($sender->hasPermission("dan.midday")){
$sender->sendMessage(TextFormat::GREEN.$this->config["middaycommandav"]);
}
if ($sender->hasPermission("dan.midnight")){
$sender->sendMessage(TextFormat::GREEN.$this->config["midnightcommandav"]);
}
return true;
} else {
$sender->sendMessage(TextFormat::DARK_RED.$this->config["nopermission"]);
return true;
}
} }
return true; } else {
$sender->sendMessage(TextFormat::DARK_RED.$this->config["ingameonly"]);
return true;
}
} }
} }