public boolean setLocation(Location loc, boolean global) {
		UUID uid = loc.getWorld().getUID();
		Connection conn = plugin.getDbCtrl().getConnection();
		PreparedStatement ps = null;

		try {
			String sql;
			if (plugin.getDbCtrl().isMySQL())
				sql = String.format("INSERT INTO `%s` VALUES (?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE `uid` = VALUES(`uid`), `x` = VALUES(`x`), `y` = VALUES(`y`), `z` = VALUES(`z`), `yaw` = VALUES(`yaw`), `pitch` = VALUES(`pitch`), `global` = VALUES(`global`)",
						plugin.getDbCtrl().getTable(Table.LOCATION));
			else
				sql = String.format("MERGE INTO `%s` VALUES (?, ?, ?, ?, ?, ?, ?)",
						plugin.getDbCtrl().getTable(Table.LOCATION));

			ps = conn.prepareStatement(sql);
			ps.setString(1, uid.toString());
			ps.setDouble(2, loc.getX());
			ps.setDouble(3, loc.getY());
			ps.setDouble(4, loc.getZ());
			ps.setFloat(5, loc.getYaw());
			ps.setFloat(6, loc.getPitch());
			ps.setInt(7, global ? 1 : 0);
			ps.executeUpdate();

			locations.put(uid, loc);
			if (global)
				globalUID = uid;
			else if (!global && globalUID != null && globalUID == uid)
				globalUID = null;

			return true;
		} catch (SQLException e) {
			xAuthLog.severe("Failed to set location!", e);
			return false;
		} finally {
			plugin.getDbCtrl().close(conn, ps);
		}
	}