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

Solved Battleground plugin.

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

  1. Kkora

    Kkora Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    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 Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Telling us the error is always helpful
     
  3. Kkora

    Kkora Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    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

    Messages:
    2,137
    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 Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    Now I fixed (by my brilliant mind ). Tks for your ideas.
     
  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.