Solved Battleground plugin.

Discussion in 'Development' started by Kkora, Nov 22, 2018.

  1. Kkora

    Kkora Slime

    Messages:
    91
    GitHub:
    kkora2k3
    Hey guys, I'm trying to create .db file for my Battleground plugin but it say error.
    Can you help me for the problem?
    PHP:
    try {
                if (!
    is_file($this->getDataFolder() . "BR_sign.db")) {
                    
    $this->db = new \SQLite3($this->getDataFolder() . "BR_sign.db"SQLITE3_OPEN_READWRITE SQLITE3_OPEN_CREATE);
                } else {
                    
    $this->db = new \SQLite3($this->getDataFolder() . "BR_sign.db"SQLITE3_OPEN_READWRITE);
                }
                
    $this->db->exec("CREATE TABLE IF NOT EXISTS signs (arena TEXT PRIMARY KEY COLLATE NOCASE, x INTEGER , y INTEGER , z INTEGER, world TEXT);");
            } catch (\
    Exception $e) {
                
    $this->getLogger()->critical($e->getMessage() . ' in §b' $e->getFile() . '§c on line §b' $e->getLine());
                
    $this->getServer()->getPluginManager()->disablePlugin($this);
            }

            
     
  2. HimbeersaftLP

    HimbeersaftLP Wither Skeleton

    Messages:
    1,430
    GitHub:
    HimbeersaftLP
    Telling us the error is always helpful
     
  3. Kkora

    Kkora Slime

    Messages:
    91
    GitHub:
    kkora2k3
    The error come from this code:
    PHP:
    } catch (\Exception $e) {
                
    $this->getLogger()->critical($e->getMessage() . ' in §b' $e->getFile() . '§c on line §b' $e->getLine());
                
    $this->getServer()->getPluginManager()->disablePlugin($this);
            }
     
  4. Thunder33345

    Thunder33345 Moderator Staff Member Verified

    Messages:
    2,136
    GitHub:
    Thunder33345
    please dont
    try catch is there for a reason
    removing try catch wont make the error clearer
    maybe vardumping the exception will

    also paste the error not where it was
    but FULL error and traces
     
  5. Kkora

    Kkora Slime

    Messages:
    91
    GitHub:
    kkora2k3
    Now I fixed (by my brilliant mind ). Tks for your ideas.
     

Share This Page

  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.