Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function taskRunner(){
- foreach($this->getConfig()->getNested("CheckTime") as $time){
- if(date("H",time()) == $time){
- if(!$this->getConfig()->getNested("isCheckItem")){
- $this->getConfig()->setNested("isCheckItem",true);
- foreach($this->getConfig()->getNested("playerjobs") as $p){
- $this->getConfig()->setNested("$p.isCheck",false);
- }
- $this->getConfig()->setAll($this->getConfig()->getAll());
- $this->getConfig()->save();
- foreach($this->getServer()->getOnlinePlayers() as $a){
- $n = $a->getName();
- $inv = $a->getInventory();
- $p = $this->getConfig()->getNested("playerjobs.$n");
- if(null == $p){goto lol;}
- $name = $p["name"];
- foreach($this->getConfig()->getNested("job")[$p["idjob"]]["item"] as $item){
- $exp = explode(":", $item);
- $it = Item::get($exp[0],$exp[1],$exp[2]);
- $amount = $exp[2];
- if($inv->contains($it)){
- foreach($this->getConfig()->getNested("CommandForDoneJob") as $a){
- $this->getServer()->dispatchCommand(new ConsoleCommandSender(),str_replace(["{name}"],[$name],$a));
- }
- $inv->removeItem($it);
- }else{
- foreach($this->getConfig()->getNested("CommandForUnDoneJob") as $a){
- $this->getServer()->dispatchCommand(new ConsoleCommandSender(),str_replace(["{name}"],[$name],$a));
- }
- }
- }
- $this->getConfig()->setNested("playerjobs.$n.isCheck",true);
- $this->getConfig()->setAll($this->getConfig()->getAll());
- $this->getConfig()->save();
- lol:
- }
- }
- }else{
- if($this->getConfig()->getNested("isCheckItem")){
- $this->getConfig()->setNested("isCheckItem",false);
- $this->getConfig()->setAll($this->getConfig()->getAll());
- $this->getConfig()->save();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement