CREATE TABLE IF NOT EXISTS `{TABLE_ACCOUNT}` (
	`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
	`playername` VARCHAR(255) NOT NULL,
	`password` CHAR(255) NOT NULL,
	`email` VARCHAR(100) NULL,
	`registerdate` DATETIME NULL,
	`registerip` CHAR(15) NULL,
	`lastlogindate` DATETIME NULL,
	`lastloginip` CHAR(15) NULL,
	`active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
	PRIMARY KEY(`id`)
);

CREATE TABLE IF NOT EXISTS `{TABLE_SESSION}` (
	`accountid` INT UNSIGNED NOT NULL,
	`host` CHAR(15) NOT NULL,
	`logintime` DATETIME NOT NULL,
	PRIMARY KEY(`accountid`),
	FOREIGN KEY (`accountid`) REFERENCES `{TABLE_ACCOUNT}`(`id`) ON DELETE CASCADE
);

CREATE TABLE IF NOT EXISTS `{TABLE_LOCATION}` (
	`worldname` VARCHAR(255) NOT NULL,
	`x` DOUBLE NOT NULL,
	`y` DOUBLE NOT NULL,
	`z` DOUBLE NOT NULL,
	`yaw` FLOAT NOT NULL,
	`pitch` FLOAT NOT NULL,
	PRIMARY KEY(`worldname`)
);

CREATE TABLE IF NOT EXISTS `{TABLE_STRIKE}` (
	`host` CHAR(15) NOT NULL,
	`bantime` DATETIME NOT NULL,
	PRIMARY KEY(`host`)
);

CREATE TABLE IF NOT EXISTS `{TABLE_INVENTORY}` (
	`playername` VARCHAR(255) NOT NULL,
	`itemid` TEXT NOT NULL,
	`amount` TEXT NOT NULL,
	`durability` TEXT NOT NULL,
	PRIMARY KEY (`playername`)
);