1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

teleport and remove player.dat file not work

Discussion in 'Development' started by alexwolf_dev, Feb 24, 2017.

  1. alexwolf_dev

    alexwolf_dev Spider Jockey

    Messages:
    43
    GitHub:
    Frago9876543210
    I have class main extends PluginBase and class Events implements Listener.
    onEnable in main class:
    PHP:
    $this->getServer()->getPluginManager()->registerEvents(new Events($this), $this);
    Events class:
    PHP:
    class Events implements Listener
    {

        public 
    $plugin;

        public function 
    __construct(main $plugin)
        {
            
    $this->plugin $plugin;
        }
        public function 
    joinEv(PlayerJoinEvent $e)
        {
            
    $p $e->getPlayer();
            
    $p->teleport($this->plugin->getServer()->getDefaultLevel()->getSpawnLocation()); //not work
            
    $name strtolower($p->getName());
            @
    unlink("/mg/players/{$name}.dat"); //not work
        
    }
    }
    I set permission rwx to all dir.
    Why this not work?
     
    Last edited: Feb 24, 2017
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Are you sure the event is being called correctly? Try debugging to make sure.
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Is there an error log that we can see?
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.